2 * linux/include/linux/sunrpc/clnt.h
4 * Declarations for the high-level RPC client interface
6 * Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de>
9 #ifndef _LINUX_SUNRPC_CLNT_H
10 #define _LINUX_SUNRPC_CLNT_H
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>
22 * This defines an RPC port mapping
29 unsigned char pm_binding
: 1; /* doing a getport() */
30 struct rpc_wait_queue pm_bindwait
; /* waiting on getport() */
36 * The high-level client handle
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 */
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
; /* statistics */
50 unsigned int cl_softrtry
: 1,/* soft timeouts */
51 cl_intr
: 1,/* interruptible */
52 cl_chatty
: 1,/* be verbose */
53 cl_autobind
: 1,/* use getport() */
54 cl_droppriv
: 1,/* enable NFS suid hack */
55 cl_oneshot
: 1,/* dispose after use */
56 cl_dead
: 1;/* abandoned */
58 struct rpc_rtt
* cl_rtt
; /* RTO estimator data */
59 struct rpc_portmap
* cl_pmap
; /* port mapping */
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 struct rpc_clnt
* cl_parent
; /* Points to parent of clones */
66 struct rpc_rtt cl_rtt_default
;
67 struct rpc_portmap cl_pmap_default
;
68 char cl_inline_name
[32];
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
77 * General RPC program info
79 #define RPC_MAXVERSION 4
81 char * name
; /* protocol name */
82 u32 number
; /* program number */
83 unsigned int nrvers
; /* number of versions */
84 struct rpc_version
** version
; /* version array */
85 struct rpc_stat
* stats
; /* statistics */
86 char * pipe_dir_name
; /* path to rpc_pipefs dir */
90 u32 number
; /* version number */
91 unsigned int nrprocs
; /* number of procs */
92 struct rpc_procinfo
* procs
; /* procedure array */
96 * Procedure information
99 u32 p_proc
; /* RPC procedure number */
100 kxdrproc_t p_encode
; /* XDR encode function */
101 kxdrproc_t p_decode
; /* XDR decode function */
102 unsigned int p_bufsiz
; /* req. buffer size */
103 unsigned int p_count
; /* call count */
104 unsigned int p_timer
; /* Which RTT timer to use */
107 #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
108 #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr)
112 struct rpc_clnt
*rpc_create_client(struct rpc_xprt
*xprt
, char *servname
,
113 struct rpc_program
*info
,
114 u32 version
, rpc_authflavor_t authflavor
);
115 struct rpc_clnt
*rpc_clone_client(struct rpc_clnt
*);
116 int rpc_shutdown_client(struct rpc_clnt
*);
117 int rpc_destroy_client(struct rpc_clnt
*);
118 void rpc_release_client(struct rpc_clnt
*);
119 void rpc_getport(struct rpc_task
*, struct rpc_clnt
*);
120 int rpc_register(u32
, u32
, int, unsigned short, int *);
122 void rpc_call_setup(struct rpc_task
*, struct rpc_message
*, int);
124 int rpc_call_async(struct rpc_clnt
*clnt
, struct rpc_message
*msg
,
125 int flags
, rpc_action callback
, void *clntdata
);
126 int rpc_call_sync(struct rpc_clnt
*clnt
, struct rpc_message
*msg
,
128 void rpc_restart_call(struct rpc_task
*);
129 void rpc_clnt_sigmask(struct rpc_clnt
*clnt
, sigset_t
*oldset
);
130 void rpc_clnt_sigunmask(struct rpc_clnt
*clnt
, sigset_t
*oldset
);
131 void rpc_setbufsize(struct rpc_clnt
*, unsigned int, unsigned int);
134 int rpc_call(struct rpc_clnt
*clnt
, u32 proc
, void *argp
, void *resp
, int flags
)
136 struct rpc_message msg
= {
137 .rpc_proc
= &clnt
->cl_procinfo
[proc
],
142 return rpc_call_sync(clnt
, &msg
, flags
);
145 extern void rpciod_wake_up(void);
148 * Helper function for NFSroot support
150 int rpc_getport_external(struct sockaddr_in
*, __u32
, __u32
, int);
152 #endif /* __KERNEL__ */
153 #endif /* _LINUX_SUNRPC_CLNT_H */