[final] Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

On Mon, 18 Dec 2000, Andreas Dilger wrote:
> If I could add one thing here (we have had a 2.2 patch like this for testing
> with ext3) - if you specify the rootfstype parameter don't use the "quiet"
> option to read_super, so you know why it couldn't mount a specific filesystem
> as root, and/or print rootfs type in the panic message.

Agree completely.

Here is the hopefully final version. Sorry, Linus, I thought the first
version was final :) Looks like I have missed a couple of very useful
things... Thanks to all who commented!

Regards,
Tigran

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 15:03:44 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch <[EMAIL PROTECTED]>, 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.
  */
 
 #include 
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=ext2 
+ * if set to invalid value or if read_super() fails on the specified
+ * filesystem type then mount_root() will panic
+ */
+static char rootfs[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n > 1 && n < 32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   fs_type = get_fs_type(rootfs);
+   if (fs_type) {
+   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,0);
+   if (sb)
+   goto mount_it;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) {
if (!(fs_type->fs_flags & FS_REQUIRES_DEV))
@@ -1593,6 +1621,7 @@
put_filesystem(fs_type);
}
read_unlock(_systems_lock);
+fail:
panic("VFS: Unable to mount root %s on %s", *rootfs ? rootfs : "fs", 
kdevname(ROOT_DEV));
 
 mount_it:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Andreas Dilger

Tigran, you write:
> Thanks to suggestions from Andries and Peter I enhanced the rootfs patch
> to do the same it did before + panic when rootfs= is given but failed to

If I could add one thing here (we have had a 2.2 patch like this for testing
with ext3) - if you specify the rootfstype parameter don't use the "quiet"
option to read_super, so you know why it couldn't mount a specific filesystem
as root, and/or print rootfs type in the panic message.

This is especially useful if you have something in LILO that you forgot about...

Cheers, Andreas
=
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 14:49:08 2000
@@ -1600,7 +1600,7 @@
if (*rootfs) {
fs_type = get_fs_type(rootfs);
if (fs_type) {
-   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,1);
+   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,0);
if (sb)
goto mount_it;
} 
@@ -1622,7 +1622,8 @@
}
read_unlock(_systems_lock);
 fail:
-   panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV));
+   panic("VFS: Unable to mount root %s on %s", *rootfs ? rootfs : "fs",
+ kdevname(ROOT_DEV));
 
 mount_it:
printk ("VFS: Mounted root (%s filesystem)%s.\n",

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/   -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Oops Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

just a typo in the comment, sorry. Corrected version below.

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 15:03:44 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch <[EMAIL PROTECTED]>, 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.
  */
 
 #include 
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=ext2 
+ * if set to invalid value or if read_super() fails on the specified
+ * filesystem type then mount_root() will panic
+ */
+static char rootfs[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n > 1 && n < 32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   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;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) {
if (!(fs_type->fs_flags & FS_REQUIRES_DEV))
@@ -1593,6 +1621,7 @@
put_filesystem(fs_type);
}
read_unlock(_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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

Hi Linus,

Thanks to suggestions from Andries and Peter I enhanced the rootfs patch
to do the same it did before + panic when rootfs= is given but failed to
match the userspace mount(8) behaviour. Also other cleanups mentioned in
the thread are all incorporated (well, at least the sensible ones). Now,
everyone is (hopefully) happy.

Tested under 2.4.0-test13-pre3.

Regards,
Tigran

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 14:49:08 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch <[EMAIL PROTECTED]>, 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.
  */
 
 #include 
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=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[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n > 1 && n < 32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   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;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type->next) {
if (!(fs_type->fs_flags & FS_REQUIRES_DEV))
@@ -1593,6 +1621,7 @@
put_filesystem(fs_type);
}
read_unlock(_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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

Hi Linus,

Thanks to suggestions from Andries and Peter I enhanced the rootfs patch
to do the same it did before + panic when rootfs= is given but failed to
match the userspace mount(8) behaviour. Also other cleanups mentioned in
the thread are all incorporated (well, at least the sensible ones). Now,
everyone is (hopefully) happy.

Tested under 2.4.0-test13-pre3.

Regards,
Tigran

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 14:49:08 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch [EMAIL PROTECTED], 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.
  */
 
 #include linux/config.h
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=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[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n  1  n  32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   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;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(file_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type-next) {
if (!(fs_type-fs_flags  FS_REQUIRES_DEV))
@@ -1593,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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Oops Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

just a typo in the comment, sorry. Corrected version below.

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 15:03:44 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch [EMAIL PROTECTED], 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.
  */
 
 #include linux/config.h
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=ext2 
+ * if set to invalid value or if read_super() fails on the specified
+ * filesystem type then mount_root() will panic
+ */
+static char rootfs[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n  1  n  32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   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;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(file_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type-next) {
if (!(fs_type-fs_flags  FS_REQUIRES_DEV))
@@ -1593,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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Andreas Dilger

Tigran, you write:
 Thanks to suggestions from Andries and Peter I enhanced the rootfs patch
 to do the same it did before + panic when rootfs= is given but failed to

If I could add one thing here (we have had a 2.2 patch like this for testing
with ext3) - if you specify the rootfstype parameter don't use the "quiet"
option to read_super, so you know why it couldn't mount a specific filesystem
as root, and/or print rootfs type in the panic message.

This is especially useful if you have something in LILO that you forgot about...

Cheers, Andreas
=
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 14:49:08 2000
@@ -1600,7 +1600,7 @@
if (*rootfs) {
fs_type = get_fs_type(rootfs);
if (fs_type) {
-   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,1);
+   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,0);
if (sb)
goto mount_it;
} 
@@ -1622,7 +1622,8 @@
}
read_unlock(file_systems_lock);
 fail:
-   panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV));
+   panic("VFS: Unable to mount root %s on %s", *rootfs ? rootfs : "fs",
+ kdevname(ROOT_DEV));
 
 mount_it:
printk ("VFS: Mounted root (%s filesystem)%s.\n",

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/   -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



[final] Re: [patch-2.4.0-test13-pre3] rootfs (2nd attempt)

2000-12-18 Thread Tigran Aivazian

On Mon, 18 Dec 2000, Andreas Dilger wrote:
 If I could add one thing here (we have had a 2.2 patch like this for testing
 with ext3) - if you specify the rootfstype parameter don't use the "quiet"
 option to read_super, so you know why it couldn't mount a specific filesystem
 as root, and/or print rootfs type in the panic message.

Agree completely.

Here is the hopefully final version. Sorry, Linus, I thought the first
version was final :) Looks like I have missed a couple of very useful
things... Thanks to all who commented!

Regards,
Tigran

diff -urN -X dontdiff linux/Documentation/kernel-parameters.txt 
rootfs/Documentation/kernel-parameters.txt
--- linux/Documentation/kernel-parameters.txt   Tue Sep  5 21:51:14 2000
+++ rootfs/Documentation/kernel-parameters.txt  Mon Dec 18 09:04:06 2000
@@ -473,7 +473,10 @@
 
ro  [KNL] Mount root device read-only on boot.
 
-   root=   [KNL] root filesystem.
+   root=   [KNL] Mount root filesystem on specified (as hex or 
+"/dev/XXX") device.
+
+   rootfs= [KNL] Use filesystem type specified (e.g. rootfs=ext2) for 
+root.
+ 
 
rw  [KNL] Mount root device read-write on boot.
 
diff -urN -X dontdiff linux/fs/super.c rootfs/fs/super.c
--- linux/fs/super.cTue Dec 12 09:25:22 2000
+++ rootfs/fs/super.c   Mon Dec 18 15:03:44 2000
@@ -18,6 +18,7 @@
  *Torbjörn Lindh ([EMAIL PROTECTED]), April 14, 1996.
  *  Added devfs support: Richard Gooch [EMAIL PROTECTED], 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.
  */
 
 #include linux/config.h
@@ -58,6 +59,12 @@
 /* this is initialized in init/main.c */
 kdev_t ROOT_DEV;
 
+/* this can be set at boot time, e.g. rootfs=ext2 
+ * if set to invalid value or if read_super() fails on the specified
+ * filesystem type then mount_root() will panic
+ */
+static char rootfs[32] __initdata = "";
+
 int nr_super_blocks;
 int max_super_blocks = NR_SUPER;
 LIST_HEAD(super_blocks);
@@ -78,6 +85,17 @@
 static struct file_system_type *file_systems;
 static rwlock_t file_systems_lock = RW_LOCK_UNLOCKED;
 
+static int __init rootfs_setup(char *line)
+{
+   int n = strlen(line) + 1;
+
+   if (n  1  n  32)
+   strncpy(rootfs, line, n);
+   return 1;
+}
+
+__setup("rootfs=", rootfs_setup);
+
 /* WARNING: This can be used only if we _already_ own a reference */
 static void get_filesystem(struct file_system_type *fs)
 {
@@ -1579,6 +1597,16 @@
goto mount_it;
}
 
+   if (*rootfs) {
+   fs_type = get_fs_type(rootfs);
+   if (fs_type) {
+   sb = read_super(ROOT_DEV,bdev,fs_type,root_mountflags,NULL,0);
+   if (sb)
+   goto mount_it;
+   } 
+   /* don't try others if type given explicitly, same behaviour as 
+mount(8) */
+   goto fail;
+   }
read_lock(file_systems_lock);
for (fs_type = file_systems ; fs_type ; fs_type = fs_type-next) {
if (!(fs_type-fs_flags  FS_REQUIRES_DEV))
@@ -1593,6 +1621,7 @@
put_filesystem(fs_type);
}
read_unlock(file_systems_lock);
+fail:
panic("VFS: Unable to mount root %s on %s", *rootfs ? rootfs : "fs", 
kdevname(ROOT_DEV));
 
 mount_it:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/