diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2018-05-13 21:11:26 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2018-05-22 14:28:01 -0400 |
commit | 1c5fedbb508fe8b206ada3115811870f44128471 (patch) | |
tree | 786a8bfbba4a7152c39506569b1f5acba5f6d25e | |
parent | 293542d8e501dc47e32ca82276aa9a0a5d9358b5 (diff) |
ncp_lookup(): use d_splice_alias()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/staging/ncpfs/dir.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/staging/ncpfs/dir.c b/drivers/staging/ncpfs/dir.c index 0c57c5c5d40a..072bcb12898f 100644 --- a/drivers/staging/ncpfs/dir.c +++ b/drivers/staging/ncpfs/dir.c | |||
@@ -823,12 +823,11 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig | |||
823 | struct ncp_server *server = NCP_SERVER(dir); | 823 | struct ncp_server *server = NCP_SERVER(dir); |
824 | struct inode *inode = NULL; | 824 | struct inode *inode = NULL; |
825 | struct ncp_entry_info finfo; | 825 | struct ncp_entry_info finfo; |
826 | int error, res, len; | 826 | int res, len; |
827 | __u8 __name[NCP_MAXPATHLEN + 1]; | 827 | __u8 __name[NCP_MAXPATHLEN + 1]; |
828 | 828 | ||
829 | error = -EIO; | ||
830 | if (!ncp_conn_valid(server)) | 829 | if (!ncp_conn_valid(server)) |
831 | goto finished; | 830 | return ERR_PTR(-EIO); |
832 | 831 | ||
833 | ncp_vdbg("server lookup for %pd2\n", dentry); | 832 | ncp_vdbg("server lookup for %pd2\n", dentry); |
834 | 833 | ||
@@ -847,31 +846,20 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig | |||
847 | res = ncp_obtain_info(server, dir, __name, &(finfo.i)); | 846 | res = ncp_obtain_info(server, dir, __name, &(finfo.i)); |
848 | } | 847 | } |
849 | ncp_vdbg("looked for %pd2, res=%d\n", dentry, res); | 848 | ncp_vdbg("looked for %pd2, res=%d\n", dentry, res); |
850 | /* | 849 | if (!res) { |
851 | * If we didn't find an entry, make a negative dentry. | 850 | /* |
852 | */ | 851 | * Entry found; create an inode for it. |
853 | if (res) | 852 | */ |
854 | goto add_entry; | 853 | finfo.opened = 0; |
855 | 854 | finfo.ino = iunique(dir->i_sb, 2); | |
856 | /* | 855 | finfo.volume = finfo.i.volNumber; |
857 | * Create an inode for the entry. | 856 | inode = ncp_iget(dir->i_sb, &finfo); |
858 | */ | 857 | if (unlikely(!inode)) |
859 | finfo.opened = 0; | 858 | inode = ERR_PTR(-EACCES); |
860 | finfo.ino = iunique(dir->i_sb, 2); | 859 | else |
861 | finfo.volume = finfo.i.volNumber; | 860 | ncp_new_dentry(dentry); |
862 | error = -EACCES; | ||
863 | inode = ncp_iget(dir->i_sb, &finfo); | ||
864 | |||
865 | if (inode) { | ||
866 | ncp_new_dentry(dentry); | ||
867 | add_entry: | ||
868 | d_add(dentry, inode); | ||
869 | error = 0; | ||
870 | } | 861 | } |
871 | 862 | return d_splice_alias(inode, dentry); | |
872 | finished: | ||
873 | ncp_vdbg("result=%d\n", error); | ||
874 | return ERR_PTR(error); | ||
875 | } | 863 | } |
876 | 864 | ||
877 | /* | 865 | /* |