From: kn Date: Sat, 13 Nov 2021 18:18:59 +0000 (+0000) Subject: Use long filenames by default on FAT filesystems X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5970a9358741ba60688cc0007b2da2a5d30355bf;p=openbsd Use long filenames by default on FAT filesystems These days, 8.3 filenames are often a problem, filesystems containing firmware with long names must not truncate them -- it's also a sane default as portable file system between OSes, anyway. Altough undocumented in mount_msdos(8), the default for FAT32 already is to use long filenames: ever since its import from NetBSD in 1998. Previously, mount_msdos would ignore long filenames and default to short filenames unless a flag was used or long ones were found on the filesystem prior to mounting it. Just always mount with support for long filenames (unless `-s' is used). As various install media use FAT filesystems, adjust the remaining ones to also pass explicit mount option reflecting the previous default. OK deraadt --- diff --git a/distrib/amd64/ramdisk_cd/Makefile b/distrib/amd64/ramdisk_cd/Makefile index c4241c63081..b9561fcd19d 100644 --- a/distrib/amd64/ramdisk_cd/Makefile +++ b/distrib/amd64/ramdisk_cd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.33 2021/11/11 20:25:56 kn Exp $ +# $OpenBSD: Makefile,v 1.34 2021/11/13 18:18:59 kn Exp $ FS= miniroot${OSrev}.img FSSIZE= 10368 @@ -8,6 +8,8 @@ MOUNT_POINT= /mnt MTREE= ${UTILS}/mtree.conf RAMDISK= RAMDISK_CD +MOUNT_ARGS_msdos=-o-s + LISTS= ${.CURDIR}/list UTILS= ${.CURDIR}/../../miniroot @@ -21,7 +23,7 @@ ${FS}: bsd.gz fdisk -yi -l ${FSSIZE} -b 960 -f ${DESTDIR}/usr/mdec/mbr `cat vnd` disklabel -wAT ${.CURDIR}/template `cat vnd` newfs -t msdos /dev/r`cat vnd`i - mount /dev/`cat vnd`i ${MOUNT_POINT} + mount ${MOUNT_ARGS_msdos} /dev/`cat vnd`i ${MOUNT_POINT} mkdir -p ${MOUNT_POINT}/efi/boot cp ${EFIBOOT} ${MOUNT_POINT}/efi/boot umount ${MOUNT_POINT} diff --git a/distrib/octeon/ramdisk/Makefile b/distrib/octeon/ramdisk/Makefile index 16c0e22535c..7a7b74de8b1 100644 --- a/distrib/octeon/ramdisk/Makefile +++ b/distrib/octeon/ramdisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2021/10/23 16:16:22 krw Exp $ +# $OpenBSD: Makefile,v 1.20 2021/11/13 18:18:59 kn Exp $ FS= miniroot${OSrev}.img FSSIZE= 24576 @@ -7,6 +7,8 @@ MOUNT_POINT= /mnt MTREE= ${UTILS}/mtree.conf RAMDISK= RAMDISK +MOUNT_ARGS_msdos=-o-s + LISTS= ${.CURDIR}/list UTILS= ${.CURDIR}/../../miniroot @@ -21,7 +23,7 @@ ${FS}: bsd.rd echo 'u\ne 0\nC\nn\n64\n*\nf 0\nw\nq\n' | fdisk -e `cat vnd` echo 'w\ny\nq\n' | disklabel -E `cat vnd` > /dev/null newfs -t msdos /dev/r`cat vnd`i - mount /dev/`cat vnd`i ${MOUNT_POINT} + mount ${MOUNT_ARGS_msdos} /dev/`cat vnd`i ${MOUNT_POINT} cp bsd.rd ${MOUNT_POINT}/bsd.rd df -i ${MOUNT_POINT} umount ${MOUNT_POINT} diff --git a/sbin/mount_msdos/mount_msdos.8 b/sbin/mount_msdos/mount_msdos.8 index fb9950161d3..965a768077f 100644 --- a/sbin/mount_msdos/mount_msdos.8 +++ b/sbin/mount_msdos/mount_msdos.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mount_msdos.8,v 1.31 2020/04/23 21:28:09 jmc Exp $ +.\" $OpenBSD: mount_msdos.8,v 1.32 2021/11/13 18:18:59 kn Exp $ .\" $NetBSD: mount_msdos.8,v 1.10 1996/01/19 21:14:43 leo Exp $ .\" .\" Copyright (c) 1993,1994 Christopher G. Demetriou @@ -29,7 +29,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: April 23 2020 $ +.Dd $Mdocdate: November 13 2021 $ .Dt MOUNT_MSDOS 8 .Os .Sh NAME @@ -91,20 +91,7 @@ Force listing and generation of Windows 95/98 long filenames and separate creation/modification/access dates. .Pp -If neither -.Fl s -nor -.Fl l -are given, -.Nm -searches the root directory of the file system to -be mounted for any existing Windows 95/98 long filenames. -If no such entries are found, -.Fl s -is the default. -Otherwise -.Fl l -is assumed. +This is the default. .It Fl m Ar mask Specify the maximum permissions for files and directories in the file system. @@ -119,21 +106,6 @@ as described in .It Fl s Force behaviour to ignore and not generate Windows 95/98 long filenames. -.Pp -If neither -.Fl s -nor -.Fl l -are given, -.Nm -searches the root directory of the file system to -be mounted for any existing Windows 95/98 long filenames. -If no such entries are found, -.Fl s -is the default. -Otherwise -.Fl l -is assumed. .It Fl u Ar uid Set the owner of the files in the file system to .Ar uid . @@ -212,14 +184,5 @@ flag could result in damaged file systems, albeit the damage is in part taken care of by procedures similar to the ones used in Windows 95/98. .Pp -The default handling for -.Fl s -and -.Fl l -will result in empty file systems being populated -with short filenames only. -To generate long filenames on empty DOS file systems use -.Fl l . -.Pp Note that Windows 95/98 handles only access dates, but not access times. diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index 5be9e107160..543854c7a7e 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.94 2020/08/10 05:18:46 jsg Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.95 2021/11/13 18:18:59 kn Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -200,25 +200,8 @@ msdosfs_mount(struct mount *mp, const char *path, void *data, if (pmp->pm_flags & MSDOSFSMNT_NOWIN95) pmp->pm_flags |= MSDOSFSMNT_SHORTNAME; else if (!(pmp->pm_flags & - (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) { - struct vnode *rvp; - - /* - * Try to divine whether to support Win'95 long filenames - */ - if (FAT32(pmp)) - pmp->pm_flags |= MSDOSFSMNT_LONGNAME; - else { - if ((error = msdosfs_root(mp, &rvp)) != 0) { - msdosfs_unmount(mp, MNT_FORCE, p); - goto error; - } - pmp->pm_flags |= findwin95(VTODE(rvp)) - ? MSDOSFSMNT_LONGNAME - : MSDOSFSMNT_SHORTNAME; - vput(rvp); - } - } + (MSDOSFSMNT_SHORTNAME | MSDOSFSMNT_LONGNAME))) + pmp->pm_flags |= MSDOSFSMNT_LONGNAME; if (pmp->pm_flags & MSDOSFSMNT_LONGNAME) mp->mnt_stat.f_namemax = WIN_MAXLEN;