Commit ddf1bda1 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] rd cleanup

	switched to explicit devfs_register()/devfs_remove(), killed gratitious
devfs_handle_t variable.
parent 0db3cb7a
...@@ -78,7 +78,6 @@ int initrd_below_start_ok; ...@@ -78,7 +78,6 @@ int initrd_below_start_ok;
*/ */
static struct gendisk *rd_disks[NUM_RAMDISKS]; static struct gendisk *rd_disks[NUM_RAMDISKS];
static devfs_handle_t devfs_handle;
static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */ static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
/* /*
...@@ -380,12 +379,13 @@ static void __exit rd_cleanup (void) ...@@ -380,12 +379,13 @@ static void __exit rd_cleanup (void)
} }
del_gendisk(rd_disks[i]); del_gendisk(rd_disks[i]);
put_disk(rd_disks[i]); put_disk(rd_disks[i]);
devfs_remove("rd/%d", i);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
put_disk(initrd_disk); put_disk(initrd_disk);
devfs_remove("rd/initrd");
#endif #endif
devfs_remove("rd");
devfs_unregister (devfs_handle);
unregister_blkdev( MAJOR_NR, "ramdisk" ); unregister_blkdev( MAJOR_NR, "ramdisk" );
} }
...@@ -426,8 +426,11 @@ static int __init rd_init (void) ...@@ -426,8 +426,11 @@ static int __init rd_init (void)
blk_queue_make_request(&rd_queue, &rd_make_request); blk_queue_make_request(&rd_queue, &rd_make_request);
devfs_mk_dir (NULL, "rd", NULL);
for (i = 0; i < NUM_RAMDISKS; i++) { for (i = 0; i < NUM_RAMDISKS; i++) {
struct gendisk *disk = rd_disks[i]; struct gendisk *disk = rd_disks[i];
char name[16];
/* rd_size is given in kB */ /* rd_size is given in kB */
disk->major = MAJOR_NR; disk->major = MAJOR_NR;
disk->first_minor = i; disk->first_minor = i;
...@@ -435,12 +438,12 @@ static int __init rd_init (void) ...@@ -435,12 +438,12 @@ static int __init rd_init (void)
disk->queue = &rd_queue; disk->queue = &rd_queue;
sprintf(disk->disk_name, "ram%d", i); sprintf(disk->disk_name, "ram%d", i);
set_capacity(disk, rd_size * 2); set_capacity(disk, rd_size * 2);
} sprintf(name, "rd/%d", i);
devfs_handle = devfs_mk_dir (NULL, "rd", NULL); devfs_register(NULL, name, DEVFS_FL_DEFAULT,
devfs_register_series (devfs_handle, "%u", NUM_RAMDISKS, disk->major, disk->first_minor,
DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUSR | S_IWUSR, S_IFBLK | S_IRUSR | S_IWUSR,
&rd_bd_op, NULL); disk->fops, NULL);
}
for (i = 0; i < NUM_RAMDISKS; i++) for (i = 0; i < NUM_RAMDISKS; i++)
add_disk(rd_disks[i]); add_disk(rd_disks[i]);
...@@ -449,7 +452,7 @@ static int __init rd_init (void) ...@@ -449,7 +452,7 @@ static int __init rd_init (void)
/* We ought to separate initrd operations here */ /* We ought to separate initrd operations here */
set_capacity(initrd_disk, (initrd_end-initrd_start+511)>>9); set_capacity(initrd_disk, (initrd_end-initrd_start+511)>>9);
add_disk(initrd_disk); add_disk(initrd_disk);
devfs_register(devfs_handle, "initrd", DEVFS_FL_DEFAULT, MAJOR_NR, devfs_register(NULL, "rd/initrd", DEVFS_FL_DEFAULT, MAJOR_NR,
INITRD_MINOR, S_IFBLK | S_IRUSR, &rd_bd_op, NULL); INITRD_MINOR, S_IFBLK | S_IRUSR, &rd_bd_op, NULL);
#endif #endif
......
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