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>
This commit is contained in:
Родитель
b693ba4a33
Коммит
7364af6a2d
|
@ -417,7 +417,7 @@ enum {
|
||||||
struct rpc_filelist {
|
struct rpc_filelist {
|
||||||
char *name;
|
char *name;
|
||||||
const struct file_operations *i_fop;
|
const struct file_operations *i_fop;
|
||||||
int mode;
|
umode_t mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rpc_filelist files[] = {
|
static struct rpc_filelist files[] = {
|
||||||
|
@ -516,7 +516,7 @@ rpc_release_path(struct nameidata *nd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct inode *
|
static struct inode *
|
||||||
rpc_get_inode(struct super_block *sb, int mode)
|
rpc_get_inode(struct super_block *sb, umode_t mode)
|
||||||
{
|
{
|
||||||
struct inode *inode = new_inode(sb);
|
struct inode *inode = new_inode(sb);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
|
@ -589,7 +589,8 @@ rpc_populate(struct dentry *parent,
|
||||||
struct inode *inode, *dir = parent->d_inode;
|
struct inode *inode, *dir = parent->d_inode;
|
||||||
void *private = RPC_I(dir)->private;
|
void *private = RPC_I(dir)->private;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
int mode, i;
|
umode_t mode;
|
||||||
|
int i;
|
||||||
|
|
||||||
mutex_lock(&dir->i_mutex);
|
mutex_lock(&dir->i_mutex);
|
||||||
for (i = start; i < eof; i++) {
|
for (i = start; i < eof; i++) {
|
||||||
|
@ -783,6 +784,12 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *dir, *inode;
|
struct inode *dir, *inode;
|
||||||
struct rpc_inode *rpci;
|
struct rpc_inode *rpci;
|
||||||
|
umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR;
|
||||||
|
|
||||||
|
if (ops->upcall == NULL)
|
||||||
|
umode &= ~S_IRUGO;
|
||||||
|
if (ops->downcall == NULL)
|
||||||
|
umode &= ~S_IWUGO;
|
||||||
|
|
||||||
dentry = rpc_lookup_create(parent, name, strlen(name), 0);
|
dentry = rpc_lookup_create(parent, name, strlen(name), 0);
|
||||||
if (IS_ERR(dentry))
|
if (IS_ERR(dentry))
|
||||||
|
@ -799,7 +806,7 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
|
||||||
rpci->nkern_readwriters++;
|
rpci->nkern_readwriters++;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR);
|
inode = rpc_get_inode(dir->i_sb, umode);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
goto err_dput;
|
goto err_dput;
|
||||||
inode->i_ino = iunique(dir->i_sb, 100);
|
inode->i_ino = iunique(dir->i_sb, 100);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче