blob: a92571a34556a8f90fbbc9aca28a7e250c5d08a2 [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 *);
\"J. Bruce Fields\c3810602008-12-23 16:08:32 -050018 int (*open_pipe)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 void (*destroy_msg)(struct rpc_pipe_msg *);
20};
21
22struct rpc_inode {
23 struct inode vfs_inode;
24 void *private;
25 struct list_head pipe;
26 struct list_head in_upcall;
Trond Myklebust6e84c7b2007-06-07 15:31:36 -040027 struct list_head in_downcall;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 int pipelen;
29 int nreaders;
30 int nwriters;
Trond Myklebust03a12562007-06-08 14:14:53 -040031 int nkern_readwriters;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 wait_queue_head_t waitq;
33#define RPC_PIPE_WAIT_FOR_OPEN 1
34 int flags;
David Howells52bad642006-11-22 14:54:01 +000035 struct delayed_work queue_timeout;
Trond Myklebustb693ba42009-08-09 15:14:15 -040036 const struct rpc_pipe_ops *ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037};
38
39static inline struct rpc_inode *
40RPC_I(struct inode *inode)
41{
42 return container_of(inode, struct rpc_inode, vfs_inode);
43}
44
45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
46
Trond Myklebust458adb8b2009-08-09 15:14:22 -040047struct rpc_clnt;
Trond Myklebust23ac6582009-08-09 15:14:25 -040048extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
Trond Myklebust458adb8b2009-08-09 15:14:22 -040049extern int rpc_remove_client_dir(struct dentry *);
Trond Myklebust8854e822009-08-09 15:14:30 -040050
51struct cache_detail;
52extern struct dentry *rpc_create_cache_dir(struct dentry *,
53 struct qstr *,
54 mode_t umode,
55 struct cache_detail *);
56extern void rpc_remove_cache_dir(struct dentry *);
57
Trond Myklebustb693ba42009-08-09 15:14:15 -040058extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
59 const struct rpc_pipe_ops *, int flags);
Trond Myklebust5d674762006-07-31 14:11:48 -070060extern int rpc_unlink(struct dentry *);
Trond Myklebust54281542006-03-20 13:44:49 -050061extern struct vfsmount *rpc_get_mount(void);
62extern void rpc_put_mount(void);
Trond Myklebust7531d692007-05-14 17:21:26 -040063extern int register_rpc_pipefs(void);
64extern void unregister_rpc_pipefs(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
66#endif
67#endif