4 /* Copyright 1995 David C. Niemi
5 * Copyright 1996-1998,2000-2003,2005,2007-2009 Alain Knaff.
6 * This file is part of mtools.
8 * Mtools is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * Mtools is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Mtools. If not, see <http://www.gnu.org/licenses/>.
25 * VFAT-related common header file
35 /* #define MAX_VFAT_SUBENTRIES 32 */ /* Theoretical max # of VSEs */
36 #define MAX_VFAT_SUBENTRIES 20 /* Max useful # of VSEs */
37 #define VSE_NAMELEN 13
45 struct vfat_subentry {
46 unsigned char id; /* 0x40 = last; & 0x1f = VSE ID */
47 struct unicode_char text1[VSE1SIZE];
48 unsigned char attribute; /* 0x0f for VFAT */
49 unsigned char hash1; /* Always 0? */
50 unsigned char sum; /* Checksum of short name */
51 struct unicode_char text2[VSE2SIZE];
52 unsigned char sector_l; /* 0 for VFAT */
53 unsigned char sector_u; /* 0 for VFAT */
54 struct unicode_char text3[VSE3SIZE];
57 /* Enough size for a worst case number of full VSEs plus a null */
58 #define VBUFSIZE ((MAX_VFAT_SUBENTRIES*VSE_NAMELEN) + 1)
60 /* Max legal length of a VFAT long name */
61 #define MAX_VNAMELEN (255)
63 #define VSE_PRESENT 0x01
68 wchar_t name[VBUFSIZE];
69 int status; /* is now a bit map of 32 bits */
71 unsigned char sum; /* no need to remember the sum for each entry,
72 * it is the same anyways */
81 unsigned int free_start;
82 unsigned int free_end;
85 unsigned int size_needed;
89 #include "mtoolsDirentry.h"
91 void clear_vfat(struct vfat_state *);
92 int unicode_write(wchar_t *, struct unicode_char *, int num, int *end);
94 int clear_vses(Stream_t *, int, size_t);
95 void autorename_short(struct dos_name_t *, int);
96 void autorename_long(char *, int);
98 #define DO_OPEN 1 /* open all files that are found */
99 #define ACCEPT_LABEL 0x08
100 #define ACCEPT_DIR 0x10
101 #define ACCEPT_PLAIN 0x20
102 #define MATCH_ANY 0x40
104 #define NO_DOTS 0x100 /* accept no dots if matched by wildcard */
105 #define DO_OPEN_DIRS 0x400 /* open all directories that are found */
106 #define OPEN_PARENT 0x1000 /* in target lookup, open parent
107 * instead of file itself */
108 #define NO_UNIX 0x2000 /* in target lookup, consider all files to reside on