Eliminate root_dev_names - part 2 of 2
Subsystems (2)
PATCH 1/1 Eliminate root_dev_names - part 2 of 2
This patch removes root_dev_names.
get_gendisk_by_name is added to genhd.c.
root_dev_setup now only initializes root_device_name.
name_to_kdev_t is called from prepare_namespace in order to initialize ROOT_DEV.
With this patch applied, a number of devices will fail to boot. For the most part, they need to register gendisks. My plan is to launder patches through the maintainers.
nfs - not a block device, but registering a dummy gendisk probably won't hurt
loop - I didn't know you could boot from a loop device, needs a dummy gendisk
ram - needs a dummy gendisk
fd, mcd, cdu535, aztcd, gscd, sbpcd, pcd, pf, jsfd, mtdblock, scd, cm206cd - need gendisks
sonycd - synonym for cdu535, needs an extra gendisk
apblock, ddv - can't find these anywhere in the pool, I think they need to be garbage-collected out of existence
Jeff
drivers/block/genhd.c +23 -0
@@ -124,6 +124,29 @@EXPORT_SYMBOL (get_gendisk_by_kdev_t); +/** +* get_gendisk_by_name - get partitioning information for a given device +* @name: device name to get partitioning information for +* +* This function gets the structure containing partitioning +* information for the given device name @name. +*/ +struct gendisk * +get_gendisk_by_name (char *name) +{ +struct gendisk *gp =NULL ; + +read_lock (&gendisk_lock); +for (gp = gendisk_head; gp; gp = gp->next) { +if (strncmp (name, gp->major_name,strlen (gp->major_name))) +continue ; +read_unlock (&gendisk_lock); +return gp; + } +read_unlock (&gendisk_lock); +return NULL ; +} +#ifdef CONFIG_PROC_FS /* iterator */ static void *part_start (struct seq_file *part,loff_t *pos)
include/linux/genhd.h +1 -0
@@ -90,6 +90,7 @@extern void add_gendisk (struct gendisk *gp);extern void del_gendisk (struct gendisk *gp);extern struct gendisk *get_gendisk_by_kdev_t (kdev_t dev); +extern struct gendisk *get_gendisk_by_name (char *name);static inline unsigned long get_start_sect (struct block_device *bdev) {return bdev->bd_offset;
init/do_mounts.c +13 -146
186 lines not on this page · raw message
Quoted 2 lines · [email protected] said:
nfs - not a block device, but registering a dummy gendisk probably
won't hurt
That will be done in userspace anyway -- no need to worry about that in the long term, I suspect.
I'd like to fix JFFS2 mounting too -- currently we _pretend_ to mount on a block device, because that was just easiest. Then we check the major number == MTD_BLOCK_MAJOR and use the minor as an index to find the actual MTD device, and don't use the mtdblock driver at all.
In 2.5, we also allow mounting by MTD device number or name, but not as a root filesystem because the actual text of the 'root=' argument is not passed to the file system in that case.
T'would be nice if that could be fixed.
--
dwmw2