Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Written by Paul Popelka (paulp@uts.amdahl.com) | |
3 | * | |
4 | * You can do anything you want with this software, | |
5 | * just don't say you wrote it, | |
6 | * and don't remove this notice. | |
7 | * | |
8 | * This software is provided "as is". | |
9 | * | |
10 | * The author supplies this software to be publicly | |
11 | * redistributed on the understanding that the author | |
12 | * is not responsible for the correct functioning of | |
13 | * this software in any circumstances and is not liable | |
14 | * for any damages caused by this software. | |
15 | * | |
16 | * October 1992 | |
17 | * | |
bbc3f849 | 18 | * $Id: direntry.h,v 1.2 1993/10/16 19:29:28 rgrimes Exp $ |
15637ed4 RG |
19 | */ |
20 | ||
bbc3f849 GW |
21 | #ifndef _PCFS_DIRENTRY_H_ |
22 | #define _PCFS_DIRENTRY_H_ 1 | |
23 | ||
15637ed4 RG |
24 | /* |
25 | * Structure of a dos directory entry. | |
26 | */ | |
27 | struct direntry { | |
28 | u_char deName[8]; /* filename, blank filled */ | |
29 | #define SLOT_EMPTY 0x00 /* slot has never been used */ | |
30 | #define SLOT_E5 0x05 /* the real value is 0xe5 */ | |
31 | #define SLOT_DELETED 0xe5 /* file in this slot deleted */ | |
32 | u_char deExtension[3]; /* extension, blank filled */ | |
33 | u_char deAttributes; /* file attributes */ | |
34 | #define ATTR_NORMAL 0x00 /* normal file */ | |
35 | #define ATTR_READONLY 0x01 /* file is readonly */ | |
36 | #define ATTR_HIDDEN 0x02 /* file is hidden */ | |
37 | #define ATTR_SYSTEM 0x04 /* file is a system file */ | |
38 | #define ATTR_VOLUME 0x08 /* entry is a volume label */ | |
39 | #define ATTR_DIRECTORY 0x10 /* entry is a directory name */ | |
40 | #define ATTR_ARCHIVE 0x20 /* file is new or modified */ | |
41 | char deReserved[10]; /* reserved */ | |
42 | u_short deTime; /* create/last update time */ | |
43 | u_short deDate; /* create/last update date */ | |
44 | u_short deStartCluster; /* starting cluster of file */ | |
45 | u_long deFileSize; /* size of file in bytes */ | |
46 | }; | |
47 | ||
48 | /* | |
49 | * This is the format of the contents of the deTime | |
50 | * field in the direntry structure. | |
51 | */ | |
52 | struct DOStime { | |
53 | u_short | |
54 | dt_2seconds:5, /* seconds divided by 2 */ | |
55 | dt_minutes:6, /* minutes */ | |
56 | dt_hours:5; /* hours */ | |
57 | }; | |
58 | ||
59 | /* | |
60 | * This is the format of the contents of the deDate | |
61 | * field in the direntry structure. | |
62 | */ | |
63 | struct DOSdate { | |
64 | u_short | |
65 | dd_day:5, /* day of month */ | |
66 | dd_month:4, /* month */ | |
67 | dd_year:7; /* years since 1980 */ | |
68 | }; | |
69 | ||
70 | union dostime { | |
71 | struct DOStime dts; | |
72 | u_short dti; | |
73 | }; | |
74 | ||
75 | union dosdate { | |
76 | struct DOSdate dds; | |
77 | u_short ddi; | |
78 | }; | |
79 | ||
80 | /* | |
81 | * The following defines are used to rename fields in | |
82 | * the ufs_specific structure in the nameidata structure | |
83 | * in namei.h | |
84 | */ | |
85 | #define ni_pcfs ni_ufs | |
86 | #define pcfs_count ufs_count | |
87 | #define pcfs_offset ufs_offset | |
88 | #define pcfs_cluster ufs_ino | |
89 | ||
90 | #if defined(KERNEL) | |
91 | void unix2dostime __P((struct timeval *tvp, | |
92 | union dosdate *ddp, | |
93 | union dostime *dtp)); | |
94 | void dos2unixtime __P((union dosdate *ddp, | |
95 | union dostime *dtp, | |
96 | struct timeval *tvp)); | |
97 | int dos2unixfn __P((u_char dn[11], u_char *un)); | |
98 | void unix2dosfn __P((u_char *un, u_char dn[11], int unlen)); | |
99 | #endif /* defined(KERNEL) */ | |
bbc3f849 | 100 | #endif /* _PCFS_DIRENTRY_H_ */ |