Commit d27edb65 authored by Trond Myklebust's avatar Trond Myklebust

Micro-optimization: rename rpc_lookup_path() as rpc_lookup_parent()

and drop the 'flags' argument (it was always set too LOOKUP_PARENT).

If the user supplies and empty path, return -ENOENT.
parent ebfd2036
...@@ -422,8 +422,10 @@ rpc_put_mount(void) ...@@ -422,8 +422,10 @@ rpc_put_mount(void)
} }
static int static int
rpc_lookup_path(char *path, struct nameidata *nd, int flags) rpc_lookup_parent(char *path, struct nameidata *nd)
{ {
if (path[0] == '\0')
return -ENOENT;
if (rpc_get_mount()) { if (rpc_get_mount()) {
printk(KERN_WARNING "%s: %s failed to mount " printk(KERN_WARNING "%s: %s failed to mount "
"pseudofilesystem \n", __FILE__, __FUNCTION__); "pseudofilesystem \n", __FILE__, __FUNCTION__);
...@@ -432,7 +434,7 @@ rpc_lookup_path(char *path, struct nameidata *nd, int flags) ...@@ -432,7 +434,7 @@ rpc_lookup_path(char *path, struct nameidata *nd, int flags)
nd->mnt = mntget(rpc_mount); nd->mnt = mntget(rpc_mount);
nd->dentry = dget(rpc_mount->mnt_root); nd->dentry = dget(rpc_mount->mnt_root);
nd->last_type = LAST_ROOT; nd->last_type = LAST_ROOT;
nd->flags = flags; nd->flags = LOOKUP_PARENT;
if (path_walk(path, nd)) { if (path_walk(path, nd)) {
printk(KERN_WARNING "%s: %s failed to find path %s\n", printk(KERN_WARNING "%s: %s failed to find path %s\n",
...@@ -594,7 +596,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd) ...@@ -594,7 +596,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
struct inode *dir; struct inode *dir;
int error; int error;
if ((error = rpc_lookup_path(path, nd, LOOKUP_PARENT)) != 0) if ((error = rpc_lookup_parent(path, nd)) != 0)
return ERR_PTR(error); return ERR_PTR(error);
dir = nd->dentry->d_inode; dir = nd->dentry->d_inode;
down(&dir->i_sem); down(&dir->i_sem);
...@@ -656,7 +658,7 @@ rpc_rmdir(char *path) ...@@ -656,7 +658,7 @@ rpc_rmdir(char *path)
struct inode *dir; struct inode *dir;
int error; int error;
if ((error = rpc_lookup_path(path, &nd, LOOKUP_PARENT)) != 0) if ((error = rpc_lookup_parent(path, &nd)) != 0)
return error; return error;
dir = nd.dentry->d_inode; dir = nd.dentry->d_inode;
down(&dir->i_sem); down(&dir->i_sem);
...@@ -716,7 +718,7 @@ rpc_unlink(char *path) ...@@ -716,7 +718,7 @@ rpc_unlink(char *path)
struct inode *dir; struct inode *dir;
int error; int error;
if ((error = rpc_lookup_path(path, &nd, LOOKUP_PARENT)) != 0) if ((error = rpc_lookup_parent(path, &nd)) != 0)
return error; return error;
dir = nd.dentry->d_inode; dir = nd.dentry->d_inode;
down(&dir->i_sem); down(&dir->i_sem);
......
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