Re: The naming wars continue...

From: markus reichelt
Date: Sat Oct 23 2004 - 08:19:23 EST


Linus Torvalds <torvalds@xxxxxxxx> wrote:
> (*) In other words, I had a beer and watched TV. Mmm... Donuts.

seems to be a good opportunity even though I'm a bit late, but could
you please include this patch, written by Heikki Linnakangas?

http://mareichelt.de/pub/boot-off-usb/boot-off-usb-2.patch

applies cleanly to 2.6.7 vanilla, thus making boot off usb devices
possible

--
Bastard Administrator in $hell

diff -c init/do_mounts.c init.orig/do_mounts.c
*** init/do_mounts.c Tue Oct 5 22:16:54 2004
--- init.orig/do_mounts.c Wed Jun 16 08:19:13 2004
***************
*** 272,285 ****
return 0;
}

! static int first_try = 1;
!
! int __init mount_block_root(char *name, int flags)
{
char *fs_names = __getname();
char *p;
char b[BDEVNAME_SIZE];
- int success;

get_fs_names(fs_names);
retry:
--- 272,282 ----
return 0;
}

! void __init mount_block_root(char *name, int flags)
{
char *fs_names = __getname();
char *p;
char b[BDEVNAME_SIZE];

get_fs_names(fs_names);
retry:
***************
*** 287,293 ****
int err = do_mount_root(name, p, flags, root_mount_data);
switch (err) {
case 0:
- success = 1;
goto out;
case -EACCES:
flags |= MS_RDONLY;
--- 284,289 ----
***************
*** 295,320 ****
case -EINVAL:
continue;
}
! /* Print out a warning on the first attempt */
! if(first_try) {
! first_try = 0;
! /*
! * Allow the user to distinguish between failed sys_open
! * and bad superblock on root device.
! */
! __bdevname(ROOT_DEV, b);
!
! printk("VFS: Cannot open root device \"%s\" or %s\n",
root_device_name, b);
! printk("Retrying. Please verify the \"root=\" boot option.\n");
! }
! success = 0;
! goto out;
}
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
out:
putname(fs_names);
- return success;
}

#ifdef CONFIG_ROOT_NFS
--- 291,310 ----
case -EINVAL:
continue;
}
! /*
! * Allow the user to distinguish between failed sys_open
! * and bad superblock on root device.
! */
! __bdevname(ROOT_DEV, b);
! printk("VFS: Cannot open root device \"%s\" or %s\n",
root_device_name, b);
! printk("Please append a correct \"root=\" boot option\n");
!
! panic("VFS: Unable to mount root fs on %s", b);
}
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
out:
putname(fs_names);
}

#ifdef CONFIG_ROOT_NFS
***************
*** 360,366 ****
}
#endif

! int __init mount_root(void)
{
#ifdef CONFIG_ROOT_NFS
if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
--- 350,356 ----
}
#endif

! void __init mount_root(void)
{
#ifdef CONFIG_ROOT_NFS
if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
***************
*** 384,390 ****
}
#endif
create_dev("/dev/root", ROOT_DEV, root_device_name);
! return mount_block_root("/dev/root", root_mountflags);
}

/*
--- 374,380 ----
}
#endif
create_dev("/dev/root", ROOT_DEV, root_device_name);
! mount_block_root("/dev/root", root_mountflags);
}

/*
***************
*** 398,427 ****

md_run_setup();

! do {
! if (saved_root_name[0]) {
! root_device_name = saved_root_name;
! ROOT_DEV = name_to_dev_t(root_device_name);
! if (strncmp(root_device_name, "/dev/", 5) == 0)
! root_device_name += 5;
! }
!
! is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
!
! if (initrd_load())
! break;

! if (is_floppy && rd_doload && rd_load_disk(0))
! ROOT_DEV = Root_RAM0;

! if(mount_root())
! break;

! /* Mounting root failed. Retry after a small delay */
! set_current_state(TASK_INTERRUPTIBLE);
! schedule_timeout(1*HZ);
! } while(1);

umount_devfs("/dev");
sys_mount(".", "/", NULL, MS_MOVE, NULL);
sys_chroot(".");
--- 388,410 ----

md_run_setup();

! if (saved_root_name[0]) {
! root_device_name = saved_root_name;
! ROOT_DEV = name_to_dev_t(root_device_name);
! if (strncmp(root_device_name, "/dev/", 5) == 0)
! root_device_name += 5;
! }

! is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;

! if (initrd_load())
! goto out;

! if (is_floppy && rd_doload && rd_load_disk(0))
! ROOT_DEV = Root_RAM0;

+ mount_root();
+ out:
umount_devfs("/dev");
sys_mount(".", "/", NULL, MS_MOVE, NULL);
sys_chroot(".");
diff -c init/do_mounts.h init.orig/do_mounts.h
*** init/do_mounts.h Tue Oct 5 22:10:30 2004
--- init.orig/do_mounts.h Wed Jun 16 08:19:37 2004
***************
*** 11,18 ****

dev_t name_to_dev_t(char *name);
void change_floppy(char *fmt, ...);
! int mount_block_root(char *name, int flags);
! int mount_root(void);
extern int root_mountflags;
extern char *root_device_name;

--- 11,18 ----

dev_t name_to_dev_t(char *name);
void change_floppy(char *fmt, ...);
! void mount_block_root(char *name, int flags);
! void mount_root(void);
extern int root_mountflags;
extern char *root_device_name;