source: trunk/minix/commands/i386/mtools-3.9.7/vfat.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.4 KB
Line 
1#ifndef MTOOLS_VFAT_H
2#define MTOOLS_VFAT_H
3
4#include "msdos.h"
5
6/*
7 * VFAT-related common header file
8 */
9#define VFAT_SUPPORT
10
11struct unicode_char {
12 char lchar;
13 char uchar;
14};
15
16
17/* #define MAX_VFAT_SUBENTRIES 32 */ /* Theoretical max # of VSEs */
18#define MAX_VFAT_SUBENTRIES 20 /* Max useful # of VSEs */
19#define VSE_NAMELEN 13
20
21#define VSE1SIZE 5
22#define VSE2SIZE 6
23#define VSE3SIZE 2
24
25#include "stream.h"
26
27struct vfat_subentry {
28 unsigned char id; /* 0x40 = last; & 0x1f = VSE ID */
29 struct unicode_char text1[VSE1SIZE] PACKED;
30 unsigned char attribute; /* 0x0f for VFAT */
31 unsigned char hash1; /* Always 0? */
32 unsigned char sum; /* Checksum of short name */
33 struct unicode_char text2[VSE2SIZE] PACKED;
34 unsigned char sector_l; /* 0 for VFAT */
35 unsigned char sector_u; /* 0 for VFAT */
36 struct unicode_char text3[VSE3SIZE] PACKED;
37};
38
39/* Enough size for a worst case number of full VSEs plus a null */
40#define VBUFSIZE ((MAX_VFAT_SUBENTRIES*VSE_NAMELEN) + 1)
41
42/* Max legal length of a VFAT long name */
43#define MAX_VNAMELEN (255)
44
45#define VSE_PRESENT 0x01
46#define VSE_LAST 0x40
47#define VSE_MASK 0x1f
48
49struct vfat_state {
50 char name[VBUFSIZE];
51 int status; /* is now a bit map of 32 bits */
52 int subentries;
53 unsigned char sum; /* no need to remember the sum for each entry,
54 * it is the same anyways */
55 int present;
56};
57
58
59struct scan_state {
60 int match_free;
61 int shortmatch;
62 int longmatch;
63 int free_start;
64 int free_end;
65 int slot;
66 int got_slots;
67 int size_needed;
68 int max_entry;
69};
70
71#include "mtoolsDirent.h"
72
73void clear_vfat(struct vfat_state *);
74int unicode_write(char *, struct unicode_char *, int num, int *end);
75
76int clear_vses(Stream_t *, int, size_t);
77void autorename_short(char *, int);
78void autorename_long(char *, int);
79
80int lookupForInsert(Stream_t *Dir,
81 char *dosname,
82 char *longname,
83 struct scan_state *ssp,
84 int ignore_entry,
85 int source_entry,
86 int pessimisticShortRename);
87
88#define DO_OPEN 1 /* open all files that are found */
89#define ACCEPT_LABEL 0x08
90#define ACCEPT_DIR 0x10
91#define ACCEPT_PLAIN 0x20
92#define MATCH_ANY 0x40
93#define NO_MSG 0x80
94#define NO_DOTS 0x100 /* accept no dots if matched by wildcard */
95#define DO_OPEN_DIRS 0x400 /* open all directories that are found */
96#define OPEN_PARENT 0x1000 /* in target lookup, open parent
97 * instead of file itself */
98#define NO_UNIX 0x2000 /* in target lookup, consider all files to reside on
99 * the DOS fs */
100#endif
Note: See TracBrowser for help on using the repository browser.