aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-08-21 11:27:29 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-08-21 11:27:29 -0400
commite9dc122166b8d863d3057a66ada04838e5548e52 (patch)
tree749e15bf719b64bf9113db7acd8e043d9742cb26 /include/linux/sunrpc
parent560ab42ef923aaf2e4347315bdfcc74b2708972c (diff)
parent405d8f8b1d936414da2093d4149ff790ff3f84a5 (diff)
Merge branch 'nfs-for-2.6.32' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6 into for-2.6.32-incoming
Conflicts: net/sunrpc/cache.c
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.h20
-rw-r--r--include/linux/sunrpc/xdr.h11
-rw-r--r--include/linux/sunrpc/xprt.h2
6 files changed, 110 insertions, 23 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..cf14db975da0 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -3,6 +3,8 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/workqueue.h>
7
6struct rpc_pipe_msg { 8struct rpc_pipe_msg {
7 struct list_head list; 9 struct list_head list;
8 void *data; 10 void *data;
@@ -32,8 +34,8 @@ struct rpc_inode {
32 wait_queue_head_t waitq; 34 wait_queue_head_t waitq;
33#define RPC_PIPE_WAIT_FOR_OPEN 1 35#define RPC_PIPE_WAIT_FOR_OPEN 1
34 int flags; 36 int flags;
35 struct rpc_pipe_ops *ops;
36 struct delayed_work queue_timeout; 37 struct delayed_work queue_timeout;
38 const struct rpc_pipe_ops *ops;
37}; 39};
38 40
39static inline struct rpc_inode * 41static inline struct rpc_inode *
@@ -44,9 +46,19 @@ RPC_I(struct inode *inode)
44 46
45extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 47extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
46 48
47extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 49struct rpc_clnt;
48extern int rpc_rmdir(struct dentry *); 50extern 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); 51extern int rpc_remove_client_dir(struct dentry *);
52
53struct cache_detail;
54extern struct dentry *rpc_create_cache_dir(struct dentry *,
55 struct qstr *,
56 mode_t umode,
57 struct cache_detail *);
58extern void rpc_remove_cache_dir(struct dentry *);
59
60extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *,
61 const struct rpc_pipe_ops *, int flags);
50extern int rpc_unlink(struct dentry *); 62extern int rpc_unlink(struct dentry *);
51extern struct vfsmount *rpc_get_mount(void); 63extern struct vfsmount *rpc_get_mount(void);
52extern void rpc_put_mount(void); 64extern void rpc_put_mount(void);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index d8910b68e1bd..7da466ba4b0d 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -12,7 +12,6 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/smp_lock.h>
16 15
17/* 16/*
18 * Buffer adjustment 17 * Buffer adjustment
@@ -118,17 +117,15 @@ static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int le
118static inline __be32 * 117static inline __be32 *
119xdr_encode_hyper(__be32 *p, __u64 val) 118xdr_encode_hyper(__be32 *p, __u64 val)
120{ 119{
121 *p++ = htonl(val >> 32); 120 *(__be64 *)p = cpu_to_be64(val);
122 *p++ = htonl(val & 0xFFFFFFFF); 121 return p + 2;
123 return p;
124} 122}
125 123
126static inline __be32 * 124static inline __be32 *
127xdr_decode_hyper(__be32 *p, __u64 *valp) 125xdr_decode_hyper(__be32 *p, __u64 *valp)
128{ 126{
129 *valp = ((__u64) ntohl(*p++)) << 32; 127 *valp = be64_to_cpup((__be64 *)p);
130 *valp |= ntohl(*p++); 128 return p + 2;
131 return p;
132} 129}
133 130
134/* 131/*
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};