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

[PATCH] loop.c cleanup

	switched to explicit devfs_register()/devfs_remove()
parent e752c144
......@@ -84,7 +84,6 @@
static int max_loop = 8;
static struct loop_device *loop_dev;
static struct gendisk **disks;
static devfs_handle_t devfs_handle; /* For the directory */
/*
* Transfer functions
......@@ -1022,11 +1021,7 @@ int __init loop_init(void)
return -EIO;
}
devfs_handle = devfs_mk_dir(NULL, "loop", NULL);
devfs_register_series(devfs_handle, "%u", max_loop, DEVFS_FL_DEFAULT,
MAJOR_NR, 0,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
&lo_fops, NULL);
devfs_mk_dir(NULL, "loop", NULL);
loop_dev = kmalloc(max_loop * sizeof(struct loop_device), GFP_KERNEL);
if (!loop_dev)
......@@ -1043,6 +1038,7 @@ int __init loop_init(void)
}
for (i = 0; i < max_loop; i++) {
char name[16];
struct loop_device *lo = &loop_dev[i];
struct gendisk *disk = disks[i];
memset(lo, 0, sizeof(*lo));
......@@ -1058,6 +1054,11 @@ int __init loop_init(void)
disk->private_data = lo;
disk->queue = &lo->lo_queue;
add_disk(disk);
sprintf(name, "loop/%d", i);
devfs_register(NULL, name, DEVFS_FL_DEFAULT,
disk->major, disk->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
disk->fops, NULL);
}
printk(KERN_INFO "loop: loaded (max %d devices)\n", max_loop);
return 0;
......@@ -1078,8 +1079,9 @@ void loop_exit(void)
for (i = 0; i < max_loop; i++) {
del_gendisk(disks[i]);
put_disk(disks[i]);
devfs_remove("loop/%d", i);
}
devfs_unregister(devfs_handle);
devfs_remove("loop");
if (unregister_blkdev(MAJOR_NR, "loop"))
printk(KERN_WARNING "loop: cannot unregister blkdev\n");
......
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