Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 2 | #define _LINUX_SUNRPC_RPC_PIPE_FS_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | |
J. Bruce Fields | 4dceef9 | 2009-08-20 17:08:39 -0400 | [diff] [blame] | 6 | #include <linux/workqueue.h> |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | struct rpc_pipe_msg { |
| 9 | struct list_head list; |
| 10 | void *data; |
| 11 | size_t len; |
| 12 | size_t copied; |
| 13 | int errno; |
| 14 | }; |
| 15 | |
| 16 | struct 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\ | c381060 | 2008-12-23 16:08:32 -0500 | [diff] [blame] | 20 | int (*open_pipe)(struct inode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | void (*destroy_msg)(struct rpc_pipe_msg *); |
| 22 | }; |
| 23 | |
| 24 | struct rpc_inode { |
| 25 | struct inode vfs_inode; |
| 26 | void *private; |
| 27 | struct list_head pipe; |
| 28 | struct list_head in_upcall; |
Trond Myklebust | 6e84c7b | 2007-06-07 15:31:36 -0400 | [diff] [blame] | 29 | struct list_head in_downcall; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | int pipelen; |
| 31 | int nreaders; |
| 32 | int nwriters; |
Trond Myklebust | 03a1256 | 2007-06-08 14:14:53 -0400 | [diff] [blame] | 33 | int nkern_readwriters; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | wait_queue_head_t waitq; |
| 35 | #define RPC_PIPE_WAIT_FOR_OPEN 1 |
| 36 | int flags; |
David Howells | 52bad64 | 2006-11-22 14:54:01 +0000 | [diff] [blame] | 37 | struct delayed_work queue_timeout; |
Trond Myklebust | b693ba4 | 2009-08-09 15:14:15 -0400 | [diff] [blame] | 38 | const struct rpc_pipe_ops *ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | static inline struct rpc_inode * |
| 42 | RPC_I(struct inode *inode) |
| 43 | { |
| 44 | return container_of(inode, struct rpc_inode, vfs_inode); |
| 45 | } |
| 46 | |
| 47 | extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); |
| 48 | |
Trond Myklebust | 458adb8b | 2009-08-09 15:14:22 -0400 | [diff] [blame] | 49 | struct rpc_clnt; |
Trond Myklebust | 23ac658 | 2009-08-09 15:14:25 -0400 | [diff] [blame] | 50 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); |
Trond Myklebust | 458adb8b | 2009-08-09 15:14:22 -0400 | [diff] [blame] | 51 | extern int rpc_remove_client_dir(struct dentry *); |
Trond Myklebust | 8854e82 | 2009-08-09 15:14:30 -0400 | [diff] [blame] | 52 | |
| 53 | struct cache_detail; |
| 54 | extern struct dentry *rpc_create_cache_dir(struct dentry *, |
| 55 | struct qstr *, |
| 56 | mode_t umode, |
| 57 | struct cache_detail *); |
| 58 | extern void rpc_remove_cache_dir(struct dentry *); |
| 59 | |
Trond Myklebust | b693ba4 | 2009-08-09 15:14:15 -0400 | [diff] [blame] | 60 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, |
| 61 | const struct rpc_pipe_ops *, int flags); |
Trond Myklebust | 5d67476 | 2006-07-31 14:11:48 -0700 | [diff] [blame] | 62 | extern int rpc_unlink(struct dentry *); |
Trond Myklebust | 5428154 | 2006-03-20 13:44:49 -0500 | [diff] [blame] | 63 | extern struct vfsmount *rpc_get_mount(void); |
| 64 | extern void rpc_put_mount(void); |
Trond Myklebust | 7531d69 | 2007-05-14 17:21:26 -0400 | [diff] [blame] | 65 | extern int register_rpc_pipefs(void); |
| 66 | extern void unregister_rpc_pipefs(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | #endif |
| 69 | #endif |