Commit f350db2c authored by Alexander Viro's avatar Alexander Viro Committed by Jens Axboe

[PATCH] eliminated use of devfs_auto_unregister() in checks.c

parent 8e96b6e0
...@@ -163,7 +163,7 @@ static void devfs_register_partition(struct gendisk *dev, int part) ...@@ -163,7 +163,7 @@ static void devfs_register_partition(struct gendisk *dev, int part)
if (p[part-1].de) if (p[part-1].de)
return; return;
dir = devfs_get_parent(dev->disk_de); dir = dev->de;
if (!dir) if (!dir)
return; return;
if (dev->flags & GENHD_FL_REMOVABLE) if (dev->flags & GENHD_FL_REMOVABLE)
...@@ -178,7 +178,6 @@ static void devfs_register_partition(struct gendisk *dev, int part) ...@@ -178,7 +178,6 @@ static void devfs_register_partition(struct gendisk *dev, int part)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER; static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER;
static devfs_handle_t cdroms;
static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER; static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER;
#endif #endif
...@@ -189,7 +188,6 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -189,7 +188,6 @@ static void devfs_create_partitions(struct gendisk *dev)
devfs_handle_t dir, slave; devfs_handle_t dir, slave;
unsigned int devfs_flags = DEVFS_FL_DEFAULT; unsigned int devfs_flags = DEVFS_FL_DEFAULT;
char dirname[64], symlink[16]; char dirname[64], symlink[16];
static devfs_handle_t devfs_handle;
if (dev->flags & GENHD_FL_REMOVABLE) if (dev->flags & GENHD_FL_REMOVABLE)
devfs_flags |= DEVFS_FL_REMOVABLE; devfs_flags |= DEVFS_FL_REMOVABLE;
...@@ -206,19 +204,15 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -206,19 +204,15 @@ static void devfs_create_partitions(struct gendisk *dev)
sprintf(dirname, "../%s/disc%d", dev->disk_name, sprintf(dirname, "../%s/disc%d", dev->disk_name,
dev->first_minor >> dev->minor_shift); dev->first_minor >> dev->minor_shift);
dir = devfs_mk_dir(NULL, dirname + 3, NULL); dir = devfs_mk_dir(NULL, dirname + 3, NULL);
dev->de = dir;
} }
if (!devfs_handle)
devfs_handle = devfs_mk_dir(NULL, "discs", NULL);
dev->number = devfs_alloc_unique_number (&disc_numspace); dev->number = devfs_alloc_unique_number (&disc_numspace);
sprintf(symlink, "disc%d", dev->number); sprintf(symlink, "discs/disc%d", dev->number);
devfs_mk_symlink (devfs_handle, symlink, DEVFS_FL_DEFAULT, devfs_mk_symlink(NULL, symlink, DEVFS_FL_DEFAULT,
dirname + pos, &slave, NULL); dirname + pos, &slave, NULL);
dev->disk_de = devfs_register(dir, "disc", devfs_flags, dev->disk_de = devfs_register(dir, "disc", devfs_flags,
dev->major, dev->first_minor, dev->major, dev->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL);
devfs_auto_unregister(dev->disk_de, slave);
if (!(dev->flags & GENHD_FL_DEVFS))
devfs_auto_unregister (slave, dir);
#endif #endif
} }
...@@ -227,11 +221,8 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -227,11 +221,8 @@ static void devfs_create_cdrom(struct gendisk *dev)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
char vname[23]; char vname[23];
if (!cdroms)
cdroms = devfs_mk_dir (NULL, "cdroms", NULL);
dev->number = devfs_alloc_unique_number(&cdrom_numspace); dev->number = devfs_alloc_unique_number(&cdrom_numspace);
sprintf(vname, "cdrom%d", dev->number); sprintf(vname, "cdroms/cdrom%d", dev->number);
if (dev->de) { if (dev->de) {
int pos; int pos;
devfs_handle_t slave; devfs_handle_t slave;
...@@ -245,10 +236,8 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -245,10 +236,8 @@ static void devfs_create_cdrom(struct gendisk *dev)
pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3); pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3);
if (pos >= 0) { if (pos >= 0) {
strncpy(rname + pos, "../", 3); strncpy(rname + pos, "../", 3);
devfs_mk_symlink(cdroms, vname, devfs_mk_symlink(NULL, vname, DEVFS_FL_DEFAULT,
DEVFS_FL_DEFAULT,
rname + pos, &slave, NULL); rname + pos, &slave, NULL);
devfs_auto_unregister(dev->de, slave);
} }
} else { } else {
dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT, dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT,
...@@ -264,10 +253,22 @@ static void devfs_remove_partitions(struct gendisk *dev) ...@@ -264,10 +253,22 @@ static void devfs_remove_partitions(struct gendisk *dev)
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
devfs_unregister(dev->disk_de); devfs_unregister(dev->disk_de);
dev->disk_de = NULL; dev->disk_de = NULL;
if (dev->flags & GENHD_FL_CD) if (dev->flags & GENHD_FL_CD) {
char name[64];
sprintf(name, "cdroms/cdrom%d", dev->number);
if (dev->de)
devfs_find_and_unregister(NULL, name, 0, 0, 0, 0);
devfs_dealloc_unique_number(&cdrom_numspace, dev->number); devfs_dealloc_unique_number(&cdrom_numspace, dev->number);
else } else {
char name[64];
sprintf(name, "discs/disc%d", dev->number);
devfs_find_and_unregister(NULL, name, 0, 0, 0, 0);
if (!(dev->flags & GENHD_FL_DEVFS)) {
devfs_unregister(dev->de);
dev->de = NULL;
}
devfs_dealloc_unique_number(&disc_numspace, dev->number); devfs_dealloc_unique_number(&disc_numspace, dev->number);
}
#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