Commit 1c5fedbb authored by Al Viro's avatar Al Viro

ncp_lookup(): use d_splice_alias()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 293542d8
...@@ -823,12 +823,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig ...@@ -823,12 +823,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
struct ncp_server *server = NCP_SERVER(dir); struct ncp_server *server = NCP_SERVER(dir);
struct inode *inode = NULL; struct inode *inode = NULL;
struct ncp_entry_info finfo; struct ncp_entry_info finfo;
int error, res, len; int res, len;
__u8 __name[NCP_MAXPATHLEN + 1]; __u8 __name[NCP_MAXPATHLEN + 1];
error = -EIO;
if (!ncp_conn_valid(server)) if (!ncp_conn_valid(server))
goto finished; return ERR_PTR(-EIO);
ncp_vdbg("server lookup for %pd2\n", dentry); ncp_vdbg("server lookup for %pd2\n", dentry);
...@@ -847,31 +846,20 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig ...@@ -847,31 +846,20 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
res = ncp_obtain_info(server, dir, __name, &(finfo.i)); res = ncp_obtain_info(server, dir, __name, &(finfo.i));
} }
ncp_vdbg("looked for %pd2, res=%d\n", dentry, res); ncp_vdbg("looked for %pd2, res=%d\n", dentry, res);
/* if (!res) {
* If we didn't find an entry, make a negative dentry. /*
*/ * Entry found; create an inode for it.
if (res) */
goto add_entry; finfo.opened = 0;
finfo.ino = iunique(dir->i_sb, 2);
/* finfo.volume = finfo.i.volNumber;
* Create an inode for the entry. inode = ncp_iget(dir->i_sb, &finfo);
*/ if (unlikely(!inode))
finfo.opened = 0; inode = ERR_PTR(-EACCES);
finfo.ino = iunique(dir->i_sb, 2); else
finfo.volume = finfo.i.volNumber; ncp_new_dentry(dentry);
error = -EACCES;
inode = ncp_iget(dir->i_sb, &finfo);
if (inode) {
ncp_new_dentry(dentry);
add_entry:
d_add(dentry, inode);
error = 0;
} }
return d_splice_alias(inode, dentry);
finished:
ncp_vdbg("result=%d\n", error);
return ERR_PTR(error);
} }
/* /*
......
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