Merge tag 'kvm-arm-for-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.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
6739ffb7
TM
8struct rpc_pipe_dir_head {
9 struct list_head pdh_entries;
10 struct dentry *pdh_dentry;
11};
12
13struct rpc_pipe_dir_object_ops;
14struct rpc_pipe_dir_object {
15 struct list_head pdo_head;
16 const struct rpc_pipe_dir_object_ops *pdo_ops;
17
18 void *pdo_data;
19};
20
21struct rpc_pipe_dir_object_ops {
22 int (*create)(struct dentry *dir,
23 struct rpc_pipe_dir_object *pdo);
24 void (*destroy)(struct dentry *dir,
25 struct rpc_pipe_dir_object *pdo);
26};
27
1da177e4
LT
28struct rpc_pipe_msg {
29 struct list_head list;
30 void *data;
31 size_t len;
32 size_t copied;
33 int errno;
34};
35
36struct rpc_pipe_ops {
37 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
38 ssize_t (*downcall)(struct file *, const char __user *, size_t);
39 void (*release_pipe)(struct inode *);
c3810608 40 int (*open_pipe)(struct inode *);
1da177e4
LT
41 void (*destroy_msg)(struct rpc_pipe_msg *);
42};
43
ba9e0975 44struct rpc_pipe {
1da177e4
LT
45 struct list_head pipe;
46 struct list_head in_upcall;
6e84c7b6 47 struct list_head in_downcall;
1da177e4
LT
48 int pipelen;
49 int nreaders;
50 int nwriters;
1da177e4
LT
51#define RPC_PIPE_WAIT_FOR_OPEN 1
52 int flags;
52bad64d 53 struct delayed_work queue_timeout;
b693ba4a 54 const struct rpc_pipe_ops *ops;
766347be 55 spinlock_t lock;
c239d83b 56 struct dentry *dentry;
1da177e4
LT
57};
58
ba9e0975
SK
59struct rpc_inode {
60 struct inode vfs_inode;
61 void *private;
62 struct rpc_pipe *pipe;
591ad7fe 63 wait_queue_head_t waitq;
ba9e0975
SK
64};
65
1da177e4
LT
66static inline struct rpc_inode *
67RPC_I(struct inode *inode)
68{
69 return container_of(inode, struct rpc_inode, vfs_inode);
70}
71
eee17325
SK
72enum {
73 SUNRPC_PIPEFS_NFS_PRIO,
74 SUNRPC_PIPEFS_RPC_PRIO,
75};
76
2d00131a
SK
77extern int rpc_pipefs_notifier_register(struct notifier_block *);
78extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
79
80enum {
81 RPC_PIPEFS_MOUNT,
82 RPC_PIPEFS_UMOUNT,
83};
84
432eb1a5
SK
85extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
86 const unsigned char *dir_name);
4b9a445e
JL
87extern int rpc_pipefs_init_net(struct net *net);
88extern void rpc_pipefs_exit_net(struct net *net);
c21a588f
SK
89extern struct super_block *rpc_get_sb_net(const struct net *net);
90extern void rpc_put_sb_net(const struct net *net);
432eb1a5 91
c1225158
PT
92extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
93 char __user *, size_t);
d706ed1f 94extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
1da177e4 95
458adb8b 96struct rpc_clnt;
a95e691f 97extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
c36dcfe1 98extern int rpc_remove_client_dir(struct rpc_clnt *);
6739ffb7
TM
99
100extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
101extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
102 const struct rpc_pipe_dir_object_ops *pdo_ops,
103 void *pdo_data);
104extern int rpc_add_pipe_dir_object(struct net *net,
105 struct rpc_pipe_dir_head *pdh,
106 struct rpc_pipe_dir_object *pdo);
107extern void rpc_remove_pipe_dir_object(struct net *net,
108 struct rpc_pipe_dir_head *pdh,
109 struct rpc_pipe_dir_object *pdo);
298fc355
TM
110extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object(
111 struct net *net,
112 struct rpc_pipe_dir_head *pdh,
113 int (*match)(struct rpc_pipe_dir_object *, void *),
114 struct rpc_pipe_dir_object *(*alloc)(void *),
115 void *data);
8854e82d
TM
116
117struct cache_detail;
118extern struct dentry *rpc_create_cache_dir(struct dentry *,
a95e691f 119 const char *,
64f1426f 120 umode_t umode,
8854e82d
TM
121 struct cache_detail *);
122extern void rpc_remove_cache_dir(struct dentry *);
123
eee17325
SK
124extern int rpc_rmdir(struct dentry *dentry);
125
c239d83b
SK
126struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
127void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
128extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
129 struct rpc_pipe *);
5d67476f 130extern int rpc_unlink(struct dentry *);
7531d692
TM
131extern int register_rpc_pipefs(void);
132extern void unregister_rpc_pipefs(void);
1da177e4 133
89f84243
JL
134extern bool gssd_running(struct net *net);
135
1da177e4
LT
136#endif
137#endif
This page took 1.394816 seconds and 5 git commands to generate.