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>
This commit is contained in:
Al Viro
2012-06-22 12:39:14 +04:00
parent 3d8a00d209
commit d95852777b
13 changed files with 97 additions and 105 deletions

View File

@@ -634,21 +634,20 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
return dentry;
}
struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags, umode_t mode,
int *opened)
int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags, umode_t mode,
int *opened)
{
int err;
struct dentry *res = NULL;
struct file *filp;
if (!(flags & O_CREAT)) {
if (dentry->d_name.len > NAME_MAX)
return ERR_PTR(-ENAMETOOLONG);
return -ENAMETOOLONG;
err = ceph_init_dentry(dentry);
if (err < 0)
return ERR_PTR(err);
return err;
return ceph_lookup_open(dir, dentry, od, flags, mode, opened);
}
@@ -656,7 +655,7 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
if (d_unhashed(dentry)) {
res = ceph_lookup(dir, dentry, NULL);
if (IS_ERR(res))
return ERR_CAST(res);
return PTR_ERR(res);
if (res)
dentry = res;
@@ -665,14 +664,14 @@ struct file *ceph_atomic_open(struct inode *dir, struct dentry *dentry,
/* We don't deal with positive dentries here */
if (dentry->d_inode) {
finish_no_open(od, res);
return NULL;
return 1;
}
*opened |= FILE_CREATED;
filp = ceph_lookup_open(dir, dentry, od, flags, mode, opened);
err = ceph_lookup_open(dir, dentry, od, flags, mode, opened);
dput(res);
return filp;
return err;
}
/*

View File

@@ -213,9 +213,9 @@ out:
* may_open() fails, the struct *file gets cleaned up (i.e.
* ceph_release gets called). So fear not!
*/
struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags, umode_t mode,
int *opened)
int ceph_lookup_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags, umode_t mode,
int *opened)
{
struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -230,7 +230,7 @@ struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
/* do the open */
req = prepare_open_request(dir->i_sb, flags, mode);
if (IS_ERR(req))
return ERR_CAST(req);
return PTR_ERR(req);
req->r_dentry = dget(dentry);
req->r_num_caps = 2;
if (flags & O_CREAT) {
@@ -257,10 +257,10 @@ out:
dout("ceph_lookup_open result=%p\n", ret);
if (IS_ERR(ret))
return ERR_CAST(ret);
return PTR_ERR(ret);
dput(ret);
return err ? ERR_PTR(err) : file;
return err;
}
int ceph_release(struct inode *inode, struct file *file)

View File

@@ -806,9 +806,9 @@ extern int ceph_copy_from_page_vector(struct page **pages,
loff_t off, size_t len);
extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
extern int ceph_open(struct inode *inode, struct file *file);
extern struct file *ceph_lookup_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags,
umode_t mode, int *opened);
extern int ceph_lookup_open(struct inode *dir, struct dentry *dentry,
struct opendata *od, unsigned flags,
umode_t mode, int *opened);
extern int ceph_release(struct inode *inode, struct file *filp);
/* dir.c */