[PATCH] remove duplicate get_dentry functions in various places
Various filesystem drivers have grown a get_dentry() function that's a duplicate of lookup_one_len, except that it doesn't take a maximum length argument and doesn't check for \0 or / in the passed in filename. Switch all these places to use lookup_one_len. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Greg KH <greg@kroah.com> Cc: Paul Jackson <pj@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
ac20427ef6
commit
5f45f1a78f
+3
-2
@@ -8,6 +8,7 @@
|
||||
#include <linux/mount.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/namei.h>
|
||||
#include "sysfs.h"
|
||||
|
||||
DECLARE_RWSEM(sysfs_rename_sem);
|
||||
@@ -99,7 +100,7 @@ static int create_dir(struct kobject * k, struct dentry * p,
|
||||
umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
|
||||
|
||||
down(&p->d_inode->i_sem);
|
||||
*d = sysfs_get_dentry(p,n);
|
||||
*d = lookup_one_len(n, p, strlen(n));
|
||||
if (!IS_ERR(*d)) {
|
||||
error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, SYSFS_DIR);
|
||||
if (!error) {
|
||||
@@ -315,7 +316,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
|
||||
|
||||
down(&parent->d_inode->i_sem);
|
||||
|
||||
new_dentry = sysfs_get_dentry(parent, new_name);
|
||||
new_dentry = lookup_one_len(new_name, parent, strlen(new_name));
|
||||
if (!IS_ERR(new_dentry)) {
|
||||
if (!new_dentry->d_inode) {
|
||||
error = kobject_set_name(kobj, "%s", new_name);
|
||||
|
||||
Reference in New Issue
Block a user