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>
diff --git a/fs/namei.c b/fs/namei.c
index 18b9326..f0dae00 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2204,7 +2204,7 @@
umode_t mode;
int error;
int acc_mode;
- struct file *filp;
+ struct file *filp = NULL;
int create_error = 0;
struct dentry *const DENTRY_NOT_SET = (void *) -1UL;
@@ -2271,14 +2271,15 @@
od->dentry = DENTRY_NOT_SET;
od->mnt = nd->path.mnt;
- filp = dir->i_op->atomic_open(dir, dentry, od, open_flag, mode,
+ error = dir->i_op->atomic_open(dir, dentry, od, open_flag, mode,
opened);
- if (IS_ERR(filp)) {
+ if (error < 0) {
if (WARN_ON(od->dentry != DENTRY_NOT_SET))
dput(od->dentry);
- if (create_error && PTR_ERR(filp) == -ENOENT)
- filp = ERR_PTR(create_error);
+ if (create_error && error == -ENOENT)
+ error = create_error;
+ filp = ERR_PTR(error);
goto out;
}
@@ -2288,7 +2289,7 @@
acc_mode = MAY_OPEN;
}
- if (!filp) {
+ if (error) { /* returned 1, that is */
if (WARN_ON(od->dentry == DENTRY_NOT_SET)) {
filp = ERR_PTR(-EIO);
goto out;
@@ -2304,6 +2305,7 @@
* We didn't have the inode before the open, so check open permission
* here.
*/
+ filp = od->filp;
error = may_open(&filp->f_path, acc_mode, open_flag);
if (error) {
fput(filp);