Module Name: src Committed By: thorpej Date: Sat Oct 23 16:58:17 UTC 2021
Modified Files: src/sys/fs/msdosfs: denode.h direntry.h fat.h msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c msdosfs_rename.c msdosfs_vfsops.c msdosfs_vnops.c src/usr.sbin/makefs/msdos: msdosfs_denode.c msdosfs_vfsops.c msdosfs_vnops.c Log Message: Sanitize the symbol namespace. NFC. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/fs/msdosfs/denode.h cvs rdiff -u -r1.11 -r1.12 src/sys/fs/msdosfs/direntry.h cvs rdiff -u -r1.9 -r1.10 src/sys/fs/msdosfs/fat.h cvs rdiff -u -r1.17 -r1.18 src/sys/fs/msdosfs/msdosfs_conv.c cvs rdiff -u -r1.59 -r1.60 src/sys/fs/msdosfs/msdosfs_denode.c cvs rdiff -u -r1.35 -r1.36 src/sys/fs/msdosfs/msdosfs_fat.c cvs rdiff -u -r1.39 -r1.40 src/sys/fs/msdosfs/msdosfs_lookup.c cvs rdiff -u -r1.2 -r1.3 src/sys/fs/msdosfs/msdosfs_rename.c cvs rdiff -u -r1.136 -r1.137 src/sys/fs/msdosfs/msdosfs_vfsops.c cvs rdiff -u -r1.109 -r1.110 src/sys/fs/msdosfs/msdosfs_vnops.c cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/msdos/msdosfs_denode.c cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/makefs/msdos/msdosfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/fs/msdosfs/denode.h diff -u src/sys/fs/msdosfs/denode.h:1.28 src/sys/fs/msdosfs/denode.h:1.29 --- src/sys/fs/msdosfs/denode.h:1.28 Sat Oct 23 07:45:03 2021 +++ src/sys/fs/msdosfs/denode.h Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: denode.h,v 1.28 2021/10/23 07:45:03 hannken Exp $ */ +/* $NetBSD: denode.h,v 1.29 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -305,34 +305,36 @@ int msdosfs_pathconf (void *); struct componentname; struct direntry; struct kauth_cred; -int msdosfs_update(struct vnode *, const struct timespec *, +int msdosfs_update(struct vnode *, const struct timespec *, const struct timespec *, int); -int createde(struct denode *, struct denode *, +int msdosfs_createde(struct denode *, struct denode *, const struct msdosfs_lookup_results *, struct denode **, struct componentname *); -int deextend(struct denode *, u_long, struct kauth_cred *); +int msdosfs_deextend(struct denode *, u_long, struct kauth_cred *); #ifdef MAKEFS -int deget(struct msdosfsmount *, u_long, u_long, struct denode **); +int msdosfs_deget(struct msdosfsmount *, u_long, u_long, struct denode **); #else -int deget(struct msdosfsmount *, u_long, u_long, struct vnode **); +int msdosfs_deget(struct msdosfsmount *, u_long, u_long, struct vnode **); #endif -int detrunc(struct denode *, u_long, int, struct kauth_cred *); -int deupdat(struct denode *, int); -int dosdirempty(struct denode *); -int readde(struct denode *, struct buf **, struct direntry **); -int readep(struct msdosfsmount *, u_long, u_long, +int msdosfs_detrunc(struct denode *, u_long, int, struct kauth_cred *); +int msdosfs_deupdat(struct denode *, int); +int msdosfs_dosdirempty(struct denode *); +int msdosfs_readde(struct denode *, struct buf **, struct direntry **); +int msdosfs_readep(struct msdosfsmount *, u_long, u_long, struct buf **, struct direntry **); -int removede(struct denode *, struct denode *, +int msdosfs_removede(struct denode *, struct denode *, const struct msdosfs_lookup_results *); -int uniqdosname(struct denode *, struct componentname *, u_char *); -int findwin95(struct denode *); -int msdosfs_gop_alloc(struct vnode *, off_t, off_t, int, struct kauth_cred *); -void msdosfs_gop_markupdate(struct vnode *, int); -void msdosfs_detimes(struct denode *, const struct timespec *, - const struct timespec *, const struct timespec *, int); -int msdosfs_fh_enter(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *); -int msdosfs_fh_remove(struct msdosfsmount *, uint32_t, uint32_t); -int msdosfs_fh_lookup(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *); -void msdosfs_fh_destroy(struct msdosfsmount *); +int msdosfs_uniqdosname(struct denode *, struct componentname *, u_char *); +int msdosfs_findwin95(struct denode *); +int msdosfs_gop_alloc(struct vnode *, off_t, off_t, int, + struct kauth_cred *); +void msdosfs_gop_markupdate(struct vnode *, int); +void msdosfs_detimes(struct denode *, const struct timespec *, + const struct timespec *, const struct timespec *, int); +int msdosfs_fh_enter(struct msdosfsmount *, uint32_t, uint32_t, uint32_t *); +int msdosfs_fh_remove(struct msdosfsmount *, uint32_t, uint32_t); +int msdosfs_fh_lookup(struct msdosfsmount *, uint32_t, uint32_t, + uint32_t *); +void msdosfs_fh_destroy(struct msdosfsmount *); #endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_DENODE_H_ */ Index: src/sys/fs/msdosfs/direntry.h diff -u src/sys/fs/msdosfs/direntry.h:1.11 src/sys/fs/msdosfs/direntry.h:1.12 --- src/sys/fs/msdosfs/direntry.h:1.11 Mon Feb 1 02:59:33 2016 +++ src/sys/fs/msdosfs/direntry.h Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: direntry.h,v 1.11 2016/02/01 02:59:33 christos Exp $ */ +/* $NetBSD: direntry.h,v 1.12 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -128,20 +128,20 @@ struct winentry { #if defined(_KERNEL) || defined(MAKEFS) struct dirent; -void unix2dostime(const struct timespec *tsp, int gmtoff, uint16_t *ddp, - uint16_t *dtp, uint8_t *dhp); -void dos2unixtime(unsigned int dd, unsigned int dt, unsigned int dh, +void msdosfs_unix2dostime(const struct timespec *tsp, int gmtoff, + uint16_t *ddp, uint16_t *dtp, uint8_t *dhp); +void msdosfs_dos2unixtime(unsigned int dd, unsigned int dt, unsigned int dh, int gmtoff, struct timespec *tsp); -int dos2unixfn(unsigned char dn[11], unsigned char *un, int lower); -int unix2dosfn(const unsigned char *un, unsigned char dn[12], int unlen, - unsigned int gen); -int unix2winfn(const unsigned char *un, int unlen, struct winentry *wep, - int cnt, int chksum, int utf8); -int winChkName(const unsigned char *un, int unlen, struct winentry *wep, - int chksum, int utf8); -int win2unixfn(struct winentry *wep, struct dirent *dp, int chksum, +int msdosfs_dos2unixfn(unsigned char dn[11], unsigned char *un, int lower); +int msdosfs_unix2dosfn(const unsigned char *un, unsigned char dn[12], + int unlen, unsigned int gen); +int msdosfs_unix2winfn(const unsigned char *un, int unlen, + struct winentry *wep, int cnt, int chksum, int utf8); +int msdosfs_winChkName(const unsigned char *un, int unlen, + struct winentry *wep, int chksum, int utf8); +int msdosfs_win2unixfn(struct winentry *wep, struct dirent *dp, int chksum, uint16_t *namlen, int utf8); -uint8_t winChksum(uint8_t *name); -int winSlotCnt(const unsigned char *un, int unlen, int utf8); +uint8_t msdosfs_winChksum(uint8_t *name); +int msdosfs_winSlotCnt(const unsigned char *un, int unlen, int utf8); #endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_DIRENTRY_H_ */ Index: src/sys/fs/msdosfs/fat.h diff -u src/sys/fs/msdosfs/fat.h:1.9 src/sys/fs/msdosfs/fat.h:1.10 --- src/sys/fs/msdosfs/fat.h:1.9 Sat Oct 18 08:33:28 2014 +++ src/sys/fs/msdosfs/fat.h Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fat.h,v 1.9 2014/10/18 08:33:28 snj Exp $ */ +/* $NetBSD: fat.h,v 1.10 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1997 Wolfgang Solfrank. @@ -106,14 +106,16 @@ */ #define DE_CLEAR 1 /* Zero out the blocks allocated */ -int pcbmap(struct denode *, u_long, daddr_t *, u_long *, int *); -int clusterfree(struct msdosfsmount *, u_long, u_long *); -int clusteralloc(struct msdosfsmount *, u_long, u_long,u_long *,u_long *); -int extendfile(struct denode *, u_long, struct buf **, u_long *, int); -int fatentry(int, struct msdosfsmount *, u_long, u_long *, u_long); -void fc_purge(struct denode *, u_int); -void fc_lookup(struct denode *, u_long, u_long *, u_long *); -int fillinusemap(struct msdosfsmount *); -int freeclusterchain(struct msdosfsmount *, u_long); +int msdosfs_pcbmap(struct denode *, u_long, daddr_t *, u_long *, int *); +int msdosfs_clusterfree(struct msdosfsmount *, u_long, u_long *); +int msdosfs_clusteralloc(struct msdosfsmount *, u_long, u_long, u_long *, + u_long *); +int msdosfs_extendfile(struct denode *, u_long, struct buf **, u_long *, + int); +int msdosfs_fatentry(int, struct msdosfsmount *, u_long, u_long *, u_long); +void msdosfs_fc_purge(struct denode *, u_int); +void msdosfs_fc_lookup(struct denode *, u_long, u_long *, u_long *); +int msdosfs_fillinusemap(struct msdosfsmount *); +int msdosfs_freeclusterchain(struct msdosfsmount *, u_long); #endif /* _KERNEL || MAKEFS */ #endif /* _MSDOSFS_FAT_H_ */ Index: src/sys/fs/msdosfs/msdosfs_conv.c diff -u src/sys/fs/msdosfs/msdosfs_conv.c:1.17 src/sys/fs/msdosfs/msdosfs_conv.c:1.18 --- src/sys/fs/msdosfs/msdosfs_conv.c:1.17 Thu Jun 30 09:34:01 2016 +++ src/sys/fs/msdosfs/msdosfs_conv.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_conv.c,v 1.17 2016/06/30 09:34:01 nonaka Exp $ */ +/* $NetBSD: msdosfs_conv.c,v 1.18 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1995, 1997 Wolfgang Solfrank. @@ -58,7 +58,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.17 2016/06/30 09:34:01 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.18 2021/10/23 16:58:17 thorpej Exp $"); /* * System include files. @@ -117,7 +117,8 @@ static int char8match(u_int16_t *, u_int * file timestamps. The passed in unix time is assumed to be in GMT. */ void -unix2dostime(const struct timespec *tsp, int gmtoff, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp) +msdosfs_unix2dostime(const struct timespec *tsp, int gmtoff, + u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp) { u_long t; struct clock_ymdhms ymd; @@ -170,7 +171,8 @@ invalid_dos_date: * not be too efficient. */ void -dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, struct timespec *tsp) +msdosfs_dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, + struct timespec *tsp) { time_t seconds; struct clock_ymdhms ymd; @@ -320,7 +322,7 @@ u2l[256] = { * null. */ int -dos2unixfn(u_char dn[11], u_char *un, int lower) +msdosfs_dos2unixfn(u_char dn[11], u_char *un, int lower) { int i, j; int thislong = 1; @@ -383,7 +385,7 @@ dos2unixfn(u_char dn[11], u_char *un, in * 3 if conversion was successful and generation number was inserted */ int -unix2dosfn(const u_char *un, u_char dn[12], int unlen, u_int gen) +msdosfs_unix2dosfn(const u_char *un, u_char dn[12], int unlen, u_int gen) { int i, j, l; int conv = 1; @@ -536,7 +538,8 @@ unix2dosfn(const u_char *un, u_char dn[1 * i.e. doesn't consist solely of blanks and dots */ int -unix2winfn(const u_char *un, int unlen, struct winentry *wep, int cnt, int chksum, int utf8) +msdosfs_unix2winfn(const u_char *un, int unlen, struct winentry *wep, int cnt, + int chksum, int utf8) { u_int16_t wn[WIN_MAXLEN], *p; int i, len; @@ -592,7 +595,8 @@ unix2winfn(const u_char *un, int unlen, * Returns the checksum or -1 if no match */ int -winChkName(const u_char *un, int unlen, struct winentry *wep, int chksum, int utf8) +msdosfs_winChkName(const u_char *un, int unlen, struct winentry *wep, + int chksum, int utf8) { u_int16_t wn[WIN_MAXLEN], *p; u_int16_t buf[WIN_CHARS]; @@ -648,7 +652,7 @@ winChkName(const u_char *un, int unlen, * Returns the checksum or -1 if impossible */ int -win2unixfn(struct winentry *wep, struct dirent *dp, int chksum, +msdosfs_win2unixfn(struct winentry *wep, struct dirent *dp, int chksum, uint16_t *namlen, int utf8) { u_int16_t wn[WIN_CHARS], *p; @@ -722,7 +726,7 @@ win2unixfn(struct winentry *wep, struct * Compute the checksum of a DOS filename for Win95 use */ u_int8_t -winChksum(u_int8_t *name) +msdosfs_winChksum(u_int8_t *name) { int i; u_int8_t s; @@ -736,7 +740,7 @@ winChksum(u_int8_t *name) * Determine the number of slots necessary for Win95 names */ int -winSlotCnt(const u_char *un, int unlen, int utf8) +msdosfs_winSlotCnt(const u_char *un, int unlen, int utf8) { const u_char *cp; int len; Index: src/sys/fs/msdosfs/msdosfs_denode.c diff -u src/sys/fs/msdosfs/msdosfs_denode.c:1.59 src/sys/fs/msdosfs/msdosfs_denode.c:1.60 --- src/sys/fs/msdosfs/msdosfs_denode.c:1.59 Thu Apr 23 21:47:07 2020 +++ src/sys/fs/msdosfs/msdosfs_denode.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_denode.c,v 1.59 2020/04/23 21:47:07 ad Exp $ */ +/* $NetBSD: msdosfs_denode.c,v 1.60 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.59 2020/04/23 21:47:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.60 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -179,7 +179,7 @@ msdosfs_done(void) * vpp - returns the address of the gotten vnode. */ int -deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, +msdosfs_deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, struct vnode **vpp) /* pmp: so we know the maj/min number */ /* dirclust: cluster this dir entry came from */ @@ -243,7 +243,7 @@ msdosfs_loadvnode(struct mount *mp, stru ldep->de_pmp = pmp; ldep->de_devvp = pmp->pm_devvp; ldep->de_refcnt = 1; - fc_purge(ldep, 0); /* init the FAT cache for this denode */ + msdosfs_fc_purge(ldep, 0); /* init the FAT cache for this denode */ /* * Copy the directory entry into the denode area of the vnode. @@ -280,8 +280,8 @@ msdosfs_loadvnode(struct mount *mp, stru ldep->de_MDate = ldep->de_CDate; /* leave the other fields as garbage */ } else { - error = readep(pmp, ldep->de_dirclust, ldep->de_diroffset, - &bp, &direntptr); + error = msdosfs_readep(pmp, ldep->de_dirclust, + ldep->de_diroffset, &bp, &direntptr); if (error) { pool_put(&msdosfs_denode_pool, ldep); return error; @@ -305,7 +305,7 @@ msdosfs_loadvnode(struct mount *mp, stru vp->v_type = VDIR; if (ldep->de_StartCluster != MSDOSFSROOT) { - error = pcbmap(ldep, CLUST_END, 0, &size, 0); + error = msdosfs_pcbmap(ldep, CLUST_END, 0, &size, 0); if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; @@ -330,7 +330,7 @@ msdosfs_loadvnode(struct mount *mp, stru } int -deupdat(struct denode *dep, int waitfor) +msdosfs_deupdat(struct denode *dep, int waitfor) { return (msdosfs_update(DETOV(dep), NULL, NULL, @@ -341,7 +341,7 @@ deupdat(struct denode *dep, int waitfor) * Truncate the file described by dep to the length specified by length. */ int -detrunc(struct denode *dep, u_long length, int flags, kauth_cred_t cred) +msdosfs_detrunc(struct denode *dep, u_long length, int flags, kauth_cred_t cred) { int error; int allerror; @@ -374,7 +374,7 @@ detrunc(struct denode *dep, u_long lengt uvm_vnp_setsize(DETOV(dep), length); if (dep->de_FileSize < length) - return (deextend(dep, length, cred)); + return (msdosfs_deextend(dep, length, cred)); lastblock = de_clcount(pmp, length) - 1; /* @@ -391,7 +391,7 @@ detrunc(struct denode *dep, u_long lengt dep->de_StartCluster = 0; eofentry = ~0; } else { - error = pcbmap(dep, lastblock, 0, &eofentry, 0); + error = msdosfs_pcbmap(dep, lastblock, 0, &eofentry, 0); if (error) { #ifdef MSDOSFS_DEBUG printf("detrunc(): pcbmap fails %d\n", error); @@ -437,20 +437,20 @@ detrunc(struct denode *dep, u_long lengt if (!isadir) dep->de_flag |= DE_UPDATE|DE_MODIFIED; vtruncbuf(DETOV(dep), lastblock + 1, 0, 0); - allerror = deupdat(dep, 1); + allerror = msdosfs_deupdat(dep, 1); #ifdef MSDOSFS_DEBUG printf("detrunc(): allerror %d, eofentry %lu\n", allerror, eofentry); #endif - fc_purge(dep, lastblock + 1); + msdosfs_fc_purge(dep, lastblock + 1); /* * If we need to break the cluster chain for the file then do it * now. */ if (eofentry != ~0) { - error = fatentry(FAT_GET_AND_SET, pmp, eofentry, + error = msdosfs_fatentry(FAT_GET_AND_SET, pmp, eofentry, &chaintofree, CLUST_EOFE); if (error) { #ifdef MSDOSFS_DEBUG @@ -467,7 +467,7 @@ detrunc(struct denode *dep, u_long lengt * truncation. */ if (chaintofree != 0 && !MSDOSFSEOF(chaintofree, pmp->pm_fatmask)) - freeclusterchain(pmp, chaintofree); + msdosfs_freeclusterchain(pmp, chaintofree); return (allerror); } @@ -476,7 +476,7 @@ detrunc(struct denode *dep, u_long lengt * Extend the file described by dep to length specified by length. */ int -deextend(struct denode *dep, u_long length, kauth_cred_t cred) +msdosfs_deextend(struct denode *dep, u_long length, kauth_cred_t cred) { struct msdosfsmount *pmp = dep->de_pmp; u_long count, osize; @@ -504,10 +504,10 @@ deextend(struct denode *dep, u_long leng if (count > 0) { if (count > pmp->pm_freeclustercount) return (ENOSPC); - error = extendfile(dep, count, NULL, NULL, DE_CLEAR); + error = msdosfs_extendfile(dep, count, NULL, NULL, DE_CLEAR); if (error) { /* truncate the added clusters away again */ - (void) detrunc(dep, dep->de_FileSize, 0, cred); + (void) msdosfs_detrunc(dep, dep->de_FileSize, 0, cred); return (error); } } @@ -525,7 +525,7 @@ deextend(struct denode *dep, u_long leng (size_t)(round_page(dep->de_FileSize) - osize), UBC_VNODE_FLAGS(DETOV(dep))); uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize); - return (deupdat(dep, 1)); + return (msdosfs_deupdat(dep, 1)); } int @@ -598,13 +598,13 @@ msdosfs_inactive(void *v) #endif if (dep->de_refcnt <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { if (dep->de_FileSize != 0) { - error = detrunc(dep, (u_long)0, 0, NOCRED); + error = msdosfs_detrunc(dep, (u_long)0, 0, NOCRED); } dep->de_Name[0] = SLOT_DELETED; msdosfs_fh_remove(dep->de_pmp, dep->de_dirclust, dep->de_diroffset); } - deupdat(dep, 0); + msdosfs_deupdat(dep, 0); out: /* * If we are done with the denode, reclaim it Index: src/sys/fs/msdosfs/msdosfs_fat.c diff -u src/sys/fs/msdosfs/msdosfs_fat.c:1.35 src/sys/fs/msdosfs/msdosfs_fat.c:1.36 --- src/sys/fs/msdosfs/msdosfs_fat.c:1.35 Mon Sep 7 01:35:25 2020 +++ src/sys/fs/msdosfs/msdosfs_fat.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_fat.c,v 1.35 2020/09/07 01:35:25 mrg Exp $ */ +/* $NetBSD: msdosfs_fat.c,v 1.36 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -52,7 +52,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.35 2020/09/07 01:35:25 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_fat.c,v 1.36 2021/10/23 16:58:17 thorpej Exp $"); /* * kernel include files. @@ -179,11 +179,11 @@ fatblock(struct msdosfsmount *pmp, u_lon * If cnp is null, nothing is returned. */ int -pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int *sp) - /* findcn: file relative cluster to get */ - /* bnp: returned filesys rel sector number */ - /* cnp: returned cluster number */ - /* sp: returned block size */ +msdosfs_pcbmap(struct denode *dep, + u_long findcn, /* file relative cluster to get */ + daddr_t *bnp, /* returned filesys rel sector number */ + u_long *cnp, /* returned cluster number */ + int *sp) /* returned block size */ { int error; u_long i; @@ -254,7 +254,7 @@ pcbmap(struct denode *dep, u_long findcn * off the cache was from where we wanted to be. */ i = 0; - fc_lookup(dep, findcn, &i, &cn); + msdosfs_fc_lookup(dep, findcn, &i, &cn); DPRINTF(("%s(bpcluster=%lu i=%lu cn=%lu\n", __func__, pmp->pm_bpcluster, i, cn)); if ((bn = findcn - i) >= LMMAX) { @@ -348,7 +348,8 @@ hiteof:; * for. */ void -fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp, u_long *fsrcnp) +msdosfs_fc_lookup(struct denode *dep, u_long findcn, u_long *frcnp, + u_long *fsrcnp) { int i; u_long cn; @@ -372,7 +373,7 @@ fc_lookup(struct denode *dep, u_long fin * relative cluster frcn and beyond. */ void -fc_purge(struct denode *dep, u_int frcn) +msdosfs_fc_purge(struct denode *dep, u_int frcn) { int i; struct fatcache *fcp; @@ -522,13 +523,14 @@ usemap_free(struct msdosfsmount *pmp, u_ } int -clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) +msdosfs_clusterfree(struct msdosfsmount *pmp, u_long cluster, u_long *oldcnp) { int error; u_long oldcn; usemap_free(pmp, cluster); - error = fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, MSDOSFSFREE); + error = msdosfs_fatentry(FAT_GET_AND_SET, pmp, cluster, &oldcn, + MSDOSFSFREE); if (error) { usemap_alloc(pmp, cluster); return (error); @@ -563,7 +565,8 @@ clusterfree(struct msdosfsmount *pmp, u_ * 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) +msdosfs_fatentry(int function, struct msdosfsmount *pmp, u_long cn, + u_long *oldcontents, u_long newcontents) { int error; u_long readcn; @@ -804,7 +807,8 @@ chainalloc(struct msdosfsmount *pmp, u_l * got - how many clusters were actually allocated. */ int -clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long *retcluster, u_long *got) +msdosfs_clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, + u_long *retcluster, u_long *got) { u_long idx; u_long len, newst, foundl, cn, l; @@ -888,7 +892,7 @@ clusteralloc(struct msdosfsmount *pmp, u * freed. */ int -freeclusterchain(struct msdosfsmount *pmp, u_long cluster) +msdosfs_freeclusterchain(struct msdosfsmount *pmp, u_long cluster) { int error; struct buf *bp = NULL; @@ -947,7 +951,7 @@ freeclusterchain(struct msdosfsmount *pm * found turn off its corresponding bit in the pm_inusemap. */ int -fillinusemap(struct msdosfsmount *pmp) +msdosfs_fillinusemap(struct msdosfsmount *pmp) { struct buf *bp = NULL; u_long cn, readcn; @@ -1014,7 +1018,8 @@ fillinusemap(struct msdosfsmount *pmp) */ int -extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags) +msdosfs_extendfile(struct denode *dep, u_long count, struct buf **bpp, + u_long *ncp, int flags) { int error; u_long frcn = 0, cn, got; @@ -1038,7 +1043,7 @@ extendfile(struct denode *dep, u_long co if (dep->de_fc[FC_LASTFC].fc_frcn == FCE_EMPTY && dep->de_StartCluster != 0) { fc_lfcempty++; - error = pcbmap(dep, CLUST_END, 0, &cn, 0); + error = msdosfs_pcbmap(dep, CLUST_END, 0, &cn, 0); /* we expect it to return E2BIG */ if (error != E2BIG) return (error); @@ -1062,7 +1067,7 @@ extendfile(struct denode *dep, u_long co cn = 0; else cn = dep->de_fc[FC_LASTFC].fc_fsrcn + 1; - error = clusteralloc(pmp, cn, count, &cn, &got); + error = msdosfs_clusteralloc(pmp, cn, count, &cn, &got); if (error) return (error); @@ -1081,11 +1086,11 @@ extendfile(struct denode *dep, u_long co dep->de_StartCluster = cn; frcn = 0; } else { - error = fatentry(FAT_SET, pmp, + error = msdosfs_fatentry(FAT_SET, pmp, dep->de_fc[FC_LASTFC].fc_fsrcn, 0, cn); if (error) { - clusterfree(pmp, cn, NULL); + msdosfs_clusterfree(pmp, cn, NULL); return (error); } frcn = dep->de_fc[FC_LASTFC].fc_frcn + 1; Index: src/sys/fs/msdosfs/msdosfs_lookup.c diff -u src/sys/fs/msdosfs/msdosfs_lookup.c:1.39 src/sys/fs/msdosfs/msdosfs_lookup.c:1.40 --- src/sys/fs/msdosfs/msdosfs_lookup.c:1.39 Sat Oct 23 07:41:37 2021 +++ src/sys/fs/msdosfs/msdosfs_lookup.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_lookup.c,v 1.39 2021/10/23 07:41:37 hannken Exp $ */ +/* $NetBSD: msdosfs_lookup.c,v 1.40 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -52,7 +52,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.39 2021/10/23 07:41:37 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.40 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> @@ -183,19 +183,19 @@ msdosfs_lookup(void *v) goto foundroot; } - switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename, + switch (msdosfs_unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename, cnp->cn_namelen, 0)) { case 0: return (EINVAL); case 1: break; case 2: - wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr, + wincnt = msdosfs_winSlotCnt((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, pmp->pm_flags & MSDOSFSMNT_UTF8) + 1; break; case 3: olddos = 0; - wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr, + wincnt = msdosfs_winSlotCnt((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, pmp->pm_flags & MSDOSFSMNT_UTF8) + 1; break; } @@ -230,7 +230,8 @@ msdosfs_lookup(void *v) */ diroff = 0; for (frcn = 0; diroff < dp->de_FileSize; frcn++) { - if ((error = pcbmap(dp, frcn, &bn, &cluster, &blsize)) != 0) { + if ((error = msdosfs_pcbmap(dp, frcn, &bn, &cluster, + &blsize)) != 0) { if (error == E2BIG) break; return (error); @@ -283,7 +284,7 @@ msdosfs_lookup(void *v) if (pmp->pm_flags & MSDOSFSMNT_SHORTNAME) continue; - chksum = winChkName((const u_char *)cnp->cn_nameptr, + chksum = msdosfs_winChkName((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, (struct winentry *)dep, chksum, @@ -303,7 +304,8 @@ msdosfs_lookup(void *v) /* * Check for a checksum or name match */ - chksum_ok = (chksum == winChksum(dep->deName)); + chksum_ok = + (chksum == msdosfs_winChksum(dep->deName)); if (!chksum_ok && ( !olddos || memcmp(&dosfilename[0],dep->deName,8) || @@ -495,7 +497,7 @@ foundroot: *vpp = vdp; return (0); } - error = deget(pmp, cluster, blkoff, vpp); + error = msdosfs_deget(pmp, cluster, blkoff, vpp); return error; } @@ -524,14 +526,14 @@ foundroot: if (dp->de_StartCluster == scn && isadir) return (EISDIR); - error = deget(pmp, cluster, blkoff, vpp); + error = msdosfs_deget(pmp, cluster, blkoff, vpp); return error; } if (dp->de_StartCluster == scn && isadir) { vref(vdp); /* we want ourself, ie "." */ *vpp = vdp; - } else if ((error = deget(pmp, cluster, blkoff, vpp)) != 0) { + } else if ((error = msdosfs_deget(pmp, cluster, blkoff, vpp)) != 0) { return error; } @@ -552,7 +554,7 @@ foundroot: * cnp - componentname needed for Win95 long filenames */ int -createde(struct denode *dep, struct denode *ddep, +msdosfs_createde(struct denode *dep, struct denode *ddep, const struct msdosfs_lookup_results *mlr, struct denode **depp, struct componentname *cnp) { @@ -587,8 +589,10 @@ createde(struct denode *dep, struct deno u_long needlen = ddep->de_crap.mlr_fndoffset + sizeof(struct direntry) - ddep->de_FileSize; dirclust = de_clcount(pmp, needlen); - if ((error = extendfile(ddep, dirclust, 0, 0, DE_CLEAR)) != 0) { - (void)detrunc(ddep, ddep->de_FileSize, 0, NOCRED); + if ((error = msdosfs_extendfile(ddep, dirclust, 0, 0, + DE_CLEAR)) != 0) { + (void)msdosfs_detrunc(ddep, ddep->de_FileSize, 0, + NOCRED); goto err_norollback; } @@ -603,7 +607,7 @@ createde(struct denode *dep, struct deno * entry in. Then write it to disk. NOTE: DOS directories * do not get smaller as clusters are emptied. */ - error = pcbmap(ddep, de_cluster(pmp, mlr->mlr_fndoffset), + error = msdosfs_pcbmap(ddep, de_cluster(pmp, mlr->mlr_fndoffset), &bn, &dirclust, &blsize); if (error) goto err_norollback; @@ -622,7 +626,7 @@ createde(struct denode *dep, struct deno * Now write the Win95 long name */ if (mlr->mlr_fndcnt > 0) { - u_int8_t chksum = winChksum(ndep->deName); + u_int8_t chksum = msdosfs_winChksum(ndep->deName); const u_char *un = (const u_char *)cnp->cn_nameptr; int unlen = cnp->cn_namelen; u_long xhavecnt; @@ -641,7 +645,7 @@ createde(struct denode *dep, struct deno goto rollback; fndoffset -= sizeof(struct direntry); - error = pcbmap(ddep, + error = msdosfs_pcbmap(ddep, de_cluster(pmp, fndoffset), &bn, 0, &blsize); if (error) @@ -658,7 +662,8 @@ createde(struct denode *dep, struct deno ndep--; fndoffset -= sizeof(struct direntry); } - if (!unix2winfn(un, unlen, (struct winentry *)ndep, + if (!msdosfs_unix2winfn(un, unlen, + (struct winentry *)ndep, wcnt, chksum, ddep->de_pmp->pm_flags & MSDOSFSMNT_UTF8)) break; @@ -686,11 +691,11 @@ createde(struct denode *dep, struct deno diroffset = 0; } #ifdef MAKEFS - error = deget(pmp, dirclust, diroffset, depp); + error = msdosfs_deget(pmp, dirclust, diroffset, depp); #else struct vnode *vp; - error = deget(pmp, dirclust, diroffset, &vp); + error = msdosfs_deget(pmp, dirclust, diroffset, &vp); if (error == 0) *depp = VTODE(vp); else @@ -708,7 +713,7 @@ createde(struct denode *dep, struct deno * consistent state. */ fndoffset = mlr->mlr_fndoffset; - rberror = pcbmap(ddep, de_cluster(pmp, fndoffset), + rberror = msdosfs_pcbmap(ddep, de_cluster(pmp, fndoffset), &bn, NULL, &blsize); if (rberror) goto err_norollback; @@ -733,7 +738,7 @@ createde(struct denode *dep, struct deno goto err_norollback; fndoffset -= sizeof(struct direntry); - rberror = pcbmap(ddep, + rberror = msdosfs_pcbmap(ddep, de_cluster(pmp, fndoffset), &bn, 0, &blsize); if (rberror) @@ -766,7 +771,7 @@ createde(struct denode *dep, struct deno * return 0 if not empty or error. */ int -dosdirempty(struct denode *dep) +msdosfs_dosdirempty(struct denode *dep) { int blsize; int error; @@ -782,7 +787,7 @@ dosdirempty(struct denode *dep) * we hit end of file. */ for (cn = 0;; cn++) { - if ((error = pcbmap(dep, cn, &bn, 0, &blsize)) != 0) { + if ((error = msdosfs_pcbmap(dep, cn, &bn, 0, &blsize)) != 0) { if (error == E2BIG) return (1); /* it's empty */ return (0); @@ -835,7 +840,8 @@ dosdirempty(struct denode *dep) * directory entry within the block. */ int -readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, struct buf **bpp, struct direntry **epp) +msdosfs_readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, + struct buf **bpp, struct direntry **epp) { int error; daddr_t bn; @@ -862,9 +868,9 @@ readep(struct msdosfsmount *pmp, u_long * entry within the block. */ int -readde(struct denode *dep, struct buf **bpp, struct direntry **epp) +msdosfs_readde(struct denode *dep, struct buf **bpp, struct direntry **epp) { - return (readep(dep->de_pmp, dep->de_dirclust, dep->de_diroffset, + return (msdosfs_readep(dep->de_pmp, dep->de_dirclust, dep->de_diroffset, bpp, epp)); } @@ -877,7 +883,7 @@ readde(struct denode *dep, struct buf ** * msdosfs_reclaim() which will remove the denode from the denode cache. */ int -removede(struct denode *pdep, struct denode *dep, +msdosfs_removede(struct denode *pdep, struct denode *dep, const struct msdosfs_lookup_results *mlr) /* pdep: directory where the entry is removed */ /* dep: file to be removed */ @@ -918,7 +924,8 @@ removede(struct denode *pdep, struct den offset += sizeof(struct direntry); do { offset -= sizeof(struct direntry); - error = pcbmap(pdep, de_cluster(pmp, offset), &bn, 0, &blsize); + error = msdosfs_pcbmap(pdep, de_cluster(pmp, offset), &bn, 0, + &blsize); if (error) return error; error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, @@ -966,7 +973,7 @@ removede(struct denode *pdep, struct den * Create a unique DOS name in dvp */ int -uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp) +msdosfs_uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp) { struct msdosfsmount *pmp = dep->de_pmp; struct direntry *dentp; @@ -981,7 +988,7 @@ uniqdosname(struct denode *dep, struct c /* * Generate DOS name with generation number */ - if (!unix2dosfn((const u_char *)cnp->cn_nameptr, cp, + if (!msdosfs_unix2dosfn((const u_char *)cnp->cn_nameptr, cp, cnp->cn_namelen, gen)) return gen == 1 ? EINVAL : EEXIST; @@ -989,7 +996,8 @@ uniqdosname(struct denode *dep, struct c * Now look for a dir entry with this exact name */ for (cn = error = 0; !error; cn++) { - if ((error = pcbmap(dep, cn, &bn, 0, &blsize)) != 0) { + if ((error = msdosfs_pcbmap(dep, cn, &bn, 0, + &blsize)) != 0) { if (error == E2BIG) /* EOF reached and not found */ return 0; return error; @@ -1028,7 +1036,7 @@ uniqdosname(struct denode *dep, struct c * Find any Win'95 long filename entry in directory dep */ int -findwin95(struct denode *dep) +msdosfs_findwin95(struct denode *dep) { struct msdosfsmount *pmp = dep->de_pmp; struct direntry *dentp; @@ -1043,7 +1051,7 @@ findwin95(struct denode *dep) * XXX Note: Error currently handled just as EOF */ for (cn = 0;; cn++) { - if (pcbmap(dep, cn, &bn, 0, &blsize)) + if (msdosfs_pcbmap(dep, cn, &bn, 0, &blsize)) return win95; if (bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, 0, &bp)) { Index: src/sys/fs/msdosfs/msdosfs_rename.c diff -u src/sys/fs/msdosfs/msdosfs_rename.c:1.2 src/sys/fs/msdosfs/msdosfs_rename.c:1.3 --- src/sys/fs/msdosfs/msdosfs_rename.c:1.2 Sat Oct 23 07:45:03 2021 +++ src/sys/fs/msdosfs/msdosfs_rename.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_rename.c,v 1.2 2021/10/23 07:45:03 hannken Exp $ */ +/* $NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.2 2021/10/23 07:45:03 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -211,7 +211,7 @@ msdosfs_gro_directory_empty_p(struct mou KASSERT(VOP_ISLOCKED(vp) == LK_EXCLUSIVE); KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE); - return dosdirempty(VTODE(vp)); + return msdosfs_dosdirempty(VTODE(vp)); } /* @@ -439,7 +439,7 @@ msdosfs_gro_rename(struct mount *mp, kau * there will be something at the target pathname? */ if (tvp != NULL) { - error = removede(VTODE(tdvp), VTODE(tvp), tmlr); + error = msdosfs_removede(VTODE(tdvp), VTODE(tvp), tmlr); if (error) goto out; } @@ -449,7 +449,7 @@ msdosfs_gro_rename(struct mount *mp, kau * into the denode and directory entry for the destination * file/directory. */ - error = uniqdosname(VTODE(tdvp), tcnp, toname); + error = msdosfs_uniqdosname(VTODE(tdvp), tcnp, toname); if (error) goto out; @@ -466,7 +466,7 @@ msdosfs_gro_rename(struct mount *mp, kau memcpy(oldname, VTODE(fvp)->de_Name, 11); memcpy(VTODE(fvp)->de_Name, toname, 11); - error = createde(VTODE(fvp), VTODE(tdvp), tmlr, 0, tcnp); + error = msdosfs_createde(VTODE(fvp), VTODE(tdvp), tmlr, 0, tcnp); if (error) { /* Directory entry didn't take -- back out the name change. */ memcpy(VTODE(fvp)->de_Name, oldname, 11); @@ -483,10 +483,10 @@ msdosfs_gro_rename(struct mount *mp, kau /* * XXX Yes, createde and removede have arguments swapped. Go figure. */ - error = removede(VTODE(fdvp), VTODE(fvp), fmlr); + error = msdosfs_removede(VTODE(fdvp), VTODE(fvp), fmlr); if (error) { #if 0 /* XXX Back out the new directory entry? Panic? */ - (void)removede(VTODE(tdvp), VTODE(fvp), tmlr); + (void)msdosfs_removede(VTODE(tdvp), VTODE(fvp), tmlr); memcpy(VTODE(fvp)->de_Name, oldname, 11); #endif goto out; @@ -498,7 +498,7 @@ msdosfs_gro_rename(struct mount *mp, kau struct denode_key old_key = VTODE(fvp)->de_key; struct denode_key new_key = VTODE(fvp)->de_key; - error = pcbmap(VTODE(tdvp), + error = msdosfs_pcbmap(VTODE(tdvp), de_cluster(pmp, tmlr->mlr_fndoffset), NULL, &new_key.dk_dirclust, NULL); if (error) /* XXX Back everything out? Panic? */ @@ -561,7 +561,7 @@ msdosfs_gro_remove(struct mount *mp, kau KASSERT(VOP_ISLOCKED(dvp) == LK_EXCLUSIVE); KASSERT(VOP_ISLOCKED(vp) == LK_EXCLUSIVE); - error = removede(VTODE(dvp), VTODE(vp), mlr); + error = msdosfs_removede(VTODE(dvp), VTODE(vp), mlr); *tvp_nlinkp = (error ? 1 : 0); @@ -691,7 +691,8 @@ msdosfs_gro_genealogy(struct mount *mp, /* Neither -- keep ascending. */ - error = deget(pmp, dotdot_cn, (dotdot_cn ? 0 : MSDOSFSROOT_OFS), &dvp); + error = msdosfs_deget(pmp, dotdot_cn, + (dotdot_cn ? 0 : MSDOSFSROOT_OFS), &dvp); vput(vp); if (error) return error; Index: src/sys/fs/msdosfs/msdosfs_vfsops.c diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.136 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.137 --- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.136 Thu Feb 11 00:15:55 2021 +++ src/sys/fs/msdosfs/msdosfs_vfsops.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vfsops.c,v 1.136 2021/02/11 00:15:55 ryoon Exp $ */ +/* $NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.136 2021/02/11 00:15:55 ryoon Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.137 2021/10/23 16:58:17 thorpej Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -213,7 +213,7 @@ update_mp(struct mount *mp, struct msdos error = msdosfs_root(mp, LK_EXCLUSIVE, &rtvp); if (error != 0) return error; - pmp->pm_flags |= findwin95(VTODE(rtvp)) + pmp->pm_flags |= msdosfs_findwin95(VTODE(rtvp)) ? MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; vput(rtvp); @@ -849,7 +849,7 @@ msdosfs_mountfs(struct vnode *devvp, str /* * Have the inuse map filled in. */ - if ((error = fillinusemap(pmp)) != 0) { + if ((error = msdosfs_fillinusemap(pmp)) != 0) { DPRINTF("fillinusemap %d", error); goto error_exit; } @@ -969,7 +969,8 @@ msdosfs_root(struct mount *mp, int lktyp #ifdef MSDOSFS_DEBUG printf("msdosfs_root(); mp %p, pmp %p\n", mp, pmp); #endif - if ((error = deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, vpp)) != 0) + if ((error = msdosfs_deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, + vpp)) != 0) return error; error = vn_lock(*vpp, lktype); if (error) { @@ -1095,7 +1096,7 @@ msdosfs_fhtovp(struct mount *mp, struct *vpp = NULLVP; return error; } - error = deget(pmp, defh.defid_dirclust, defh.defid_dirofs, vpp); + error = msdosfs_deget(pmp, defh.defid_dirclust, defh.defid_dirofs, vpp); if (error) { DPRINTF("deget %d", error); *vpp = NULLVP; Index: src/sys/fs/msdosfs/msdosfs_vnops.c diff -u src/sys/fs/msdosfs/msdosfs_vnops.c:1.109 src/sys/fs/msdosfs/msdosfs_vnops.c:1.110 --- src/sys/fs/msdosfs/msdosfs_vnops.c:1.109 Sat Oct 23 07:41:37 2021 +++ src/sys/fs/msdosfs/msdosfs_vnops.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vnops.c,v 1.109 2021/10/23 07:41:37 hannken Exp $ */ +/* $NetBSD: msdosfs_vnops.c,v 1.110 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.109 2021/10/23 07:41:37 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.110 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -137,7 +137,7 @@ msdosfs_create(void *v) * readonly. */ memset(&ndirent, 0, sizeof(ndirent)); - if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0) + if ((error = msdosfs_uniqdosname(pdep, cnp, ndirent.de_Name)) != 0) goto bad; ndirent.de_Attributes = (ap->a_vap->va_mode & S_IWUSR) ? @@ -149,7 +149,8 @@ msdosfs_create(void *v) ndirent.de_pmp = pdep->de_pmp; ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE; DETIMES(&ndirent, NULL, NULL, NULL, pdep->de_pmp->pm_gmtoff); - if ((error = createde(&ndirent, pdep, &pdep->de_crap, &dep, cnp)) != 0) + if ((error = msdosfs_createde(&ndirent, pdep, &pdep->de_crap, &dep, + cnp)) != 0) goto bad; *ap->a_vpp = DETOV(dep); cache_enter(ap->a_dvp, *ap->a_vpp, cnp->cn_nameptr, cnp->cn_namelen, @@ -286,12 +287,12 @@ msdosfs_getattr(void *v) vap->va_nlink = 1; vap->va_rdev = 0; vap->va_size = ap->a_vp->v_size; - dos2unixtime(dep->de_MDate, dep->de_MTime, 0, pmp->pm_gmtoff, + msdosfs_dos2unixtime(dep->de_MDate, dep->de_MTime, 0, pmp->pm_gmtoff, &vap->va_mtime); if (dep->de_pmp->pm_flags & MSDOSFSMNT_LONGNAME) { - dos2unixtime(dep->de_ADate, 0, 0, pmp->pm_gmtoff, + msdosfs_dos2unixtime(dep->de_ADate, 0, 0, pmp->pm_gmtoff, &vap->va_atime); - dos2unixtime(dep->de_CDate, dep->de_CTime, dep->de_CHun, + msdosfs_dos2unixtime(dep->de_CDate, dep->de_CTime, dep->de_CHun, pmp->pm_gmtoff, &vap->va_ctime); } else { vap->va_atime = vap->va_mtime; @@ -359,7 +360,7 @@ msdosfs_setattr(void *v) error = EROFS; goto bad; } - error = detrunc(dep, (u_long)vap->va_size, 0, cred); + error = msdosfs_detrunc(dep, (u_long)vap->va_size, 0, cred); if (error) goto bad; de_changed = 1; @@ -376,9 +377,11 @@ msdosfs_setattr(void *v) goto bad; if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && vap->va_atime.tv_sec != VNOVAL) - unix2dostime(&vap->va_atime, pmp->pm_gmtoff, &dep->de_ADate, NULL, NULL); + msdosfs_unix2dostime(&vap->va_atime, pmp->pm_gmtoff, + &dep->de_ADate, NULL, NULL); if (vap->va_mtime.tv_sec != VNOVAL) - unix2dostime(&vap->va_mtime, pmp->pm_gmtoff, &dep->de_MDate, &dep->de_MTime, NULL); + msdosfs_unix2dostime(&vap->va_mtime, pmp->pm_gmtoff, + &dep->de_MDate, &dep->de_MTime, NULL); dep->de_Attributes |= ATTR_ARCHIVE; dep->de_flag |= DE_MODIFIED; de_changed = 1; @@ -426,7 +429,7 @@ msdosfs_setattr(void *v) } if (de_changed) { - error = deupdat(dep, 1); + error = msdosfs_deupdat(dep, 1); if (error) goto bad; } @@ -500,7 +503,7 @@ msdosfs_read(void *v) n = (long) diff; /* convert cluster # to sector # */ - error = pcbmap(dep, lbn, &lbn, 0, &blsize); + error = msdosfs_pcbmap(dep, lbn, &lbn, 0, &blsize); if (error) goto bad; @@ -523,7 +526,7 @@ out: if ((ap->a_ioflag & IO_SYNC) == IO_SYNC) { int uerror; - uerror = deupdat(dep, 1); + uerror = msdosfs_deupdat(dep, 1); if (error == 0) error = uerror; } @@ -593,7 +596,8 @@ msdosfs_write(void *v) * with zeroed blocks. */ if (uio->uio_offset > dep->de_FileSize) { - if ((error = deextend(dep, uio->uio_offset, cred)) != 0) { + if ((error = msdosfs_deextend(dep, uio->uio_offset, + cred)) != 0) { return (error); } } @@ -612,7 +616,7 @@ msdosfs_write(void *v) if (uio->uio_offset + resid > osize) { count = de_clcount(pmp, uio->uio_offset + resid) - de_clcount(pmp, osize); - if ((error = extendfile(dep, count, NULL, NULL, 0))) + if ((error = msdosfs_extendfile(dep, count, NULL, NULL, 0))) goto errexit; dep->de_FileSize = uio->uio_offset + resid; @@ -662,11 +666,11 @@ msdosfs_write(void *v) */ errexit: if (error) { - detrunc(dep, osize, ioflag & IO_SYNC, NOCRED); + msdosfs_detrunc(dep, osize, ioflag & IO_SYNC, NOCRED); uio->uio_offset -= resid - uio->uio_resid; uio->uio_resid = resid; } else if ((ioflag & IO_SYNC) == IO_SYNC) - error = deupdat(dep, 1); + error = msdosfs_deupdat(dep, 1); KASSERT(vp->v_size == dep->de_FileSize); return (error); } @@ -691,7 +695,7 @@ msdosfs_update(struct vnode *vp, const s return (0); if (dep->de_refcnt <= 0) return (0); - error = readde(dep, &bp, &dirp); + error = msdosfs_readde(dep, &bp, &dirp); if (error) return (error); DE_EXTERNALIZE(dirp, dep); @@ -725,7 +729,7 @@ msdosfs_remove(void *v) if (ap->a_vp->v_type == VDIR) error = EPERM; else - error = removede(ddep, dep, &ddep->de_crap); + error = msdosfs_removede(ddep, dep, &ddep->de_crap); #ifdef MSDOSFS_DEBUG printf("msdosfs_remove(), dep %p, usecount %d\n", dep, vrefcnt(ap->a_vp)); @@ -801,7 +805,7 @@ msdosfs_mkdir(void *v) /* * Allocate a cluster to hold the about to be created directory. */ - error = clusteralloc(pmp, 0, 1, &newcluster, NULL); + error = msdosfs_clusteralloc(pmp, 0, 1, &newcluster, NULL); if (error) goto bad2; @@ -857,7 +861,7 @@ msdosfs_mkdir(void *v) * cluster. This will be written to an empty slot in the parent * directory. */ - if ((error = uniqdosname(pdep, cnp, ndirent.de_Name)) != 0) + if ((error = msdosfs_uniqdosname(pdep, cnp, ndirent.de_Name)) != 0) goto bad; ndirent.de_Attributes = ATTR_DIRECTORY; @@ -865,13 +869,14 @@ msdosfs_mkdir(void *v) ndirent.de_FileSize = 0; ndirent.de_dev = pdep->de_dev; ndirent.de_devvp = pdep->de_devvp; - if ((error = createde(&ndirent, pdep, &pdep->de_crap, &dep, cnp)) != 0) + if ((error = msdosfs_createde(&ndirent, pdep, &pdep->de_crap, &dep, + cnp)) != 0) goto bad; *ap->a_vpp = DETOV(dep); return (0); bad: - clusterfree(pmp, newcluster, NULL); + msdosfs_clusterfree(pmp, newcluster, NULL); bad2: return (error); } @@ -907,7 +912,7 @@ msdosfs_rmdir(void *v) * non-empty.) */ error = 0; - if (!dosdirempty(ip) || ip->de_flag & DE_RENAME) { + if (!msdosfs_dosdirempty(ip) || ip->de_flag & DE_RENAME) { error = ENOTEMPTY; goto out; } @@ -919,7 +924,7 @@ msdosfs_rmdir(void *v) * up access and eventually msdosfs_reclaim() will be called which * will remove it from the denode cache. */ - if ((error = removede(dp, ip, &dp->de_crap)) != 0) + if ((error = msdosfs_removede(dp, ip, &dp->de_crap)) != 0) goto out; /* * This is where we decrement the link count in the parent @@ -930,7 +935,7 @@ msdosfs_rmdir(void *v) /* * Truncate the directory that is being deleted. */ - error = detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred); + error = msdosfs_detrunc(ip, (u_long)0, IO_SYNC, cnp->cn_cred); cache_purge(vp); out: vput(vp); @@ -1074,7 +1079,7 @@ msdosfs_readdir(void *v) if (diff <= 0) break; n = MIN(n, diff); - if ((error = pcbmap(dep, lbn, &bn, &cn, &blsize)) != 0) + if ((error = msdosfs_pcbmap(dep, lbn, &bn, &cn, &blsize)) != 0) break; error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize, 0, &bp); @@ -1116,7 +1121,8 @@ msdosfs_readdir(void *v) if (dentp->deAttributes == ATTR_WIN95) { if (pmp->pm_flags & MSDOSFSMNT_SHORTNAME) continue; - chksum = win2unixfn((struct winentry *)dentp, + chksum = + msdosfs_win2unixfn((struct winentry *)dentp, dirbuf, chksum, &namlen, pmp->pm_flags & MSDOSFSMNT_UTF8); if (chksum != -1) @@ -1157,8 +1163,9 @@ msdosfs_readdir(void *v) offset / sizeof(struct direntry); dirbuf->d_type = DT_REG; } - if (chksum != winChksum(dentp->deName)) - dirbuf->d_namlen = dos2unixfn(dentp->deName, + if (chksum != msdosfs_winChksum(dentp->deName)) + dirbuf->d_namlen = + msdosfs_dos2unixfn(dentp->deName, (u_char *)dirbuf->d_name, pmp->pm_flags & MSDOSFSMNT_SHORTNAME); else @@ -1236,7 +1243,7 @@ msdosfs_bmap(void *v) *ap->a_vpp = dep->de_devvp; if (ap->a_bnp == NULL) return (0); - status = pcbmap(dep, ap->a_bn, ap->a_bnp, 0, 0); + status = msdosfs_pcbmap(dep, ap->a_bn, ap->a_bnp, 0, 0); /* * From FreeBSD: @@ -1251,8 +1258,8 @@ msdosfs_bmap(void *v) maxrun = ulmin(MAXPHYS / dep->de_pmp->pm_bpcluster - 1, dep->de_pmp->pm_maxcluster - ap->a_bn); for (run = 1; run <= maxrun; run++) { - if (pcbmap(dep, ap->a_bn + run, &runbn, NULL, NULL) - != 0 || runbn != + if (msdosfs_pcbmap(dep, ap->a_bn + run, &runbn, NULL, + NULL) != 0 || runbn != *ap->a_bnp + de_cn2bn(dep->de_pmp, run)) break; } @@ -1287,7 +1294,7 @@ msdosfs_strategy(void *v) * don't allow files with holes, so we shouldn't ever see this. */ if (bp->b_blkno == bp->b_lblkno) { - error = pcbmap(dep, de_bn2cn(dep->de_pmp, bp->b_lblkno), + error = msdosfs_pcbmap(dep, de_bn2cn(dep->de_pmp, bp->b_lblkno), &bp->b_blkno, 0, 0); if (error) bp->b_blkno = -1; @@ -1424,7 +1431,8 @@ msdosfs_detimes(struct denode *dep, cons getnanotime(&tsb); mod = ts = &tsb; } - unix2dostime(mod, gmtoff, &dep->de_MDate, &dep->de_MTime, NULL); + msdosfs_unix2dostime(mod, gmtoff, &dep->de_MDate, + &dep->de_MTime, NULL); dep->de_Attributes |= ATTR_ARCHIVE; } if ((dep->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0) { @@ -1432,13 +1440,14 @@ msdosfs_detimes(struct denode *dep, cons if (acc == NULL) acc = ts == NULL ? (getnanotime(&tsb), ts = &tsb) : ts; - unix2dostime(acc, gmtoff, &dep->de_ADate, NULL, NULL); + msdosfs_unix2dostime(acc, gmtoff, &dep->de_ADate, + NULL, NULL); } if (dep->de_flag & DE_CREATE) { if (cre == NULL) cre = ts == NULL ? (getnanotime(&tsb), ts = &tsb) : ts; - unix2dostime(cre, gmtoff, &dep->de_CDate, + msdosfs_unix2dostime(cre, gmtoff, &dep->de_CDate, &dep->de_CTime, &dep->de_CHun); } } Index: src/usr.sbin/makefs/msdos/msdosfs_denode.c diff -u src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.7 src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.8 --- src/usr.sbin/makefs/msdos/msdosfs_denode.c:1.7 Sun Mar 29 05:52:59 2015 +++ src/usr.sbin/makefs/msdos/msdosfs_denode.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $ */ +/* $NetBSD: msdosfs_denode.c,v 1.8 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -52,7 +52,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.8 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> @@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_deno * depp - returns the address of the gotten denode. */ int -deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, +msdosfs_deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, struct denode **depp) /* pmp: so we know the maj/min number */ /* dirclust: cluster this dir entry came from */ @@ -114,7 +114,7 @@ deget(struct msdosfsmount *pmp, u_long d ldep->de_pmp = pmp; ldep->de_devvp = pmp->pm_devvp; ldep->de_refcnt = 1; - fc_purge(ldep, 0); + msdosfs_fc_purge(ldep, 0); /* * Copy the directory entry into the denode area of the vnode. */ @@ -153,7 +153,8 @@ deget(struct msdosfsmount *pmp, u_long d ldep->de_MDate = ldep->de_CDate; /* leave the other fields as garbage */ } else { - error = readep(pmp, dirclust, diroffset, &bp, &direntptr); + error = msdosfs_readep(pmp, dirclust, diroffset, &bp, + &direntptr); if (error) { ldep->de_devvp = NULL; ldep->de_Name[0] = SLOT_DELETED; @@ -177,7 +178,7 @@ deget(struct msdosfsmount *pmp, u_long d u_long size; if (ldep->de_StartCluster != MSDOSFSROOT) { - error = pcbmap(ldep, CLUST_END, 0, &size, 0); + error = msdosfs_pcbmap(ldep, CLUST_END, 0, &size, 0); if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; @@ -193,7 +194,8 @@ deget(struct msdosfsmount *pmp, u_long d * Truncate the file described by dep to the length specified by length. */ int -detrunc(struct denode *dep, u_long length, int flags, struct kauth_cred *cred) +msdosfs_detrunc(struct denode *dep, u_long length, int flags, + struct kauth_cred *cred) { int error; int allerror = 0; @@ -224,7 +226,7 @@ detrunc(struct denode *dep, u_long lengt } if (dep->de_FileSize < length) - return (deextend(dep, length, cred)); + return (msdosfs_deextend(dep, length, cred)); lastblock = de_clcount(pmp, length) - 1; /* @@ -241,7 +243,7 @@ detrunc(struct denode *dep, u_long lengt dep->de_StartCluster = 0; eofentry = ~0; } else { - error = pcbmap(dep, lastblock, 0, &eofentry, 0); + error = msdosfs_pcbmap(dep, lastblock, 0, &eofentry, 0); if (error) { #ifdef MSDOSFS_DEBUG printf("detrunc(): pcbmap fails %d\n", error); @@ -292,7 +294,7 @@ detrunc(struct denode *dep, u_long lengt * now. */ if (eofentry != (u_long)~0) { - error = fatentry(FAT_GET_AND_SET, pmp, eofentry, + error = msdosfs_fatentry(FAT_GET_AND_SET, pmp, eofentry, &chaintofree, CLUST_EOFE); if (error) { #ifdef MSDOSFS_DEBUG @@ -307,7 +309,7 @@ detrunc(struct denode *dep, u_long lengt * truncation. */ if (chaintofree != 0 && !MSDOSFSEOF(chaintofree, pmp->pm_fatmask)) - freeclusterchain(pmp, chaintofree); + msdosfs_freeclusterchain(pmp, chaintofree); return (allerror); } @@ -316,7 +318,7 @@ detrunc(struct denode *dep, u_long lengt * Extend the file described by dep to length specified by length. */ int -deextend(struct denode *dep, u_long length, struct kauth_cred *cred) +msdosfs_deextend(struct denode *dep, u_long length, struct kauth_cred *cred) { struct msdosfsmount *pmp = dep->de_pmp; u_long count; @@ -344,10 +346,10 @@ deextend(struct denode *dep, u_long leng if (count > 0) { if (count > pmp->pm_freeclustercount) return (ENOSPC); - error = extendfile(dep, count, NULL, NULL, DE_CLEAR); + error = msdosfs_extendfile(dep, count, NULL, NULL, DE_CLEAR); if (error) { /* truncate the added clusters away again */ - (void) detrunc(dep, dep->de_FileSize, 0, cred); + (void) msdosfs_detrunc(dep, dep->de_FileSize, 0, cred); return (error); } } Index: src/usr.sbin/makefs/msdos/msdosfs_vfsops.c diff -u src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.11 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.12 --- src/usr.sbin/makefs/msdos/msdosfs_vfsops.c:1.11 Sat Jan 27 02:07:33 2018 +++ src/usr.sbin/makefs/msdos/msdosfs_vfsops.c Sat Oct 23 16:58:17 2021 @@ -50,7 +50,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.11 2018/01/27 02:07:33 sevan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.12 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> @@ -382,7 +382,7 @@ msdosfs_mount(struct vnode *devvp, int f /* * Have the inuse map filled in. */ - if ((error = fillinusemap(pmp)) != 0) { + if ((error = msdosfs_fillinusemap(pmp)) != 0) { DPRINTF(("fillinusemap %d\n", error)); goto error_exit; } @@ -423,7 +423,8 @@ msdosfs_root(struct msdosfsmount *pmp, s int error; *vp = *pmp->pm_devvp; - if ((error = deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, &ndep)) != 0) { + if ((error = msdosfs_deget(pmp, MSDOSFSROOT, MSDOSFSROOT_OFS, + &ndep)) != 0) { errno = error; return -1; } Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.20 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.21 --- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.20 Sat Oct 23 07:38:33 2021 +++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c Sat Oct 23 16:58:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vnops.c,v 1.20 2021/10/23 07:38:33 hannken Exp $ */ +/* $NetBSD: msdosfs_vnops.c,v 1.21 2021/10/23 16:58:17 thorpej Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -51,7 +51,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.20 2021/10/23 07:38:33 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.21 2021/10/23 16:58:17 thorpej Exp $"); #include <sys/param.h> #include <sys/mman.h> @@ -113,8 +113,10 @@ msdosfs_times(struct msdosfsmount *pmp, mt.tv_sec = st->st_mtime; mt.tv_nsec = 0; #endif - unix2dostime(&at, pmp->pm_gmtoff, &dep->de_ADate, NULL, NULL); - unix2dostime(&mt, pmp->pm_gmtoff, &dep->de_MDate, &dep->de_MTime, NULL); + msdosfs_unix2dostime(&at, pmp->pm_gmtoff, &dep->de_ADate, + NULL, NULL); + msdosfs_unix2dostime(&mt, pmp->pm_gmtoff, &dep->de_MDate, + &dep->de_MTime, NULL); } /* @@ -154,19 +156,19 @@ msdosfs_findslot(struct denode *dp, stru pmp = dp->de_pmp; - switch (unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename, + switch (msdosfs_unix2dosfn((const u_char *)cnp->cn_nameptr, dosfilename, cnp->cn_namelen, 0)) { case 0: return (EINVAL); case 1: break; case 2: - wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr, + wincnt = msdosfs_winSlotCnt((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, pmp->pm_flags & MSDOSFSMNT_UTF8) + 1; break; case 3: olddos = 0; - wincnt = winSlotCnt((const u_char *)cnp->cn_nameptr, + wincnt = msdosfs_winSlotCnt((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, pmp->pm_flags & MSDOSFSMNT_UTF8) + 1; break; } @@ -195,7 +197,8 @@ msdosfs_findslot(struct denode *dp, stru */ diroff = 0; for (frcn = 0; diroff < dp->de_FileSize; frcn++) { - if ((error = pcbmap(dp, frcn, &bn, &cluster, &blsize)) != 0) { + if ((error = msdosfs_pcbmap(dp, frcn, &bn, &cluster, + &blsize)) != 0) { if (error == E2BIG) break; return (error); @@ -248,7 +251,7 @@ msdosfs_findslot(struct denode *dp, stru if (pmp->pm_flags & MSDOSFSMNT_SHORTNAME) continue; - chksum = winChkName((const u_char *)cnp->cn_nameptr, + chksum = msdosfs_winChkName((const u_char *)cnp->cn_nameptr, cnp->cn_namelen, (struct winentry *)dep, chksum, @@ -268,7 +271,8 @@ msdosfs_findslot(struct denode *dp, stru /* * Check for a checksum or name match */ - chksum_ok = (chksum == winChksum(dep->deName)); + chksum_ok = + (chksum == msdosfs_winChksum(dep->deName)); if (!chksum_ok && (!olddos || memcmp(dosfilename, dep->deName, 11))) { chksum = -1; @@ -378,7 +382,7 @@ msdosfs_mkfile(const char *path, struct * readonly. */ memset(&ndirent, 0, sizeof(ndirent)); - if ((error = uniqdosname(pdep, &cn, ndirent.de_Name)) != 0) + if ((error = msdosfs_uniqdosname(pdep, &cn, ndirent.de_Name)) != 0) goto bad; ndirent.de_Attributes = (st->st_mode & S_IWUSR) ? @@ -392,7 +396,8 @@ msdosfs_mkfile(const char *path, struct msdosfs_times(pmp, &ndirent, st); if ((error = msdosfs_findslot(pdep, &cn)) != 0) goto bad; - if ((error = createde(&ndirent, pdep, &pdep->de_crap, &dep, &cn)) != 0) + if ((error = msdosfs_createde(&ndirent, pdep, &pdep->de_crap, &dep, + &cn)) != 0) goto bad; if ((error = msdosfs_wfile(path, dep, node)) != 0) goto bad; @@ -410,7 +415,7 @@ msdosfs_updatede(struct denode *dep) int error; dep->de_flag &= ~DE_MODIFIED; - error = readde(dep, &bp, &dirp); + error = msdosfs_readde(dep, &bp, &dirp); if (error) return error; DE_EXTERNALIZE(dirp, dep); @@ -446,7 +451,7 @@ msdosfs_wfile(const char *path, struct d nsize = st->st_size; DPRINTF(("%s(nsize=%zu, osize=%zu)\n", __func__, nsize, osize)); if (nsize > osize) { - if ((error = deextend(dep, nsize, NULL)) != 0) + if ((error = msdosfs_deextend(dep, nsize, NULL)) != 0) return error; if ((error = msdosfs_updatede(dep)) != 0) return error; @@ -482,7 +487,8 @@ msdosfs_wfile(const char *path, struct d bn = cntobn(pmp, cn); blsize = pmp->pm_bpcluster; #else - if ((error = pcbmap(dep, cn++, &bn, NULL, &blsize)) != 0) { + if ((error = msdosfs_pcbmap(dep, cn++, &bn, NULL, + &blsize)) != 0) { DPRINTF(("%s: pcbmap %lu", __func__, bn)); goto out; } @@ -564,7 +570,7 @@ msdosfs_mkdire(const char *path, struct /* * Allocate a cluster to hold the about to be created directory. */ - error = clusteralloc(pmp, 0, 1, &newcluster, NULL); + error = msdosfs_clusteralloc(pmp, 0, 1, &newcluster, NULL); if (error) goto bad2; @@ -622,7 +628,7 @@ msdosfs_mkdire(const char *path, struct * cluster. This will be written to an empty slot in the parent * directory. */ - if ((error = uniqdosname(pdep, &cn, ndirent.de_Name)) != 0) + if ((error = msdosfs_uniqdosname(pdep, &cn, ndirent.de_Name)) != 0) goto bad; ndirent.de_Attributes = ATTR_DIRECTORY; @@ -633,14 +639,15 @@ msdosfs_mkdire(const char *path, struct ndirent.de_pmp = pdep->de_pmp; if ((error = msdosfs_findslot(pdep, &cn)) != 0) goto bad; - if ((error = createde(&ndirent, pdep, &pdep->de_crap, &dep, &cn)) != 0) + if ((error = msdosfs_createde(&ndirent, pdep, &pdep->de_crap, &dep, + &cn)) != 0) goto bad; if ((error = msdosfs_updatede(dep)) != 0) goto bad; return dep; bad: - clusterfree(pmp, newcluster, NULL); + msdosfs_clusterfree(pmp, newcluster, NULL); bad2: errno = error; return NULL;