aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/clnt.h57
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h5
-rw-r--r--include/linux/sunrpc/xprt.h52
4 files changed, 77 insertions, 39 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8fe9f35eba31..f6d1d646ce05 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -18,18 +18,6 @@
18#include <linux/sunrpc/timer.h> 18#include <linux/sunrpc/timer.h>
19#include <asm/signal.h> 19#include <asm/signal.h>
20 20
21/*
22 * This defines an RPC port mapping
23 */
24struct rpc_portmap {
25 __u32 pm_prog;
26 __u32 pm_vers;
27 __u32 pm_prot;
28 __u16 pm_port;
29 unsigned char pm_binding : 1; /* doing a getport() */
30 struct rpc_wait_queue pm_bindwait; /* waiting on getport() */
31};
32
33struct rpc_inode; 21struct rpc_inode;
34 22
35/* 23/*
@@ -40,7 +28,9 @@ struct rpc_clnt {
40 atomic_t cl_users; /* number of references */ 28 atomic_t cl_users; /* number of references */
41 struct rpc_xprt * cl_xprt; /* transport */ 29 struct rpc_xprt * cl_xprt; /* transport */
42 struct rpc_procinfo * cl_procinfo; /* procedure info */ 30 struct rpc_procinfo * cl_procinfo; /* procedure info */
43 u32 cl_maxproc; /* max procedure number */ 31 u32 cl_prog, /* RPC program number */
32 cl_vers, /* RPC version number */
33 cl_maxproc; /* max procedure number */
44 34
45 char * cl_server; /* server machine name */ 35 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 36 char * cl_protname; /* protocol name */
@@ -55,7 +45,6 @@ struct rpc_clnt {
55 cl_dead : 1;/* abandoned */ 45 cl_dead : 1;/* abandoned */
56 46
57 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 47 struct rpc_rtt * cl_rtt; /* RTO estimator data */
58 struct rpc_portmap * cl_pmap; /* port mapping */
59 48
60 int cl_nodelen; /* nodename length */ 49 int cl_nodelen; /* nodename length */
61 char cl_nodename[UNX_MAXNODENAME]; 50 char cl_nodename[UNX_MAXNODENAME];
@@ -64,14 +53,8 @@ struct rpc_clnt {
64 struct dentry * cl_dentry; /* inode */ 53 struct dentry * cl_dentry; /* inode */
65 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 54 struct rpc_clnt * cl_parent; /* Points to parent of clones */
66 struct rpc_rtt cl_rtt_default; 55 struct rpc_rtt cl_rtt_default;
67 struct rpc_portmap cl_pmap_default;
68 char cl_inline_name[32]; 56 char cl_inline_name[32];
69}; 57};
70#define cl_timeout cl_xprt->timeout
71#define cl_prog cl_pmap->pm_prog
72#define cl_vers cl_pmap->pm_vers
73#define cl_port cl_pmap->pm_port
74#define cl_prot cl_pmap->pm_prot
75 58
76/* 59/*
77 * General RPC program info 60 * General RPC program info
@@ -106,24 +89,36 @@ struct rpc_procinfo {
106 char * p_name; /* name of procedure */ 89 char * p_name; /* name of procedure */
107}; 90};
108 91
109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
110#define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr)
111
112#ifdef __KERNEL__ 92#ifdef __KERNEL__
113 93
114struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, 94struct rpc_create_args {
115 struct rpc_program *info, 95 int protocol;
116 u32 version, rpc_authflavor_t authflavor); 96 struct sockaddr *address;
117struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, 97 size_t addrsize;
118 struct rpc_program *info, 98 struct rpc_timeout *timeout;
119 u32 version, rpc_authflavor_t authflavor); 99 char *servername;
100 struct rpc_program *program;
101 u32 version;
102 rpc_authflavor_t authflavor;
103 unsigned long flags;
104};
105
106/* Values for "flags" field */
107#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
108#define RPC_CLNT_CREATE_INTR (1UL << 1)
109#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
110#define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
111#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
112#define RPC_CLNT_CREATE_NOPING (1UL << 5)
113
114struct rpc_clnt *rpc_create(struct rpc_create_args *args);
120struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 115struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
121 struct rpc_program *, int); 116 struct rpc_program *, int);
122struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 117struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
123int rpc_shutdown_client(struct rpc_clnt *); 118int rpc_shutdown_client(struct rpc_clnt *);
124int rpc_destroy_client(struct rpc_clnt *); 119int rpc_destroy_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 120void rpc_release_client(struct rpc_clnt *);
126void rpc_getport(struct rpc_task *, struct rpc_clnt *); 121void rpc_getport(struct rpc_task *);
127int rpc_register(u32, u32, int, unsigned short, int *); 122int rpc_register(u32, u32, int, unsigned short, int *);
128 123
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 124void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
@@ -140,6 +135,8 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
140size_t rpc_max_payload(struct rpc_clnt *); 135size_t rpc_max_payload(struct rpc_clnt *);
141void rpc_force_rebind(struct rpc_clnt *); 136void rpc_force_rebind(struct rpc_clnt *);
142int rpc_ping(struct rpc_clnt *clnt, int flags); 137int rpc_ping(struct rpc_clnt *clnt, int flags);
138size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
139char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
143 140
144/* 141/*
145 * Helper function for NFSroot support 142 * Helper function for NFSroot support
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a481472c9484..a2eb9b4a9de3 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -43,7 +43,7 @@ extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
43 43
44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(struct dentry *); 45extern int rpc_rmdir(struct dentry *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(struct dentry *); 47extern int rpc_unlink(struct dentry *);
48extern struct vfsmount *rpc_get_mount(void); 48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void); 49extern void rpc_put_mount(void);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 82a91bb22362..f399c138f79d 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -127,7 +127,6 @@ struct rpc_call_ops {
127 */ 127 */
128#define RPC_TASK_ASYNC 0x0001 /* is an async task */ 128#define RPC_TASK_ASYNC 0x0001 /* is an async task */
129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */ 129#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */
130#define RPC_TASK_CHILD 0x0008 /* is child of other task */
131#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ 130#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */
132#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ 131#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */
133#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 132#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
@@ -136,7 +135,6 @@ struct rpc_call_ops {
136#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */ 135#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
137 136
138#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 137#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
139#define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD)
140#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 138#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
141#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 139#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
142#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 140#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
@@ -253,7 +251,6 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
253 const struct rpc_call_ops *ops, void *data); 251 const struct rpc_call_ops *ops, void *data);
254struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, 252struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
255 const struct rpc_call_ops *ops, void *data); 253 const struct rpc_call_ops *ops, void *data);
256struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
257void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, 254void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
258 int flags, const struct rpc_call_ops *ops, 255 int flags, const struct rpc_call_ops *ops,
259 void *data); 256 void *data);
@@ -261,8 +258,6 @@ void rpc_release_task(struct rpc_task *);
261void rpc_exit_task(struct rpc_task *); 258void rpc_exit_task(struct rpc_task *);
262void rpc_killall_tasks(struct rpc_clnt *); 259void rpc_killall_tasks(struct rpc_clnt *);
263int rpc_execute(struct rpc_task *); 260int rpc_execute(struct rpc_task *);
264void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
265 rpc_action action);
266void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 261void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
267void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 262void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
268void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 263void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3a0cca255b76..bdeba8538c71 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -12,6 +12,7 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h>
15#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
16#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
17 18
@@ -51,6 +52,14 @@ struct rpc_timeout {
51 unsigned char to_exponential; 52 unsigned char to_exponential;
52}; 53};
53 54
55enum rpc_display_format_t {
56 RPC_DISPLAY_ADDR = 0,
57 RPC_DISPLAY_PORT,
58 RPC_DISPLAY_PROTO,
59 RPC_DISPLAY_ALL,
60 RPC_DISPLAY_MAX,
61};
62
54struct rpc_task; 63struct rpc_task;
55struct rpc_xprt; 64struct rpc_xprt;
56struct seq_file; 65struct seq_file;
@@ -103,8 +112,10 @@ struct rpc_rqst {
103 112
104struct rpc_xprt_ops { 113struct rpc_xprt_ops {
105 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
115 char * (*print_addr)(struct rpc_xprt *xprt, enum rpc_display_format_t format);
106 int (*reserve_xprt)(struct rpc_task *task); 116 int (*reserve_xprt)(struct rpc_task *task);
107 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 117 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
118 void (*rpcbind)(struct rpc_task *task);
108 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_task *task);
110 void * (*buf_alloc)(struct rpc_task *task, size_t size); 121 void * (*buf_alloc)(struct rpc_task *task, size_t size);
@@ -119,12 +130,14 @@ struct rpc_xprt_ops {
119}; 130};
120 131
121struct rpc_xprt { 132struct rpc_xprt {
133 struct kref kref; /* Reference count */
122 struct rpc_xprt_ops * ops; /* transport methods */ 134 struct rpc_xprt_ops * ops; /* transport methods */
123 struct socket * sock; /* BSD socket layer */ 135 struct socket * sock; /* BSD socket layer */
124 struct sock * inet; /* INET layer */ 136 struct sock * inet; /* INET layer */
125 137
126 struct rpc_timeout timeout; /* timeout parms */ 138 struct rpc_timeout timeout; /* timeout parms */
127 struct sockaddr_in addr; /* server address */ 139 struct sockaddr_storage addr; /* server address */
140 size_t addrlen; /* size of server address */
128 int prot; /* IP protocol */ 141 int prot; /* IP protocol */
129 142
130 unsigned long cong; /* current congestion */ 143 unsigned long cong; /* current congestion */
@@ -138,6 +151,7 @@ struct rpc_xprt {
138 unsigned int tsh_size; /* size of transport specific 151 unsigned int tsh_size; /* size of transport specific
139 header */ 152 header */
140 153
154 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
141 struct rpc_wait_queue sending; /* requests waiting to send */ 155 struct rpc_wait_queue sending; /* requests waiting to send */
142 struct rpc_wait_queue resend; /* requests waiting to resend */ 156 struct rpc_wait_queue resend; /* requests waiting to resend */
143 struct rpc_wait_queue pending; /* requests in flight */ 157 struct rpc_wait_queue pending; /* requests in flight */
@@ -205,6 +219,8 @@ struct rpc_xprt {
205 void (*old_data_ready)(struct sock *, int); 219 void (*old_data_ready)(struct sock *, int);
206 void (*old_state_change)(struct sock *); 220 void (*old_state_change)(struct sock *);
207 void (*old_write_space)(struct sock *); 221 void (*old_write_space)(struct sock *);
222
223 char * address_strings[RPC_DISPLAY_MAX];
208}; 224};
209 225
210#define XPRT_LAST_FRAG (1 << 0) 226#define XPRT_LAST_FRAG (1 << 0)
@@ -217,12 +233,12 @@ struct rpc_xprt {
217/* 233/*
218 * Transport operations used by ULPs 234 * Transport operations used by ULPs
219 */ 235 */
220struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to);
221void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); 236void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
222 237
223/* 238/*
224 * Generic internal transport functions 239 * Generic internal transport functions
225 */ 240 */
241struct rpc_xprt * xprt_create_transport(int proto, struct sockaddr *addr, size_t size, struct rpc_timeout *toparms);
226void xprt_connect(struct rpc_task *task); 242void xprt_connect(struct rpc_task *task);
227void xprt_reserve(struct rpc_task *task); 243void xprt_reserve(struct rpc_task *task);
228int xprt_reserve_xprt(struct rpc_task *task); 244int xprt_reserve_xprt(struct rpc_task *task);
@@ -234,7 +250,8 @@ int xprt_adjust_timeout(struct rpc_rqst *req);
234void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 250void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
235void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 251void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
236void xprt_release(struct rpc_task *task); 252void xprt_release(struct rpc_task *task);
237int xprt_destroy(struct rpc_xprt *xprt); 253struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
254void xprt_put(struct rpc_xprt *xprt);
238 255
239static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) 256static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p)
240{ 257{
@@ -269,6 +286,8 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
269#define XPRT_CONNECTED (1) 286#define XPRT_CONNECTED (1)
270#define XPRT_CONNECTING (2) 287#define XPRT_CONNECTING (2)
271#define XPRT_CLOSE_WAIT (3) 288#define XPRT_CLOSE_WAIT (3)
289#define XPRT_BOUND (4)
290#define XPRT_BINDING (5)
272 291
273static inline void xprt_set_connected(struct rpc_xprt *xprt) 292static inline void xprt_set_connected(struct rpc_xprt *xprt)
274{ 293{
@@ -312,6 +331,33 @@ static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
312 return test_and_set_bit(XPRT_CONNECTING, &xprt->state); 331 return test_and_set_bit(XPRT_CONNECTING, &xprt->state);
313} 332}
314 333
334static inline void xprt_set_bound(struct rpc_xprt *xprt)
335{
336 test_and_set_bit(XPRT_BOUND, &xprt->state);
337}
338
339static inline int xprt_bound(struct rpc_xprt *xprt)
340{
341 return test_bit(XPRT_BOUND, &xprt->state);
342}
343
344static inline void xprt_clear_bound(struct rpc_xprt *xprt)
345{
346 clear_bit(XPRT_BOUND, &xprt->state);
347}
348
349static inline void xprt_clear_binding(struct rpc_xprt *xprt)
350{
351 smp_mb__before_clear_bit();
352 clear_bit(XPRT_BINDING, &xprt->state);
353 smp_mb__after_clear_bit();
354}
355
356static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
357{
358 return test_and_set_bit(XPRT_BINDING, &xprt->state);
359}
360
315#endif /* __KERNEL__*/ 361#endif /* __KERNEL__*/
316 362
317#endif /* _LINUX_SUNRPC_XPRT_H */ 363#endif /* _LINUX_SUNRPC_XPRT_H */