aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-22 04:39:14 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:35 -0400
commitd95852777bc8ba6b3ad3397d495c5f9dd8ca8383 (patch)
tree96e9d8b1d33c4f6f7b5ba5be0fa4fd8f77c7a67f /fs/9p
parent3d8a00d2099ebc6d5a6e95fadaf861709d9919a8 (diff)
make ->atomic_open() return int
Change of calling conventions: old new NULL 1 file 0 ERR_PTR(-ve) -ve Caller *knows* that struct file *; no need to return it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_inode.c10
-rw-r--r--fs/9p/vfs_inode_dotl.c14
2 files changed, 10 insertions, 14 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index de626b3b342f..62ce8daefa95 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -856,7 +856,7 @@ error:
856 return ERR_PTR(result); 856 return ERR_PTR(result);
857} 857}
858 858
859static struct file * 859static int
860v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, 860v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
861 struct opendata *od, unsigned flags, umode_t mode, 861 struct opendata *od, unsigned flags, umode_t mode,
862 int *opened) 862 int *opened)
@@ -872,7 +872,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
872 if (d_unhashed(dentry)) { 872 if (d_unhashed(dentry)) {
873 res = v9fs_vfs_lookup(dir, dentry, NULL); 873 res = v9fs_vfs_lookup(dir, dentry, NULL);
874 if (IS_ERR(res)) 874 if (IS_ERR(res))
875 return ERR_CAST(res); 875 return PTR_ERR(res);
876 876
877 if (res) 877 if (res)
878 dentry = res; 878 dentry = res;
@@ -881,7 +881,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
881 /* Only creates */ 881 /* Only creates */
882 if (!(flags & O_CREAT) || dentry->d_inode) { 882 if (!(flags & O_CREAT) || dentry->d_inode) {
883 finish_no_open(od, res); 883 finish_no_open(od, res);
884 return NULL; 884 return 1;
885 } 885 }
886 886
887 err = 0; 887 err = 0;
@@ -933,13 +933,11 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
933 *opened |= FILE_CREATED; 933 *opened |= FILE_CREATED;
934out: 934out:
935 dput(res); 935 dput(res);
936 return filp; 936 return err;
937 937
938error: 938error:
939 if (fid) 939 if (fid)
940 p9_client_clunk(fid); 940 p9_client_clunk(fid);
941
942 filp = ERR_PTR(err);
943 goto out; 941 goto out;
944} 942}
945 943
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 3db55471bc93..69f05109f75d 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -240,7 +240,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
240 return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0); 240 return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0);
241} 241}
242 242
243static struct file * 243static int
244v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, 244v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
245 struct opendata *od, unsigned flags, umode_t omode, 245 struct opendata *od, unsigned flags, umode_t omode,
246 int *opened) 246 int *opened)
@@ -262,7 +262,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
262 if (d_unhashed(dentry)) { 262 if (d_unhashed(dentry)) {
263 res = v9fs_vfs_lookup(dir, dentry, NULL); 263 res = v9fs_vfs_lookup(dir, dentry, NULL);
264 if (IS_ERR(res)) 264 if (IS_ERR(res))
265 return ERR_CAST(res); 265 return PTR_ERR(res);
266 266
267 if (res) 267 if (res)
268 dentry = res; 268 dentry = res;
@@ -271,7 +271,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
271 /* Only creates */ 271 /* Only creates */
272 if (!(flags & O_CREAT) || dentry->d_inode) { 272 if (!(flags & O_CREAT) || dentry->d_inode) {
273 finish_no_open(od, res); 273 finish_no_open(od, res);
274 return NULL; 274 return 1;
275 } 275 }
276 276
277 v9ses = v9fs_inode2v9ses(dir); 277 v9ses = v9fs_inode2v9ses(dir);
@@ -284,7 +284,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
284 if (IS_ERR(dfid)) { 284 if (IS_ERR(dfid)) {
285 err = PTR_ERR(dfid); 285 err = PTR_ERR(dfid);
286 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err); 286 p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
287 goto err_return; 287 goto out;
288 } 288 }
289 289
290 /* clone a fid to use for creation */ 290 /* clone a fid to use for creation */
@@ -292,7 +292,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
292 if (IS_ERR(ofid)) { 292 if (IS_ERR(ofid)) {
293 err = PTR_ERR(ofid); 293 err = PTR_ERR(ofid);
294 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); 294 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
295 goto err_return; 295 goto out;
296 } 296 }
297 297
298 gid = v9fs_get_fsgid_for_create(dir); 298 gid = v9fs_get_fsgid_for_create(dir);
@@ -370,7 +370,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
370 *opened |= FILE_CREATED; 370 *opened |= FILE_CREATED;
371out: 371out:
372 dput(res); 372 dput(res);
373 return filp; 373 return err;
374 374
375error: 375error:
376 if (fid) 376 if (fid)
@@ -379,8 +379,6 @@ err_clunk_old_fid:
379 if (ofid) 379 if (ofid)
380 p9_client_clunk(ofid); 380 p9_client_clunk(ofid);
381 v9fs_set_create_acl(NULL, &dacl, &pacl); 381 v9fs_set_create_acl(NULL, &dacl, &pacl);
382err_return:
383 filp = ERR_PTR(err);
384 goto out; 382 goto out;
385} 383}
386 384