|
|
1.1 ! root 1: /* ! 2: * Written by Paul Popelka ([email protected]) ! 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: * fat.h,v 1.2 1993/05/20 03:34:07 cgd Exp ! 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) ! 57: int pcbmap __P((struct denode *dep, ! 58: u_long findcn, ! 59: daddr_t *bnp, ! 60: u_long *cnp)); ! 61: int clusterfree __P((struct pcfsmount *pmp, u_long cn, u_long *oldcnp)); ! 62: int clusteralloc __P((struct pcfsmount *pmp, u_long *retcluster, ! 63: u_long fillwith)); ! 64: int fatentry __P((int function, struct pcfsmount *pmp, ! 65: u_long cluster, u_long *oldcontents, u_long newcontents)); ! 66: int freeclusterchain __P((struct pcfsmount *pmp, u_long startchain)); ! 67: #endif /* defined(KERNEL) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.