1
2
3
4
5
6
7
8 #ifndef _LINUX_RPCSOCK_H
9 #define _LINUX_RPCSOCK_H
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #define RPC_MAXREQS 32
27 #define RPC_CWNDSCALE 256
28 #define RPC_MAXCWND (RPC_MAXREQS * RPC_CWNDSCALE)
29
30 #define RPC_INITCWND RPC_CWNDSCALE
31 #define RPC_CONGESTED(rsock) ((rsock)->cong >= (rsock)->cwnd)
32
33
34
35
36 #define RPC_HDRSIZE (4 * 4)
37
38
39
40
41 struct rpc_timeout {
42 unsigned long to_initval,
43 to_maxval,
44 to_increment;
45 int to_retries;
46 char to_exponential;
47 };
48
49
50
51
52 struct rpc_ioreq {
53 struct rpc_wait * rq_slot;
54 struct sockaddr * rq_addr;
55 int rq_alen;
56 struct iovec rq_svec[MAX_IOVEC];
57 unsigned int rq_snr;
58 unsigned long rq_slen;
59 struct iovec rq_rvec[MAX_IOVEC];
60 unsigned int rq_rnr;
61 unsigned long rq_rlen;
62 };
63
64
65
66
67 struct rpc_wait;
68 typedef void (*rpc_callback_fn_t)(int, struct rpc_wait *, void *);
69
70
71
72
73
74 struct rpc_wait {
75 struct rpc_sock * w_sock;
76 struct rpc_wait * w_prev;
77 struct rpc_wait * w_next;
78 struct rpc_ioreq * w_req;
79 int w_result;
80 struct wait_queue * w_wait;
81 rpc_callback_fn_t w_handler;
82 void * w_cdata;
83 char w_queued;
84 char w_gotit;
85 __u32 w_xid;
86 };
87
88 struct rpc_sock {
89 struct file * file;
90 struct socket * sock;
91 struct sock * inet;
92 struct rpc_wait waiting[RPC_MAXREQS];
93 unsigned long cong;
94 unsigned long cwnd;
95 struct rpc_wait * pending;
96 struct rpc_wait * free;
97 struct wait_queue * backlog;
98 struct wait_queue * shutwait;
99 int shutdown;
100 };
101
102 #ifdef __KERNEL__
103
104
105 int rpc_call(struct rpc_sock *, struct rpc_ioreq *,
106 struct rpc_timeout *);
107
108
109
110
111 int rpc_reserve(struct rpc_sock *, struct rpc_ioreq *, int);
112 void rpc_release(struct rpc_sock *, struct rpc_ioreq *);
113 int rpc_transmit(struct rpc_sock *, struct rpc_ioreq *);
114 int rpc_doio(struct rpc_sock *, struct rpc_ioreq *,
115 struct rpc_timeout *, int);
116 struct rpc_sock * rpc_makesock(struct file *);
117 int rpc_closesock(struct rpc_sock *);
118
119 #endif
120
121 #endif