Re: [patch-2.4.0-test13-pre3] rootfs boot param. support

From: Peter Samuelson (peter@cadcamlab.org)
Date: Mon Dec 18 2000 - 10:22:19 EST


[Andries Brouwer]
> (i) I prefer "rootfstype". Indeed, "rootfs" is ambiguous.
> It gives some property of the root filesystem, but which?

> (ii) It is a bad idea to arbitrarily select "ext2".

> (iii) [...] Thus, if the boot option rootfstype is given, I prefer a
> boot failure over a kernel attempt to try all filesystems it knows

Agreed on all counts.

Peter

--- test13pre3+rootfs/fs/super.c~ Mon Dec 18 09:06:47 2000
+++ test13pre3+rootfs/fs/super.c Mon Dec 18 09:18:02 2000
@@ -18,7 +18,7 @@
  * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996.
  * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998
  * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
- * Added rootfs boot param. used by mount_root(): Tigran Aivazian. Dec 2000.
+ * Added rootfstype boot param. used by mount_root(): Tigran Aivazian. Dec 2000.
  */
 
 #include <linux/config.h>
@@ -59,11 +59,11 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
-/* this can be set at boot time, e.g. rootfs=ext2
+/* this can be set at boot time, e.g. rootfstype=ext2
  * if set to invalid value or if read_super() fails on the specified
  * filesystem type then mount_root() will go through all registered filesystems.
  */
-static char rootfs[128] __initdata = "ext2";
+static char rootfstype[32] __initdata = "";
 
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
@@ -90,11 +90,11 @@
         int n = strlen(line) + 1;
 
         if (n > 1 && n < 128)
- strncpy(rootfs, line, n);
+ strncpy(rootfstype, line, n);
         return 1;
 }
 
-__setup("rootfs=", rootfs_setup);
+__setup("rootfstype=", rootfs_setup);
 
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
@@ -1479,7 +1479,7 @@
 
 void __init mount_root(void)
 {
- struct file_system_type * fs_type;
+ struct file_system_type * fs_type = NULL;
         struct super_block * sb;
         struct vfsmount *vfsmnt;
         struct block_device *bdev = NULL;
@@ -1597,11 +1597,15 @@
                 goto mount_it;
         }
 
- fs_type = get_fs_type(rootfs);
- if (fs_type) {
- sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,1);
- if (sb)
- goto mount_it;
+ if (*rootfstype) {
+ fs_type = get_fs_type(rootfstype);
+ if (fs_type) {
+ sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,1);
+ if (sb)
+ goto mount_it;
+ }
+ /* do NOT try all filesystems - user explicitly wanted this one */
+ goto fail;
         }
         read_lock(&file_systems_lock);
         for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) {
@@ -1617,6 +1621,7 @@
                 put_filesystem(fs_type);
         }
         read_unlock(&file_systems_lock);
+fail:
         panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV));
 
 mount_it:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 23 2000 - 21:00:21 EST