aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/cache.h40
-rw-r--r--include/linux/sunrpc/clnt.h43
-rw-r--r--include/linux/sunrpc/msg_prot.h17
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h18
-rw-r--r--include/linux/sunrpc/xprt.h2
5 files changed, 104 insertions, 16 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 2d8b211b9324..6f52b4d7c447 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -59,6 +59,15 @@ struct cache_head {
59 59
60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 60#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
61 61
62struct cache_detail_procfs {
63 struct proc_dir_entry *proc_ent;
64 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
65};
66
67struct cache_detail_pipefs {
68 struct dentry *dir;
69};
70
62struct cache_detail { 71struct cache_detail {
63 struct module * owner; 72 struct module * owner;
64 int hash_size; 73 int hash_size;
@@ -70,15 +79,17 @@ struct cache_detail {
70 char *name; 79 char *name;
71 void (*cache_put)(struct kref *); 80 void (*cache_put)(struct kref *);
72 81
73 void (*cache_request)(struct cache_detail *cd, 82 int (*cache_upcall)(struct cache_detail *,
74 struct cache_head *h, 83 struct cache_head *);
75 char **bpp, int *blen); 84
76 int (*cache_parse)(struct cache_detail *, 85 int (*cache_parse)(struct cache_detail *,
77 char *buf, int len); 86 char *buf, int len);
78 87
79 int (*cache_show)(struct seq_file *m, 88 int (*cache_show)(struct seq_file *m,
80 struct cache_detail *cd, 89 struct cache_detail *cd,
81 struct cache_head *h); 90 struct cache_head *h);
91 void (*warn_no_listener)(struct cache_detail *cd,
92 int has_died);
82 93
83 struct cache_head * (*alloc)(void); 94 struct cache_head * (*alloc)(void);
84 int (*match)(struct cache_head *orig, struct cache_head *new); 95 int (*match)(struct cache_head *orig, struct cache_head *new);
@@ -96,13 +107,15 @@ struct cache_detail {
96 107
97 /* fields for communication over channel */ 108 /* fields for communication over channel */
98 struct list_head queue; 109 struct list_head queue;
99 struct proc_dir_entry *proc_ent;
100 struct proc_dir_entry *flush_ent, *channel_ent, *content_ent;
101 110
102 atomic_t readers; /* how many time is /chennel open */ 111 atomic_t readers; /* how many time is /chennel open */
103 time_t last_close; /* if no readers, when did last close */ 112 time_t last_close; /* if no readers, when did last close */
104 time_t last_warn; /* when we last warned about no readers */ 113 time_t last_warn; /* when we last warned about no readers */
105 void (*warn_no_listener)(struct cache_detail *cd); 114
115 union {
116 struct cache_detail_procfs procfs;
117 struct cache_detail_pipefs pipefs;
118 } u;
106}; 119};
107 120
108 121
@@ -127,6 +140,10 @@ struct cache_deferred_req {
127}; 140};
128 141
129 142
143extern const struct file_operations cache_file_operations_pipefs;
144extern const struct file_operations content_file_operations_pipefs;
145extern const struct file_operations cache_flush_operations_pipefs;
146
130extern struct cache_head * 147extern struct cache_head *
131sunrpc_cache_lookup(struct cache_detail *detail, 148sunrpc_cache_lookup(struct cache_detail *detail,
132 struct cache_head *key, int hash); 149 struct cache_head *key, int hash);
@@ -134,6 +151,13 @@ extern struct cache_head *
134sunrpc_cache_update(struct cache_detail *detail, 151sunrpc_cache_update(struct cache_detail *detail,
135 struct cache_head *new, struct cache_head *old, int hash); 152 struct cache_head *new, struct cache_head *old, int hash);
136 153
154extern int
155sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h,
156 void (*cache_request)(struct cache_detail *,
157 struct cache_head *,
158 char **,
159 int *));
160
137 161
138extern void cache_clean_deferred(void *owner); 162extern void cache_clean_deferred(void *owner);
139 163
@@ -171,6 +195,10 @@ extern void cache_purge(struct cache_detail *detail);
171extern int cache_register(struct cache_detail *cd); 195extern int cache_register(struct cache_detail *cd);
172extern void cache_unregister(struct cache_detail *cd); 196extern void cache_unregister(struct cache_detail *cd);
173 197
198extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
199 mode_t, struct cache_detail *);
200extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
201
174extern void qword_add(char **bpp, int *lp, char *str); 202extern void qword_add(char **bpp, int *lp, char *str);
175extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); 203extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
176extern int qword_get(char **bpp, char *dest, int bufsize); 204extern int qword_get(char **bpp, char *dest, int bufsize);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 37881f1a0bd7..ab3f6e90caa5 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -9,6 +9,10 @@
9#ifndef _LINUX_SUNRPC_CLNT_H 9#ifndef _LINUX_SUNRPC_CLNT_H
10#define _LINUX_SUNRPC_CLNT_H 10#define _LINUX_SUNRPC_CLNT_H
11 11
12#include <linux/socket.h>
13#include <linux/in.h>
14#include <linux/in6.h>
15
12#include <linux/sunrpc/msg_prot.h> 16#include <linux/sunrpc/msg_prot.h>
13#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
14#include <linux/sunrpc/xprt.h> 18#include <linux/sunrpc/xprt.h>
@@ -17,6 +21,7 @@
17#include <linux/sunrpc/xdr.h> 21#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/timer.h> 22#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 23#include <asm/signal.h>
24#include <linux/path.h>
20 25
21struct rpc_inode; 26struct rpc_inode;
22 27
@@ -50,9 +55,7 @@ struct rpc_clnt {
50 55
51 int cl_nodelen; /* nodename length */ 56 int cl_nodelen; /* nodename length */
52 char cl_nodename[UNX_MAXNODENAME]; 57 char cl_nodename[UNX_MAXNODENAME];
53 char cl_pathname[30];/* Path in rpc_pipe_fs */ 58 struct path cl_path;
54 struct vfsmount * cl_vfsmnt;
55 struct dentry * cl_dentry; /* inode */
56 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 59 struct rpc_clnt * cl_parent; /* Points to parent of clones */
57 struct rpc_rtt cl_rtt_default; 60 struct rpc_rtt cl_rtt_default;
58 struct rpc_timeout cl_timeout_default; 61 struct rpc_timeout cl_timeout_default;
@@ -151,5 +154,39 @@ void rpc_force_rebind(struct rpc_clnt *);
151size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 154size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
152const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 155const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
153 156
157size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
158size_t rpc_pton(const char *, const size_t,
159 struct sockaddr *, const size_t);
160char * rpc_sockaddr2uaddr(const struct sockaddr *);
161size_t rpc_uaddr2sockaddr(const char *, const size_t,
162 struct sockaddr *, const size_t);
163
164static inline unsigned short rpc_get_port(const struct sockaddr *sap)
165{
166 switch (sap->sa_family) {
167 case AF_INET:
168 return ntohs(((struct sockaddr_in *)sap)->sin_port);
169 case AF_INET6:
170 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
171 }
172 return 0;
173}
174
175static inline void rpc_set_port(struct sockaddr *sap,
176 const unsigned short port)
177{
178 switch (sap->sa_family) {
179 case AF_INET:
180 ((struct sockaddr_in *)sap)->sin_port = htons(port);
181 break;
182 case AF_INET6:
183 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
184 break;
185 }
186}
187
188#define IPV6_SCOPE_DELIMITER '%'
189#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
190
154#endif /* __KERNEL__ */ 191#endif /* __KERNEL__ */
155#endif /* _LINUX_SUNRPC_CLNT_H */ 192#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 70df4f1d8847..77e624883393 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -189,7 +189,22 @@ typedef __be32 rpc_fraghdr;
189 * Additionally, the two alternative forms specified in Section 2.2 of 189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable. 190 * [RFC2373] are also acceptable.
191 */ 191 */
192#define RPCBIND_MAXUADDRLEN (56u) 192
193#include <linux/inet.h>
194
195/* Maximum size of the port number part of a universal address */
196#define RPCBIND_MAXUADDRPLEN sizeof(".255.255")
197
198/* Maximum size of an IPv4 universal address */
199#define RPCBIND_MAXUADDR4LEN \
200 (INET_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
201
202/* Maximum size of an IPv6 universal address */
203#define RPCBIND_MAXUADDR6LEN \
204 (INET6_ADDRSTRLEN + RPCBIND_MAXUADDRPLEN)
205
206/* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */
207#define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN
193 208
194#endif /* __KERNEL__ */ 209#endif /* __KERNEL__ */
195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 210#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cea764c2359f..a92571a34556 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -32,8 +32,8 @@ struct rpc_inode {
32 wait_queue_head_t waitq; 32 wait_queue_head_t waitq;
33#define RPC_PIPE_WAIT_FOR_OPEN 1 33#define RPC_PIPE_WAIT_FOR_OPEN 1
34 int flags; 34 int flags;
35 struct rpc_pipe_ops *ops;
36 struct delayed_work queue_timeout; 35 struct delayed_work queue_timeout;
36 const struct rpc_pipe_ops *ops;
37}; 37};
38 38
39static inline struct rpc_inode * 39static inline struct rpc_inode *
@@ -44,9 +44,19 @@ RPC_I(struct inode *inode)
44 44
45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
46 46
47extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 47struct rpc_clnt;
48extern int rpc_rmdir(struct dentry *); 48extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
49extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags); 49extern int rpc_remove_client_dir(struct dentry *);
50
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
58extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
59 const struct rpc_pipe_ops *, int flags);
50extern int rpc_unlink(struct dentry *); 60extern int rpc_unlink(struct dentry *);
51extern struct vfsmount *rpc_get_mount(void); 61extern struct vfsmount *rpc_get_mount(void);
52extern void rpc_put_mount(void); 62extern void rpc_put_mount(void);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 1175d58efc2e..c090df442572 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -38,10 +38,8 @@ enum rpc_display_format_t {
38 RPC_DISPLAY_ADDR = 0, 38 RPC_DISPLAY_ADDR = 0,
39 RPC_DISPLAY_PORT, 39 RPC_DISPLAY_PORT,
40 RPC_DISPLAY_PROTO, 40 RPC_DISPLAY_PROTO,
41 RPC_DISPLAY_ALL,
42 RPC_DISPLAY_HEX_ADDR, 41 RPC_DISPLAY_HEX_ADDR,
43 RPC_DISPLAY_HEX_PORT, 42 RPC_DISPLAY_HEX_PORT,
44 RPC_DISPLAY_UNIVERSAL_ADDR,
45 RPC_DISPLAY_NETID, 43 RPC_DISPLAY_NETID,
46 RPC_DISPLAY_MAX, 44 RPC_DISPLAY_MAX,
47}; 45};