Rev 423 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
423 | giacomo | 1 | /* |
2 | * linux/include/linux/sunrpc/clnt.h |
||
3 | * |
||
4 | * Declarations for the high-level RPC client interface |
||
5 | * |
||
6 | * Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de> |
||
7 | */ |
||
8 | |||
9 | #ifndef _LINUX_SUNRPC_CLNT_H |
||
10 | #define _LINUX_SUNRPC_CLNT_H |
||
11 | |||
12 | #include <linux/sunrpc/msg_prot.h> |
||
13 | #include <linux/sunrpc/sched.h> |
||
14 | #include <linux/sunrpc/xprt.h> |
||
15 | #include <linux/sunrpc/auth.h> |
||
16 | #include <linux/sunrpc/stats.h> |
||
17 | #include <linux/sunrpc/xdr.h> |
||
18 | #include <linux/sunrpc/timer.h> |
||
19 | #include <asm/signal.h> |
||
20 | |||
21 | /* |
||
22 | * This defines an RPC port mapping |
||
23 | */ |
||
24 | struct rpc_portmap { |
||
25 | __u32 pm_prog; |
||
26 | __u32 pm_vers; |
||
27 | __u32 pm_prot; |
||
28 | __u16 pm_port; |
||
29 | }; |
||
30 | |||
31 | struct rpc_inode; |
||
32 | |||
33 | /* |
||
34 | * The high-level client handle |
||
35 | */ |
||
36 | struct rpc_clnt { |
||
37 | atomic_t cl_users; /* number of references */ |
||
38 | struct rpc_xprt * cl_xprt; /* transport */ |
||
39 | struct rpc_procinfo * cl_procinfo; /* procedure info */ |
||
40 | u32 cl_maxproc; /* max procedure number */ |
||
41 | |||
42 | char * cl_server; /* server machine name */ |
||
43 | char * cl_protname; /* protocol name */ |
||
44 | struct rpc_auth * cl_auth; /* authenticator */ |
||
45 | struct rpc_stat * cl_stats; /* statistics */ |
||
46 | |||
47 | unsigned int cl_softrtry : 1,/* soft timeouts */ |
||
48 | cl_intr : 1,/* interruptible */ |
||
49 | cl_chatty : 1,/* be verbose */ |
||
50 | cl_autobind : 1,/* use getport() */ |
||
51 | cl_binding : 1,/* doing a getport() */ |
||
52 | cl_droppriv : 1,/* enable NFS suid hack */ |
||
53 | cl_oneshot : 1,/* dispose after use */ |
||
54 | cl_dead : 1;/* abandoned */ |
||
55 | |||
56 | struct rpc_rtt cl_rtt; /* RTO estimator data */ |
||
57 | |||
58 | struct rpc_portmap cl_pmap; /* port mapping */ |
||
59 | struct rpc_wait_queue cl_bindwait; /* waiting on getport() */ |
||
60 | |||
61 | int cl_nodelen; /* nodename length */ |
||
62 | char cl_nodename[UNX_MAXNODENAME]; |
||
63 | char cl_pathname[30];/* Path in rpc_pipe_fs */ |
||
64 | struct dentry * cl_dentry; /* inode */ |
||
65 | }; |
||
66 | #define cl_timeout cl_xprt->timeout |
||
67 | #define cl_prog cl_pmap.pm_prog |
||
68 | #define cl_vers cl_pmap.pm_vers |
||
69 | #define cl_port cl_pmap.pm_port |
||
70 | #define cl_prot cl_pmap.pm_prot |
||
71 | |||
72 | /* |
||
73 | * General RPC program info |
||
74 | */ |
||
75 | #define RPC_MAXVERSION 4 |
||
76 | struct rpc_program { |
||
77 | char * name; /* protocol name */ |
||
78 | u32 number; /* program number */ |
||
79 | unsigned int nrvers; /* number of versions */ |
||
80 | struct rpc_version ** version; /* version array */ |
||
81 | struct rpc_stat * stats; /* statistics */ |
||
82 | char * pipe_dir_name; /* path to rpc_pipefs dir */ |
||
83 | }; |
||
84 | |||
85 | struct rpc_version { |
||
86 | u32 number; /* version number */ |
||
87 | unsigned int nrprocs; /* number of procs */ |
||
88 | struct rpc_procinfo * procs; /* procedure array */ |
||
89 | }; |
||
90 | |||
91 | /* |
||
92 | * Procedure information |
||
93 | */ |
||
94 | struct rpc_procinfo { |
||
95 | u32 p_proc; /* RPC procedure number */ |
||
96 | kxdrproc_t p_encode; /* XDR encode function */ |
||
97 | kxdrproc_t p_decode; /* XDR decode function */ |
||
98 | unsigned int p_bufsiz; /* req. buffer size */ |
||
99 | unsigned int p_count; /* call count */ |
||
100 | unsigned int p_timer; /* Which RTT timer to use */ |
||
101 | }; |
||
102 | |||
103 | #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) |
||
104 | #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr) |
||
105 | |||
106 | #ifdef __KERNEL__ |
||
107 | |||
108 | struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, |
||
109 | struct rpc_program *info, |
||
110 | u32 version, rpc_authflavor_t authflavor); |
||
111 | int rpc_shutdown_client(struct rpc_clnt *); |
||
112 | int rpc_destroy_client(struct rpc_clnt *); |
||
113 | void rpc_release_client(struct rpc_clnt *); |
||
114 | void rpc_getport(struct rpc_task *, struct rpc_clnt *); |
||
115 | int rpc_register(u32, u32, int, unsigned short, int *); |
||
116 | |||
117 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); |
||
118 | |||
119 | int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, |
||
120 | int flags, rpc_action callback, void *clntdata); |
||
121 | int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, |
||
122 | int flags); |
||
123 | void rpc_restart_call(struct rpc_task *); |
||
124 | void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset); |
||
125 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); |
||
126 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); |
||
127 | |||
128 | static __inline__ |
||
129 | int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags) |
||
130 | { |
||
131 | struct rpc_message msg = { |
||
132 | .rpc_proc = &clnt->cl_procinfo[proc], |
||
133 | .rpc_argp = argp, |
||
134 | .rpc_resp = resp, |
||
135 | .rpc_cred = NULL |
||
136 | }; |
||
137 | return rpc_call_sync(clnt, &msg, flags); |
||
138 | } |
||
139 | |||
140 | extern void rpciod_wake_up(void); |
||
141 | |||
142 | /* |
||
143 | * Helper function for NFSroot support |
||
144 | */ |
||
145 | int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int); |
||
146 | |||
147 | #endif /* __KERNEL__ */ |
||
148 | #endif /* _LINUX_SUNRPC_CLNT_H */ |