DragonFly submit List (threaded) for 2004-01
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
patch to mount(8) to support optional filesystem mounts
Hi,
I don't know if this is useful in any way to anyone besides myself, but
attached is a simple patch to /usr/src/sbin/mount/mount.c to support
optional filesystem mounts at boot.
Basically it works like this: during a "mount -a", mount will *not* exit
with an error if it cannot mount an entry in /etc/fstab, *if* that entry
has "optional" listed in its options.
The practical upshot of this is that it makes it easier to swap out
drives. I can put two entries for the same device in /etc/fstab, one
with a "msdos" fstype and the other with a "ufs" fstype, and depending
on which (if any) 2nd HDD is in my machine today, the appropriate
mountpoint will get mounted at boot time without me having to mutter
under my breath, edit /etc/fstab, and restart.
Feedback is much appreciated (I have little idea what the peripheral
ramifications of this change might be, but I can't think of anything...
if this change does violate [DragonFly]BSD Design Sanity, I'd really
like to know before I shoot myself in the foot in some unforseen way :)
-Chris
diff -ru mount.orig/mount.c mount/mount.c
--- mount.orig/mount.c Thu Jan 22 18:48:41 2004
+++ mount/mount.c Thu Jan 22 20:13:13 2004
@@ -120,7 +120,7 @@
struct statfs *mntbuf;
FILE *mountdfp;
pid_t pid;
- int all, ch, i, init_flags, mntsize, rval, have_fstab;
+ int all, ch, i, init_flags, mntsize, rval, have_fstab, optional;
char *options;
all = init_flags = 0;
@@ -192,9 +192,14 @@
if (!(init_flags & MNT_UPDATE) &&
ismounted(fs, mntbuf, mntsize))
continue;
+ optional = 0;
+ if (hasopt(fs->fs_mntops, "optional")) {
+ optional = 1;
+ remopt(fs->fs_mntops, "optional");
+ }
if (mountfs(fs->fs_vfstype, fs->fs_spec,
fs->fs_file, init_flags, options,
- fs->fs_mntops))
+ fs->fs_mntops) && (!optional))
rval = 1;
}
} else if (fstab_style) {
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]