Page MenuHomeFreeBSD

D10821.id28570.diff
No OneTemporary

D10821.id28570.diff

Index: sys/fs/msdosfs/bootsect.h
===================================================================
--- sys/fs/msdosfs/bootsect.h
+++ sys/fs/msdosfs/bootsect.h
@@ -25,13 +25,13 @@
* first sector of a partitioned hard disk.
*/
struct bootsector33 {
- u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
+ uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
int8_t bsOemName[8]; /* OEM name and version */
int8_t bsBPB[19]; /* BIOS parameter block */
int8_t bsDriveNumber; /* drive number (0x80) */
int8_t bsBootCode[479]; /* pad so struct is 512b */
- u_int8_t bsBootSectSig0;
- u_int8_t bsBootSectSig1;
+ uint8_t bsBootSectSig0;
+ uint8_t bsBootSectSig1;
#define BOOTSIG0 0x55
#define BOOTSIG1 0xaa
};
@@ -47,25 +47,25 @@
};
struct bootsector50 {
- u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
+ uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
int8_t bsOemName[8]; /* OEM name and version */
int8_t bsBPB[25]; /* BIOS parameter block */
int8_t bsExt[26]; /* Bootsector Extension */
int8_t bsBootCode[448]; /* pad so structure is 512b */
- u_int8_t bsBootSectSig0;
- u_int8_t bsBootSectSig1;
+ uint8_t bsBootSectSig0;
+ uint8_t bsBootSectSig1;
#define BOOTSIG0 0x55
#define BOOTSIG1 0xaa
};
struct bootsector710 {
- u_int8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
+ uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
int8_t bsOEMName[8]; /* OEM name and version */
int8_t bsBPB[53]; /* BIOS parameter block */
int8_t bsExt[26]; /* Bootsector Extension */
int8_t bsBootCode[420]; /* pad so structure is 512b */
- u_int8_t bsBootSectSig0;
- u_int8_t bsBootSectSig1;
+ uint8_t bsBootSectSig0;
+ uint8_t bsBootSectSig1;
#define BOOTSIG0 0x55
#define BOOTSIG1 0xaa
};
Index: sys/fs/msdosfs/bpb.h
===================================================================
--- sys/fs/msdosfs/bpb.h
+++ sys/fs/msdosfs/bpb.h
@@ -24,17 +24,17 @@
* BIOS Parameter Block (BPB) for DOS 3.3
*/
struct bpb33 {
- u_int16_t bpbBytesPerSec; /* bytes per sector */
- u_int8_t bpbSecPerClust; /* sectors per cluster */
- u_int16_t bpbResSectors; /* number of reserved sectors */
- u_int8_t bpbFATs; /* number of FATs */
- u_int16_t bpbRootDirEnts; /* number of root directory entries */
- u_int16_t bpbSectors; /* total number of sectors */
- u_int8_t bpbMedia; /* media descriptor */
- u_int16_t bpbFATsecs; /* number of sectors per FAT */
- u_int16_t bpbSecPerTrack; /* sectors per track */
- u_int16_t bpbHeads; /* number of heads */
- u_int16_t bpbHiddenSecs; /* number of hidden sectors */
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint16_t bpbHiddenSecs; /* number of hidden sectors */
};
/*
@@ -42,46 +42,46 @@
* and bpbHugeSectors is not in the 3.3 bpb.
*/
struct bpb50 {
- u_int16_t bpbBytesPerSec; /* bytes per sector */
- u_int8_t bpbSecPerClust; /* sectors per cluster */
- u_int16_t bpbResSectors; /* number of reserved sectors */
- u_int8_t bpbFATs; /* number of FATs */
- u_int16_t bpbRootDirEnts; /* number of root directory entries */
- u_int16_t bpbSectors; /* total number of sectors */
- u_int8_t bpbMedia; /* media descriptor */
- u_int16_t bpbFATsecs; /* number of sectors per FAT */
- u_int16_t bpbSecPerTrack; /* sectors per track */
- u_int16_t bpbHeads; /* number of heads */
- u_int32_t bpbHiddenSecs; /* # of hidden sectors */
- u_int32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint32_t bpbHiddenSecs; /* # of hidden sectors */
+ uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
};
/*
* BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
*/
struct bpb710 {
- u_int16_t bpbBytesPerSec; /* bytes per sector */
- u_int8_t bpbSecPerClust; /* sectors per cluster */
- u_int16_t bpbResSectors; /* number of reserved sectors */
- u_int8_t bpbFATs; /* number of FATs */
- u_int16_t bpbRootDirEnts; /* number of root directory entries */
- u_int16_t bpbSectors; /* total number of sectors */
- u_int8_t bpbMedia; /* media descriptor */
- u_int16_t bpbFATsecs; /* number of sectors per FAT */
- u_int16_t bpbSecPerTrack; /* sectors per track */
- u_int16_t bpbHeads; /* number of heads */
- u_int32_t bpbHiddenSecs; /* # of hidden sectors */
- u_int32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
- u_int32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
- u_int16_t bpbExtFlags; /* extended flags: */
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint32_t bpbHiddenSecs; /* # of hidden sectors */
+ uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
+ uint32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
+ uint16_t bpbExtFlags; /* extended flags: */
#define FATNUM 0xf /* mask for numbering active FAT */
#define FATMIRROR 0x80 /* FAT is mirrored (like it always was) */
- u_int16_t bpbFSVers; /* filesystem version */
+ uint16_t bpbFSVers; /* filesystem version */
#define FSVERS 0 /* currently only 0 is understood */
- u_int32_t bpbRootClust; /* start cluster for root directory */
- u_int16_t bpbFSInfo; /* filesystem info structure sector */
- u_int16_t bpbBackup; /* backup boot sector */
- u_int8_t bpbReserved[12]; /* reserved for future expansion */
+ uint32_t bpbRootClust; /* start cluster for root directory */
+ uint16_t bpbFSInfo; /* filesystem info structure sector */
+ uint16_t bpbBackup; /* backup boot sector */
+ uint8_t bpbReserved[12]; /* reserved for future expansion */
};
/*
@@ -138,37 +138,37 @@
* BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
*/
struct byte_bpb710 {
- u_int8_t bpbBytesPerSec[2]; /* bytes per sector */
- u_int8_t bpbSecPerClust; /* sectors per cluster */
- u_int8_t bpbResSectors[2]; /* number of reserved sectors */
- u_int8_t bpbFATs; /* number of FATs */
- u_int8_t bpbRootDirEnts[2]; /* number of root directory entries */
- u_int8_t bpbSectors[2]; /* total number of sectors */
- u_int8_t bpbMedia; /* media descriptor */
- u_int8_t bpbFATsecs[2]; /* number of sectors per FAT */
- u_int8_t bpbSecPerTrack[2]; /* sectors per track */
- u_int8_t bpbHeads[2]; /* number of heads */
- u_int8_t bpbHiddenSecs[4]; /* # of hidden sectors */
- u_int8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
- u_int8_t bpbBigFATsecs[4]; /* like bpbFATsecs for FAT32 */
- u_int8_t bpbExtFlags[2]; /* extended flags: */
- u_int8_t bpbFSVers[2]; /* filesystem version */
- u_int8_t bpbRootClust[4]; /* start cluster for root directory */
- u_int8_t bpbFSInfo[2]; /* filesystem info structure sector */
- u_int8_t bpbBackup[2]; /* backup boot sector */
- u_int8_t bpbReserved[12]; /* reserved for future expansion */
+ uint8_t bpbBytesPerSec[2]; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint8_t bpbResSectors[2]; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint8_t bpbRootDirEnts[2]; /* number of root directory entries */
+ uint8_t bpbSectors[2]; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint8_t bpbFATsecs[2]; /* number of sectors per FAT */
+ uint8_t bpbSecPerTrack[2]; /* sectors per track */
+ uint8_t bpbHeads[2]; /* number of heads */
+ uint8_t bpbHiddenSecs[4]; /* # of hidden sectors */
+ uint8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
+ uint8_t bpbBigFATsecs[4]; /* like bpbFATsecs for FAT32 */
+ uint8_t bpbExtFlags[2]; /* extended flags: */
+ uint8_t bpbFSVers[2]; /* filesystem version */
+ uint8_t bpbRootClust[4]; /* start cluster for root directory */
+ uint8_t bpbFSInfo[2]; /* filesystem info structure sector */
+ uint8_t bpbBackup[2]; /* backup boot sector */
+ uint8_t bpbReserved[12]; /* reserved for future expansion */
};
/*
* FAT32 FSInfo block.
*/
struct fsinfo {
- u_int8_t fsisig1[4];
- u_int8_t fsifill1[480];
- u_int8_t fsisig2[4];
- u_int8_t fsinfree[4];
- u_int8_t fsinxtfree[4];
- u_int8_t fsifill2[12];
- u_int8_t fsisig3[4];
+ uint8_t fsisig1[4];
+ uint8_t fsifill1[480];
+ uint8_t fsisig2[4];
+ uint8_t fsinfree[4];
+ uint8_t fsinxtfree[4];
+ uint8_t fsifill2[12];
+ uint8_t fsisig3[4];
};
#endif /* !_FS_MSDOSFS_BPB_H_ */
Index: sys/fs/msdosfs/denode.h
===================================================================
--- sys/fs/msdosfs/denode.h
+++ sys/fs/msdosfs/denode.h
@@ -103,8 +103,8 @@
* structure (fc_frcn).
*/
struct fatcache {
- u_long fc_frcn; /* file relative cluster number */
- u_long fc_fsrcn; /* filesystem relative cluster number */
+ unsigned long fc_frcn; /* file relative cluster number */
+ unsigned long fc_fsrcn; /* filesystem relative cluster number */
};
/*
@@ -123,7 +123,7 @@
#define FC_NEXTTOLASTFC 2 /* entry for a close to the last cluster in
* the file */
-#define FCE_EMPTY 0xffffffff /* doesn't represent an actual cluster # */
+#define FCE_EMPTY 0xffffffff /* doesn't represent an actual cluster # */
/*
* Set a slot in the fat cache.
@@ -137,28 +137,32 @@
* contained within a vnode.
*/
struct denode {
- struct vnode *de_vnode; /* addr of vnode we are part of */
- u_long de_flag; /* flag bits */
- u_long de_dirclust; /* cluster of the directory file containing this entry */
- u_long de_diroffset; /* offset of this entry in the directory cluster */
- u_long de_fndoffset; /* offset of found dir entry */
- int de_fndcnt; /* number of slots before de_fndoffset */
- long de_refcnt; /* reference count */
+ struct vnode *de_vnode; /* addr of vnode we are part of */
+ unsigned long de_flag; /* flag bits */
+ unsigned long de_dirclust; /* cluster of the directory file
+ containing this entry */
+ unsigned long de_diroffset; /* offset of this entry in the
+ directory cluster */
+ unsigned long de_fndoffset; /* offset of found dir entry */
+ int de_fndcnt; /* number of slots before
+ de_fndoffset */
+ long de_refcnt; /* reference count */
struct msdosfsmount *de_pmp; /* addr of our mount struct */
- u_char de_Name[12]; /* name, from DOS directory entry */
- u_char de_Attributes; /* attributes, from directory entry */
- u_char de_LowerCase; /* NT VFAT lower case flags */
- u_char de_CHun; /* Hundredth of second of CTime*/
- u_short de_CTime; /* creation time */
- u_short de_CDate; /* creation date */
- u_short de_ADate; /* access date */
- u_short de_MTime; /* modification time */
- u_short de_MDate; /* modification date */
- u_long de_StartCluster; /* starting cluster of file */
- u_long de_FileSize; /* size of file in bytes */
+ unsigned char de_Name[12]; /* name, from DOS directory entry */
+ unsigned char de_Attributes; /* attributes, from directory entry */
+ unsigned char de_LowerCase; /* NT VFAT lower case flags */
+ unsigned char de_CHun; /* Hundredth of second of CTime */
+ unsigned short de_CTime; /* creation time */
+ unsigned short de_CDate; /* creation date */
+ unsigned short de_ADate; /* access date */
+ unsigned short de_MTime; /* modification time */
+ unsigned short de_MDate; /* modification date */
+ unsigned long de_StartCluster; /* starting cluster of file */
+ unsigned long de_FileSize; /* size of file in bytes */
struct fatcache de_fc[FC_SIZE]; /* fat cache */
- u_quad_t de_modrev; /* Revision level for lease. */
- u_int64_t de_inode; /* Inode number (really byte offset of direntry) */
+ uint64_t de_modrev; /* Revision level for lease */
+ uint64_t de_inode; /* Inode number (really byte offset
+ of direntry) */
};
/*
@@ -224,7 +228,7 @@
break; \
} \
if ((dep)->de_flag & DE_ACCESS) { \
- u_int16_t adate; \
+ uint16_t adate; \
\
timespec2fattime((acc), 0, &adate, NULL, NULL); \
if (adate != (dep)->de_ADate) { \
@@ -244,13 +248,12 @@
* This overlays the fid structure (see mount.h)
*/
struct defid {
- u_short defid_len; /* length of structure */
- u_short defid_pad; /* force long alignment */
-
- u_int32_t defid_dirclust; /* cluster this dir entry came from */
- u_int32_t defid_dirofs; /* offset of entry within the cluster */
+ unsigned short defid_len; /* length of structure */
+ unsigned short defid_pad; /* force long alignment */
+ uint32_t defid_dirclust; /* cluster this dir entry came from */
+ uint32_t defid_dirofs; /* offset of entry within the cluster */
#if 0
- u_int32_t defid_gen; /* generation number */
+ uint32_t defid_gen; /* generation number */
#endif
};
@@ -263,18 +266,21 @@
/*
* Internal service routine prototypes.
*/
-int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
-int uniqdosname(struct denode *, struct componentname *, u_char *);
-
-int readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs, struct buf **bpp, struct direntry **epp);
-int readde(struct denode *dep, struct buf **bpp, struct direntry **epp);
-int deextend(struct denode *dep, u_long length, struct ucred *cred);
-int fillinusemap(struct msdosfsmount *pmp);
-void reinsert(struct denode *dep);
-int dosdirempty(struct denode *dep);
-int createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct componentname *cnp);
-int deupdat(struct denode *dep, int waitfor);
-int removede(struct denode *pdep, struct denode *dep);
-int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred);
-int doscheckpath( struct denode *source, struct denode *target);
+int deget(struct msdosfsmount *, unsigned long, unsigned long,
+ struct denode **);
+int uniqdosname(struct denode *, struct componentname *, unsigned char *);
+int readep(struct msdosfsmount *pmp, unsigned long dirclu,
+ unsigned long dirofs, struct buf **bpp, struct direntry **epp);
+int readde(struct denode *dep, struct buf **bpp, struct direntry **epp);
+int deextend(struct denode *dep, unsigned long length, struct ucred *cred);
+int fillinusemap(struct msdosfsmount *pmp);
+void reinsert(struct denode *dep);
+int dosdirempty(struct denode *dep);
+int createde(struct denode *dep, struct denode *ddep, struct denode **depp,
+ struct componentname *cnp);
+int deupdat(struct denode *dep, int waitfor);
+int removede(struct denode *pdep, struct denode *dep);
+int detrunc(struct denode *dep, unsigned long length, int flags,
+ struct ucred *cred);
+int doscheckpath( struct denode *source, struct denode *target);
#endif /* _KERNEL */
Index: sys/fs/msdosfs/direntry.h
===================================================================
--- sys/fs/msdosfs/direntry.h
+++ sys/fs/msdosfs/direntry.h
@@ -54,11 +54,11 @@
* Structure of a dos directory entry.
*/
struct direntry {
- u_int8_t deName[11]; /* filename, blank filled */
+ uint8_t deName[11]; /* filename, blank filled */
#define SLOT_EMPTY 0x00 /* slot has never been used */
#define SLOT_E5 0x05 /* the real value is 0xe5 */
#define SLOT_DELETED 0xe5 /* file in this slot deleted */
- u_int8_t deAttributes; /* file attributes */
+ uint8_t deAttributes; /* file attributes */
#define ATTR_NORMAL 0x00 /* normal file */
#define ATTR_READONLY 0x01 /* file is readonly */
#define ATTR_HIDDEN 0x02 /* file is hidden */
@@ -66,37 +66,37 @@
#define ATTR_VOLUME 0x08 /* entry is a volume label */
#define ATTR_DIRECTORY 0x10 /* entry is a directory name */
#define ATTR_ARCHIVE 0x20 /* file is new or modified */
- u_int8_t deLowerCase; /* NT VFAT lower case flags */
+ uint8_t deLowerCase; /* NT VFAT lower case flags */
#define LCASE_BASE 0x08 /* filename base in lower case */
#define LCASE_EXT 0x10 /* filename extension in lower case */
- u_int8_t deCHundredth; /* hundredth of seconds in CTime */
- u_int8_t deCTime[2]; /* create time */
- u_int8_t deCDate[2]; /* create date */
- u_int8_t deADate[2]; /* access date */
- u_int8_t deHighClust[2]; /* high bytes of cluster number */
- u_int8_t deMTime[2]; /* last update time */
- u_int8_t deMDate[2]; /* last update date */
- u_int8_t deStartCluster[2]; /* starting cluster of file */
- u_int8_t deFileSize[4]; /* size of file in bytes */
+ uint8_t deCHundredth; /* hundredth of seconds in CTime */
+ uint8_t deCTime[2]; /* create time */
+ uint8_t deCDate[2]; /* create date */
+ uint8_t deADate[2]; /* access date */
+ uint8_t deHighClust[2]; /* high bytes of cluster number */
+ uint8_t deMTime[2]; /* last update time */
+ uint8_t deMDate[2]; /* last update date */
+ uint8_t deStartCluster[2]; /* starting cluster of file */
+ uint8_t deFileSize[4]; /* size of file in bytes */
};
/*
* Structure of a Win95 long name directory entry
*/
struct winentry {
- u_int8_t weCnt;
+ uint8_t weCnt;
#define WIN_LAST 0x40
#define WIN_CNT 0x3f
- u_int8_t wePart1[10];
- u_int8_t weAttributes;
+ uint8_t wePart1[10];
+ uint8_t weAttributes;
#define ATTR_WIN95 0x0f
- u_int8_t weReserved1;
- u_int8_t weChksum;
- u_int8_t wePart2[12];
- u_int16_t weReserved2;
- u_int8_t wePart3[4];
+ uint8_t weReserved1;
+ uint8_t weChksum;
+ uint8_t wePart2[12];
+ uint16_t weReserved2;
+ uint8_t wePart3[4];
};
-#define WIN_CHARS 13 /* Number of chars per winentry */
+#define WIN_CHARS 13 /* Number of chars per winentry */
/*
* Maximum number of winentries for a filename.
@@ -146,18 +146,19 @@
char *mbnambuf_flush(struct mbnambuf *nbp, struct dirent *dp);
void mbnambuf_init(struct mbnambuf *nbp);
int mbnambuf_write(struct mbnambuf *nbp, char *name, int id);
-int dos2unixfn(u_char dn[11], u_char *un, int lower,
+int dos2unixfn(unsigned char dn[11], unsigned char *un, int lower,
struct msdosfsmount *pmp);
-int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen,
- struct msdosfsmount *pmp);
-int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt,
- int chksum, struct msdosfsmount *pmp);
-int winChkName(struct mbnambuf *nbp, const u_char *un, size_t unlen,
+int unix2dosfn(const unsigned char *un, unsigned char dn[12], size_t unlen,
+ uint gen, struct msdosfsmount *pmp);
+int unix2winfn(const unsigned char *un, size_t unlen, struct winentry *wep,
+ int cnt, int chksum, struct msdosfsmount *pmp);
+int winChkName(struct mbnambuf *nbp, const unsigned char *un, size_t unlen,
int chksum, struct msdosfsmount *pmp);
int win2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum,
struct msdosfsmount *pmp);
-u_int8_t winChksum(u_int8_t *name);
-int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp);
-size_t winLenFixup(const u_char *un, size_t unlen);
+uint8_t winChksum(uint8_t *name);
+int winSlotCnt(const unsigned char *un, size_t unlen,
+ struct msdosfsmount *pmp);
+size_t winLenFixup(const unsigned char *un, size_t unlen);
#endif /* _KERNEL */
#endif /* !_FS_MSDOSFS_DIRENTRY_H_ */
Index: sys/fs/msdosfs/fat.h
===================================================================
--- sys/fs/msdosfs/fat.h
+++ sys/fs/msdosfs/fat.h
@@ -92,13 +92,19 @@
*/
#define DE_CLEAR 1 /* Zero out the blocks allocated */
-int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp);
-int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp);
-int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got);
-int fatentry(int function, struct msdosfsmount *pmp, u_long cluster, u_long *oldcontents, u_long newcontents);
-int freeclusterchain(struct msdosfsmount *pmp, u_long startchain);
-int extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags);
-void fc_purge(struct denode *dep, u_int frcn);
-int markvoldirty(struct msdosfsmount *pmp, int dirty);
+int pcbmap(struct denode *dep, unsigned long findcn, daddr_t *bnp,
+ unsigned long *cnp, int* sp);
+int clusterfree(struct msdosfsmount *pmp, unsigned long cn,
+ unsigned long *oldcnp);
+int clusteralloc(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count, unsigned long fillwith,
+ unsigned long *retcluster, unsigned long *got);
+int fatentry(int function, struct msdosfsmount *pmp, unsigned long cluster,
+ unsigned long *oldcontents, unsigned long newcontents);
+int freeclusterchain(struct msdosfsmount *pmp, unsigned long startchain);
+int extendfile(struct denode *dep, unsigned long count, struct buf **bpp,
+ unsigned long *ncp, int flags);
+void fc_purge(struct denode *dep, unsigned int frcn);
+int markvoldirty(struct msdosfsmount *pmp, int dirty);
#endif /* _KERNEL */
Index: sys/fs/msdosfs/msdosfs_conv.c
===================================================================
--- sys/fs/msdosfs/msdosfs_conv.c
+++ sys/fs/msdosfs/msdosfs_conv.c
@@ -60,11 +60,16 @@
extern struct iconv_functions *msdosfs_iconv;
-static int mbsadjpos(const char **, size_t, size_t, int, int, void *handle);
-static u_char * dos2unixchr(u_char *, const u_char **, size_t *, int, struct msdosfsmount *);
-static u_int16_t unix2doschr(const u_char **, size_t *, struct msdosfsmount *);
-static u_char * win2unixchr(u_char *, u_int16_t, struct msdosfsmount *);
-static u_int16_t unix2winchr(const u_char **, size_t *, int, struct msdosfsmount *);
+static int mbsadjpos(const char **, size_t, size_t, int, int,
+ void *handle);
+static unsigned char *dos2unixchr(unsigned char *, const unsigned char **,
+ size_t *, int, struct msdosfsmount *);
+static uint16_t unix2doschr(const unsigned char **, size_t *,
+ struct msdosfsmount *);
+static unsigned char *win2unixchr(unsigned char *, uint16_t,
+ struct msdosfsmount *);
+static uint16_t unix2winchr(const unsigned char **, size_t *, int,
+ struct msdosfsmount *);
/*
* 0 - character disallowed in long file name.
@@ -73,7 +78,7 @@
* 2 - character ('.' and ' ') should be skipped in DOS file name,
* and generation number inserted.
*/
-static u_char
+static unsigned char
unix2dos[256] = {
/* iso8859-1 -> cp850 */
0, 0, 0, 0, 0, 0, 0, 0, /* 00-07 */
@@ -110,7 +115,7 @@
0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0x98, /* f8-ff */
};
-static u_char
+static unsigned char
dos2unix[256] = {
/* cp850 -> iso8859-1 */
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* 00-07 */
@@ -147,7 +152,7 @@
0xb0, 0xa8, 0xb7, 0xb9, 0xb3, 0xb2, 0x3f, 0x3f, /* f8-ff */
};
-static u_char
+static unsigned char
u2l[256] = {
/* tolower */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */
@@ -184,7 +189,7 @@
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* f8-ff */
};
-static u_char
+static unsigned char
l2u[256] = {
/* toupper */
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */
@@ -234,11 +239,12 @@
* null.
*/
int
-dos2unixfn(u_char dn[11], u_char *un, int lower, struct msdosfsmount *pmp)
+dos2unixfn(unsigned char dn[11], unsigned char *un, int lower,
+ struct msdosfsmount *pmp)
{
size_t i;
int thislong = 0;
- u_char *c, tmpbuf[5];
+ unsigned char *c, tmpbuf[5];
/*
* If first char of the filename is SLOT_E5 (0x05), then the real
@@ -253,8 +259,8 @@
* Copy the name portion into the unix filename string.
*/
for (i = 8; i > 0 && *dn != ' ';) {
- c = dos2unixchr(tmpbuf, __DECONST(const u_char **, &dn), &i,
- lower & LCASE_BASE, pmp);
+ c = dos2unixchr(tmpbuf, __DECONST(const unsigned char **, &dn),
+ &i, lower & LCASE_BASE, pmp);
while (*c != '\0') {
*un++ = *c++;
thislong++;
@@ -270,8 +276,9 @@
*un++ = '.';
thislong++;
for (i = 3; i > 0 && *dn != ' ';) {
- c = dos2unixchr(tmpbuf, __DECONST(const u_char **, &dn),
- &i, lower & LCASE_EXT, pmp);
+ c = dos2unixchr(tmpbuf,
+ __DECONST(const unsigned char **, &dn), &i,
+ lower & LCASE_EXT, pmp);
while (*c != '\0') {
*un++ = *c++;
thislong++;
@@ -295,15 +302,15 @@
* 3 if conversion was successful and generation number was inserted
*/
int
-unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen,
- struct msdosfsmount *pmp)
+unix2dosfn(const unsigned char *un, unsigned char dn[12], size_t unlen,
+ unsigned int gen, struct msdosfsmount *pmp)
{
ssize_t i, j;
int l;
int conv = 1;
- const u_char *cp, *dp, *dp1;
- u_char gentext[6], *wcp;
- u_int16_t c;
+ const unsigned char *cp, *dp, *dp1;
+ unsigned char gentext[6], *wcp;
+ uint16_t c;
/*
* Fill the dos filename string with blanks. These are DOS's pad
@@ -485,7 +492,8 @@
* Correct posision to where insert the generation number
*/
cp = dn;
- i -= mbsadjpos((const char**)&cp, i, unlen, 1, pmp->pm_flags, pmp->pm_d2u);
+ i -= mbsadjpos((const char **)&cp, i, unlen, 1, pmp->pm_flags,
+ pmp->pm_d2u);
dn[i++] = '~';
while (wcp < gentext + sizeof(gentext))
@@ -515,12 +523,12 @@
* i.e. doesn't consist solely of blanks and dots
*/
int
-unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt,
+unix2winfn(const unsigned char *un, size_t unlen, struct winentry *wep, int cnt,
int chksum, struct msdosfsmount *pmp)
{
- u_int8_t *wcp;
+ uint8_t *wcp;
int i, end;
- u_int16_t code;
+ uint16_t code;
/*
* Drop trailing blanks and dots
@@ -536,7 +544,7 @@
/*
* Initialize winentry to some useful default
*/
- for (wcp = (u_int8_t *)wep, i = sizeof(*wep); --i >= 0; *wcp++ = 0xff);
+ for (wcp = (uint8_t *)wep, i = sizeof(*wep); --i >= 0; *wcp++ = 0xff);
wep->weCnt = cnt;
wep->weAttributes = ATTR_WIN95;
wep->weReserved1 = 0;
@@ -579,12 +587,12 @@
* Returns the checksum or -1 if no match
*/
int
-winChkName(struct mbnambuf *nbp, const u_char *un, size_t unlen, int chksum,
- struct msdosfsmount *pmp)
+winChkName(struct mbnambuf *nbp, const unsigned char *un, size_t unlen,
+ int chksum, struct msdosfsmount *pmp)
{
size_t len;
- u_int16_t c1, c2;
- u_char *np;
+ uint16_t c1, c2;
+ unsigned char *np;
struct dirent dirbuf;
/*
@@ -612,7 +620,7 @@
* to look up or create files in case sensitive even when
* it's a long file name.
*/
- c1 = unix2winchr(__DECONST(const u_char **, &np), &len,
+ c1 = unix2winchr(__DECONST(const unsigned char **, &np), &len,
LCASE_BASE, pmp);
c2 = unix2winchr(&un, &unlen, LCASE_BASE, pmp);
if (c1 != c2)
@@ -629,10 +637,10 @@
win2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum,
struct msdosfsmount *pmp)
{
- u_char *c, tmpbuf[5];
- u_int8_t *cp;
- u_int8_t *np, name[WIN_CHARS * 3 + 1];
- u_int16_t code;
+ unsigned char *c, tmpbuf[5];
+ uint8_t *cp;
+ uint8_t *np, name[WIN_CHARS * 3 + 1];
+ uint16_t code;
int i;
if ((wep->weCnt&WIN_CNT) > howmany(WIN_MAXLEN, WIN_CHARS)
@@ -722,11 +730,11 @@
/*
* Compute the unrolled checksum of a DOS filename for Win95 LFN use.
*/
-u_int8_t
-winChksum(u_int8_t *name)
+uint8_t
+winChksum(uint8_t *name)
{
int i;
- u_int8_t s;
+ uint8_t s;
for (s = 0, i = 11; --i >= 0; s += *name++)
s = (s << 7)|(s >> 1);
@@ -737,7 +745,7 @@
* Determine the number of slots necessary for Win95 names
*/
int
-winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp)
+winSlotCnt(const unsigned char *un, size_t unlen, struct msdosfsmount *pmp)
{
size_t wlen;
char wn[WIN_MAXLEN * 2 + 1], *wnp;
@@ -747,7 +755,8 @@
if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {
wlen = WIN_MAXLEN * 2;
wnp = wn;
- msdosfs_iconv->conv(pmp->pm_u2w, (const char **)&un, &unlen, &wnp, &wlen);
+ msdosfs_iconv->conv(pmp->pm_u2w, (const char **)&un, &unlen,
+ &wnp, &wlen);
if (unlen > 0)
return 0;
return howmany(WIN_MAXLEN - wlen/2, WIN_CHARS);
@@ -762,7 +771,7 @@
* Determine the number of bytes necessary for Win95 names
*/
size_t
-winLenFixup(const u_char *un, size_t unlen)
+winLenFixup(const unsigned char *un, size_t unlen)
{
for (un += unlen; unlen > 0; unlen--)
if (*--un != ' ' && *un != '.')
@@ -776,7 +785,8 @@
* inlen or outlen.
*/
static int
-mbsadjpos(const char **instr, size_t inlen, size_t outlen, int weight, int flag, void *handle)
+mbsadjpos(const char **instr, size_t inlen, size_t outlen, int weight, int flag,
+ void *handle)
{
char *outp, outstr[outlen * weight + 1];
@@ -794,10 +804,11 @@
/*
* Convert DOS char to Local char
*/
-static u_char *
-dos2unixchr(u_char *outbuf, const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp)
+static unsigned char *
+dos2unixchr(unsigned char *outbuf, const unsigned char **instr, size_t *ilen,
+ int lower, struct msdosfsmount *pmp)
{
- u_char c, *outp;
+ unsigned char c, *outp;
size_t len, olen;
outp = outbuf;
@@ -805,11 +816,12 @@
olen = len = 4;
if (lower & (LCASE_BASE | LCASE_EXT))
- msdosfs_iconv->convchr_case(pmp->pm_d2u, (const char **)instr,
- ilen, (char **)&outp, &olen, KICONV_LOWER);
+ msdosfs_iconv->convchr_case(pmp->pm_d2u,
+ (const char **)instr, ilen, (char **)&outp,
+ &olen, KICONV_LOWER);
else
- msdosfs_iconv->convchr(pmp->pm_d2u, (const char **)instr,
- ilen, (char **)&outp, &olen);
+ msdosfs_iconv->convchr(pmp->pm_d2u,
+ (const char **)instr, ilen, (char **)&outp, &olen);
len -= olen;
/*
@@ -838,12 +850,12 @@
/*
* Convert Local char to DOS char
*/
-static u_int16_t
-unix2doschr(const u_char **instr, size_t *ilen, struct msdosfsmount *pmp)
+static uint16_t
+unix2doschr(const unsigned char **instr, size_t *ilen, struct msdosfsmount *pmp)
{
- u_char c;
+ unsigned char c;
char *up, *outp, unicode[3], outbuf[3];
- u_int16_t wc;
+ uint16_t wc;
size_t len, ucslen, unixlen, olen;
if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {
@@ -887,11 +899,12 @@
olen = len = 2;
outp = outbuf;
msdosfs_iconv->convchr_case(pmp->pm_u2d, (const char **)instr,
- ilen, &outp, &olen, KICONV_FROM_UPPER);
+ ilen, &outp, &olen, KICONV_FROM_UPPER);
len -= olen;
/*
- * cannot be converted, but has unicode char, should return magic number
+ * cannot be converted, but has unicode char, should return
+ * magic number
*/
if (len == 0) {
(*ilen) -= unixlen;
@@ -909,22 +922,22 @@
c = *(*instr)++;
c = l2u[c];
c = unix2dos[c];
- return ((u_int16_t)c);
+ return ((uint16_t)c);
}
/*
* Convert Windows char to Local char
*/
-static u_char *
-win2unixchr(u_char *outbuf, u_int16_t wc, struct msdosfsmount *pmp)
+static unsigned char *
+win2unixchr(unsigned char *outbuf, uint16_t wc, struct msdosfsmount *pmp)
{
- u_char *inp, *outp, inbuf[3];
+ unsigned char *inp, *outp, inbuf[3];
size_t ilen, olen, len;
outp = outbuf;
if (pmp->pm_flags & MSDOSFSMNT_KICONV && msdosfs_iconv) {
- inbuf[0] = (u_char)(wc>>8);
- inbuf[1] = (u_char)wc;
+ inbuf[0] = (unsigned char)(wc>>8);
+ inbuf[1] = (unsigned char)wc;
inbuf[2] = '\0';
ilen = 2;
@@ -940,7 +953,7 @@
if (len == 0)
*outp++ = '?';
} else {
- *outp++ = (wc & 0xff00) ? '?' : (u_char)(wc & 0xff);
+ *outp++ = (wc & 0xff00) ? '?' : (unsigned char)(wc & 0xff);
}
*outp = '\0';
@@ -951,11 +964,12 @@
/*
* Convert Local char to Windows char
*/
-static u_int16_t
-unix2winchr(const u_char **instr, size_t *ilen, int lower, struct msdosfsmount *pmp)
+static uint16_t
+unix2winchr(const unsigned char **instr, size_t *ilen, int lower,
+ struct msdosfsmount *pmp)
{
- u_char *outp, outbuf[3];
- u_int16_t wc;
+ unsigned char *outp, outbuf[3];
+ uint16_t wc;
size_t olen;
if (*ilen == 0)
@@ -965,12 +979,12 @@
outp = outbuf;
olen = 2;
if (lower & (LCASE_BASE | LCASE_EXT))
- msdosfs_iconv->convchr_case(pmp->pm_u2w, (const char **)instr,
- ilen, (char **)&outp, &olen,
- KICONV_FROM_LOWER);
+ msdosfs_iconv->convchr_case(pmp->pm_u2w,
+ (const char **)instr, ilen, (char **)&outp, &olen,
+ KICONV_FROM_LOWER);
else
- msdosfs_iconv->convchr(pmp->pm_u2w, (const char **)instr,
- ilen, (char **)&outp, &olen);
+ msdosfs_iconv->convchr(pmp->pm_u2w,
+ (const char **)instr, ilen, (char **)&outp, &olen);
/*
* return '0' if end of filename
Index: sys/fs/msdosfs/msdosfs_denode.c
===================================================================
--- sys/fs/msdosfs/msdosfs_denode.c
+++ sys/fs/msdosfs/msdosfs_denode.c
@@ -93,7 +93,7 @@
* depp - returns the address of the gotten denode.
*/
int
-deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
+deget(struct msdosfsmount *pmp, unsigned long dirclust, unsigned long diroffset,
struct denode **depp)
{
int error;
@@ -247,7 +247,7 @@
* to find out the length of the directory and plug it into
* the denode structure.
*/
- u_long size;
+ unsigned long size;
/*
* XXX it sometimes happens that the "." entry has cluster
@@ -330,12 +330,12 @@
* Truncate the file described by dep to the length specified by length.
*/
int
-detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
+detrunc(struct denode *dep, unsigned long length, int flags, struct ucred *cred)
{
int error;
int allerror;
- u_long eofentry;
- u_long chaintofree;
+ unsigned long eofentry;
+ unsigned long chaintofree;
daddr_t bn;
int boff;
int isadir = dep->de_Attributes & ATTR_DIRECTORY;
@@ -343,7 +343,8 @@
struct msdosfsmount *pmp = dep->de_pmp;
#ifdef MSDOSFS_DEBUG
- printf("detrunc(): file %s, length %lu, flags %x\n", dep->de_Name, length, flags);
+ printf("detrunc(): file %s, length %lu, flags %x\n",
+ dep->de_Name, length, flags);
#endif
/*
@@ -381,7 +382,7 @@
dep->de_StartCluster = 0;
eofentry = ~0;
} else {
- error = pcbmap(dep, de_clcount(pmp, length) - 1, 0,
+ error = pcbmap(dep, de_clcount(pmp, length) - 1, 0,
&eofentry, 0);
if (error) {
#ifdef MSDOSFS_DEBUG
@@ -469,10 +470,10 @@
* Extend the file described by dep to length specified by length.
*/
int
-deextend(struct denode *dep, u_long length, struct ucred *cred)
+deextend(struct denode *dep, unsigned long length, struct ucred *cred)
{
struct msdosfsmount *pmp = dep->de_pmp;
- u_long count;
+ unsigned long count;
int error;
/*
@@ -575,7 +576,8 @@
int error = 0;
#ifdef MSDOSFS_DEBUG
- printf("msdosfs_inactive(): dep %p, de_Name[0] %x\n", dep, dep->de_Name[0]);
+ printf("msdosfs_inactive(): dep %p, de_Name[0] %x\n",
+ dep, dep->de_Name[0]);
#endif
/*
@@ -594,7 +596,7 @@
dep, dep->de_refcnt, vp->v_mount->mnt_flag, MNT_RDONLY);
#endif
if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
- error = detrunc(dep, (u_long) 0, 0, NOCRED);
+ error = detrunc(dep, (unsigned long) 0, 0, NOCRED);
dep->de_flag |= DE_UPDATE;
dep->de_Name[0] = SLOT_DELETED;
}
Index: sys/fs/msdosfs/msdosfs_fat.c
===================================================================
--- sys/fs/msdosfs/msdosfs_fat.c
+++ sys/fs/msdosfs/msdosfs_fat.c
@@ -60,34 +60,35 @@
#include <fs/msdosfs/fat.h>
#include <fs/msdosfs/msdosfsmount.h>
-#define FULL_RUN ((u_int)0xffffffff)
-
-static int chainalloc(struct msdosfsmount *pmp, u_long start,
- u_long count, u_long fillwith, u_long *retcluster,
- u_long *got);
-static int chainlength(struct msdosfsmount *pmp, u_long start,
- u_long count);
-static void fatblock(struct msdosfsmount *pmp, u_long ofs, u_long *bnp,
- u_long *sizep, u_long *bop);
-static int fatchain(struct msdosfsmount *pmp, u_long start, u_long count,
- u_long fillwith);
-static void fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp,
- u_long *fsrcnp);
+#define FULL_RUN ((unsigned int)0xffffffff)
+
+static int chainalloc(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count, unsigned long fillwith,
+ unsigned long *retcluster, unsigned long *got);
+static int chainlength(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count);
+static void fatblock(struct msdosfsmount *pmp, unsigned long ofs,
+ unsigned long *bnp, unsigned long *sizep,
+ unsigned long *bop);
+static int fatchain(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count, unsigned long fillwith);
+static void fc_lookup(struct denode *dep, unsigned long findcn,
+ unsigned long *frcnp, unsigned long *fsrcnp);
static void updatefats(struct msdosfsmount *pmp, struct buf *bp,
- u_long fatbn);
+ unsigned long fatbn);
static __inline void
- usemap_alloc(struct msdosfsmount *pmp, u_long cn);
+ usemap_alloc(struct msdosfsmount *pmp, unsigned long cn);
static __inline void
- usemap_free(struct msdosfsmount *pmp, u_long cn);
-static int clusteralloc1(struct msdosfsmount *pmp, u_long start,
- u_long count, u_long fillwith, u_long *retcluster,
- u_long *got);
+ usemap_free(struct msdosfsmount *pmp, unsigned long cn);
+static int clusteralloc1(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count, unsigned long fillwith,
+ unsigned long *retcluster, unsigned long *got);
static void
-fatblock(struct msdosfsmount *pmp, u_long ofs, u_long *bnp, u_long *sizep,
- u_long *bop)
+fatblock(struct msdosfsmount *pmp, unsigned long ofs, unsigned long *bnp,
+ unsigned long *sizep, unsigned long *bop)
{
- u_long bn, size;
+ unsigned long bn, size;
bn = ofs / pmp->pm_fatblocksize * pmp->pm_fatblocksec;
size = min(pmp->pm_fatblocksec, pmp->pm_FATsecs - bn)
@@ -122,19 +123,20 @@
* If cnp is null, nothing is returned.
*/
int
-pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int *sp)
+pcbmap(struct denode *dep, unsigned long findcn, daddr_t *bnp,
+ unsigned long *cnp, int *sp)
{
int error;
- u_long i;
- u_long cn;
- u_long prevcn = 0; /* XXX: prevcn could be used unititialized */
- u_long byteoffset;
- u_long bn;
- u_long bo;
+ unsigned long i;
+ unsigned long cn;
+ unsigned long prevcn = 0; /* XXX: prevcn could be used unititialized */
+ unsigned long byteoffset;
+ unsigned long bn;
+ unsigned long bo;
struct buf *bp = NULL;
- u_long bp_bn = -1;
+ unsigned long bp_bn = -1;
struct msdosfsmount *pmp = dep->de_pmp;
- u_long bsize;
+ unsigned long bsize;
KASSERT(bnp != NULL || cnp != NULL || sp != NULL,
("pcbmap: extra call"));
@@ -151,11 +153,13 @@
if (dep->de_Attributes & ATTR_DIRECTORY) {
if (de_cn2off(pmp, findcn) >= dep->de_FileSize) {
if (cnp)
- *cnp = de_bn2cn(pmp, pmp->pm_rootdirsize);
+ *cnp = de_bn2cn(pmp,
+ pmp->pm_rootdirsize);
return (E2BIG);
}
if (bnp)
- *bnp = pmp->pm_rootdirblk + de_cn2bn(pmp, findcn);
+ *bnp = pmp->pm_rootdirblk +
+ de_cn2bn(pmp, findcn);
if (cnp)
*cnp = MSDOSFSROOT;
if (sp)
@@ -254,10 +258,11 @@
* for.
*/
static void
-fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp, u_long *fsrcnp)
+fc_lookup(struct denode *dep, unsigned long findcn, unsigned long *frcnp,
+ unsigned long *fsrcnp)
{
int i;
- u_long cn;
+ unsigned long cn;
struct fatcache *closest = NULL;
ASSERT_VOP_LOCKED(DETOV(dep), "fc_lookup");
@@ -280,7 +285,7 @@
* relative cluster frcn and beyond.
*/
void
-fc_purge(struct denode *dep, u_int frcn)
+fc_purge(struct denode *dep, unsigned int frcn)
{
int i;
struct fatcache *fcp;
@@ -304,7 +309,7 @@
* fatbn - block number relative to begin of filesystem of the modified fat block.
*/
static void
-updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
+updatefats(struct msdosfsmount *pmp, struct buf *bp, unsigned long fatbn)
{
struct buf *bpn;
int cleanfat, i;
@@ -315,14 +320,15 @@
if (pmp->pm_flags & MSDOSFS_FATMIRROR) {
/*
- * Now copy the block(s) of the modified fat to the other copies of
- * the fat and write them out. This is faster than reading in the
- * other fats and then writing them back out. This could tie up
- * the fat for quite a while. Preventing others from accessing it.
- * To prevent us from going after the fat quite so much we use
- * delayed writes, unless they specfied "synchronous" when the
- * filesystem was mounted. If synch is asked for then use
- * bwrite()'s and really slow things down.
+ * Now copy the block(s) of the modified fat to the other
+ * copies of the fat and write them out. This is faster than
+ * reading in the other fats and then writing them back out.
+ * This could tie up the fat for quite a while. Preventing
+ * others from accessing it. To prevent us from going after
+ * the fat quite so much we use delayed writes, unless they
+ * specfied "synchronous" when the filesystem was mounted.
+ * If synch is asked for then use bwrite()'s and really
+ * slow things down.
*/
if (fatbn != pmp->pm_fatblk || FAT12(pmp))
cleanfat = 0;
@@ -338,9 +344,9 @@
bcopy(bp->b_data, bpn->b_data, bp->b_bcount);
/* Force the clean bit on in the other copies. */
if (cleanfat == 16)
- ((u_int8_t *)bpn->b_data)[3] |= 0x80;
+ ((uint8_t *)bpn->b_data)[3] |= 0x80;
else if (cleanfat == 32)
- ((u_int8_t *)bpn->b_data)[7] |= 0x08;
+ ((uint8_t *)bpn->b_data)[7] |= 0x08;
if (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
bwrite(bpn);
else
@@ -377,7 +383,7 @@
*
*/
static __inline void
-usemap_alloc(struct msdosfsmount *pmp, u_long cn)
+usemap_alloc(struct msdosfsmount *pmp, unsigned long cn)
{
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@@ -396,7 +402,7 @@
}
static __inline void
-usemap_free(struct msdosfsmount *pmp, u_long cn)
+usemap_free(struct msdosfsmount *pmp, unsigned long cn)
{
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@@ -414,10 +420,11 @@
}
int
-clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp)
+clusterfree(struct msdosfsmount *pmp, unsigned long cluster,
+ unsigned long *oldcnp)
{
int error;
- u_long oldcn;
+ unsigned long oldcn;
error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE);
if (error)
@@ -455,12 +462,12 @@
* the msdosfsmount structure. This is left to the caller.
*/
int
-fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents,
- u_long newcontents)
+fatentry(int function, struct msdosfsmount *pmp, unsigned long cn,
+ unsigned long *oldcontents, unsigned long newcontents)
{
int error;
- u_long readcn;
- u_long bn, bo, bsize, byteoffset;
+ unsigned long readcn;
+ unsigned long bn, bo, bsize, byteoffset;
struct buf *bp;
#ifdef MSDOSFS_DEBUG
@@ -563,10 +570,11 @@
* fillwith - what to write into fat entry of last cluster
*/
static int
-fatchain(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith)
+fatchain(struct msdosfsmount *pmp, unsigned long start, unsigned long count,
+ unsigned long fillwith)
{
int error;
- u_long bn, bo, bsize, byteoffset, readcn, newc;
+ unsigned long bn, bo, bsize, byteoffset, readcn, newc;
struct buf *bp;
#ifdef MSDOSFS_DEBUG
@@ -634,11 +642,11 @@
* count - maximum interesting length
*/
static int
-chainlength(struct msdosfsmount *pmp, u_long start, u_long count)
+chainlength(struct msdosfsmount *pmp, unsigned long start, unsigned long count)
{
- u_long idx, max_idx;
- u_int map;
- u_long len;
+ unsigned long idx, max_idx;
+ unsigned int map;
+ unsigned long len;
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@@ -691,11 +699,11 @@
* got - how many clusters were actually allocated.
*/
static int
-chainalloc(struct msdosfsmount *pmp, u_long start, u_long count,
- u_long fillwith, u_long *retcluster, u_long *got)
+chainalloc(struct msdosfsmount *pmp, unsigned long start, unsigned long count,
+ unsigned long fillwith, unsigned long *retcluster, unsigned long *got)
{
int error;
- u_long cl, n;
+ unsigned long cl, n;
MSDOSFS_ASSERT_MP_LOCKED(pmp);
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
@@ -736,8 +744,8 @@
* got - how many clusters were actually allocated.
*/
int
-clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count,
- u_long fillwith, u_long *retcluster, u_long *got)
+clusteralloc(struct msdosfsmount *pmp, unsigned long start, unsigned long count,
+ unsigned long fillwith, unsigned long *retcluster, unsigned long *got)
{
int error;
@@ -748,13 +756,14 @@
}
static int
-clusteralloc1(struct msdosfsmount *pmp, u_long start, u_long count,
- u_long fillwith, u_long *retcluster, u_long *got)
+clusteralloc1(struct msdosfsmount *pmp, unsigned long start,
+ unsigned long count, unsigned long fillwith,
+ unsigned long *retcluster, unsigned long *got)
{
- u_long idx;
- u_long len, newst, foundl, cn, l;
- u_long foundcn = 0; /* XXX: foundcn could be used unititialized */
- u_int map;
+ unsigned long idx;
+ unsigned long len, newst, foundl, cn, l;
+ unsigned long foundcn = 0; /* XXX: foundcn could be used unititialized */
+ unsigned int map;
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@@ -763,7 +772,8 @@
#endif
if (start) {
if ((len = chainlength(pmp, start, count)) >= count)
- return (chainalloc(pmp, start, count, fillwith, retcluster, got));
+ return chainalloc(pmp, start, count,
+ fillwith, retcluster, got);
} else
len = 0;
@@ -777,7 +787,8 @@
if (map != FULL_RUN) {
cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
- return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
+ return chainalloc(pmp, cn, count,
+ fillwith, retcluster, got);
if (l > foundl) {
foundcn = cn;
foundl = l;
@@ -794,7 +805,8 @@
if (map != FULL_RUN) {
cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
if ((l = chainlength(pmp, cn, count)) >= count)
- return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
+ return chainalloc(pmp, cn, count,
+ fillwith, retcluster, got);
if (l > foundl) {
foundcn = cn;
foundl = l;
@@ -809,9 +821,10 @@
return (ENOSPC);
if (len)
- return (chainalloc(pmp, start, len, fillwith, retcluster, got));
+ return chainalloc(pmp, start, len, fillwith, retcluster, got);
else
- return (chainalloc(pmp, foundcn, foundl, fillwith, retcluster, got));
+ return chainalloc(pmp, foundcn, foundl,
+ fillwith, retcluster, got);
}
@@ -824,12 +837,12 @@
* freed.
*/
int
-freeclusterchain(struct msdosfsmount *pmp, u_long cluster)
+freeclusterchain(struct msdosfsmount *pmp, unsigned long cluster)
{
int error;
struct buf *bp = NULL;
- u_long bn, bo, bsize, byteoffset;
- u_long readcn, lbn = -1;
+ unsigned long bn, bo, bsize, byteoffset;
+ unsigned long readcn, lbn = -1;
MSDOSFS_LOCK_MP(pmp);
while (cluster >= CLUST_FIRST && cluster <= pmp->pm_maxcluster) {
@@ -889,9 +902,9 @@
fillinusemap(struct msdosfsmount *pmp)
{
struct buf *bp = NULL;
- u_long cn, readcn;
+ unsigned long cn, readcn;
int error;
- u_long bn, bo, bsize, byteoffset;
+ unsigned long bn, bo, bsize, byteoffset;
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@@ -959,12 +972,12 @@
* field. This is left for the caller to do.
*/
int
-extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp,
- int flags)
+extendfile(struct denode *dep, unsigned long count, struct buf **bpp,
+ unsigned long *ncp, int flags)
{
int error;
- u_long frcn;
- u_long cn, got;
+ unsigned long frcn;
+ unsigned long cn, got;
struct msdosfsmount *pmp = dep->de_pmp;
struct buf *bp;
daddr_t blkno;
@@ -1042,15 +1055,16 @@
}
/*
- * Update the "last cluster of the file" entry in the denode's fat
- * cache.
+ * Update the "last cluster of the file" entry in the denode's
+ * fat cache.
*/
fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);
if (flags & DE_CLEAR) {
while (got-- > 0) {
/*
- * Get the buf header for the new block of the file.
+ * Get the buf header for the new block of
+ * the file.
*/
if (dep->de_Attributes & ATTR_DIRECTORY)
bp = getblk(pmp->pm_devvp,
@@ -1109,7 +1123,7 @@
markvoldirty(struct msdosfsmount *pmp, int dirty)
{
struct buf *bp;
- u_long bn, bo, bsize, byteoffset, fatval;
+ unsigned long bn, bo, bsize, byteoffset, fatval;
int error;
/*
Index: sys/fs/msdosfs/msdosfs_lookup.c
===================================================================
--- sys/fs/msdosfs/msdosfs_lookup.c
+++ sys/fs/msdosfs/msdosfs_lookup.c
@@ -62,7 +62,7 @@
#include <fs/msdosfs/msdosfsmount.h>
static int msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
- struct componentname *cnp, u_int64_t *inum);
+ struct componentname *cnp, uint64_t *inum);
int
msdosfs_lookup(struct vop_cachedlookup_args *ap)
@@ -72,7 +72,7 @@
}
struct deget_dotdot {
- u_long cluster;
+ unsigned long cluster;
int blkoff;
};
@@ -110,7 +110,7 @@
*/
static int
msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
- struct componentname *cnp, u_int64_t *dd_inum)
+ struct componentname *cnp, uint64_t *dd_inum)
{
struct mbnambuf nb;
daddr_t bn;
@@ -118,12 +118,12 @@
int slotcount;
int slotoffset = 0;
int frcn;
- u_long cluster;
+ unsigned long cluster;
int blkoff;
int diroff;
int blsize;
int isadir; /* ~0 if found direntry is a directory */
- u_long scn; /* starting cluster number */
+ unsigned long scn; /* starting cluster number */
struct vnode *pdp;
struct denode *dp;
struct denode *tdp;
@@ -131,11 +131,11 @@
struct buf *bp = NULL;
struct direntry *dep = NULL;
struct deget_dotdot dd_arg;
- u_char dosfilename[12];
+ unsigned char dosfilename[12];
int flags = cnp->cn_flags;
int nameiop = cnp->cn_nameiop;
int unlen;
- u_int64_t inode1;
+ uint64_t inode1;
int wincnt = 1;
int chksum = -1, chksum_ok;
@@ -172,19 +172,19 @@
goto foundroot;
}
- switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename,
+ switch (unix2dosfn((const unsigned char *)cnp->cn_nameptr, dosfilename,
cnp->cn_namelen, 0, pmp)) {
case 0:
return (EINVAL);
case 1:
break;
case 2:
- wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr,
+ wincnt = winSlotCnt((const unsigned char *)cnp->cn_nameptr,
cnp->cn_namelen, pmp) + 1;
break;
case 3:
olddos = 0;
- wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr,
+ wincnt = winSlotCnt((const unsigned char *)cnp->cn_nameptr,
cnp->cn_namelen, pmp) + 1;
break;
}
@@ -266,8 +266,8 @@
}
} else {
/*
- * If there wasn't enough space for our winentries,
- * forget about the empty space
+ * If there wasn't enough space for our
+ * winentries, forget about the empty space
*/
if (slotcount < wincnt)
slotcount = 0;
@@ -286,8 +286,8 @@
}
chksum = winChkName(&nb,
- (const u_char *)cnp->cn_nameptr, unlen,
- chksum, pmp);
+ (const unsigned char *)cnp->cn_nameptr,
+ unlen, chksum, pmp);
if (chksum == -2) {
chksum = -1;
continue;
@@ -306,8 +306,8 @@
* Check for a checksum or name match
*/
chksum_ok = (chksum == winChksum(dep->deName));
- if (!chksum_ok
- && (!olddos || bcmp(dosfilename, dep->deName, 11))) {
+ if (!chksum_ok && (!olddos || bcmp(dosfilename,
+ dep->deName, 11))) {
chksum = -1;
continue;
}
@@ -596,7 +596,7 @@
struct componentname *cnp)
{
int error;
- u_long dirclust, diroffset;
+ unsigned long dirclust, diroffset;
struct direntry *ndep;
struct msdosfsmount *pmp = ddep->de_pmp;
struct buf *bp;
@@ -656,8 +656,8 @@
* Now write the Win95 long name
*/
if (ddep->de_fndcnt > 0) {
- u_int8_t chksum = winChksum(ndep->deName);
- const u_char *un = (const u_char *)cnp->cn_nameptr;
+ uint8_t chksum = winChksum(ndep->deName);
+ const unsigned char *un = (const unsigned char *)cnp->cn_nameptr;
int unlen = cnp->cn_namelen;
int cnt = 1;
@@ -726,7 +726,7 @@
{
int blsize;
int error;
- u_long cn;
+ unsigned long cn;
daddr_t bn;
struct buf *bp;
struct msdosfsmount *pmp = dep->de_pmp;
@@ -887,8 +887,8 @@
* directory entry within the block.
*/
int
-readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
- struct buf **bpp, struct direntry **epp)
+readep(struct msdosfsmount *pmp, unsigned long dirclust,
+ unsigned long diroffset, struct buf **bpp, struct direntry **epp)
{
int error;
daddr_t bn;
@@ -942,7 +942,7 @@
daddr_t bn;
int blsize;
struct msdosfsmount *pmp = pdep->de_pmp;
- u_long offset = pdep->de_fndoffset;
+ unsigned long offset = pdep->de_fndoffset;
#ifdef MSDOSFS_DEBUG
printf("removede(): filename %s, dep %p, offset %08lx\n",
@@ -975,10 +975,10 @@
offset += sizeof(struct direntry);
while (1) {
/*
- * We are a bit aggressive here in that we delete any Win95
- * entries preceding this entry, not just the ones we "own".
- * Since these presumably aren't valid anyway,
- * there should be no harm.
+ * We are a bit aggressive here in that we delete any
+ * Win95 entries preceding this entry, not just the ones
+ * we "own". Since these presumably aren't valid
+ * anyway, there should be no harm.
*/
offset -= sizeof(struct direntry);
ep--->deName[0] = SLOT_DELETED;
@@ -1001,26 +1001,26 @@
* Create a unique DOS name in dvp
*/
int
-uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp)
+uniqdosname(struct denode *dep, struct componentname *cnp, unsigned char *cp)
{
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;
int gen;
int blsize;
- u_long cn;
+ unsigned long cn;
daddr_t bn;
struct buf *bp;
int error;
if (pmp->pm_flags & MSDOSFSMNT_SHORTNAME)
- return (unix2dosfn((const u_char *)cnp->cn_nameptr, cp,
+ return (unix2dosfn((const unsigned char *)cnp->cn_nameptr, cp,
cnp->cn_namelen, 0, pmp) ? 0 : EINVAL);
for (gen = 1;; gen++) {
/*
* Generate DOS name with generation number
*/
- if (!unix2dosfn((const u_char *)cnp->cn_nameptr, cp,
+ if (!unix2dosfn((const unsigned char *)cnp->cn_nameptr, cp,
cnp->cn_namelen, gen, pmp))
return gen == 1 ? EINVAL : EEXIST;
@@ -1029,7 +1029,7 @@
*/
for (cn = error = 0; !error; cn++) {
if ((error = pcbmap(dep, cn, &bn, 0, &blsize)) != 0) {
- if (error == E2BIG) /* EOF reached and not found */
+ if (error == E2BIG) /* EOF reached and not found */
return 0;
return error;
}
Index: sys/fs/msdosfs/msdosfs_vfsops.c
===================================================================
--- sys/fs/msdosfs/msdosfs_vfsops.c
+++ sys/fs/msdosfs/msdosfs_vfsops.c
@@ -383,7 +383,8 @@
vfs_mountedfrom(mp, from);
#ifdef MSDOSFS_DEBUG
- printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n", mp, pmp, pmp->pm_inusemap);
+ printf("msdosfs_mount(): mp %p, pmp %p, inusemap %p\n",
+ mp, pmp, pmp->pm_inusemap);
#endif
return (0);
}
@@ -398,8 +399,8 @@
struct byte_bpb33 *b33;
struct byte_bpb50 *b50;
struct byte_bpb710 *b710;
- u_int8_t SecPerClust;
- u_long clusters;
+ uint8_t SecPerClust;
+ unsigned long clusters;
int ronly, error;
struct g_consumer *cp;
struct bufobj *bo;
Index: sys/fs/msdosfs/msdosfs_vnops.c
===================================================================
--- sys/fs/msdosfs/msdosfs_vnops.c
+++ sys/fs/msdosfs/msdosfs_vnops.c
@@ -261,7 +261,7 @@
struct vattr *vap = ap->a_vap;
mode_t mode;
struct timespec ts;
- u_long dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
+ unsigned long dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
uint64_t fileid;
getnanotime(&ts);
@@ -521,9 +521,9 @@
int blsize;
int isadir;
ssize_t orig_resid;
- u_int n;
- u_long diff;
- u_long on;
+ unsigned int n;
+ unsigned long diff;
+ unsigned long on;
daddr_t lbn;
daddr_t rablock;
int rasize;
@@ -615,9 +615,9 @@
int n;
int croffset;
ssize_t resid;
- u_long osize;
+ unsigned long osize;
int error = 0;
- u_long count;
+ unsigned long count;
int seqcount;
daddr_t bn, lastcn;
struct buf *bp;
@@ -712,7 +712,10 @@
n = min(uio->uio_resid, pmp->pm_bpcluster - croffset);
if (uio->uio_offset + n > dep->de_FileSize) {
dep->de_FileSize = uio->uio_offset + n;
- /* The object size needs to be set before buffer is allocated */
+ /*
+ * The object size needs to be set before buffer
+ * is allocated
+ */
vnode_pager_setsize(vp, dep->de_FileSize);
}
@@ -816,7 +819,8 @@
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
} else {
- detrunc(dep, dep->de_FileSize, ioflag & IO_SYNC, NOCRED);
+ detrunc(dep, dep->de_FileSize, ioflag & IO_SYNC,
+ NOCRED);
if (uio->uio_resid != resid)
error = 0;
}
@@ -874,7 +878,8 @@
else
error = removede(ddep, dep);
#ifdef MSDOSFS_DEBUG
- printf("msdosfs_remove(), dep %p, v_usecount %d\n", dep, ap->a_vp->v_usecount);
+ printf("msdosfs_remove(), dep %p, v_usecount %d\n",
+ dep, ap->a_vp->v_usecount);
#endif
return (error);
}
@@ -944,12 +949,12 @@
struct componentname *tcnp = ap->a_tcnp;
struct componentname *fcnp = ap->a_fcnp;
struct denode *ip, *xp, *dp, *zp;
- u_char toname[12], oldname[11];
- u_long from_diroffset, to_diroffset;
- u_char to_count;
+ unsigned char toname[12], oldname[11];
+ unsigned long from_diroffset, to_diroffset;
+ unsigned char to_count;
int doingdirectory = 0, newparent = 0;
int error;
- u_long cn, pcl;
+ unsigned long cn, pcl;
daddr_t bn;
struct msdosfsmount *pmp;
struct direntry *dotdotp;
@@ -1300,7 +1305,7 @@
struct direntry *denp;
struct msdosfsmount *pmp = pdep->de_pmp;
struct buf *bp;
- u_long newcluster, pcl;
+ unsigned long newcluster, pcl;
int bn;
int error;
struct denode ndirent;
@@ -1446,7 +1451,7 @@
/*
* Truncate the directory that is being deleted.
*/
- error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred);
+ error = detrunc(ip, (unsigned long)0, IO_SYNC, cnp->cn_cred);
cache_purge(vp);
out:
@@ -1471,9 +1476,9 @@
long n;
int blsize;
long on;
- u_long cn;
+ unsigned long cn;
uint64_t fileno;
- u_long dirsperblk;
+ unsigned long dirsperblk;
long bias = 0;
daddr_t bn, lbn;
struct buf *bp;
@@ -1482,7 +1487,7 @@
struct direntry *dentp;
struct dirent dirbuf;
struct uio *uio = ap->a_uio;
- u_long *cookies = NULL;
+ unsigned long *cookies = NULL;
int ncookies = 0;
off_t offset, off;
int chksum = -1;
@@ -1518,7 +1523,7 @@
if (ap->a_ncookies) {
ncookies = uio->uio_resid / 16;
- cookies = malloc(ncookies * sizeof(u_long), M_TEMP,
+ cookies = malloc(ncookies * sizeof(unsigned long), M_TEMP,
M_WAITOK);
*ap->a_cookies = cookies;
*ap->a_ncookies = ncookies;
@@ -1545,8 +1550,7 @@
n < 2; n++) {
if (FAT32(pmp))
fileno = (uint64_t)cntobn(pmp,
- pmp->pm_rootdirblk)
- * dirsperblk;
+ pmp->pm_rootdirblk) * dirsperblk;
else
fileno = 1;
if (pmp->pm_flags & MSDOSFS_LARGEFS) {
@@ -1668,8 +1672,8 @@
if (fileno == MSDOSFSROOT)
if (FAT32(pmp))
fileno = (uint64_t)cntobn(pmp,
- pmp->pm_rootdirblk)
- * dirsperblk;
+ pmp->pm_rootdirblk)
+ * dirsperblk;
else
fileno = 1;
else
@@ -1689,7 +1693,7 @@
if (chksum != winChksum(dentp->deName)) {
dirbuf.d_namlen = dos2unixfn(dentp->deName,
- (u_char *)dirbuf.d_name,
+ (unsigned char *)dirbuf.d_name,
dentp->deLowerCase |
((pmp->pm_flags & MSDOSFSMNT_SHORTNAME) ?
(LCASE_BASE | LCASE_EXT) : 0),
@@ -1757,7 +1761,7 @@
struct msdosfsmount *pmp;
struct vnode *vp;
daddr_t runbn;
- u_long cn;
+ unsigned long cn;
int bnpercn, error, maxio, maxrun, run;
vp = ap->a_vp;
Index: sys/fs/msdosfs/msdosfsmount.h
===================================================================
--- sys/fs/msdosfs/msdosfsmount.h
+++ sys/fs/msdosfs/msdosfsmount.h
@@ -52,8 +52,6 @@
#define _MSDOSFS_MSDOSFSMOUNT_H_
#ifdef _KERNEL
-
-#include <sys/types.h>
#include <sys/lock.h>
#include <sys/lockmgr.h>
#include <sys/tree.h>
@@ -68,50 +66,60 @@
* Layout of the mount control block for a msdos filesystem.
*/
struct msdosfsmount {
- struct mount *pm_mountp;/* vfs mount struct for this fs */
+ struct mount *pm_mountp; /* vfs mount struct for this fs */
struct g_consumer *pm_cp;
struct bufobj *pm_bo;
- uid_t pm_uid; /* uid to set as owner of the files */
- gid_t pm_gid; /* gid to set as owner of the files */
- mode_t pm_mask; /* mask to and with file protection bits
- for files */
- mode_t pm_dirmask; /* mask to and with file protection bits
- for directories */
- struct vnode *pm_devvp; /* vnode for character device mounted */
- struct cdev *pm_dev; /* character device mounted */
- struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */
- u_long pm_BlkPerSec; /* How many DEV_BSIZE blocks fit inside a physical sector */
- u_long pm_FATsecs; /* actual number of fat sectors */
- u_long pm_fatblk; /* block # of first FAT */
- u_long pm_rootdirblk; /* block # (cluster # for FAT32) of root directory number */
- u_long pm_rootdirsize; /* size in blocks (not clusters) */
- u_long pm_firstcluster; /* block number of first cluster */
- u_long pm_maxcluster; /* maximum cluster number */
- u_long pm_freeclustercount; /* number of free clusters */
- u_long pm_cnshift; /* shift file offset right this amount to get a cluster number */
- u_long pm_crbomask; /* and a file offset with this mask to get cluster rel offset */
- u_long pm_bnshift; /* shift file offset right this amount to get a block number */
- u_long pm_bpcluster; /* bytes per cluster */
- u_long pm_fmod; /* ~0 if fs is modified, this can rollover to 0 */
- u_long pm_fatblocksize; /* size of fat blocks in bytes */
- u_long pm_fatblocksec; /* size of fat blocks in sectors */
- u_long pm_fatsize; /* size of fat in bytes */
- u_int32_t pm_fatmask; /* mask to use for fat numbers */
- u_long pm_fsinfo; /* fsinfo block number */
- u_long pm_nxtfree; /* next place to search for a free cluster */
- u_int pm_fatmult; /* these 2 values are used in fat */
- u_int pm_fatdiv; /* offset computation */
- u_int pm_curfat; /* current fat for FAT32 (0 otherwise) */
- u_int *pm_inusemap; /* ptr to bitmap of in-use clusters */
- uint64_t pm_flags; /* see below */
- void *pm_u2w; /* Local->Unicode iconv handle */
- void *pm_w2u; /* Unicode->Local iconv handle */
- void *pm_u2d; /* Unicode->DOS iconv handle */
- void *pm_d2u; /* DOS->Local iconv handle */
- u_int32_t pm_nfileno; /* next 32-bit fileno */
+ uid_t pm_uid; /* uid to set as owner of the files */
+ gid_t pm_gid; /* gid to set as owner of the files */
+ mode_t pm_mask; /* mask to and with file protection bits
+ for files */
+ mode_t pm_dirmask; /* mask to and with file protection bits
+ for directories */
+ struct vnode *pm_devvp; /* vnode for character device mounted */
+ struct cdev *pm_dev; /* character device mounted */
+ struct bpb50 pm_bpb; /* BIOS parameter blk for this fs */
+ unsigned long pm_BlkPerSec; /* How many DEV_BSIZE blocks fit inside
+ a physical sector */
+ unsigned long pm_FATsecs; /* actual number of fat sectors */
+ unsigned long pm_fatblk; /* block # of first FAT */
+ unsigned long pm_rootdirblk; /* block # (cluster # for FAT32) of root
+ directory number */
+ unsigned long pm_rootdirsize; /* size in blocks (not clusters) */
+ unsigned long pm_firstcluster; /* block number of first cluster */
+ unsigned long pm_maxcluster; /* maximum cluster number */
+ unsigned long pm_freeclustercount; /* number of free clusters */
+ unsigned long pm_cnshift; /* shift file offset right this amount
+ to get a cluster number */
+ unsigned long pm_crbomask; /* and a file offset with this mask to
+ get cluster rel offset */
+ unsigned long pm_bnshift; /* shift file offset right this amount
+ to get a block number */
+ unsigned long pm_bpcluster; /* bytes per cluster */
+ unsigned long pm_fmod; /* ~0 if fs is modified, this can
+ rollover to 0 */
+ unsigned long pm_fatblocksize; /* size of fat blocks in bytes */
+ unsigned long pm_fatblocksec; /* size of fat blocks in sectors */
+ unsigned long pm_fatsize; /* size of fat in bytes */
+ uint32_t pm_fatmask; /* mask to use for fat numbers */
+ unsigned long pm_fsinfo; /* fsinfo block number */
+ unsigned long pm_nxtfree; /* next place to search for a free
+ cluster */
+ uint pm_fatmult; /* these 2 values are used in fat */
+ uint pm_fatdiv; /* offset computation */
+ uint pm_curfat; /* current fat for FAT32 (0 otherwise) */
+ uint *pm_inusemap; /* ptr to bitmap of in-use clusters */
+ uint64_t pm_flags; /* see below */
+ void *pm_u2w; /* Local->Unicode iconv handle */
+ void *pm_w2u; /* Unicode->Local iconv handle */
+ void *pm_u2d; /* Unicode->DOS iconv handle */
+ void *pm_d2u; /* DOS->Local iconv handle */
+ uint32_t pm_nfileno; /* next 32-bit fileno */
+
RB_HEAD(msdosfs_filenotree, msdosfs_fileno)
- pm_filenos; /* 64<->32-bit fileno mapping */
- struct lock pm_fatlock; /* lockmgr protecting allocations and rb tree */
+ pm_filenos; /* 64<->32-bit fileno mapping */
+
+ struct lock pm_fatlock; /* lockmgr protecting allocations and
+ rb tree */
};
/*
@@ -125,13 +133,12 @@
};
/* Byte offset in FAT on filesystem pmp, cluster cn */
-#define FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)
-
+#define FATOFS(pmp, cn) ((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)
#define VFSTOMSDOSFS(mp) ((struct msdosfsmount *)mp->mnt_data)
/* Number of bits in one pm_inusemap item: */
-#define N_INUSEBITS (8 * sizeof(u_int))
+#define N_INUSEBITS (8 * sizeof(unsigned int))
/*
* Shorthand for fields in the bpb contained in the msdosfsmount structure.
@@ -151,7 +158,7 @@
* Convert pointer to buffer -> pointer to direntry
*/
#define bptoep(pmp, bp, dirofs) \
- ((struct direntry *)(((bp)->b_data) \
+ ((struct direntry *)(((bp)->b_data) \
+ ((dirofs) & (pmp)->pm_crbomask)))
/*
@@ -234,13 +241,13 @@
*/
struct msdosfs_args {
char *fspec; /* blocks special holding the fs to mount */
- struct oexport_args export; /* network export information */
+ struct oexport_args export; /* network export information */
uid_t uid; /* uid that owns msdosfs files */
gid_t gid; /* gid that owns msdosfs files */
mode_t mask; /* file mask to be applied for msdosfs perms */
int flags; /* see below */
int unused1; /* unused, was version number */
- u_int16_t unused2[128]; /* no longer used, was Local->Unicode table */
+ uint16_t unused2[128]; /* no longer used, was Local->Unicode table */
char *cs_win; /* Windows(Unicode) Charset */
char *cs_dos; /* DOS Charset */
char *cs_local; /* Local Charset */
@@ -258,8 +265,8 @@
#define MSDOSFSMNT_MNTOPT \
(MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \
|MSDOSFSMNT_KICONV)
-#define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */
-#define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */
+#define MSDOSFSMNT_RONLY 0x80000000 /* mounted read-only */
+#define MSDOSFSMNT_WAITONFAT 0x40000000 /* mounted synchronous */
#define MSDOSFS_FATMIRROR 0x20000000 /* FAT is mirrored */
#define MSDOSFS_LARGEFS 0x10000000 /* perform fileno mapping */
#define MSDOSFS_FSIMOD 0x01000000

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 11, 8:38 AM (18 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25150967
Default Alt Text
D10821.id28570.diff (66 KB)

Event Timeline