blob: c93ea8689bc80f6b01d2063ee299f23c5be1360c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
2#define _LINUX_SUNRPC_RPC_PIPE_FS_H
3
4#ifdef __KERNEL__
5
J. Bruce Fields4dceef92009-08-20 17:08:39 -04006#include <linux/workqueue.h>
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008struct rpc_pipe_msg {
9 struct list_head list;
10 void *data;
11 size_t len;
12 size_t copied;
13 int errno;
14};
15
16struct rpc_pipe_ops {
17 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
18 ssize_t (*downcall)(struct file *, const char __user *, size_t);
19 void (*release_pipe)(struct inode *);
\"J. Bruce Fields\c3810602008-12-23 16:08:32 -050020 int (*open_pipe)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 void (*destroy_msg)(struct rpc_pipe_msg *);
22};
23
24struct rpc_inode {
25 struct inode vfs_inode;
26 void *private;
27 struct list_head pipe;
28 struct list_head in_upcall;
Trond Myklebust6e84c7b2007-06-07 15:31:36 -040029 struct list_head in_downcall;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 int pipelen;
31 int nreaders;
32 int nwriters;
33 wait_queue_head_t waitq;
34#define RPC_PIPE_WAIT_FOR_OPEN 1
35 int flags;
David Howells52bad642006-11-22 14:54:01 +000036 struct delayed_work queue_timeout;
Trond Myklebustb693ba42009-08-09 15:14:15 -040037 const struct rpc_pipe_ops *ops;
Stanislav Kinsbursky766347b2011-12-26 15:43:23 +030038 spinlock_t lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039};
40
41static inline struct rpc_inode *
42RPC_I(struct inode *inode)
43{
44 return container_of(inode, struct rpc_inode, vfs_inode);
45}
46
Stanislav Kinsbursky2d001312011-12-26 15:39:13 +030047extern int rpc_pipefs_notifier_register(struct notifier_block *);
48extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
49
50enum {
51 RPC_PIPEFS_MOUNT,
52 RPC_PIPEFS_UMOUNT,
53};
54
Stanislav Kinsbursky432eb1a2011-12-26 15:39:22 +030055extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
56 const unsigned char *dir_name);
Stanislav Kinsburskyc21a5882011-12-26 15:39:39 +030057extern void rpc_pipefs_init_net(struct net *net);
58extern struct super_block *rpc_get_sb_net(const struct net *net);
59extern void rpc_put_sb_net(const struct net *net);
Stanislav Kinsbursky432eb1a2011-12-26 15:39:22 +030060
Peng Taoc1225152011-09-22 21:50:10 -040061extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
62 char __user *, size_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
64
Trond Myklebust458adb8b2009-08-09 15:14:22 -040065struct rpc_clnt;
Trond Myklebust23ac6582009-08-09 15:14:25 -040066extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
Trond Myklebust458adb8b2009-08-09 15:14:22 -040067extern int rpc_remove_client_dir(struct dentry *);
Trond Myklebust8854e822009-08-09 15:14:30 -040068
69struct cache_detail;
70extern struct dentry *rpc_create_cache_dir(struct dentry *,
71 struct qstr *,
Al Viro64f14262011-07-25 00:35:13 -040072 umode_t umode,
Trond Myklebust8854e822009-08-09 15:14:30 -040073 struct cache_detail *);
74extern void rpc_remove_cache_dir(struct dentry *);
75
Trond Myklebustb693ba42009-08-09 15:14:15 -040076extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
77 const struct rpc_pipe_ops *, int flags);
Trond Myklebust5d674762006-07-31 14:11:48 -070078extern int rpc_unlink(struct dentry *);
Trond Myklebust54281542006-03-20 13:44:49 -050079extern struct vfsmount *rpc_get_mount(void);
80extern void rpc_put_mount(void);
Trond Myklebust7531d692007-05-14 17:21:26 -040081extern int register_rpc_pipefs(void);
82extern void unregister_rpc_pipefs(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84#endif
85#endif