Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Apr 2004 20:09:28 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Bosko Milekic <bmilekic@freebsd.org>
Cc:        cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sbin/mount Makefile mount.c src/sys/ufs/ffs    ffs_vfsops.c
Message-ID:  <20040427195514.T9334@gamplex.bde.org>
In-Reply-To: <20040427115536.W7721@gamplex.bde.org>
References:  <200404261513.i3QFDkb5026044@repoman.freebsd.org> <20040427115536.W7721@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 27 Apr 2004, Bruce Evans wrote:

> On Mon, 26 Apr 2004, Bosko Milekic wrote:
>
> > bmilekic    2004/04/26 08:13:46 PDT
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sbin/mount           Makefile mount.c
> >     sys/ufs/ffs          ffs_vfsops.c
> >   Log:
> >   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.
>
> This seems to fix things like "mount -t ufs" and "find / -fstype ufs"
> to not work with ufs2.  Many scripts may depend on this.

Testing shows that "df -t ufs" only finds ufs (because it looks up
file systems by type name), but "find / -fstype ufs" cannot distinguish
ufs from ufs2 (because it looks up file systems by type number).  I
think "mount -a -t ufs" works like "df -t ufs".

The number in find's lookup is the type number returned by statfs().
Lookup by number is a historical bug.  It is fixed in NetBSD:

%%%
--- function.c	Sun Apr  4 14:44:05 2004
+++ /c/NetBSD/src/usr.bin/find/function.c	Mon Apr 26 21:36:04 2004
@@ -819,66 +762,52 @@
 		 * always copy both of them.
 		 */
-		val_flags = sb.f_flags;
-		val_type = sb.f_type;
+		val = sb.f_flag;
+		strlcpy(fstype, sb.f_fstypename, sizeof(fstype));
 	}
-	switch (plan->flags & F_MTMASK) {
+	switch (plan->flags) {
 	case F_MTFLAG:
-		return val_flags & plan->mt_data;
+		return (val & plan->mt_data);
 	case F_MTTYPE:
-		return val_type == plan->mt_data;
+		return (strncmp(fstype, plan->c_data, MFSNAMELEN) == 0);
 	default:
 		abort();
 	}
 }
...
%%%

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040427195514.T9334>