NFS: implement option checking when remounting NFS filesystems (resend)
[linux-2.6-block.git] / include / linux / sunrpc / clnt.h
CommitLineData
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
21struct rpc_inode;
22
23/*
24 * The high-level client handle
25 */
26struct rpc_clnt {
34f52e35 27 struct kref cl_kref; /* Number of references */
6529eba0
TM
28 struct list_head cl_clients; /* Global list of clients */
29 struct list_head cl_tasks; /* List of tasks */
4bef61ff 30 spinlock_t cl_lock; /* spinlock */
1da177e4
LT
31 struct rpc_xprt * cl_xprt; /* transport */
32 struct rpc_procinfo * cl_procinfo; /* procedure info */
4a68179d
CL
33 u32 cl_prog, /* RPC program number */
34 cl_vers, /* RPC version number */
35 cl_maxproc; /* max procedure number */
1da177e4
LT
36
37 char * cl_server; /* server machine name */
38 char * cl_protname; /* protocol name */
39 struct rpc_auth * cl_auth; /* authenticator */
11c556b3
CL
40 struct rpc_stat * cl_stats; /* per-program statistics */
41 struct rpc_iostats * cl_metrics; /* per-client statistics */
1da177e4
LT
42
43 unsigned int cl_softrtry : 1,/* soft timeouts */
43d78ef2 44 cl_discrtry : 1,/* disconnect before retry */
90c5755f 45 cl_autobind : 1;/* use getport() */
1da177e4
LT
46
47 struct rpc_rtt * cl_rtt; /* RTO estimator data */
ba7392bb 48 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
1da177e4
LT
49
50 int cl_nodelen; /* nodename length */
51 char cl_nodename[UNX_MAXNODENAME];
52 char cl_pathname[30];/* Path in rpc_pipe_fs */
54281548 53 struct vfsmount * cl_vfsmnt;
1da177e4
LT
54 struct dentry * cl_dentry; /* inode */
55 struct rpc_clnt * cl_parent; /* Points to parent of clones */
56 struct rpc_rtt cl_rtt_default;
ba7392bb 57 struct rpc_timeout cl_timeout_default;
3e32a5d9 58 struct rpc_program * cl_program;
1da177e4
LT
59 char cl_inline_name[32];
60};
1da177e4
LT
61
62/*
63 * General RPC program info
64 */
65#define RPC_MAXVERSION 4
66struct rpc_program {
67 char * name; /* protocol name */
68 u32 number; /* program number */
69 unsigned int nrvers; /* number of versions */
70 struct rpc_version ** version; /* version array */
71 struct rpc_stat * stats; /* statistics */
72 char * pipe_dir_name; /* path to rpc_pipefs dir */
73};
74
75struct rpc_version {
76 u32 number; /* version number */
77 unsigned int nrprocs; /* number of procs */
78 struct rpc_procinfo * procs; /* procedure array */
79};
80
81/*
82 * Procedure information
83 */
84struct rpc_procinfo {
85 u32 p_proc; /* RPC procedure number */
86 kxdrproc_t p_encode; /* XDR encode function */
87 kxdrproc_t p_decode; /* XDR decode function */
2bea90d4
CL
88 unsigned int p_arglen; /* argument hdr length (u32) */
89 unsigned int p_replen; /* reply hdr length (u32) */
1da177e4
LT
90 unsigned int p_count; /* call count */
91 unsigned int p_timer; /* Which RTT timer to use */
cc0175c1
CL
92 u32 p_statidx; /* Which procedure to account */
93 char * p_name; /* name of procedure */
1da177e4
LT
94};
95
1da177e4
LT
96#ifdef __KERNEL__
97
c2866763
CL
98struct rpc_create_args {
99 int protocol;
100 struct sockaddr *address;
101 size_t addrsize;
d3bc9a1d 102 struct sockaddr *saddress;
ba7392bb 103 const struct rpc_timeout *timeout;
c2866763
CL
104 char *servername;
105 struct rpc_program *program;
106 u32 version;
107 rpc_authflavor_t authflavor;
108 unsigned long flags;
109};
110
111/* Values for "flags" field */
112#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
c2866763 113#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
90c5755f
TM
114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
115#define RPC_CLNT_CREATE_NOPING (1UL << 4)
116#define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)
c2866763
CL
117
118struct rpc_clnt *rpc_create(struct rpc_create_args *args);
007e251f 119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
89eb21c3 120 struct rpc_program *, u32);
1da177e4 121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
4c402b40 122void rpc_shutdown_client(struct rpc_clnt *);
1da177e4 123void rpc_release_client(struct rpc_clnt *);
cce63cd6 124
a509050b 125int rpcb_register(u32, u32, int, unsigned short, int *);
f1ec08cb 126int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
45160d62 127void rpcb_getport_async(struct rpc_task *);
1da177e4 128
77de2c59 129void rpc_call_start(struct rpc_task *);
cbc20059
TM
130int rpc_call_async(struct rpc_clnt *clnt,
131 const struct rpc_message *msg, int flags,
132 const struct rpc_call_ops *tk_ops,
963d8fe5 133 void *calldata);
cbc20059
TM
134int rpc_call_sync(struct rpc_clnt *clnt,
135 const struct rpc_message *msg, int flags);
5e1550d6
TM
136struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
137 int flags);
1da177e4 138void rpc_restart_call(struct rpc_task *);
1da177e4
LT
139void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
140size_t rpc_max_payload(struct rpc_clnt *);
35f5a422 141void rpc_force_rebind(struct rpc_clnt *);
ed39440a 142size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
b454ae90 143const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
1da177e4 144
1da177e4
LT
145#endif /* __KERNEL__ */
146#endif /* _LINUX_SUNRPC_CLNT_H */