aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
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/namei.c
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/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 18b9326d951f..f0dae0057ec9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2204,7 +2204,7 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
2204 umode_t mode; 2204 umode_t mode;
2205 int error; 2205 int error;
2206 int acc_mode; 2206 int acc_mode;
2207 struct file *filp; 2207 struct file *filp = NULL;
2208 int create_error = 0; 2208 int create_error = 0;
2209 struct dentry *const DENTRY_NOT_SET = (void *) -1UL; 2209 struct dentry *const DENTRY_NOT_SET = (void *) -1UL;
2210 2210
@@ -2271,14 +2271,15 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
2271 2271
2272 od->dentry = DENTRY_NOT_SET; 2272 od->dentry = DENTRY_NOT_SET;
2273 od->mnt = nd->path.mnt; 2273 od->mnt = nd->path.mnt;
2274 filp = dir->i_op->atomic_open(dir, dentry, od, open_flag, mode, 2274 error = dir->i_op->atomic_open(dir, dentry, od, open_flag, mode,
2275 opened); 2275 opened);
2276 if (IS_ERR(filp)) { 2276 if (error < 0) {
2277 if (WARN_ON(od->dentry != DENTRY_NOT_SET)) 2277 if (WARN_ON(od->dentry != DENTRY_NOT_SET))
2278 dput(od->dentry); 2278 dput(od->dentry);
2279 2279
2280 if (create_error && PTR_ERR(filp) == -ENOENT) 2280 if (create_error && error == -ENOENT)
2281 filp = ERR_PTR(create_error); 2281 error = create_error;
2282 filp = ERR_PTR(error);
2282 goto out; 2283 goto out;
2283 } 2284 }
2284 2285
@@ -2288,7 +2289,7 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
2288 acc_mode = MAY_OPEN; 2289 acc_mode = MAY_OPEN;
2289 } 2290 }
2290 2291
2291 if (!filp) { 2292 if (error) { /* returned 1, that is */
2292 if (WARN_ON(od->dentry == DENTRY_NOT_SET)) { 2293 if (WARN_ON(od->dentry == DENTRY_NOT_SET)) {
2293 filp = ERR_PTR(-EIO); 2294 filp = ERR_PTR(-EIO);
2294 goto out; 2295 goto out;
@@ -2304,6 +2305,7 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
2304 * We didn't have the inode before the open, so check open permission 2305 * We didn't have the inode before the open, so check open permission
2305 * here. 2306 * here.
2306 */ 2307 */
2308 filp = od->filp;
2307 error = may_open(&filp->f_path, acc_mode, open_flag); 2309 error = may_open(&filp->f_path, acc_mode, open_flag);
2308 if (error) { 2310 if (error) {
2309 fput(filp); 2311 fput(filp);