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