Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit c0c1a7d

Browse files
Christoph Hellwigaxboe
authored andcommitted
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: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 3701c60 commit c0c1a7d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5452,7 +5452,12 @@
54525452
port and the regular usb controller gets disabled.
54535453

54545454
root= [KNL] Root filesystem
5455-
See name_to_dev_t comment in init/do_mounts.c.
5455+
Usually this a a block device specifier of some kind,
5456+
see the name_to_dev_t comment in init/do_mounts.c for
5457+
details.
5458+
Alternatively this can be "ram" for the legacy initial
5459+
ramdisk, "nfs" and "cifs" for root on a network file
5460+
system, or "mtd" and "ubi" for mounting from raw flash.
54565461

54575462
rootdelay= [KNL] Delay (in seconds) to pause before attempting to
54585463
mount the root filesystem

init/do_mounts.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ static dev_t devt_from_devnum(const char *name)
248248
*
249249
* 1) <hex_major><hex_minor> device number in hexadecimal represents itself
250250
* no leading 0x, for example b302.
251-
* 2) /dev/nfs represents Root_NFS (0xff)
252251
* 3) /dev/<disk_name> represents the device number of disk
253252
* 4) /dev/<disk_name><decimal> represents the device number
254253
* of partition - device number of disk plus the partition number
@@ -266,7 +265,6 @@ static dev_t devt_from_devnum(const char *name)
266265
* a colon.
267266
* 9) PARTLABEL=<name> with name being the GPT partition label.
268267
* MSDOS partitions do not support labels!
269-
* 10) /dev/cifs represents Root_CIFS (0xfe)
270268
*
271269
* If name doesn't have fall into the categories above, we return (0,0).
272270
* 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)
275273
*/
276274
dev_t name_to_dev_t(const char *name)
277275
{
278-
if (strcmp(name, "/dev/nfs") == 0)
279-
return Root_NFS;
280-
if (strcmp(name, "/dev/cifs") == 0)
281-
return Root_CIFS;
282-
if (strcmp(name, "/dev/ram") == 0)
283-
return Root_RAM0;
284276
#ifdef CONFIG_BLOCK
285277
if (strncmp(name, "PARTUUID=", 9) == 0)
286278
return devt_from_partuuid(name + 9);
@@ -631,6 +623,12 @@ static dev_t __init parse_root_device(char *root_device_name)
631623
if (!strncmp(root_device_name, "mtd", 3) ||
632624
!strncmp(root_device_name, "ubi", 3))
633625
return Root_Generic;
626+
if (strcmp(root_device_name, "/dev/nfs") == 0)
627+
return Root_NFS;
628+
if (strcmp(root_device_name, "/dev/cifs") == 0)
629+
return Root_CIFS;
630+
if (strcmp(root_device_name, "/dev/ram") == 0)
631+
return Root_RAM0;
634632
return name_to_dev_t(root_device_name);
635633
}
636634

0 commit comments

Comments
 (0)