Commit 22e07d66 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jeff Garzik

[PATCH] devfs: sanitize devfs_register_tape prototype

Pass in the path directly instead of getting it from a devfs_handle_t.
parent 7bdc8e54
......@@ -6318,7 +6318,7 @@ static int idetape_attach (ide_drive_t *drive)
S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL);
drive->disk->number = devfs_register_tape(drive->de);
drive->disk->number = devfs_register_tape(drive->devfs_name);
drive->disk->fops = &idetape_block_ops;
return 0;
failed:
......
......@@ -5571,7 +5571,7 @@ static int osst_attach(Scsi_Device * SDp)
S_IFCHR | S_IRUGO | S_IWUGO,
&osst_fops, NULL);
}
drive->number = devfs_register_tape (SDp->de);
drive->number = devfs_register_tape(SDp->devfs_name);
printk(KERN_INFO
"osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n",
......
......@@ -3909,7 +3909,7 @@ static int st_attach(Scsi_Device * SDp)
S_IFCHR | S_IRUGO | S_IWUGO,
&st_fops, NULL);
}
disk->number = devfs_register_tape(SDp->de);
disk->number = devfs_register_tape(SDp->devfs_name);
printk(KERN_WARNING
"Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
......
......@@ -77,28 +77,18 @@
#define PRINTK(format, args...) \
{printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);}
/* Private functions follow */
/**
* devfs_register_tape - Register a tape device in the "/dev/tapes" hierarchy.
* @de: Any tape device entry in the device directory.
*/
int devfs_register_tape (devfs_handle_t de)
int devfs_register_tape(const char *name)
{
int pos;
char name[32], dest[64];
char tname[32], dest[64];
static unsigned int tape_counter;
int n = tape_counter++;
unsigned int n = tape_counter++;
sprintf(dest, "../%s", name);
sprintf(tname, "tapes/tape%u", n);
devfs_mk_symlink(tname, dest);
pos = devfs_generate_path (de, dest + 3, sizeof dest - 3);
if (pos < 0) return -1;
strncpy (dest + pos, "../", 3);
sprintf (name, "tapes/tape%u", n);
devfs_mk_symlink (name, dest + pos);
return n;
} /* End Function devfs_register_tape */
}
EXPORT_SYMBOL(devfs_register_tape);
void devfs_unregister_tape(int num)
......
......@@ -32,7 +32,7 @@ extern devfs_handle_t devfs_mk_dir(const char *fmt, ...)
extern void devfs_remove(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
extern int devfs_generate_path (devfs_handle_t de, char *path, int buflen);
extern int devfs_register_tape (devfs_handle_t de);
extern int devfs_register_tape(const char *name);
extern void devfs_unregister_tape(int num);
extern void devfs_create_partitions(struct gendisk *dev);
extern void devfs_create_cdrom(struct gendisk *dev);
......
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