This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / sys / pcfs / direntry.h
CommitLineData
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 *
78ed81a3 18 * $Id$
15637ed4
RG
19 */
20
21/*
22 * Structure of a dos directory entry.
23 */
24struct direntry {
25 u_char deName[8]; /* filename, blank filled */
26#define SLOT_EMPTY 0x00 /* slot has never been used */
27#define SLOT_E5 0x05 /* the real value is 0xe5 */
28#define SLOT_DELETED 0xe5 /* file in this slot deleted */
29 u_char deExtension[3]; /* extension, blank filled */
30 u_char deAttributes; /* file attributes */
31#define ATTR_NORMAL 0x00 /* normal file */
32#define ATTR_READONLY 0x01 /* file is readonly */
33#define ATTR_HIDDEN 0x02 /* file is hidden */
34#define ATTR_SYSTEM 0x04 /* file is a system file */
35#define ATTR_VOLUME 0x08 /* entry is a volume label */
36#define ATTR_DIRECTORY 0x10 /* entry is a directory name */
37#define ATTR_ARCHIVE 0x20 /* file is new or modified */
38 char deReserved[10]; /* reserved */
39 u_short deTime; /* create/last update time */
40 u_short deDate; /* create/last update date */
41 u_short deStartCluster; /* starting cluster of file */
42 u_long deFileSize; /* size of file in bytes */
43};
44
45/*
46 * This is the format of the contents of the deTime
47 * field in the direntry structure.
48 */
49struct DOStime {
50 u_short
51 dt_2seconds:5, /* seconds divided by 2 */
52 dt_minutes:6, /* minutes */
53 dt_hours:5; /* hours */
54};
55
56/*
57 * This is the format of the contents of the deDate
58 * field in the direntry structure.
59 */
60struct DOSdate {
61 u_short
62 dd_day:5, /* day of month */
63 dd_month:4, /* month */
64 dd_year:7; /* years since 1980 */
65};
66
67union dostime {
68 struct DOStime dts;
69 u_short dti;
70};
71
72union dosdate {
73 struct DOSdate dds;
74 u_short ddi;
75};
76
77/*
78 * The following defines are used to rename fields in
79 * the ufs_specific structure in the nameidata structure
80 * in namei.h
81 */
82#define ni_pcfs ni_ufs
83#define pcfs_count ufs_count
84#define pcfs_offset ufs_offset
85#define pcfs_cluster ufs_ino
86
87#if defined(KERNEL)
88void unix2dostime __P((struct timeval *tvp,
89 union dosdate *ddp,
90 union dostime *dtp));
91void dos2unixtime __P((union dosdate *ddp,
92 union dostime *dtp,
93 struct timeval *tvp));
94int dos2unixfn __P((u_char dn[11], u_char *un));
95void unix2dosfn __P((u_char *un, u_char dn[11], int unlen));
96#endif /* defined(KERNEL) */