lkml.org 
[lkml]   [2010]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/12] sunrpc: introduce get_rpc_pipefs()
Date
From: Kirill A. Shutemov <kirill@shutemov.name>

Get rpc_pipefs mount point by path.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
include/linux/sunrpc/rpc_pipe_fs.h | 2 ++
net/sunrpc/rpc_pipe.c | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index b09bfa5..922057c 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -46,6 +46,8 @@ RPC_I(struct inode *inode)

extern struct vfsmount *init_rpc_pipefs;

+struct vfsmount *get_rpc_pipefs(const char *path);
+
extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);

struct rpc_clnt;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index b1e299b..c48f7a5 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -931,6 +931,30 @@ static const struct super_operations s_ops = {

#define RPCAUTH_GSSMAGIC 0x67596969

+struct vfsmount *get_rpc_pipefs(const char *p)
+{
+ int error;
+ struct vfsmount *rpcmount;
+ struct path path;
+
+ if (!p)
+ return mntget(init_rpc_pipefs);
+
+ error = kern_path(p, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+ if (error)
+ return ERR_PTR(error);
+
+ if (path.mnt->mnt_sb->s_magic != RPCAUTH_GSSMAGIC) {
+ path_put(&path);
+ return ERR_PTR(-EINVAL);
+ }
+
+ rpcmount = mntget(path.mnt);
+ path_put(&path);
+
+ return rpcmount;
+}
+
/*
* We have a single directory with 1 node in it.
*/
--
1.7.3.4


\
 
 \ /
  Last update: 2010-12-20 12:59    [W:0.531 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site