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