vfat.h

Go to the documentation of this file.
00001 #ifndef MTOOLS_VFAT_H
00002 #define MTOOLS_VFAT_H
00003 
00004 #include "msdos.h"
00005 
00006 /*
00007  * VFAT-related common header file
00008  */
00009 #define VFAT_SUPPORT
00010 
00011 struct unicode_char {
00012         char lchar;
00013         char uchar;
00014 };
00015 
00016 
00017 /* #define MAX_VFAT_SUBENTRIES 32 */ /* Theoretical max # of VSEs */
00018 #define MAX_VFAT_SUBENTRIES 20          /* Max useful # of VSEs */
00019 #define VSE_NAMELEN 13
00020 
00021 #define VSE1SIZE 5
00022 #define VSE2SIZE 6
00023 #define VSE3SIZE 2
00024 
00025 #include "stream.h"
00026 
00027 struct vfat_subentry {
00028         unsigned char id;               /* 0x40 = last; & 0x1f = VSE ID */
00029         struct unicode_char text1[VSE1SIZE] PACKED;
00030         unsigned char attribute;        /* 0x0f for VFAT */
00031         unsigned char hash1;            /* Always 0? */
00032         unsigned char sum;              /* Checksum of short name */
00033         struct unicode_char text2[VSE2SIZE] PACKED;
00034         unsigned char sector_l;         /* 0 for VFAT */
00035         unsigned char sector_u;         /* 0 for VFAT */
00036         struct unicode_char text3[VSE3SIZE] PACKED;
00037 };
00038 
00039 /* Enough size for a worst case number of full VSEs plus a null */
00040 #define VBUFSIZE ((MAX_VFAT_SUBENTRIES*VSE_NAMELEN) + 1)
00041 
00042 /* Max legal length of a VFAT long name */
00043 #define MAX_VNAMELEN (255)
00044 
00045 #define VSE_PRESENT 0x01
00046 #define VSE_LAST 0x40
00047 #define VSE_MASK 0x1f
00048 
00049 struct vfat_state {
00050         char name[VBUFSIZE];
00051         int status; /* is now a bit map of 32 bits */
00052         int subentries;
00053         unsigned char sum; /* no need to remember the sum for each entry,
00054                             * it is the same anyways */
00055         int present;
00056 };
00057 
00058 
00059 struct scan_state {
00060         int match_free;
00061         int shortmatch;
00062         int longmatch;
00063         int free_start;
00064         int free_end;
00065         int slot;
00066         int got_slots;
00067         int size_needed;
00068         int max_entry;
00069 };
00070 
00071 #include "mtoolsDirent.h"
00072 
00073 void clear_vfat(struct vfat_state  *);
00074 int unicode_write(char *, struct unicode_char *, int num, int *end);
00075 
00076 int clear_vses(Stream_t *, int, size_t);
00077 void autorename_short(char *, int);
00078 void autorename_long(char *, int);
00079 
00080 int lookupForInsert(Stream_t *Dir,
00081                                         char *dosname,
00082                                         char *longname,
00083                                         struct scan_state *ssp, 
00084                                         int ignore_entry,
00085                                         int source_entry,
00086                                         int pessimisticShortRename);
00087 
00088 #define DO_OPEN 1 /* open all files that are found */
00089 #define ACCEPT_LABEL 0x08
00090 #define ACCEPT_DIR 0x10
00091 #define ACCEPT_PLAIN 0x20
00092 #define MATCH_ANY 0x40
00093 #define NO_MSG 0x80
00094 #define NO_DOTS 0x100 /* accept no dots if matched by wildcard */
00095 #define DO_OPEN_DIRS 0x400 /* open all directories that are found */
00096 #define OPEN_PARENT 0x1000  /* in target lookup, open parent
00097                              * instead of file itself */
00098 #define NO_UNIX 0x2000 /* in target lookup, consider all files to reside on
00099                         * the DOS fs */
00100 #endif

Generated on Fri Apr 14 22:56:56 2006 for minix by  doxygen 1.4.6