Mount msdosfs with longnames support by default.

The old behavior depended on the FAT version and on what files were in the
root directory. "mount_msdosfs -o shortnames" is still supported.

Reviewed by:	wblock, cem
Discussed with:	trasz, adrian, imp
MFC after:	4 weeks
X-MFC-Notes:	Don't MFC the removal of findwin95
Differential Revision:	https://reviews.freebsd.org/D8018
This commit is contained in:
Alan Somers 2016-09-23 19:05:07 +00:00
parent 7dd7ec2c6b
commit 0696afbe09
5 changed files with 4 additions and 80 deletions

View File

@ -142,15 +142,8 @@ If neither
nor
.Fl l
are given,
.Nm
searches the root directory of the file system to
be mounted for any existing Win'95 long filenames.
If no such entries are found, but short DOS filenames are found,
.Fl s
is the default.
Otherwise
.Fl l
is assumed.
is the default.
.It Fl 9
Ignore the special Win'95 directory entries even
if deleting or renaming a file.

View File

@ -265,7 +265,6 @@ int msdosfs_reclaim(struct vop_reclaim_args *);
*/
int deget(struct msdosfsmount *, u_long, u_long, struct denode **);
int uniqdosname(struct denode *, struct componentname *, u_char *);
int findwin95(struct denode *);
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);

View File

@ -1062,55 +1062,3 @@ uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp)
}
}
}
/*
* Find any Win'95 long filename entry in directory dep
*/
int
findwin95(struct denode *dep)
{
struct msdosfsmount *pmp = dep->de_pmp;
struct direntry *dentp;
int blsize, win95;
u_long cn;
daddr_t bn;
struct buf *bp;
win95 = 1;
/*
* Read through the directory looking for Win'95 entries
* Note: Error currently handled just as EOF XXX
*/
for (cn = 0;; cn++) {
if (pcbmap(dep, cn, &bn, 0, &blsize))
return (win95);
if (bread(pmp->pm_devvp, bn, blsize, NOCRED, &bp)) {
brelse(bp);
return (win95);
}
for (dentp = (struct direntry *)bp->b_data;
(char *)dentp < bp->b_data + blsize;
dentp++) {
if (dentp->deName[0] == SLOT_EMPTY) {
/*
* Last used entry and not found
*/
brelse(bp);
return (win95);
}
if (dentp->deName[0] == SLOT_DELETED) {
/*
* Ignore deleted files
* Note: might be an indication of Win'95 anyway XXX
*/
continue;
}
if (dentp->deAttributes == ATTR_WIN95) {
brelse(bp);
return 1;
}
win95 = 0;
}
brelse(bp);
}
}

View File

@ -175,24 +175,8 @@ update_mp(struct mount *mp, struct thread *td)
if (pmp->pm_flags & MSDOSFSMNT_NOWIN95)
pmp->pm_flags |= MSDOSFSMNT_SHORTNAME;
else if (!(pmp->pm_flags &
(MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) {
struct vnode *rootvp;
/*
* Try to divine whether to support Win'95 long filenames
*/
if (FAT32(pmp))
pmp->pm_flags |= MSDOSFSMNT_LONGNAME;
else {
if ((error =
msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0)
return error;
pmp->pm_flags |= findwin95(VTODE(rootvp)) ?
MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME;
vput(rootvp);
}
}
else
pmp->pm_flags |= MSDOSFSMNT_LONGNAME;
return 0;
}

View File

@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1200009 /* Master, propagated to newvers */
#define __FreeBSD_version 1200010 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,