ANSIfy sys/fs/msdosfs

There are a number of msdosfs improvements in NetBSD that may be worth
bringing over, and this reduces noise in the comparison.

Differential Revision:	https://reviews.freebsd.org/D1466
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Ed Maste 2015-01-09 14:50:08 +00:00
parent d63e657c04
commit 10c9700f3e
6 changed files with 63 additions and 286 deletions

View file

@ -234,11 +234,7 @@ l2u[256] = {
* null.
*/
int
dos2unixfn(dn, un, lower, pmp)
u_char dn[11];
u_char *un;
int lower;
struct msdosfsmount *pmp;
dos2unixfn(u_char dn[11], u_char *un, int lower, struct msdosfsmount *pmp)
{
size_t i;
int thislong = 0;

View file

@ -92,11 +92,8 @@ de_vncmpf(struct vnode *vp, void *arg)
* depp - returns the address of the gotten denode.
*/
int
deget(pmp, dirclust, diroffset, depp)
struct msdosfsmount *pmp; /* so we know the maj/min number */
u_long dirclust; /* cluster this dir entry came from */
u_long diroffset; /* index of entry within the cluster */
struct denode **depp; /* returns the addr of the gotten denode */
deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
struct denode **depp)
{
int error;
uint64_t inode;
@ -284,9 +281,7 @@ deget(pmp, dirclust, diroffset, depp)
}
int
deupdat(dep, waitfor)
struct denode *dep;
int waitfor;
deupdat(struct denode *dep, int waitfor)
{
struct direntry dir;
struct timespec ts;
@ -334,11 +329,7 @@ deupdat(dep, waitfor)
* Truncate the file described by dep to the length specified by length.
*/
int
detrunc(dep, length, flags, cred)
struct denode *dep;
u_long length;
int flags;
struct ucred *cred;
detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
{
int error;
int allerror;
@ -477,10 +468,7 @@ detrunc(dep, length, flags, cred)
* Extend the file described by dep to length specified by length.
*/
int
deextend(dep, length, cred)
struct denode *dep;
u_long length;
struct ucred *cred;
deextend(struct denode *dep, u_long length, struct ucred *cred)
{
struct msdosfsmount *pmp = dep->de_pmp;
u_long count;
@ -525,8 +513,7 @@ deextend(dep, length, cred)
* been moved to a new directory.
*/
void
reinsert(dep)
struct denode *dep;
reinsert(struct denode *dep)
{
struct vnode *vp;
@ -549,10 +536,7 @@ reinsert(dep)
}
int
msdosfs_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
} */ *ap;
msdosfs_reclaim(struct vop_reclaim_args *ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
@ -583,11 +567,7 @@ msdosfs_reclaim(ap)
}
int
msdosfs_inactive(ap)
struct vop_inactive_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
msdosfs_inactive(struct vop_inactive_args *ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);

View file

@ -82,12 +82,8 @@ static int clusteralloc1(struct msdosfsmount *pmp, u_long start,
u_long *got);
static void
fatblock(pmp, ofs, bnp, sizep, bop)
struct msdosfsmount *pmp;
u_long ofs;
u_long *bnp;
u_long *sizep;
u_long *bop;
fatblock(struct msdosfsmount *pmp, u_long ofs, u_long *bnp, u_long *sizep,
u_long *bop)
{
u_long bn, size;
@ -123,12 +119,7 @@ fatblock(pmp, ofs, bnp, sizep, bop)
* If cnp is null, nothing is returned.
*/
int
pcbmap(dep, findcn, bnp, cnp, sp)
struct denode *dep;
u_long findcn; /* file relative cluster to get */
daddr_t *bnp; /* returned filesys relative blk number */
u_long *cnp; /* returned cluster number */
int *sp; /* returned block size */
pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int *sp)
{
int error;
u_long i;
@ -260,11 +251,7 @@ hiteof:;
* for.
*/
static void
fc_lookup(dep, findcn, frcnp, fsrcnp)
struct denode *dep;
u_long findcn;
u_long *frcnp;
u_long *fsrcnp;
fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp, u_long *fsrcnp)
{
int i;
u_long cn;
@ -290,9 +277,7 @@ fc_lookup(dep, findcn, frcnp, fsrcnp)
* relative cluster frcn and beyond.
*/
void
fc_purge(dep, frcn)
struct denode *dep;
u_int frcn;
fc_purge(struct denode *dep, u_int frcn)
{
int i;
struct fatcache *fcp;
@ -316,10 +301,7 @@ fc_purge(dep, frcn)
* fatbn - block number relative to begin of filesystem of the modified fat block.
*/
static void
updatefats(pmp, bp, fatbn)
struct msdosfsmount *pmp;
struct buf *bp;
u_long fatbn;
updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
{
struct buf *bpn;
int cleanfat, i;
@ -392,9 +374,7 @@ updatefats(pmp, bp, fatbn)
*
*/
static __inline void
usemap_alloc(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
usemap_alloc(struct msdosfsmount *pmp, u_long cn)
{
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@ -409,9 +389,7 @@ usemap_alloc(pmp, cn)
}
static __inline void
usemap_free(pmp, cn)
struct msdosfsmount *pmp;
u_long cn;
usemap_free(struct msdosfsmount *pmp, u_long cn)
{
MSDOSFS_ASSERT_MP_LOCKED(pmp);
@ -424,10 +402,7 @@ usemap_free(pmp, cn)
}
int
clusterfree(pmp, cluster, oldcnp)
struct msdosfsmount *pmp;
u_long cluster;
u_long *oldcnp;
clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp)
{
int error;
u_long oldcn;
@ -468,12 +443,7 @@ clusterfree(pmp, cluster, oldcnp)
* the msdosfsmount structure. This is left to the caller.
*/
int
fatentry(function, pmp, cn, oldcontents, newcontents)
int function;
struct msdosfsmount *pmp;
u_long cn;
u_long *oldcontents;
u_long newcontents;
fatentry(int function, struct msdosfsmount *pmp, u_long cn, u_long *oldcontents, u_long newcontents)
{
int error;
u_long readcn;
@ -580,11 +550,7 @@ fatentry(function, pmp, cn, oldcontents, newcontents)
* fillwith - what to write into fat entry of last cluster
*/
static int
fatchain(pmp, start, count, fillwith)
struct msdosfsmount *pmp;
u_long start;
u_long count;
u_long fillwith;
fatchain(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith)
{
int error;
u_long bn, bo, bsize, byteoffset, readcn, newc;
@ -655,10 +621,7 @@ fatchain(pmp, start, count, fillwith)
* count - maximum interesting length
*/
static int
chainlength(pmp, start, count)
struct msdosfsmount *pmp;
u_long start;
u_long count;
chainlength(struct msdosfsmount *pmp, u_long start, u_long count)
{
u_long idx, max_idx;
u_int map;
@ -703,13 +666,8 @@ chainlength(pmp, start, count)
* got - how many clusters were actually allocated.
*/
static int
chainalloc(pmp, start, count, fillwith, retcluster, got)
struct msdosfsmount *pmp;
u_long start;
u_long count;
u_long fillwith;
u_long *retcluster;
u_long *got;
chainalloc(struct msdosfsmount *pmp, u_long start, u_long count,
u_long fillwith, u_long *retcluster, u_long *got)
{
int error;
u_long cl, n;
@ -836,9 +794,7 @@ clusteralloc1(struct msdosfsmount *pmp, u_long start, u_long count,
* freed.
*/
int
freeclusterchain(pmp, cluster)
struct msdosfsmount *pmp;
u_long cluster;
freeclusterchain(struct msdosfsmount *pmp, u_long cluster)
{
int error;
struct buf *bp = NULL;
@ -900,8 +856,7 @@ freeclusterchain(pmp, cluster)
* found turn off its corresponding bit in the pm_inusemap.
*/
int
fillinusemap(pmp)
struct msdosfsmount *pmp;
fillinusemap(struct msdosfsmount *pmp)
{
struct buf *bp = NULL;
u_long cn, readcn;
@ -969,12 +924,8 @@ fillinusemap(pmp)
* field. This is left for the caller to do.
*/
int
extendfile(dep, count, bpp, ncp, flags)
struct denode *dep;
u_long count;
struct buf **bpp;
u_long *ncp;
int flags;
extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp,
int flags)
{
int error;
u_long frcn;

View file

@ -68,8 +68,7 @@ static int msdosfs_fileno_compare(struct msdosfs_fileno *,
/* Initialize file number mapping structures. */
void
msdosfs_fileno_init(mp)
struct mount *mp;
msdosfs_fileno_init(struct mount *mp)
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
@ -82,8 +81,7 @@ msdosfs_fileno_init(mp)
/* Free 32-bit file number generation structures. */
void
msdosfs_fileno_free(mp)
struct mount *mp;
msdosfs_fileno_free(struct mount *mp)
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct msdosfs_fileno *mf, *next;
@ -98,9 +96,7 @@ msdosfs_fileno_free(mp)
/* Map a 64-bit file number into a 32-bit one. */
uint32_t
msdosfs_fileno_map(mp, fileno)
struct mount *mp;
uint64_t fileno;
msdosfs_fileno_map(struct mount *mp, uint64_t fileno)
{
struct msdosfsmount *pmp = VFSTOMSDOSFS(mp);
struct msdosfs_fileno key, *mf, *tmf;
@ -142,8 +138,7 @@ msdosfs_fileno_map(mp, fileno)
/* Compare by 64-bit file number. */
static int
msdosfs_fileno_compare(fa, fb)
struct msdosfs_fileno *fa, *fb;
msdosfs_fileno_compare(struct msdosfs_fileno *fa, struct msdosfs_fileno *fb)
{
if (fa->mf_fileno64 > fb->mf_fileno64)

View file

@ -592,11 +592,8 @@ foundroot:
* cnp - componentname needed for Win95 long filenames
*/
int
createde(dep, ddep, depp, cnp)
struct denode *dep;
struct denode *ddep;
struct denode **depp;
struct componentname *cnp;
createde(struct denode *dep, struct denode *ddep, struct denode **depp,
struct componentname *cnp)
{
int error;
u_long dirclust, diroffset;
@ -725,8 +722,7 @@ createde(dep, ddep, depp, cnp)
* return 0 if not empty or error.
*/
int
dosdirempty(dep)
struct denode *dep;
dosdirempty(struct denode *dep)
{
int blsize;
int error;
@ -802,9 +798,7 @@ dosdirempty(dep)
* The target inode is always unlocked on return.
*/
int
doscheckpath(source, target)
struct denode *source;
struct denode *target;
doscheckpath(struct denode *source, struct denode *target)
{
daddr_t scn;
struct msdosfsmount *pmp;
@ -893,11 +887,8 @@ out:;
* directory entry within the block.
*/
int
readep(pmp, dirclust, diroffset, bpp, epp)
struct msdosfsmount *pmp;
u_long dirclust, diroffset;
struct buf **bpp;
struct direntry **epp;
readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
struct buf **bpp, struct direntry **epp)
{
int error;
daddr_t bn;
@ -924,10 +915,7 @@ readep(pmp, dirclust, diroffset, bpp, epp)
* entry within the block.
*/
int
readde(dep, bpp, epp)
struct denode *dep;
struct buf **bpp;
struct direntry **epp;
readde(struct denode *dep, struct buf **bpp, struct direntry **epp)
{
return (readep(dep->de_pmp, dep->de_dirclust, dep->de_diroffset,
@ -943,9 +931,7 @@ readde(dep, bpp, epp)
* msdosfs_reclaim() which will remove the denode from the denode cache.
*/
int
removede(pdep, dep)
struct denode *pdep; /* directory where the entry is removed */
struct denode *dep; /* file to be removed */
removede(struct denode *pdep, struct denode *dep)
{
int error;
struct direntry *ep;
@ -1012,10 +998,7 @@ removede(pdep, dep)
* Create a unique DOS name in dvp
*/
int
uniqdosname(dep, cnp, cp)
struct denode *dep;
struct componentname *cnp;
u_char *cp;
uniqdosname(struct denode *dep,struct componentname *cnp, u_char *cp)
{
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;
@ -1081,8 +1064,7 @@ uniqdosname(dep, cnp, cp)
* Find any Win'95 long filename entry in directory dep
*/
int
findwin95(dep)
struct denode *dep;
findwin95(struct denode *dep)
{
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;

View file

@ -127,13 +127,7 @@ static vop_vptofh_t msdosfs_vptofh;
* only if the SAVESTART bit in cn_flags is clear on success.
*/
static int
msdosfs_create(ap)
struct vop_create_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
} */ *ap;
msdosfs_create(struct vop_create_args *ap)
{
struct componentname *cnp = ap->a_cnp;
struct denode ndirent;
@ -193,27 +187,14 @@ bad:
}
static int
msdosfs_mknod(ap)
struct vop_mknod_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
} */ *ap;
msdosfs_mknod(struct vop_mknod_args *ap)
{
return (EINVAL);
}
static int
msdosfs_open(ap)
struct vop_open_args /* {
struct vnode *a_vp;
int a_mode;
struct ucred *a_cred;
struct thread *a_td;
struct file *a_fp;
} */ *ap;
msdosfs_open(struct vop_open_args *ap)
{
struct denode *dep = VTODE(ap->a_vp);
vnode_create_vobject(ap->a_vp, dep->de_FileSize, ap->a_td);
@ -221,13 +202,7 @@ msdosfs_open(ap)
}
static int
msdosfs_close(ap)
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
struct ucred *a_cred;
struct thread *a_td;
} */ *ap;
msdosfs_close(struct vop_close_args *ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(vp);
@ -243,13 +218,7 @@ msdosfs_close(ap)
}
static int
msdosfs_access(ap)
struct vop_access_args /* {
struct vnode *a_vp;
accmode_t a_accmode;
struct ucred *a_cred;
struct thread *a_td;
} */ *ap;
msdosfs_access(struct vop_access_args *ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(ap->a_vp);
@ -281,12 +250,7 @@ msdosfs_access(ap)
}
static int
msdosfs_getattr(ap)
struct vop_getattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
} */ *ap;
msdosfs_getattr(struct vop_getattr_args *ap)
{
struct denode *dep = VTODE(ap->a_vp);
struct msdosfsmount *pmp = dep->de_pmp;
@ -360,12 +324,7 @@ msdosfs_getattr(ap)
}
static int
msdosfs_setattr(ap)
struct vop_setattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
struct ucred *a_cred;
} */ *ap;
msdosfs_setattr(struct vop_setattr_args *ap)
{
struct vnode *vp = ap->a_vp;
struct denode *dep = VTODE(ap->a_vp);
@ -552,13 +511,7 @@ msdosfs_setattr(ap)
}
static int
msdosfs_read(ap)
struct vop_read_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
} */ *ap;
msdosfs_read(struct vop_read_args *ap)
{
int error = 0;
int blsize;
@ -653,13 +606,7 @@ msdosfs_read(ap)
* Write data to a file or directory.
*/
static int
msdosfs_write(ap)
struct vop_write_args /* {
struct vnode *a_vp;
struct uio *a_uio;
int a_ioflag;
struct ucred *a_cred;
} */ *ap;
msdosfs_write(struct vop_write_args *ap)
{
int n;
int croffset;
@ -872,13 +819,7 @@ errexit:
* Flush the blocks of a file to disk.
*/
static int
msdosfs_fsync(ap)
struct vop_fsync_args /* {
struct vnode *a_vp;
struct ucred *a_cred;
int a_waitfor;
struct thread *a_td;
} */ *ap;
msdosfs_fsync(struct vop_fsync_args *ap)
{
struct vnode *devvp;
int allerror, error;
@ -912,12 +853,7 @@ msdosfs_fsync(ap)
}
static int
msdosfs_remove(ap)
struct vop_remove_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
} */ *ap;
msdosfs_remove(struct vop_remove_args *ap)
{
struct denode *dep = VTODE(ap->a_vp);
struct denode *ddep = VTODE(ap->a_dvp);
@ -937,12 +873,7 @@ msdosfs_remove(ap)
* DOS filesystems don't know what links are.
*/
static int
msdosfs_link(ap)
struct vop_link_args /* {
struct vnode *a_tdvp;
struct vnode *a_vp;
struct componentname *a_cnp;
} */ *ap;
msdosfs_link(struct vop_link_args *ap)
{
return (EOPNOTSUPP);
}
@ -994,15 +925,7 @@ msdosfs_link(ap)
* all denodes should be released
*/
static int
msdosfs_rename(ap)
struct vop_rename_args /* {
struct vnode *a_fdvp;
struct vnode *a_fvp;
struct componentname *a_fcnp;
struct vnode *a_tdvp;
struct vnode *a_tvp;
struct componentname *a_tcnp;
} */ *ap;
msdosfs_rename(struct vop_rename_args *ap)
{
struct vnode *tdvp = ap->a_tdvp;
struct vnode *fvp = ap->a_fvp;
@ -1363,13 +1286,7 @@ static struct {
};
static int
msdosfs_mkdir(ap)
struct vop_mkdir_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struvt componentname *a_cnp;
struct vattr *a_vap;
} */ *ap;
msdosfs_mkdir(struct vop_mkdir_args *ap)
{
struct componentname *cnp = ap->a_cnp;
struct denode *dep;
@ -1480,12 +1397,7 @@ bad2:
}
static int
msdosfs_rmdir(ap)
struct vop_rmdir_args /* {
struct vnode *a_dvp;
struct vnode *a_vp;
struct componentname *a_cnp;
} */ *ap;
msdosfs_rmdir(struct vop_rmdir_args *ap)
{
struct vnode *vp = ap->a_vp;
struct vnode *dvp = ap->a_dvp;
@ -1539,28 +1451,13 @@ out:
* DOS filesystems don't know what symlinks are.
*/
static int
msdosfs_symlink(ap)
struct vop_symlink_args /* {
struct vnode *a_dvp;
struct vnode **a_vpp;
struct componentname *a_cnp;
struct vattr *a_vap;
char *a_target;
} */ *ap;
msdosfs_symlink(struct vop_symlink_args *ap)
{
return (EOPNOTSUPP);
}
static int
msdosfs_readdir(ap)
struct vop_readdir_args /* {
struct vnode *a_vp;
struct uio *a_uio;
struct ucred *a_cred;
int *a_eofflag;
int *a_ncookies;
u_long **a_cookies;
} */ *ap;
msdosfs_readdir(struct vop_readdir_args *ap)
{
struct mbnambuf nb;
int error = 0;
@ -1847,15 +1744,7 @@ out:
* a_runb - where to return the "run before" a_bn.
*/
static int
msdosfs_bmap(ap)
struct vop_bmap_args /* {
struct vnode *a_vp;
daddr_t a_bn;
struct bufobj **a_bop;
daddr_t *a_bnp;
int *a_runp;
int *a_runb;
} */ *ap;
msdosfs_bmap(struct vop_bmap_args *ap)
{
struct denode *dep;
struct mount *mp;
@ -1908,11 +1797,7 @@ msdosfs_bmap(ap)
}
static int
msdosfs_strategy(ap)
struct vop_strategy_args /* {
struct vnode *a_vp;
struct buf *a_bp;
} */ *ap;
msdosfs_strategy(struct vop_strategy_args *ap)
{
struct buf *bp = ap->a_bp;
struct denode *dep = VTODE(ap->a_vp);
@ -1953,10 +1838,7 @@ msdosfs_strategy(ap)
}
static int
msdosfs_print(ap)
struct vop_print_args /* {
struct vnode *vp;
} */ *ap;
msdosfs_print(struct vop_print_args *ap)
{
struct denode *dep = VTODE(ap->a_vp);
@ -1967,12 +1849,7 @@ msdosfs_print(ap)
}
static int
msdosfs_pathconf(ap)
struct vop_pathconf_args /* {
struct vnode *a_vp;
int a_name;
int *a_retval;
} */ *ap;
msdosfs_pathconf(struct vop_pathconf_args *ap)
{
struct msdosfsmount *pmp = VTODE(ap->a_vp)->de_pmp;
@ -1999,11 +1876,7 @@ msdosfs_pathconf(ap)
}
static int
msdosfs_vptofh(ap)
struct vop_vptofh_args /* {
struct vnode *a_vp;
struct fid *a_fhp;
} */ *ap;
msdosfs_vptofh(struct vop_vptofh_args *ap)
{
struct denode *dep;
struct defid *defhp;