Commit ee73954c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jeff Garzik

[PATCH] devfs: cleanup devfs use in ide

Store the path of it's devfs directory in ide_drive_t.  Use
it in the devfs_register calls instead of the devfs_handle_t
which will go away soon.
parent b8a7b080
......@@ -1289,7 +1289,6 @@ static void init_gendisk (ide_hwif_t *hwif)
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t * drive = &hwif->drives[unit];
char name[64];
ide_add_generic_settings(drive);
snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
hwif->index,unit);
......@@ -1298,13 +1297,13 @@ static void init_gendisk (ide_hwif_t *hwif)
drive->gendev.parent = &hwif->gendev;
drive->gendev.bus = &ide_bus_type;
drive->gendev.driver_data = drive;
sprintf (name, "ide/host%d/bus%d/target%d/lun%d",
(hwif->channel && hwif->mate) ?
hwif->mate->index : hwif->index,
hwif->channel, unit, drive->lun);
if (drive->present) {
device_register(&drive->gendev);
drive->de = devfs_mk_dir(name);
sprintf(drive->devfs_name, "ide/host%d/bus%d/target%d/lun%d",
(hwif->channel && hwif->mate) ?
hwif->mate->index : hwif->index,
hwif->channel, unit, drive->lun);
drive->de = devfs_mk_dir(drive->devfs_name);
}
}
blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
......
......@@ -866,8 +866,6 @@ typedef struct {
*/
typedef struct {
ide_drive_t *drive;
devfs_handle_t de_r, de_n;
/*
* Since a typical character device operation requires more
* than one packet command, we provide here enough memory
......@@ -6170,8 +6168,8 @@ static int idetape_cleanup (ide_drive_t *drive)
DRIVER(drive)->busy = 0;
(void) ide_unregister_subdriver(drive);
drive->driver_data = NULL;
devfs_unregister(tape->de_r);
devfs_unregister(tape->de_n);
devfs_remove("%s/mt");
devfs_remove("%s/mtn");
devfs_unregister_tape(drive->disk->number);
kfree (tape);
drive->disk->fops = ide_fops;
......@@ -6272,6 +6270,7 @@ static struct block_device_operations idetape_block_ops = {
static int idetape_attach (ide_drive_t *drive)
{
idetape_tape_t *tape;
char devfs_name[64];
int minor;
if (!strstr("ide-tape", drive->driver_req))
......@@ -6306,16 +6305,19 @@ static int idetape_attach (ide_drive_t *drive)
;
idetape_setup(drive, tape, minor);
idetape_chrdevs[minor].drive = drive;
tape->de_r =
devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
tape->de_n =
devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
HWIF(drive)->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
sprintf(devfs_name, "%s/mt", drive->devfs_name);
tape->de_r = devfs_register (NULL, devfs_name, 0,
HWIF(drive)->major, minor,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
sprintf(devfs_name, "%s/mtn", drive->devfs_name);
tape->de_n = devfs_register (NULL, devfs_name, 0,
HWIF(drive)->major, minor + 128,
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
drive->disk->number = devfs_register_tape(drive->de);
drive->disk->fops = &idetape_block_ops;
return 0;
......
......@@ -650,9 +650,9 @@ void ide_unregister (unsigned int index)
*/
for (i = 0; i < MAX_DRIVES; ++i) {
drive = &hwif->drives[i];
if (drive->de) {
devfs_unregister(drive->de);
drive->de = NULL;
if (drive->devfs_name[0] != '\0') {
devfs_remove(drive->devfs_name);
drive->devfs_name[0] = '\0';
}
if (!drive->present)
continue;
......
......@@ -699,7 +699,8 @@ typedef struct ide_drive_s {
struct hd_driveid *id; /* drive model identification info */
struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
struct ide_settings_s *settings;/* /proc/ide/ drive settings */
devfs_handle_t de; /* directory for device */
char devfs_name[64]; /* devfs crap */
devfs_handle_t de; /* will go away soon */
struct hwif_s *hwif; /* actually (ide_hwif_t *) */
......
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