Commit c0c1a7dc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

init: move the nfs/cifs/ram special cases out of name_to_dev_t

The nfs/cifs/ram special case only needs to be parsed once, and only in
the boot code.  Move them out of name_to_dev_t and into
prepare_namespace.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230531125535.676098-13-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3701c600
...@@ -5452,7 +5452,12 @@ ...@@ -5452,7 +5452,12 @@
port and the regular usb controller gets disabled. port and the regular usb controller gets disabled.
root= [KNL] Root filesystem root= [KNL] Root filesystem
See name_to_dev_t comment in init/do_mounts.c. Usually this a a block device specifier of some kind,
see the name_to_dev_t comment in init/do_mounts.c for
details.
Alternatively this can be "ram" for the legacy initial
ramdisk, "nfs" and "cifs" for root on a network file
system, or "mtd" and "ubi" for mounting from raw flash.
rootdelay= [KNL] Delay (in seconds) to pause before attempting to rootdelay= [KNL] Delay (in seconds) to pause before attempting to
mount the root filesystem mount the root filesystem
......
...@@ -248,7 +248,6 @@ static dev_t devt_from_devnum(const char *name) ...@@ -248,7 +248,6 @@ static dev_t devt_from_devnum(const char *name)
* *
* 1) <hex_major><hex_minor> device number in hexadecimal represents itself * 1) <hex_major><hex_minor> device number in hexadecimal represents itself
* no leading 0x, for example b302. * no leading 0x, for example b302.
* 2) /dev/nfs represents Root_NFS (0xff)
* 3) /dev/<disk_name> represents the device number of disk * 3) /dev/<disk_name> represents the device number of disk
* 4) /dev/<disk_name><decimal> represents the device number * 4) /dev/<disk_name><decimal> represents the device number
* of partition - device number of disk plus the partition number * of partition - device number of disk plus the partition number
...@@ -266,7 +265,6 @@ static dev_t devt_from_devnum(const char *name) ...@@ -266,7 +265,6 @@ static dev_t devt_from_devnum(const char *name)
* a colon. * a colon.
* 9) PARTLABEL=<name> with name being the GPT partition label. * 9) PARTLABEL=<name> with name being the GPT partition label.
* MSDOS partitions do not support labels! * MSDOS partitions do not support labels!
* 10) /dev/cifs represents Root_CIFS (0xfe)
* *
* If name doesn't have fall into the categories above, we return (0,0). * If name doesn't have fall into the categories above, we return (0,0).
* block_class is used to check if something is a disk name. If the disk * block_class is used to check if something is a disk name. If the disk
...@@ -275,12 +273,6 @@ static dev_t devt_from_devnum(const char *name) ...@@ -275,12 +273,6 @@ static dev_t devt_from_devnum(const char *name)
*/ */
dev_t name_to_dev_t(const char *name) dev_t name_to_dev_t(const char *name)
{ {
if (strcmp(name, "/dev/nfs") == 0)
return Root_NFS;
if (strcmp(name, "/dev/cifs") == 0)
return Root_CIFS;
if (strcmp(name, "/dev/ram") == 0)
return Root_RAM0;
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
if (strncmp(name, "PARTUUID=", 9) == 0) if (strncmp(name, "PARTUUID=", 9) == 0)
return devt_from_partuuid(name + 9); return devt_from_partuuid(name + 9);
...@@ -631,6 +623,12 @@ static dev_t __init parse_root_device(char *root_device_name) ...@@ -631,6 +623,12 @@ static dev_t __init parse_root_device(char *root_device_name)
if (!strncmp(root_device_name, "mtd", 3) || if (!strncmp(root_device_name, "mtd", 3) ||
!strncmp(root_device_name, "ubi", 3)) !strncmp(root_device_name, "ubi", 3))
return Root_Generic; return Root_Generic;
if (strcmp(root_device_name, "/dev/nfs") == 0)
return Root_NFS;
if (strcmp(root_device_name, "/dev/cifs") == 0)
return Root_CIFS;
if (strcmp(root_device_name, "/dev/ram") == 0)
return Root_RAM0;
return name_to_dev_t(root_device_name); return name_to_dev_t(root_device_name);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment