Commit 3563104e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] devfs_mk_symlink simplification

All devfs_mk_symlink arguments except the from and to strings are
unused.  Bring the prototype in shape.
parent 81e1b9a1
...@@ -438,7 +438,7 @@ void line_register_devfs(struct lines *set, struct line_driver *line_driver, ...@@ -438,7 +438,7 @@ void line_register_devfs(struct lines *set, struct line_driver *line_driver,
from = line_driver->symlink_from; from = line_driver->symlink_from;
to = line_driver->symlink_to; to = line_driver->symlink_to;
err = devfs_mk_symlink(NULL, from, 0, to, NULL, NULL); err = devfs_mk_symlink(from, to);
if(err) printk("Symlink creation from /dev/%s to /dev/%s " if(err) printk("Symlink creation from /dev/%s to /dev/%s "
"returned %d\n", from, to, err); "returned %d\n", from, to, err);
......
...@@ -127,8 +127,7 @@ static int __init mmapper_init(void) ...@@ -127,8 +127,7 @@ static int __init mmapper_init(void)
devfs_register (NULL, "mmapper", DEVFS_FL_DEFAULT, devfs_register (NULL, "mmapper", DEVFS_FL_DEFAULT,
30, 0, S_IFCHR | S_IRUGO | S_IWUGO, 30, 0, S_IFCHR | S_IRUGO | S_IWUGO,
&mmapper_fops, NULL); &mmapper_fops, NULL);
devfs_mk_symlink(NULL, "mmapper0", DEVFS_FL_DEFAULT, "mmapper", devfs_mk_symlink("mmapper0", "mmapper");
NULL, NULL);
return(0); return(0);
} }
......
...@@ -1089,8 +1089,6 @@ static struct file_operations _ctl_fops = { ...@@ -1089,8 +1089,6 @@ static struct file_operations _ctl_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static devfs_handle_t _ctl_handle;
static struct miscdevice _dm_misc = { static struct miscdevice _dm_misc = {
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.name = DM_NAME, .name = DM_NAME,
...@@ -1115,8 +1113,7 @@ int __init dm_interface_init(void) ...@@ -1115,8 +1113,7 @@ int __init dm_interface_init(void)
return r; return r;
} }
r = devfs_mk_symlink(NULL, DM_DIR "/control", DEVFS_FL_DEFAULT, r = devfs_mk_symlink(DM_DIR "/control", "../misc/" DM_NAME);
"../misc/" DM_NAME, &_ctl_handle, NULL);
if (r) { if (r) {
DMERR("devfs_mk_symlink failed for control device"); DMERR("devfs_mk_symlink failed for control device");
goto failed; goto failed;
......
...@@ -125,8 +125,8 @@ static int __init miropcm20_rds_init(void) ...@@ -125,8 +125,8 @@ static int __init miropcm20_rds_init(void)
if (error) if (error)
return error; return error;
error = devfs_mk_symlink(NULL, "v4l/rds/radiotext", 0, error = devfs_mk_symlink("v4l/rds/radiotext",
"../misc/radiotext", NULL, NULL); "../misc/radiotext");
if (error) if (error)
misc_deregister(&rds_miscdev); misc_deregister(&rds_miscdev);
......
...@@ -1607,8 +1607,7 @@ void devfs_unregister (devfs_handle_t de) ...@@ -1607,8 +1607,7 @@ void devfs_unregister (devfs_handle_t de)
} /* End Function devfs_unregister */ } /* End Function devfs_unregister */
static int devfs_do_symlink (devfs_handle_t dir, const char *name, static int devfs_do_symlink (devfs_handle_t dir, const char *name,
unsigned int flags, const char *link, const char *link, devfs_handle_t *handle)
devfs_handle_t *handle, void *info)
{ {
int err; int err;
unsigned int linklength; unsigned int linklength;
...@@ -1638,7 +1637,7 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name, ...@@ -1638,7 +1637,7 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name,
kfree (newlink); kfree (newlink);
return -ENOTDIR; return -ENOTDIR;
} }
de->info = info; de->info = NULL;
de->u.symlink.linkname = newlink; de->u.symlink.linkname = newlink;
de->u.symlink.length = linklength; de->u.symlink.length = linklength;
if ( ( err = _devfs_append_entry (dir, de, NULL) ) != 0 ) if ( ( err = _devfs_append_entry (dir, de, NULL) ) != 0 )
...@@ -1660,32 +1659,25 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name, ...@@ -1660,32 +1659,25 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name,
/** /**
* devfs_mk_symlink Create a symbolic link in the devfs namespace. * devfs_mk_symlink Create a symbolic link in the devfs namespace.
* @dir: The handle to the parent devfs directory entry. If this is %NULL the * @from: The name of the entry.
* new name is relative to the root of the devfs. * @to: Name of the destination
* @name: The name of the entry.
* @flags: A set of bitwise-ORed flags (DEVFS_FL_*).
* @link: The destination name.
* @handle: The handle to the symlink entry is written here. This may be %NULL.
* @info: An arbitrary pointer which will be associated with the entry.
* *
* Returns 0 on success, else a negative error code is returned. * Returns 0 on success, else a negative error code is returned.
*/ */
int devfs_mk_symlink (devfs_handle_t dir, const char *name, unsigned int flags, int devfs_mk_symlink(const char *from, const char *to)
const char *link, devfs_handle_t *handle, void *info)
{ {
int err; devfs_handle_t de;
devfs_handle_t de; int err;
if (handle != NULL) *handle = NULL; err = devfs_do_symlink(NULL, from, to, &de);
DPRINTK (DEBUG_REGISTER, "(%s)\n", name); if (!err) {
err = devfs_do_symlink (dir, name, flags, link, &de, info); de->vfs_deletable = TRUE;
if (err) return err; devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED, 0);
if (handle == NULL) de->vfs_deletable = TRUE; }
else *handle = de;
devfsd_notify (de, DEVFSD_NOTIFY_REGISTERED, flags & DEVFS_FL_WAIT); return err;
return 0; }
} /* End Function devfs_mk_symlink */
/** /**
...@@ -2397,8 +2389,7 @@ static int devfs_symlink (struct inode *dir, struct dentry *dentry, ...@@ -2397,8 +2389,7 @@ static int devfs_symlink (struct inode *dir, struct dentry *dentry,
/* First try to get the devfs entry for this directory */ /* First try to get the devfs entry for this directory */
parent = get_devfs_entry_from_vfs_inode (dir); parent = get_devfs_entry_from_vfs_inode (dir);
if (parent == NULL) return -ENOENT; if (parent == NULL) return -ENOENT;
err = devfs_do_symlink (parent, dentry->d_name.name, DEVFS_FL_NONE, err = devfs_do_symlink (parent, dentry->d_name.name, symname, &de);
symname, &de, NULL);
DPRINTK (DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n", DPRINTK (DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n",
dentry->d_name.name, err); dentry->d_name.name, err);
if (err < 0) return err; if (err < 0) return err;
......
...@@ -87,7 +87,6 @@ ...@@ -87,7 +87,6 @@
int devfs_register_tape (devfs_handle_t de) int devfs_register_tape (devfs_handle_t de)
{ {
int pos; int pos;
devfs_handle_t slave;
char name[32], dest[64]; char name[32], dest[64];
static unsigned int tape_counter; static unsigned int tape_counter;
int n = tape_counter++; int n = tape_counter++;
...@@ -96,7 +95,7 @@ int devfs_register_tape (devfs_handle_t de) ...@@ -96,7 +95,7 @@ int devfs_register_tape (devfs_handle_t de)
if (pos < 0) return -1; if (pos < 0) return -1;
strncpy (dest + pos, "../", 3); strncpy (dest + pos, "../", 3);
sprintf (name, "tapes/tape%u", n); sprintf (name, "tapes/tape%u", n);
devfs_mk_symlink (NULL, name, DEVFS_FL_DEFAULT, dest + pos, &slave, NULL); devfs_mk_symlink (name, dest + pos);
return n; return n;
} /* End Function devfs_register_tape */ } /* End Function devfs_register_tape */
EXPORT_SYMBOL(devfs_register_tape); EXPORT_SYMBOL(devfs_register_tape);
......
...@@ -185,7 +185,7 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -185,7 +185,7 @@ static void devfs_create_partitions(struct gendisk *dev)
{ {
#ifdef CONFIG_DEVFS_FS #ifdef CONFIG_DEVFS_FS
int pos = 0; int pos = 0;
devfs_handle_t dir, slave; devfs_handle_t dir;
char dirname[64], symlink[16]; char dirname[64], symlink[16];
if (dev->flags & GENHD_FL_DEVFS) { if (dev->flags & GENHD_FL_DEVFS) {
...@@ -205,8 +205,7 @@ static void devfs_create_partitions(struct gendisk *dev) ...@@ -205,8 +205,7 @@ static void devfs_create_partitions(struct gendisk *dev)
} }
dev->number = devfs_alloc_unique_number (&disc_numspace); dev->number = devfs_alloc_unique_number (&disc_numspace);
sprintf(symlink, "discs/disc%d", dev->number); sprintf(symlink, "discs/disc%d", dev->number);
devfs_mk_symlink(NULL, symlink, DEVFS_FL_DEFAULT, devfs_mk_symlink(symlink, dirname + pos);
dirname + pos, &slave, NULL);
dev->disk_de = devfs_register(dir, "disc", 0, dev->disk_de = devfs_register(dir, "disc", 0,
dev->major, dev->first_minor, dev->major, dev->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL);
...@@ -222,7 +221,6 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -222,7 +221,6 @@ static void devfs_create_cdrom(struct gendisk *dev)
sprintf(vname, "cdroms/cdrom%d", dev->number); sprintf(vname, "cdroms/cdrom%d", dev->number);
if (dev->de) { if (dev->de) {
int pos; int pos;
devfs_handle_t slave;
char rname[64]; char rname[64];
dev->disk_de = devfs_register(dev->de, "cd", DEVFS_FL_DEFAULT, dev->disk_de = devfs_register(dev->de, "cd", DEVFS_FL_DEFAULT,
...@@ -233,8 +231,7 @@ static void devfs_create_cdrom(struct gendisk *dev) ...@@ -233,8 +231,7 @@ static void devfs_create_cdrom(struct gendisk *dev)
pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3); pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3);
if (pos >= 0) { if (pos >= 0) {
strncpy(rname + pos, "../", 3); strncpy(rname + pos, "../", 3);
devfs_mk_symlink(NULL, vname, DEVFS_FL_DEFAULT, devfs_mk_symlink(vname, rname + pos);
rname + pos, &slave, NULL);
} }
} else { } else {
dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT, dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT,
......
...@@ -41,9 +41,7 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, ...@@ -41,9 +41,7 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
unsigned int major, unsigned int minor, unsigned int major, unsigned int minor,
umode_t mode, void *ops, void *info); umode_t mode, void *ops, void *info);
extern void devfs_unregister (devfs_handle_t de); extern void devfs_unregister (devfs_handle_t de);
extern int devfs_mk_symlink (devfs_handle_t dir, const char *name, extern int devfs_mk_symlink (const char *name, const char *link);
unsigned int flags, const char *link,
devfs_handle_t *handle, void *info);
extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name, extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name,
void *info); void *info);
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);
...@@ -78,9 +76,7 @@ static inline void devfs_unregister (devfs_handle_t de) ...@@ -78,9 +76,7 @@ static inline void devfs_unregister (devfs_handle_t de)
{ {
return; return;
} }
static inline int devfs_mk_symlink (devfs_handle_t dir, const char *name, static inline int devfs_mk_symlink (const char *name, const char *link)
unsigned int flags, const char *link,
devfs_handle_t *handle, void *info)
{ {
return 0; return 0;
} }
......
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