From 2aebb586db4a62e62fb7e6bd8c6420ff10d06345 Mon Sep 17 00:00:00 2001 From: Bosko Milekic Date: Mon, 26 Apr 2004 15:13:46 +0000 Subject: [PATCH] The previous change to mount(8) to report ufs or ufs2 used libufs, which only works for Charlie root. This change reverts the introduction of libufs and moves the check into the kernel. Since the f_fstypename is the same for both ufs and ufs2, we check fs_magic for presence of ufs2 and copy "ufs2" explicitly instead. Submitted by: Christian S.J. Peron --- sbin/mount/Makefile | 2 -- sbin/mount/mount.c | 11 ----------- sys/ufs/ffs/ffs_vfsops.c | 11 +++++++++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/sbin/mount/Makefile b/sbin/mount/Makefile index e9e4fdf5f549..407abea2f1f3 100644 --- a/sbin/mount/Makefile +++ b/sbin/mount/Makefile @@ -3,8 +3,6 @@ PROG= mount SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c -DPADD= ${LIBUFS} -LDADD= -lufs WARNS?= 0 MAN= mount.8 # We do NOT install the getmntopts.3 man page. diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 5f6a9503fc0d..df97adbb88f8 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -46,10 +46,6 @@ static const char rcsid[] = #include #include -#include -#include -#include - #include #include #include @@ -62,7 +58,6 @@ static const char rcsid[] = #include #include #include -#include #include "extern.h" #include "mntopts.h" @@ -515,16 +510,10 @@ prmount(sfp) int flags, i; struct opt *o; struct passwd *pw; - struct uufsd disk; (void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname, sfp->f_fstypename); - if (strncmp(sfp->f_fstypename, "ufs", 3) == 0) { - ufs_disk_fillout(&disk, sfp->f_mntonname); - printf("%s", (disk.d_ufs == 2) ? "2" : ""); - } - flags = sfp->f_flags & MNT_VISFLAGMASK; for (o = optnames; flags && o->o_opt; o++) if (flags & o->o_opt) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 8f205db74d32..951f0eb6ec01 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1062,6 +1062,9 @@ ffs_statfs(mp, sbp, td) fs = ump->um_fs; if (fs->fs_magic != FS_UFS1_MAGIC && fs->fs_magic != FS_UFS2_MAGIC) panic("ffs_statfs"); + if (fs->fs_magic == FS_UFS2_MAGIC) + bcopy((caddr_t)"ufs2", + (caddr_t)&sbp->f_fstypename[0], MFSNAMELEN); sbp->f_version = STATFS_VERSION; sbp->f_bsize = fs->fs_fsize; sbp->f_iosize = fs->fs_bsize; @@ -1082,8 +1085,12 @@ ffs_statfs(mp, sbp, td) sbp->f_asyncreads = mp->mnt_stat.f_asyncreads; sbp->f_owner = mp->mnt_stat.f_owner; sbp->f_fsid = mp->mnt_stat.f_fsid; - bcopy((caddr_t)mp->mnt_stat.f_fstypename, - (caddr_t)&sbp->f_fstypename[0], MFSNAMELEN); + if (fs->fs_magic == FS_UFS2_MAGIC) + bcopy((caddr_t)"ufs2", + (caddr_t)&sbp->f_fstypename[0], MFSNAMELEN); + else + bcopy((caddr_t)mp->mnt_stat.f_fstypename, + (caddr_t)&sbp->f_fstypename[0], MFSNAMELEN); bcopy((caddr_t)mp->mnt_stat.f_mntonname, (caddr_t)&sbp->f_mntonname[0], MNAMELEN); bcopy((caddr_t)mp->mnt_stat.f_mntfromname,