diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:14:16 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-08-09 15:14:16 -0400 |
commit | 7364af6a2d5e708b5c6fee3cce08d1bd7b27c9f1 (patch) | |
tree | f4ce755e169489cae527c9fd18eaabbd7b6a7e93 /net/sunrpc/rpc_pipe.c | |
parent | b693ba4a338da15db1db4b5ebaa36e4ab9781c82 (diff) |
SUNRPC: Allow rpc_pipefs_ops to have null values for upcall and downcall
Also ensure that we use the umode_t type when appropriate...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index f6f60f625e3f..8fa718201e3f 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -417,7 +417,7 @@ enum { | |||
417 | struct rpc_filelist { | 417 | struct rpc_filelist { |
418 | char *name; | 418 | char *name; |
419 | const struct file_operations *i_fop; | 419 | const struct file_operations *i_fop; |
420 | int mode; | 420 | umode_t mode; |
421 | }; | 421 | }; |
422 | 422 | ||
423 | static struct rpc_filelist files[] = { | 423 | static struct rpc_filelist files[] = { |
@@ -516,7 +516,7 @@ rpc_release_path(struct nameidata *nd) | |||
516 | } | 516 | } |
517 | 517 | ||
518 | static struct inode * | 518 | static struct inode * |
519 | rpc_get_inode(struct super_block *sb, int mode) | 519 | rpc_get_inode(struct super_block *sb, umode_t mode) |
520 | { | 520 | { |
521 | struct inode *inode = new_inode(sb); | 521 | struct inode *inode = new_inode(sb); |
522 | if (!inode) | 522 | if (!inode) |
@@ -589,7 +589,8 @@ rpc_populate(struct dentry *parent, | |||
589 | struct inode *inode, *dir = parent->d_inode; | 589 | struct inode *inode, *dir = parent->d_inode; |
590 | void *private = RPC_I(dir)->private; | 590 | void *private = RPC_I(dir)->private; |
591 | struct dentry *dentry; | 591 | struct dentry *dentry; |
592 | int mode, i; | 592 | umode_t mode; |
593 | int i; | ||
593 | 594 | ||
594 | mutex_lock(&dir->i_mutex); | 595 | mutex_lock(&dir->i_mutex); |
595 | for (i = start; i < eof; i++) { | 596 | for (i = start; i < eof; i++) { |
@@ -783,6 +784,12 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | |||
783 | struct dentry *dentry; | 784 | struct dentry *dentry; |
784 | struct inode *dir, *inode; | 785 | struct inode *dir, *inode; |
785 | struct rpc_inode *rpci; | 786 | struct rpc_inode *rpci; |
787 | umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR; | ||
788 | |||
789 | if (ops->upcall == NULL) | ||
790 | umode &= ~S_IRUGO; | ||
791 | if (ops->downcall == NULL) | ||
792 | umode &= ~S_IWUGO; | ||
786 | 793 | ||
787 | dentry = rpc_lookup_create(parent, name, strlen(name), 0); | 794 | dentry = rpc_lookup_create(parent, name, strlen(name), 0); |
788 | if (IS_ERR(dentry)) | 795 | if (IS_ERR(dentry)) |
@@ -799,7 +806,7 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | |||
799 | rpci->nkern_readwriters++; | 806 | rpci->nkern_readwriters++; |
800 | goto out; | 807 | goto out; |
801 | } | 808 | } |
802 | inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR); | 809 | inode = rpc_get_inode(dir->i_sb, umode); |
803 | if (!inode) | 810 | if (!inode) |
804 | goto err_dput; | 811 | goto err_dput; |
805 | inode->i_ino = iunique(dir->i_sb, 100); | 812 | inode->i_ino = iunique(dir->i_sb, 100); |