]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/linux/sunrpc/rpc_pipe_fs.h
Merge tag 'md-3.7-fixes' of git://neil.brown.name/md
[mirror_ubuntu-zesty-kernel.git] / include / linux / sunrpc / rpc_pipe_fs.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H
2#define _LINUX_SUNRPC_RPC_PIPE_FS_H
3
4#ifdef __KERNEL__
5
4dceef96
BF
6#include <linux/workqueue.h>
7
1da177e4
LT
8struct 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 *);
c3810608 20 int (*open_pipe)(struct inode *);
1da177e4
LT
21 void (*destroy_msg)(struct rpc_pipe_msg *);
22};
23
ba9e0975 24struct rpc_pipe {
1da177e4
LT
25 struct list_head pipe;
26 struct list_head in_upcall;
6e84c7b6 27 struct list_head in_downcall;
1da177e4
LT
28 int pipelen;
29 int nreaders;
30 int nwriters;
1da177e4
LT
31#define RPC_PIPE_WAIT_FOR_OPEN 1
32 int flags;
52bad64d 33 struct delayed_work queue_timeout;
b693ba4a 34 const struct rpc_pipe_ops *ops;
766347be 35 spinlock_t lock;
c239d83b 36 struct dentry *dentry;
1da177e4
LT
37};
38
ba9e0975
SK
39struct rpc_inode {
40 struct inode vfs_inode;
41 void *private;
42 struct rpc_pipe *pipe;
591ad7fe 43 wait_queue_head_t waitq;
ba9e0975
SK
44};
45
1da177e4
LT
46static inline struct rpc_inode *
47RPC_I(struct inode *inode)
48{
49 return container_of(inode, struct rpc_inode, vfs_inode);
50}
51
eee17325
SK
52enum {
53 SUNRPC_PIPEFS_NFS_PRIO,
54 SUNRPC_PIPEFS_RPC_PRIO,
55};
56
2d00131a
SK
57extern int rpc_pipefs_notifier_register(struct notifier_block *);
58extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
59
60enum {
61 RPC_PIPEFS_MOUNT,
62 RPC_PIPEFS_UMOUNT,
63};
64
432eb1a5
SK
65extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
66 const unsigned char *dir_name);
c21a588f
SK
67extern void rpc_pipefs_init_net(struct net *net);
68extern struct super_block *rpc_get_sb_net(const struct net *net);
69extern void rpc_put_sb_net(const struct net *net);
432eb1a5 70
c1225158
PT
71extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
72 char __user *, size_t);
d706ed1f 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
1da177e4 74
458adb8b 75struct rpc_clnt;
23ac6581 76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
458adb8b 77extern int rpc_remove_client_dir(struct dentry *);
8854e82d
TM
78
79struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *,
81 struct qstr *,
64f1426f 82 umode_t umode,
8854e82d
TM
83 struct cache_detail *);
84extern void rpc_remove_cache_dir(struct dentry *);
85
eee17325
SK
86extern int rpc_rmdir(struct dentry *dentry);
87
c239d83b
SK
88struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
89void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
90extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
91 struct rpc_pipe *);
5d67476f 92extern int rpc_unlink(struct dentry *);
7531d692
TM
93extern int register_rpc_pipefs(void);
94extern void unregister_rpc_pipefs(void);
1da177e4
LT
95
96#endif
97#endif