blob: 51b977a4ca203eee00cb7b44f769a29c710064d5 [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
6struct rpc_pipe_msg {
7 struct list_head list;
8 void *data;
9 size_t len;
10 size_t copied;
11 int errno;
12};
13
14struct rpc_pipe_ops {
15 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
16 ssize_t (*downcall)(struct file *, const char __user *, size_t);
17 void (*release_pipe)(struct inode *);
18 void (*destroy_msg)(struct rpc_pipe_msg *);
19};
20
21struct rpc_inode {
22 struct inode vfs_inode;
23 void *private;
24 struct list_head pipe;
25 struct list_head in_upcall;
Trond Myklebust6e84c7b2007-06-07 15:31:36 -040026 struct list_head in_downcall;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 int pipelen;
28 int nreaders;
29 int nwriters;
Trond Myklebust03a12562007-06-08 14:14:53 -040030 int nkern_readwriters;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 wait_queue_head_t waitq;
32#define RPC_PIPE_WAIT_FOR_OPEN 1
33 int flags;
34 struct rpc_pipe_ops *ops;
David Howells52bad642006-11-22 14:54:01 +000035 struct delayed_work queue_timeout;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036};
37
38static inline struct rpc_inode *
39RPC_I(struct inode *inode)
40{
41 return container_of(inode, struct rpc_inode, vfs_inode);
42}
43
44extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
45
46extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
Trond Myklebustdff02cc2006-07-31 14:17:18 -070047extern int rpc_rmdir(struct dentry *);
Trond Myklebust158998b2006-08-24 01:03:17 -040048extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags);
Trond Myklebust5d674762006-07-31 14:11:48 -070049extern int rpc_unlink(struct dentry *);
Trond Myklebust54281542006-03-20 13:44:49 -050050extern struct vfsmount *rpc_get_mount(void);
51extern void rpc_put_mount(void);
Trond Myklebust7531d692007-05-14 17:21:26 -040052extern int register_rpc_pipefs(void);
53extern void unregister_rpc_pipefs(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55#endif
56#endif