diff options
| -rw-r--r-- | sys/fs/msdosfs/direntry.h | 2 | ||||
| -rw-r--r-- | sys/fs/msdosfs/msdosfs_conv.c | 25 | ||||
| -rw-r--r-- | sys/fs/msdosfs/msdosfs_lookup.c | 4 | ||||
| -rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 2 |
4 files changed, 16 insertions, 17 deletions
diff --git a/sys/fs/msdosfs/direntry.h b/sys/fs/msdosfs/direntry.h index 47e1257cb18c..7e325f77647d 100644 --- a/sys/fs/msdosfs/direntry.h +++ b/sys/fs/msdosfs/direntry.h @@ -151,7 +151,7 @@ int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, int winChkName(const u_char *un, size_t unlen, int chksum, struct msdosfsmount *pmp); int win2unixfn(struct winentry *wep, int chksum, struct msdosfsmount *pmp); -u_int8_t winChksum(u_int8_t *name); +u_int8_t winChksum(struct direntry *dep); int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp); size_t winLenFixup(const u_char *un, size_t unlen); #endif /* _KERNEL */ diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c index 2da772392683..9fc666d1ad81 100644 --- a/sys/fs/msdosfs/msdosfs_conv.c +++ b/sys/fs/msdosfs/msdosfs_conv.c @@ -916,22 +916,21 @@ win2unixfn(wep, chksum, pmp) * Compute the unrolled checksum of a DOS filename for Win95 LFN use. */ u_int8_t -winChksum(name) - u_int8_t *name; +winChksum(struct direntry *dep) { u_int8_t s; - s = name[0]; - s = ((s << 7) | (s >> 1)) + name[1]; - s = ((s << 7) | (s >> 1)) + name[2]; - s = ((s << 7) | (s >> 1)) + name[3]; - s = ((s << 7) | (s >> 1)) + name[4]; - s = ((s << 7) | (s >> 1)) + name[5]; - s = ((s << 7) | (s >> 1)) + name[6]; - s = ((s << 7) | (s >> 1)) + name[7]; - s = ((s << 7) | (s >> 1)) + name[8]; - s = ((s << 7) | (s >> 1)) + name[9]; - s = ((s << 7) | (s >> 1)) + name[10]; + s = dep->deName[0]; + s = ((s << 7) | (s >> 1)) + dep->deName[1]; + s = ((s << 7) | (s >> 1)) + dep->deName[2]; + s = ((s << 7) | (s >> 1)) + dep->deName[3]; + s = ((s << 7) | (s >> 1)) + dep->deName[4]; + s = ((s << 7) | (s >> 1)) + dep->deName[5]; + s = ((s << 7) | (s >> 1)) + dep->deName[6]; + s = ((s << 7) | (s >> 1)) + dep->deName[7]; + s = ((s << 7) | (s >> 1)) + dep->deExtension[0]; + s = ((s << 7) | (s >> 1)) + dep->deExtension[1]; + s = ((s << 7) | (s >> 1)) + dep->deExtension[2]; return (s); } diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index a16881e9a8fc..5150fcb11750 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -278,7 +278,7 @@ msdosfs_lookup(ap) /* * Check for a checksum or name match */ - chksum_ok = (chksum == winChksum(dep->deName)); + chksum_ok = (chksum == winChksum(dep)); if (!chksum_ok && (!olddos || bcmp(dosfilename, dep->deName, 11))) { chksum = -1; @@ -619,7 +619,7 @@ createde(dep, ddep, depp, cnp) * Now write the Win95 long name */ if (ddep->de_fndcnt > 0) { - u_int8_t chksum = winChksum(ndep->deName); + u_int8_t chksum = winChksum(ndep); const u_char *un = (const u_char *)cnp->cn_nameptr; int unlen = cnp->cn_namelen; int cnt = 1; diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 5c85b9204cc2..9423cc80c3cc 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1688,7 +1688,7 @@ msdosfs_readdir(ap) #else dirbuf.d_fileno = (uint32_t)fileno; #endif - if (chksum != winChksum(dentp->deName)) { + if (chksum != winChksum(dentp)) { dirbuf.d_namlen = dos2unixfn(dentp->deName, (u_char *)dirbuf.d_name, dentp->deLowerCase | |
