Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / sunrpc / clnt.h
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         unsigned char           pm_binding : 1; /* doing a getport() */
30         struct rpc_wait_queue   pm_bindwait;    /* waiting on getport() */
31 };
32
33 struct rpc_inode;
34
35 /*
36  * The high-level client handle
37  */
38 struct rpc_clnt {
39         atomic_t                cl_count;       /* Number of clones */
40         atomic_t                cl_users;       /* number of references */
41         struct rpc_xprt *       cl_xprt;        /* transport */
42         struct rpc_procinfo *   cl_procinfo;    /* procedure info */
43         u32                     cl_maxproc;     /* max procedure number */
44
45         char *                  cl_server;      /* server machine name */
46         char *                  cl_protname;    /* protocol name */
47         struct rpc_auth *       cl_auth;        /* authenticator */
48         struct rpc_stat *       cl_stats;       /* per-program statistics */
49         struct rpc_iostats *    cl_metrics;     /* per-client statistics */
50
51         unsigned int            cl_softrtry : 1,/* soft timeouts */
52                                 cl_intr     : 1,/* interruptible */
53                                 cl_autobind : 1,/* use getport() */
54                                 cl_oneshot  : 1,/* dispose after use */
55                                 cl_dead     : 1,/* abandoned */
56                                 cl_tagxid   : 1;/* do xid tagging */
57
58         struct rpc_rtt *        cl_rtt;         /* RTO estimator data */
59         struct rpc_portmap *    cl_pmap;        /* port mapping */
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 vfsmount *       cl_vfsmnt;
65         struct dentry *         cl_dentry;      /* inode */
66         struct rpc_clnt *       cl_parent;      /* Points to parent of clones */
67         struct rpc_rtt          cl_rtt_default;
68         struct rpc_portmap      cl_pmap_default;
69         char                    cl_inline_name[32];
70 };
71 #define cl_timeout              cl_xprt->timeout
72 #define cl_prog                 cl_pmap->pm_prog
73 #define cl_vers                 cl_pmap->pm_vers
74 #define cl_port                 cl_pmap->pm_port
75 #define cl_prot                 cl_pmap->pm_prot
76
77 /*
78  * General RPC program info
79  */
80 #define RPC_MAXVERSION          4
81 struct rpc_program {
82         char *                  name;           /* protocol name */
83         u32                     number;         /* program number */
84         unsigned int            nrvers;         /* number of versions */
85         struct rpc_version **   version;        /* version array */
86         struct rpc_stat *       stats;          /* statistics */
87         char *                  pipe_dir_name;  /* path to rpc_pipefs dir */
88 };
89
90 struct rpc_version {
91         u32                     number;         /* version number */
92         unsigned int            nrprocs;        /* number of procs */
93         struct rpc_procinfo *   procs;          /* procedure array */
94 };
95
96 /*
97  * Procedure information
98  */
99 struct rpc_procinfo {
100         u32                     p_proc;         /* RPC procedure number */
101         kxdrproc_t              p_encode;       /* XDR encode function */
102         kxdrproc_t              p_decode;       /* XDR decode function */
103         unsigned int            p_bufsiz;       /* req. buffer size */
104         unsigned int            p_count;        /* call count */
105         unsigned int            p_timer;        /* Which RTT timer to use */
106         u32                     p_statidx;      /* Which procedure to account */
107         char *                  p_name;         /* name of procedure */
108 };
109
110 #define RPC_CONGESTED(clnt)     (RPCXPRT_CONGESTED((clnt)->cl_xprt))
111 #define RPC_PEERADDR(clnt)      (&(clnt)->cl_xprt->addr)
112
113 #ifdef __KERNEL__
114
115 struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
116                                 struct rpc_program *info,
117                                 u32 version, rpc_authflavor_t authflavor);
118 struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname,
119                                 struct rpc_program *info,
120                                 u32 version, rpc_authflavor_t authflavor);
121 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
122                                 struct rpc_program *, int);
123 struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
124 int             rpc_shutdown_client(struct rpc_clnt *);
125 int             rpc_destroy_client(struct rpc_clnt *);
126 void            rpc_release_client(struct rpc_clnt *);
127 void            rpc_getport(struct rpc_task *, struct rpc_clnt *);
128 int             rpc_register(u32, u32, int, unsigned short, int *);
129
130 void            rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
131
132 int             rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
133                                int flags, const struct rpc_call_ops *tk_ops,
134                                void *calldata);
135 int             rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
136                               int flags);
137 void            rpc_restart_call(struct rpc_task *);
138 void            rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
139 void            rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
140 void            rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
141 size_t          rpc_max_payload(struct rpc_clnt *);
142 void            rpc_force_rebind(struct rpc_clnt *);
143 int             rpc_ping(struct rpc_clnt *clnt, int flags);
144
145 /*
146  * Helper function for NFSroot support
147  */
148 int             rpc_getport_external(struct sockaddr_in *, __u32, __u32, int);
149
150 #endif /* __KERNEL__ */
151 #endif /* _LINUX_SUNRPC_CLNT_H */