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) ...@@ -6318,7 +6318,7 @@ static int idetape_attach (ide_drive_t *drive)
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&idetape_fops, NULL); &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; drive->disk->fops = &idetape_block_ops;
return 0; return 0;
failed: failed:
......
...@@ -5571,7 +5571,7 @@ static int osst_attach(Scsi_Device * SDp) ...@@ -5571,7 +5571,7 @@ static int osst_attach(Scsi_Device * SDp)
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&osst_fops, NULL); &osst_fops, NULL);
} }
drive->number = devfs_register_tape (SDp->de); drive->number = devfs_register_tape(SDp->devfs_name);
printk(KERN_INFO printk(KERN_INFO
"osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n", "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) ...@@ -3909,7 +3909,7 @@ static int st_attach(Scsi_Device * SDp)
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
&st_fops, NULL); &st_fops, NULL);
} }
disk->number = devfs_register_tape(SDp->de); disk->number = devfs_register_tape(SDp->devfs_name);
printk(KERN_WARNING printk(KERN_WARNING
"Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n", "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
......
...@@ -77,28 +77,18 @@ ...@@ -77,28 +77,18 @@
#define PRINTK(format, args...) \ #define PRINTK(format, args...) \
{printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);} {printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);}
int devfs_register_tape(const char *name)
/* 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 pos; char tname[32], dest[64];
char name[32], dest[64];
static unsigned int tape_counter; 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; return n;
} /* End Function devfs_register_tape */ }
EXPORT_SYMBOL(devfs_register_tape); EXPORT_SYMBOL(devfs_register_tape);
void devfs_unregister_tape(int num) void devfs_unregister_tape(int num)
......
...@@ -32,7 +32,7 @@ extern devfs_handle_t devfs_mk_dir(const char *fmt, ...) ...@@ -32,7 +32,7 @@ extern devfs_handle_t devfs_mk_dir(const char *fmt, ...)
extern void devfs_remove(const char *fmt, ...) extern void devfs_remove(const char *fmt, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));
extern int devfs_generate_path (devfs_handle_t de, char *path, int buflen); 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_unregister_tape(int num);
extern void devfs_create_partitions(struct gendisk *dev); extern void devfs_create_partitions(struct gendisk *dev);
extern void devfs_create_cdrom(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