00001 #ifndef MTOOLS_VFAT_H
00002 #define MTOOLS_VFAT_H
00003
00004 #include "msdos.h"
00005
00006
00007
00008
00009 #define VFAT_SUPPORT
00010
00011 struct unicode_char {
00012 char lchar;
00013 char uchar;
00014 };
00015
00016
00017
00018 #define MAX_VFAT_SUBENTRIES 20
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;
00029 struct unicode_char text1[VSE1SIZE] PACKED;
00030 unsigned char attribute;
00031 unsigned char hash1;
00032 unsigned char sum;
00033 struct unicode_char text2[VSE2SIZE] PACKED;
00034 unsigned char sector_l;
00035 unsigned char sector_u;
00036 struct unicode_char text3[VSE3SIZE] PACKED;
00037 };
00038
00039
00040 #define VBUFSIZE ((MAX_VFAT_SUBENTRIES*VSE_NAMELEN) + 1)
00041
00042
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;
00052 int subentries;
00053 unsigned char sum;
00054
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
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
00095 #define DO_OPEN_DIRS 0x400
00096 #define OPEN_PARENT 0x1000
00097
00098 #define NO_UNIX 0x2000
00099
00100 #endif