vfat.c File Reference

#include "sysincludes.h"
#include "msdos.h"
#include "mtools.h"
#include "vfat.h"
#include "file.h"
#include "dirCache.h"

Include dependency graph for vfat.c:

Go to the source code of this file.

Enumerations

enum  result_t { RES_NOMATCH, RES_MATCH, RES_END, RES_ERROR }

Functions

static void autorename (char *name, char tilda, char dot, const char *illegals, int limit, int bump)
void autorename_short (char *name, int bump)
void autorename_long (char *name, int bump)
static int unicode_read (struct unicode_char *in, char *out, int num)
void clear_vfat (struct vfat_state *v)
static unsigned char sum_shortname (char *name)
static void check_vfat (struct vfat_state *v, struct directory *dir)
int clear_vses (Stream_t *Dir, int entrySlot, size_t last)
int write_vfat (Stream_t *Dir, char *shortname, char *longname, int start, direntry_t *mainEntry)
void dir_write (direntry_t *entry)
static void parse_vses (direntry_t *entry, struct vfat_state *v)
static dirCacheEntry_tvfat_lookup_loop_common (direntry_t *direntry, dirCache_t *cache, int lookForFreeSpace, int *io_error)
static dirCacheEntry_tvfat_lookup_loop_for_read (direntry_t *direntry, dirCache_t *cache, int *io_error)
static result_t checkNameForMatch (struct direntry_t *direntry, dirCacheEntry_t *dce, const char *filename, char *longname, char *shortname, int length, int flags)
int vfat_lookup (direntry_t *direntry, const char *filename, int length, int flags, char *shortname, char *longname)
static dirCacheEntry_tvfat_lookup_loop_for_insert (direntry_t *direntry, int initpos, dirCache_t *cache)
static void accountFreeSlots (struct scan_state *ssp, dirCacheEntry_t *dce)
int lookupForInsert (Stream_t *Dir, char *dosname, char *longname, struct scan_state *ssp, int ignore_entry, int source_entry, int pessimisticShortRename)

Variables

const char * short_illegals = ";+=[]',\"*\<>/?:|"
const char * long_illegals = "\"*\<>/?:|\005"


Enumeration Type Documentation

enum result_t
 

Enumerator:
RES_NOMATCH 
RES_MATCH 
RES_END 
RES_ERROR 

Definition at line 471 of file vfat.c.


Function Documentation

static void accountFreeSlots struct scan_state ssp,
dirCacheEntry_t dce
[static]
 

Definition at line 627 of file vfat.c.

References dirCacheEntry_t::beginSlot, dirCacheEntry_t::endSlot, scan_state::free_end, scan_state::free_start, scan_state::got_slots, scan_state::size_needed, and scan_state::slot.

Referenced by lookupForInsert().

static void autorename char *  name,
char  tilda,
char  dot,
const char *  illegals,
int  limit,
int  bump
[static]
 

Definition at line 19 of file vfat.c.

References p, printf, strchr, and tmp.

Referenced by autorename_long(), and autorename_short().

void autorename_long char *  name,
int  bump
 

Definition at line 93 of file vfat.c.

References autorename(), and long_illegals.

Referenced by process_namematch().

void autorename_short char *  name,
int  bump
 

Definition at line 88 of file vfat.c.

References autorename(), and short_illegals.

Referenced by dos_name(), and process_namematch().

static void check_vfat struct vfat_state v,
struct directory dir
[inline, static]
 

Definition at line 156 of file vfat.c.

References dir, fprintf(), vfat_state::name, vfat_state::present, vfat_state::status, stderr, strncpy(), vfat_state::subentries, vfat_state::sum, sum_shortname(), and VSE_NAMELEN.

Referenced by vfat_lookup_loop_common().

static result_t checkNameForMatch struct direntry_t direntry,
dirCacheEntry_t dce,
const char *  filename,
char *  longname,
char *  shortname,
int  length,
int  flags
[static]
 

Definition at line 484 of file vfat.c.

References ACCEPT_DIR, ACCEPT_LABEL, ACCEPT_PLAIN, directory::attr, ATTR_DIR, ATTR_LABEL, DCET_END, DCET_FREE, DCET_USED, dirCacheEntry_t::dir, direntry_t::dir, fprintf(), IS_DIR, dirCacheEntry_t::longName, MATCH_ANY, direntry_t::name, NO_MSG, RES_END, RES_ERROR, RES_MATCH, RES_NOMATCH, dirCacheEntry_t::shortName, stderr, and dirCacheEntry_t::type.

Referenced by vfat_lookup().

void clear_vfat struct vfat_state v  ) 
 

Definition at line 115 of file vfat.c.

References vfat_state::present, vfat_state::status, and vfat_state::subentries.

Referenced by parse_vses(), and vfat_lookup_loop_common().

int clear_vses Stream_t Dir,
int  entrySlot,
size_t  last
 

Definition at line 183 of file vfat.c.

References addFreeEntry(), allocDirCache(), cache, DEBUG, DELMARK, dir_read(), entry, error, exit(), fprintf(), if(), low_level_dir_write(), directory::name, and stderr.

void dir_write direntry_t entry  ) 
 

Definition at line 275 of file vfat.c.

References addFreeEntry(), allocDirCache(), dirCacheEntry_t::beginSlot, cache, DELMARK, dirCacheEntry_t::dir, entry::dir, dirCacheEntry_t::endSlot, entry, exit(), fprintf(), low_level_dir_write(), entry::name, and stderr.

Referenced by attrib_file(), del_entry(), dos_doctorfat(), flush_file(), get_slots(), makeit(), mlabel(), and renameit().

int lookupForInsert Stream_t Dir,
char *  dosname,
char *  longname,
struct scan_state ssp,
int  ignore_entry,
int  source_entry,
int  pessimisticShortRename
 

Definition at line 647 of file vfat.c.

References accountFreeSlots(), allocDirCache(), directory::attr, dirCacheEntry_t::beginSlot, cache, DCET_END, DCET_FREE, DCET_USED, dirCacheEntry_t::dir, dirCacheEntry_t::endSlot, entry, exit(), fprintf(), scan_state::got_slots, growDirCache(), initializeDirentry(), isHashed(), isRootDir(), dirCacheEntry_t::longName, scan_state::match_free, scan_state::max_entry, pos, scan_state::shortmatch, dirCacheEntry_t::shortName, stderr, strcasecmp, dirCacheEntry_t::type, unix_name(), and vfat_lookup_loop_for_insert().

Referenced by get_slots().

static void parse_vses direntry_t entry,
struct vfat_state v
[inline, static]
 

Definition at line 306 of file vfat.c.

References c, clear_vfat(), entry::dir, entry, fprintf(), vfat_subentry::id, MAX_VFAT_SUBENTRIES, vfat_state::name, printf, vfat_state::status, stderr, vfat_state::subentries, vfat_subentry::sum, vfat_state::sum, unicode_read(), VSE1SIZE, VSE2SIZE, VSE3SIZE, VSE_LAST, VSE_MASK, and VSE_NAMELEN.

Referenced by vfat_lookup_loop_common().

static unsigned char sum_shortname char *  name  )  [inline, static]
 

Definition at line 139 of file vfat.c.

References sum().

Referenced by check_vfat(), and write_vfat().

static int unicode_read struct unicode_char in,
char *  out,
int  num
[inline, static]
 

Definition at line 99 of file vfat.c.

References in.

Referenced by parse_vses().

int vfat_lookup direntry_t direntry,
const char *  filename,
int  length,
int  flags,
char *  shortname,
char *  longname
 

Definition at line 550 of file vfat.c.

References allocDirCache(), dirCacheEntry_t::beginSlot, direntry_t::beginSlot, cache, checkNameForMatch(), direntry_t::Dir, dirCacheEntry_t::endSlot, direntry_t::endSlot, direntry_t::entry, exit(), fprintf(), dirCacheEntry_t::longName, RES_MATCH, RES_NOMATCH, result, dirCacheEntry_t::shortName, stderr, strcpy(), strlen(), and vfat_lookup_loop_for_read().

Referenced by _dos_loop(), del_file(), mlabel(), print_volume_label(), recurs_dos_loop(), renameit(), and subDir().

static dirCacheEntry_t* vfat_lookup_loop_common direntry_t direntry,
dirCache_t cache,
int  lookForFreeSpace,
int *  io_error
[static]
 

Definition at line 375 of file vfat.c.

References addEndEntry(), addFreeEntry(), addUsedEntry(), directory::attr, cache, directory::Case, check_vfat(), clear_vfat(), DELMARK, direntry_t::dir, dir_read(), direntry_t::entry, error, directory::ext, longname, vfat_state::name, directory::name, newfile, NULL, parse_vses(), vfat_state::present, strncat(), strncpy(), vfat_state::subentries, and unix_name().

Referenced by vfat_lookup_loop_for_insert(), and vfat_lookup_loop_for_read().

static dirCacheEntry_t* vfat_lookup_loop_for_insert direntry_t direntry,
int  initpos,
dirCache_t cache
[inline, static]
 

Definition at line 602 of file vfat.c.

References cache, DCET_END, direntry_t::entry, exit(), fprintf(), NULL, stderr, dirCacheEntry_t::type, and vfat_lookup_loop_common().

Referenced by lookupForInsert().

static dirCacheEntry_t* vfat_lookup_loop_for_read direntry_t direntry,
dirCache_t cache,
int *  io_error
[inline, static]
 

Definition at line 453 of file vfat.c.

References cache, dirCacheEntry_t::endSlot, direntry_t::entry, and vfat_lookup_loop_common().

Referenced by vfat_lookup().

int write_vfat Stream_t Dir,
char *  shortname,
char *  longname,
int  start,
direntry_t mainEntry
 

Definition at line 216 of file vfat.c.

References vfat_subentry::attribute, c, cache, entry::dir, entry, vfat_subentry::hash1, vfat_subentry::id, low_level_dir_write(), printf, vfat_subentry::sector_l, vfat_subentry::sector_u, strlen(), vfat_subentry::sum, sum_shortname(), unicode_write(), VSE1SIZE, VSE2SIZE, VSE3SIZE, VSE_LAST, and VSE_NAMELEN.

Referenced by write_slots().


Variable Documentation

const char* long_illegals = "\"*\<>/?:|\005"
 

Definition at line 16 of file vfat.c.

Referenced by autorename_long(), and get_slots().

const char* short_illegals = ";+=[]',\"*\<>/?:|"
 

Definition at line 15 of file vfat.c.

Referenced by autorename_short(), and get_slots().


Generated on Fri Apr 14 23:04:47 2006 for minix by  doxygen 1.4.6