Made all header files idempotent and moved incorrect common data from
[unix-history] / sys / pcfs / fat.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 *
e4270b63 18 * $Id$
15637ed4
RG
19 */
20
21/*
22 * Some useful cluster numbers.
23 */
24#define PCFSROOT 0 /* cluster 0 means the root dir */
25#define CLUST_FREE 0 /* cluster 0 also means a free cluster */
26#define PCFSFREE CLUST_FREE
27#define CLUST_FIRST 2 /* first legal cluster number */
28#define CLUST_RSRVS 0xfff0 /* start of reserved cluster range */
29#define CLUST_RSRVE 0xfff6 /* end of reserved cluster range */
30#define CLUST_BAD 0xfff7 /* a cluster with a defect */
31#define CLUST_EOFS 0xfff8 /* start of eof cluster range */
32#define CLUST_EOFE 0xffff /* end of eof cluster range */
33
34#define FAT12_MASK 0x0fff /* mask for 12 bit cluster numbers */
35#define FAT16_MASK 0xffff /* mask for 16 bit cluster numbers */
36
37/*
38 * Return true if filesystem uses 12 bit fats.
39 * Microsoft Programmer's Reference says if the
40 * maximum cluster number in a filesystem is greater
41 * than 4086 then we've got a 16 bit fat filesystem.
42 */
43#define FAT12(pmp) (pmp->pm_maxcluster <= 4086)
44#define FAT16(pmp) (pmp->pm_maxcluster > 4086)
45
46#define PCFSEOF(cn) (((cn) & 0xfff8) == 0xfff8)
47
48/*
49 * These are the values for the function argument to
50 * the function fatentry().
51 */
52#define FAT_GET 0x0001 /* get a fat entry */
53#define FAT_SET 0x0002 /* set a fat entry */
54#define FAT_GET_AND_SET (FAT_GET | FAT_SET)
55
56#if defined(KERNEL)
57int pcbmap __P((struct denode *dep,
58 u_long findcn,
59 daddr_t *bnp,
60 u_long *cnp));
61int clusterfree __P((struct pcfsmount *pmp, u_long cn, u_long *oldcnp));
62int clusteralloc __P((struct pcfsmount *pmp, u_long *retcluster,
63 u_long fillwith));
64int fatentry __P((int function, struct pcfsmount *pmp,
65 u_long cluster, u_long *oldcontents, u_long newcontents));
66int freeclusterchain __P((struct pcfsmount *pmp, u_long startchain));
67#endif /* defined(KERNEL) */