Commit fe4268fc authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] devfs: uml

parent 33e2f222
...@@ -106,8 +106,6 @@ struct ubd { ...@@ -106,8 +106,6 @@ struct ubd {
__u64 size; __u64 size;
struct openflags boot_openflags; struct openflags boot_openflags;
struct openflags openflags; struct openflags openflags;
devfs_handle_t real;
devfs_handle_t fake;
struct cow cow; struct cow cow;
}; };
...@@ -127,8 +125,6 @@ struct ubd { ...@@ -127,8 +125,6 @@ struct ubd {
.size = -1, \ .size = -1, \
.boot_openflags = OPEN_FLAGS, \ .boot_openflags = OPEN_FLAGS, \
.openflags = OPEN_FLAGS, \ .openflags = OPEN_FLAGS, \
.real = NULL, \
.fake = NULL, \
.cow = DEFAULT_COW, \ .cow = DEFAULT_COW, \
} }
...@@ -485,8 +481,8 @@ static int ubd_open_dev(struct ubd *dev) ...@@ -485,8 +481,8 @@ static int ubd_open_dev(struct ubd *dev)
} }
static int ubd_new_disk(int major, u64 size, char *name, int unit, static int ubd_new_disk(int major, u64 size, char *name, int unit,
struct gendisk **disk_out, devfs_handle_t dir_handle, struct gendisk **disk_out)
devfs_handle_t *handle_out)
{ {
char devfs_name[sizeof("ubd/nnnnnn\0")]; char devfs_name[sizeof("ubd/nnnnnn\0")];
struct gendisk *disk; struct gendisk *disk;
...@@ -516,10 +512,6 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit, ...@@ -516,10 +512,6 @@ static int ubd_new_disk(int major, u64 size, char *name, int unit,
return(0); return(0);
} }
/* Initialized in an initcall, and unchanged thereafter */
devfs_handle_t ubd_dir_handle;
devfs_handle_t ubd_fake_dir_handle;
static int ubd_add(int n) static int ubd_add(int n)
{ {
struct ubd *dev = &ubd_dev[n]; struct ubd *dev = &ubd_dev[n];
...@@ -538,15 +530,13 @@ static int ubd_add(int n) ...@@ -538,15 +530,13 @@ static int ubd_add(int n)
if(err) if(err)
return(err); return(err);
err = ubd_new_disk(MAJOR_NR, dev->size, "ubd", n, &ubd_gendisk[n], err = ubd_new_disk(MAJOR_NR, dev->size, "ubd", n, &ubd_gendisk[n]);
ubd_dir_handle, &dev->real);
if(err) if(err)
return(err); return(err);
if(fake_major) if(fake_major)
ubd_new_disk(fake_major, dev->size, "ubd%d", n, ubd_new_disk(fake_major, dev->size, "ubd%d", n,
&fake_gendisk[n], ubd_fake_dir_handle, &fake_gendisk[n]);
&dev->fake);
/* perhaps this should also be under the "if (fake_major)" above */ /* perhaps this should also be under the "if (fake_major)" above */
/* using the fake_disk->disk_name and also the fakehd_set name */ /* using the fake_disk->disk_name and also the fakehd_set name */
...@@ -645,15 +635,13 @@ static int ubd_remove(char *str) ...@@ -645,15 +635,13 @@ static int ubd_remove(char *str)
del_gendisk(ubd_gendisk[n]); del_gendisk(ubd_gendisk[n]);
put_disk(ubd_gendisk[n]); put_disk(ubd_gendisk[n]);
ubd_gendisk[n] = NULL; ubd_gendisk[n] = NULL;
if(dev->real != NULL) devfs_remove("ubd/%d", n);
devfs_unregister(dev->real);
if(fake_gendisk[n] != NULL){ if(fake_gendisk[n] != NULL){
del_gendisk(fake_gendisk[n]); del_gendisk(fake_gendisk[n]);
put_disk(fake_gendisk[n]); put_disk(fake_gendisk[n]);
fake_gendisk[n] = NULL; fake_gendisk[n] = NULL;
if(dev->fake != NULL) devfs_remove("ubd/%d", n);
devfs_unregister(dev->fake);
} }
*dev = ((struct ubd) DEFAULT_UBD); *dev = ((struct ubd) DEFAULT_UBD);
...@@ -682,7 +670,7 @@ int ubd_init(void) ...@@ -682,7 +670,7 @@ int ubd_init(void)
{ {
int i; int i;
ubd_dir_handle = devfs_mk_dir("ubd"); devfs_mk_dir("ubd");
if (register_blkdev(MAJOR_NR, "ubd")) if (register_blkdev(MAJOR_NR, "ubd"))
return -1; return -1;
...@@ -693,7 +681,7 @@ int ubd_init(void) ...@@ -693,7 +681,7 @@ int ubd_init(void)
char name[sizeof("ubd_nnn\0")]; char name[sizeof("ubd_nnn\0")];
snprintf(name, sizeof(name), "ubd_%d", fake_major); snprintf(name, sizeof(name), "ubd_%d", fake_major);
ubd_fake_dir_handle = devfs_mk_dir(name); devfs_mk_dir(name);
if (register_blkdev(fake_major, "ubd")) if (register_blkdev(fake_major, "ubd"))
return -1; return -1;
} }
......
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