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,
from = line_driver->symlink_from;
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 "
"returned %d\n", from, to, err);
......
......@@ -127,8 +127,7 @@ static int __init mmapper_init(void)
devfs_register (NULL, "mmapper", DEVFS_FL_DEFAULT,
30, 0, S_IFCHR | S_IRUGO | S_IWUGO,
&mmapper_fops, NULL);
devfs_mk_symlink(NULL, "mmapper0", DEVFS_FL_DEFAULT, "mmapper",
NULL, NULL);
devfs_mk_symlink("mmapper0", "mmapper");
return(0);
}
......
......@@ -1089,8 +1089,6 @@ static struct file_operations _ctl_fops = {
.owner = THIS_MODULE,
};
static devfs_handle_t _ctl_handle;
static struct miscdevice _dm_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = DM_NAME,
......@@ -1115,8 +1113,7 @@ int __init dm_interface_init(void)
return r;
}
r = devfs_mk_symlink(NULL, DM_DIR "/control", DEVFS_FL_DEFAULT,
"../misc/" DM_NAME, &_ctl_handle, NULL);
r = devfs_mk_symlink(DM_DIR "/control", "../misc/" DM_NAME);
if (r) {
DMERR("devfs_mk_symlink failed for control device");
goto failed;
......
......@@ -125,8 +125,8 @@ static int __init miropcm20_rds_init(void)
if (error)
return error;
error = devfs_mk_symlink(NULL, "v4l/rds/radiotext", 0,
"../misc/radiotext", NULL, NULL);
error = devfs_mk_symlink("v4l/rds/radiotext",
"../misc/radiotext");
if (error)
misc_deregister(&rds_miscdev);
......
......@@ -1607,8 +1607,7 @@ void devfs_unregister (devfs_handle_t de)
} /* End Function devfs_unregister */
static int devfs_do_symlink (devfs_handle_t dir, const char *name,
unsigned int flags, const char *link,
devfs_handle_t *handle, void *info)
const char *link, devfs_handle_t *handle)
{
int err;
unsigned int linklength;
......@@ -1638,7 +1637,7 @@ static int devfs_do_symlink (devfs_handle_t dir, const char *name,
kfree (newlink);
return -ENOTDIR;
}
de->info = info;
de->info = NULL;
de->u.symlink.linkname = newlink;
de->u.symlink.length = linklength;
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,
/**
* 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
* new name is relative to the root of the devfs.
* @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.
* @from: The name of the entry.
* @to: Name of the destination
*
* 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,
const char *link, devfs_handle_t *handle, void *info)
int devfs_mk_symlink(const char *from, const char *to)
{
int err;
devfs_handle_t de;
devfs_handle_t de;
int err;
if (handle != NULL) *handle = NULL;
DPRINTK (DEBUG_REGISTER, "(%s)\n", name);
err = devfs_do_symlink (dir, name, flags, link, &de, info);
if (err) return err;
if (handle == NULL) de->vfs_deletable = TRUE;
else *handle = de;
devfsd_notify (de, DEVFSD_NOTIFY_REGISTERED, flags & DEVFS_FL_WAIT);
return 0;
} /* End Function devfs_mk_symlink */
err = devfs_do_symlink(NULL, from, to, &de);
if (!err) {
de->vfs_deletable = TRUE;
devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED, 0);
}
return err;
}
/**
......@@ -2397,8 +2389,7 @@ static int devfs_symlink (struct inode *dir, struct dentry *dentry,
/* First try to get the devfs entry for this directory */
parent = get_devfs_entry_from_vfs_inode (dir);
if (parent == NULL) return -ENOENT;
err = devfs_do_symlink (parent, dentry->d_name.name, DEVFS_FL_NONE,
symname, &de, NULL);
err = devfs_do_symlink (parent, dentry->d_name.name, symname, &de);
DPRINTK (DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n",
dentry->d_name.name, err);
if (err < 0) return err;
......
......@@ -87,7 +87,6 @@
int devfs_register_tape (devfs_handle_t de)
{
int pos;
devfs_handle_t slave;
char name[32], dest[64];
static unsigned int tape_counter;
int n = tape_counter++;
......@@ -96,7 +95,7 @@ int devfs_register_tape (devfs_handle_t de)
if (pos < 0) return -1;
strncpy (dest + pos, "../", 3);
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;
} /* End Function devfs_register_tape */
EXPORT_SYMBOL(devfs_register_tape);
......
......@@ -185,7 +185,7 @@ static void devfs_create_partitions(struct gendisk *dev)
{
#ifdef CONFIG_DEVFS_FS
int pos = 0;
devfs_handle_t dir, slave;
devfs_handle_t dir;
char dirname[64], symlink[16];
if (dev->flags & GENHD_FL_DEVFS) {
......@@ -205,8 +205,7 @@ static void devfs_create_partitions(struct gendisk *dev)
}
dev->number = devfs_alloc_unique_number (&disc_numspace);
sprintf(symlink, "discs/disc%d", dev->number);
devfs_mk_symlink(NULL, symlink, DEVFS_FL_DEFAULT,
dirname + pos, &slave, NULL);
devfs_mk_symlink(symlink, dirname + pos);
dev->disk_de = devfs_register(dir, "disc", 0,
dev->major, dev->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL);
......@@ -222,7 +221,6 @@ static void devfs_create_cdrom(struct gendisk *dev)
sprintf(vname, "cdroms/cdrom%d", dev->number);
if (dev->de) {
int pos;
devfs_handle_t slave;
char rname[64];
dev->disk_de = devfs_register(dev->de, "cd", DEVFS_FL_DEFAULT,
......@@ -233,8 +231,7 @@ static void devfs_create_cdrom(struct gendisk *dev)
pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3);
if (pos >= 0) {
strncpy(rname + pos, "../", 3);
devfs_mk_symlink(NULL, vname, DEVFS_FL_DEFAULT,
rname + pos, &slave, NULL);
devfs_mk_symlink(vname, rname + pos);
}
} else {
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,
unsigned int major, unsigned int minor,
umode_t mode, void *ops, void *info);
extern void devfs_unregister (devfs_handle_t de);
extern int devfs_mk_symlink (devfs_handle_t dir, const char *name,
unsigned int flags, const char *link,
devfs_handle_t *handle, void *info);
extern int devfs_mk_symlink (const char *name, const char *link);
extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name,
void *info);
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)
{
return;
}
static inline int devfs_mk_symlink (devfs_handle_t dir, const char *name,
unsigned int flags, const char *link,
devfs_handle_t *handle, void *info)
static inline int devfs_mk_symlink (const char *name, const char *link)
{
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