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