Commit 462ccee7 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Change rpc_ops->create() to take a dentry argument rather than a

     qstr.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@fys.uio.no>
parent 14a98a02
...@@ -986,15 +986,9 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -986,15 +986,9 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode,
if (nd && (nd->flags & LOOKUP_CREATE)) if (nd && (nd->flags & LOOKUP_CREATE))
open_flags = nd->intent.open.flags; open_flags = nd->intent.open.flags;
/*
* The 0 argument passed into the create function should one day
* contain the O_EXCL flag if requested. This allows NFSv3 to
* select the appropriate create strategy. Currently open_namei
* does not pass the create flags.
*/
lock_kernel(); lock_kernel();
nfs_begin_data_update(dir); nfs_begin_data_update(dir);
inode = NFS_PROTO(dir)->create(dir, &dentry->d_name, &attr, open_flags); inode = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags);
nfs_end_data_update(dir); nfs_end_data_update(dir);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
......
...@@ -296,7 +296,7 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata) ...@@ -296,7 +296,7 @@ static int nfs3_proc_commit(struct nfs_write_data *cdata)
* For now, we don't implement O_EXCL. * For now, we don't implement O_EXCL.
*/ */
static struct inode * static struct inode *
nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags) int flags)
{ {
struct nfs_fh fhandle; struct nfs_fh fhandle;
...@@ -304,8 +304,8 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, ...@@ -304,8 +304,8 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr,
struct nfs_fattr dir_attr; struct nfs_fattr dir_attr;
struct nfs3_createargs arg = { struct nfs3_createargs arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.name = name->name, .name = dentry->d_name.name,
.len = name->len, .len = dentry->d_name.len,
.sattr = sattr, .sattr = sattr,
}; };
struct nfs3_diropres res = { struct nfs3_diropres res = {
...@@ -315,7 +315,7 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, ...@@ -315,7 +315,7 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr,
}; };
int status; int status;
dprintk("NFS call create %s\n", name->name); dprintk("NFS call create %s\n", dentry->d_name.name);
arg.createmode = NFS3_CREATE_UNCHECKED; arg.createmode = NFS3_CREATE_UNCHECKED;
if (flags & O_EXCL) { if (flags & O_EXCL) {
arg.createmode = NFS3_CREATE_EXCLUSIVE; arg.createmode = NFS3_CREATE_EXCLUSIVE;
...@@ -353,7 +353,7 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, ...@@ -353,7 +353,7 @@ nfs3_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr,
if (status != 0) if (status != 0)
goto out; goto out;
if (fhandle.size == 0 || !(fattr.valid & NFS_ATTR_FATTR)) { if (fhandle.size == 0 || !(fattr.valid & NFS_ATTR_FATTR)) {
status = nfs3_proc_lookup(dir, name, &fhandle, &fattr); status = nfs3_proc_lookup(dir, &dentry->d_name, &fhandle, &fattr);
if (status != 0) if (status != 0)
goto out; goto out;
} }
......
...@@ -1327,7 +1327,7 @@ static int nfs4_proc_commit(struct nfs_write_data *cdata) ...@@ -1327,7 +1327,7 @@ static int nfs4_proc_commit(struct nfs_write_data *cdata)
*/ */
static struct inode * static struct inode *
nfs4_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags) int flags)
{ {
struct inode *inode; struct inode *inode;
...@@ -1335,7 +1335,7 @@ nfs4_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, ...@@ -1335,7 +1335,7 @@ nfs4_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr,
struct rpc_cred *cred; struct rpc_cred *cred;
cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0); cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0);
state = nfs4_do_open(dir, name, flags, sattr, cred); state = nfs4_do_open(dir, &dentry->d_name, flags, sattr, cred);
put_rpccred(cred); put_rpccred(cred);
if (!IS_ERR(state)) { if (!IS_ERR(state)) {
inode = state->inode; inode = state->inode;
......
...@@ -213,15 +213,15 @@ static int nfs_proc_write(struct nfs_write_data *wdata) ...@@ -213,15 +213,15 @@ static int nfs_proc_write(struct nfs_write_data *wdata)
} }
static struct inode * static struct inode *
nfs_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags) int flags)
{ {
struct nfs_fh fhandle; struct nfs_fh fhandle;
struct nfs_fattr fattr; struct nfs_fattr fattr;
struct nfs_createargs arg = { struct nfs_createargs arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.name = name->name, .name = dentry->d_name.name,
.len = name->len, .len = dentry->d_name.len,
.sattr = sattr .sattr = sattr
}; };
struct nfs_diropok res = { struct nfs_diropok res = {
...@@ -231,7 +231,7 @@ nfs_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr, ...@@ -231,7 +231,7 @@ nfs_proc_create(struct inode *dir, struct qstr *name, struct iattr *sattr,
int status; int status;
fattr.valid = 0; fattr.valid = 0;
dprintk("NFS call create %s\n", name->name); dprintk("NFS call create %s\n", dentry->d_name.name);
status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
dprintk("NFS reply create: %d\n", status); dprintk("NFS reply create: %d\n", status);
if (status == 0) { if (status == 0) {
......
...@@ -681,7 +681,7 @@ struct nfs_rpc_ops { ...@@ -681,7 +681,7 @@ struct nfs_rpc_ops {
int (*read) (struct nfs_read_data *); int (*read) (struct nfs_read_data *);
int (*write) (struct nfs_write_data *); int (*write) (struct nfs_write_data *);
int (*commit) (struct nfs_write_data *); int (*commit) (struct nfs_write_data *);
struct inode * (*create) (struct inode *, struct qstr *, struct inode * (*create) (struct inode *, struct dentry *,
struct iattr *, int); struct iattr *, int);
int (*remove) (struct inode *, struct qstr *); int (*remove) (struct inode *, struct qstr *);
int (*unlink_setup) (struct rpc_message *, int (*unlink_setup) (struct rpc_message *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment