Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | ||
1da177e4 LT |
21 | struct rpc_inode; |
22 | ||
23 | /* | |
24 | * The high-level client handle | |
25 | */ | |
26 | struct rpc_clnt { | |
27 | atomic_t cl_count; /* Number of clones */ | |
28 | atomic_t cl_users; /* number of references */ | |
29 | struct rpc_xprt * cl_xprt; /* transport */ | |
30 | struct rpc_procinfo * cl_procinfo; /* procedure info */ | |
4a68179d CL |
31 | u32 cl_prog, /* RPC program number */ |
32 | cl_vers, /* RPC version number */ | |
33 | cl_maxproc; /* max procedure number */ | |
1da177e4 LT |
34 | |
35 | char * cl_server; /* server machine name */ | |
36 | char * cl_protname; /* protocol name */ | |
37 | struct rpc_auth * cl_auth; /* authenticator */ | |
11c556b3 CL |
38 | struct rpc_stat * cl_stats; /* per-program statistics */ |
39 | struct rpc_iostats * cl_metrics; /* per-client statistics */ | |
1da177e4 LT |
40 | |
41 | unsigned int cl_softrtry : 1,/* soft timeouts */ | |
42 | cl_intr : 1,/* interruptible */ | |
1da177e4 LT |
43 | cl_autobind : 1,/* use getport() */ |
44 | cl_oneshot : 1,/* dispose after use */ | |
45 | cl_dead : 1;/* abandoned */ | |
46 | ||
47 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | |
1da177e4 LT |
48 | |
49 | int cl_nodelen; /* nodename length */ | |
50 | char cl_nodename[UNX_MAXNODENAME]; | |
51 | char cl_pathname[30];/* Path in rpc_pipe_fs */ | |
54281548 | 52 | struct vfsmount * cl_vfsmnt; |
1da177e4 LT |
53 | struct dentry * cl_dentry; /* inode */ |
54 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | |
55 | struct rpc_rtt cl_rtt_default; | |
1da177e4 LT |
56 | char cl_inline_name[32]; |
57 | }; | |
1da177e4 LT |
58 | |
59 | /* | |
60 | * General RPC program info | |
61 | */ | |
62 | #define RPC_MAXVERSION 4 | |
63 | struct rpc_program { | |
64 | char * name; /* protocol name */ | |
65 | u32 number; /* program number */ | |
66 | unsigned int nrvers; /* number of versions */ | |
67 | struct rpc_version ** version; /* version array */ | |
68 | struct rpc_stat * stats; /* statistics */ | |
69 | char * pipe_dir_name; /* path to rpc_pipefs dir */ | |
70 | }; | |
71 | ||
72 | struct rpc_version { | |
73 | u32 number; /* version number */ | |
74 | unsigned int nrprocs; /* number of procs */ | |
75 | struct rpc_procinfo * procs; /* procedure array */ | |
76 | }; | |
77 | ||
78 | /* | |
79 | * Procedure information | |
80 | */ | |
81 | struct rpc_procinfo { | |
82 | u32 p_proc; /* RPC procedure number */ | |
83 | kxdrproc_t p_encode; /* XDR encode function */ | |
84 | kxdrproc_t p_decode; /* XDR decode function */ | |
85 | unsigned int p_bufsiz; /* req. buffer size */ | |
86 | unsigned int p_count; /* call count */ | |
87 | unsigned int p_timer; /* Which RTT timer to use */ | |
cc0175c1 CL |
88 | u32 p_statidx; /* Which procedure to account */ |
89 | char * p_name; /* name of procedure */ | |
1da177e4 LT |
90 | }; |
91 | ||
92 | #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) | |
93 | #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr) | |
94 | ||
95 | #ifdef __KERNEL__ | |
96 | ||
97 | struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname, | |
98 | struct rpc_program *info, | |
99 | u32 version, rpc_authflavor_t authflavor); | |
5ee0ed7d TM |
100 | struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname, |
101 | struct rpc_program *info, | |
102 | u32 version, rpc_authflavor_t authflavor); | |
007e251f AG |
103 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
104 | struct rpc_program *, int); | |
1da177e4 LT |
105 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
106 | int rpc_shutdown_client(struct rpc_clnt *); | |
107 | int rpc_destroy_client(struct rpc_clnt *); | |
108 | void rpc_release_client(struct rpc_clnt *); | |
bbf7c1dd | 109 | void rpc_getport(struct rpc_task *); |
1da177e4 LT |
110 | int rpc_register(u32, u32, int, unsigned short, int *); |
111 | ||
112 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); | |
113 | ||
114 | int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, | |
963d8fe5 TM |
115 | int flags, const struct rpc_call_ops *tk_ops, |
116 | void *calldata); | |
1da177e4 LT |
117 | int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, |
118 | int flags); | |
119 | void rpc_restart_call(struct rpc_task *); | |
120 | void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset); | |
121 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); | |
122 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | |
123 | size_t rpc_max_payload(struct rpc_clnt *); | |
35f5a422 | 124 | void rpc_force_rebind(struct rpc_clnt *); |
5ee0ed7d | 125 | int rpc_ping(struct rpc_clnt *clnt, int flags); |
1da177e4 | 126 | |
1da177e4 LT |
127 | /* |
128 | * Helper function for NFSroot support | |
129 | */ | |
130 | int rpc_getport_external(struct sockaddr_in *, __u32, __u32, int); | |
131 | ||
132 | #endif /* __KERNEL__ */ | |
133 | #endif /* _LINUX_SUNRPC_CLNT_H */ |