Commit 118ecb9e authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] gendisk for pcd

pcd switched to use of gendisk
parent 67cba4d4
......@@ -224,6 +224,7 @@ struct pcd_unit {
int present; /* does this unit exist ? */
char *name; /* pcd0, pcd1, etc */
struct cdrom_device_info info; /* uniform cdrom interface */
struct gendisk disk;
};
struct pcd_unit pcd[PCD_UNITS];
......@@ -282,6 +283,7 @@ static void pcd_init_units(void)
pcd_drive_count = 0;
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
struct gendisk *disk = &cd->disk;
cd->pi = &cd->pia;
cd->present = 0;
cd->last_sense = 0;
......@@ -298,6 +300,11 @@ static void pcd_init_units(void)
cd->info.speed = 0;
cd->info.capacity = 1;
cd->info.mask = 0;
disk->major = major;
disk->first_minor = unit;
disk->minor_shift = 0;
disk->major_name = cd->name;
disk->fops = &pcd_bdops;
}
}
......@@ -925,8 +932,15 @@ static int __init pcd_init(void)
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
if (cd->present) {
struct gendisk *disk = &cd->disk;
register_cdrom(&cd->info);
devfs_plain_cdrom(&cd->info, &pcd_bdops);
devfs_plain_cdrom(&cd->info, disk->fops);
add_gendisk(disk);
register_disk(disk,
mk_kdev(disk->major,disk->first_minor),
1<<disk->minor_shift,
disk->fops,
0);
}
}
......@@ -942,6 +956,7 @@ static void __exit pcd_exit(void)
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
if (cd->present) {
del_gendisk(&cd->disk);
pi_release(cd->pi);
unregister_cdrom(&cd->info);
}
......
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