From owner-freebsd-hackers Mon Aug 7 17:20:03 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id RAA10403 for hackers-outgoing; Mon, 7 Aug 1995 17:20:03 -0700 Received: from gndrsh.aac.dev.com (gndrsh.aac.dev.com [198.145.92.241]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id RAA10391 for ; Mon, 7 Aug 1995 17:19:59 -0700 Received: (from rgrimes@localhost) by gndrsh.aac.dev.com (8.6.11/8.6.9) id RAA01843; Mon, 7 Aug 1995 17:19:41 -0700 From: "Rodney W. Grimes" Message-Id: <199508080019.RAA01843@gndrsh.aac.dev.com> Subject: Re: patch adding the 'noauto' switch to 'mount' To: simon@masi.ibp.fr Date: Mon, 7 Aug 1995 17:19:40 -0700 (PDT) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: <199508071209.OAA00200@neuromancer.ibp.fr> from "simon@masi.ibp.fr" at Aug 7, 95 02:09:31 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 3039 Sender: hackers-owner@FreeBSD.ORG Precedence: bulk > > > Hi, > > I just got fed up with my DOS partition being mounted automatically > at boot time, so I wrote a patch which enables the use of the 'noauto' > flag in /etc/fstab. > > For example: /dev/sd0s2 /dos msdos rw,noauto 0 0 ... Patch has a rather serious bug in it. DO NOT APPLY THIS PATCH TO ANY RUNNING SYSTEM. > > > --- /usr/include/sys/mount.h.old Sun Aug 6 14:57:33 1995 > +++ /usr/include/sys/mount.h Sun Aug 6 13:18:34 1995 > @@ -147,6 +147,7 @@ > */ > #define MNT_RDONLY 0x00000001 /* read only filesystem */ > #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ > +#define MNT_NOAUTO 0x00000003 /* don't mount with 'mount -a' */ WRONG VALUE!!! These are bit fields, not integers. MNT_NOAUTO is now the same as -o ro,sync :-(. MNT_NOAUTO does _not_ belong on in this set of bit patterns, the kernel could care less about this! We are also out of bits for some structures that try to store this value :-(. > #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ > #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ > #define MNT_NODEV 0x00000010 /* don't interpret special files */ > > > > diff -urN /usr/src/sbin/mount.old/mntopts.h /usr/src/sbin/mount/mntopts.h > --- /usr/src/sbin/mount.old/mntopts.h Sun Aug 6 14:45:30 1995 > +++ /usr/src/sbin/mount/mntopts.h Sun Aug 6 14:54:49 1995 > @@ -42,6 +42,7 @@ > > /* User-visible MNT_ flags. */ > #define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 } > +#define MOPT_NOAUTO { "auto", 1, MNT_NOAUTO, 0 } > #define MOPT_NODEV { "dev", 1, MNT_NODEV, 0 } > #define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 } > #define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 } > @@ -68,6 +69,7 @@ > /* Standard options which all mounts can understand. */ > #define MOPT_STDOPTS \ > MOPT_FSTAB_COMPAT, \ > + MOPT_NOAUTO, \ > MOPT_NODEV, \ > MOPT_NOEXEC, \ > MOPT_NOSUID, \ > diff -urN /usr/src/sbin/mount.old/mount.c /usr/src/sbin/mount/mount.c > --- /usr/src/sbin/mount.old/mount.c Sun Aug 6 14:45:40 1995 > +++ /usr/src/sbin/mount/mount.c Sun Aug 6 14:55:53 1995 > @@ -84,6 +84,7 @@ > { MNT_ASYNC, "asynchronous" }, > { MNT_EXPORTED, "NFS exported" }, > { MNT_LOCAL, "local" }, > + { MNT_NOAUTO, "noauto" }, > { MNT_NODEV, "nodev" }, > { MNT_NOEXEC, "noexec" }, > { MNT_NOSUID, "nosuid" }, > @@ -166,10 +167,12 @@ > continue; > if (badvfsname(fs->fs_vfstype, vfslist)) > continue; > + if (!strstr(fs->fs_mntops, "noauto")) { > if (mountfs(fs->fs_vfstype, fs->fs_spec, > - fs->fs_file, init_flags, options, > - fs->fs_mntops)) > - rval = 1; > + fs->fs_file, init_flags, options, > + fs->fs_mntops)) > + rval = 1; > + } > } > else { > if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) > > > > -- Rod Grimes rgrimes@gndrsh.aac.dev.com Accurate Automation Company Reliable computers for FreeBSD