1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _LINUX_SUNRPC_XPRT_H 13 #define _LINUX_SUNRPC_XPRT_H 14 15 #include <linux/uio.h> 16 #include <linux/socket.h> 17 #include <linux/in.h> 18 #include <linux/sunrpc/sched.h> 19 #include <linux/sunrpc/xdr.h> 20 21 #define RPC_MIN_SLOT_TABLE (2U) 22 #define RPC_DEF_SLOT_TABLE (16U) 23 #define RPC_MAX_SLOT_TABLE (128U) 24 25 #define RPC_CALLHDRSIZE 6 26 #define RPC_REPHDRSIZE 4 27 28 #define RPC_MIN_RESVPORT (1U) 29 #define RPC_MAX_RESVPORT (65535U) 30 #define RPC_DEF_MIN_RESVPORT (665U) 31 #define RPC_DEF_MAX_RESVPORT (1023U) 32 33 struct rpc_timeout { 34 unsigned long to_initval, 35 to_maxval, 36 to_increment; 37 unsigned int to_retries; 38 unsigned char to_exponential; 39 }; 40 41 struct rpc_task; 42 struct rpc_xprt; 43 struct seq_file; 44 45 struct rpc_rqst { 46 47 struct rpc_xprt * rq_xprt; 48 struct xdr_buf rq_snd_buf; 49 struct xdr_buf rq_rcv_buf; 50 51 struct rpc_task * rq_task; 52 __u32 rq_xid; 53 int rq_cong; 54 int rq_received; 55 u32 rq_seqno; 56 int rq_enc_pages_num; 57 struct page **rq_enc_pages; 58 void (*rq_release_snd_buf)(struct rpc_rqst *); 59 struct list_head rq_list; 60 61 __u32 * rq_buffer; 62 size_t rq_bufsize; 63 64 struct xdr_buf rq_private_buf; 65 unsigned long rq_majortimeo; 66 unsigned long rq_timeout; 67 unsigned int rq_retries; 68 69 u32 rq_bytes_sent; 70 71 unsigned long rq_xtime; 72 int rq_ntrans; 73 }; 74 #define rq_svec rq_snd_buf.head 75 #define rq_slen rq_snd_buf.len 76 77 struct rpc_xprt_ops { 78 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 79 int (*reserve_xprt)(struct rpc_task *task); 80 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 81 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 82 void (*connect)(struct rpc_task *task); 83 void * (*buf_alloc)(struct rpc_task *task, size_t size); 84 void (*buf_free)(struct rpc_task *task); 85 int (*send_request)(struct rpc_task *task); 86 void (*set_retrans_timeout)(struct rpc_task *task); 87 void (*timer)(struct rpc_task *task); 88 void (*release_request)(struct rpc_task *task); 89 void (*close)(struct rpc_xprt *xprt); 90 void (*destroy)(struct rpc_xprt *xprt); 91 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); 92 }; 93 94 struct rpc_xprt { 95 struct rpc_xprt_ops * ops; 96 struct socket * sock; 97 struct sock * inet; 98 99 struct rpc_timeout timeout; 100 struct sockaddr_in addr; 101 int prot; 102 103 unsigned long cong; 104 unsigned long cwnd; 105 106 size_t rcvsize, 107 sndsize; 108 109 size_t max_payload; 110 unsigned int tsh_size; 111 112 struct rpc_wait_queue sending; 113 struct rpc_wait_queue resend; 114 struct rpc_wait_queue pending; 115 struct rpc_wait_queue backlog; 116 struct list_head free; 117 struct rpc_rqst * slot; 118 unsigned int max_reqs; 119 unsigned long state; 120 unsigned char shutdown : 1, 121 resvport : 1; 122 123 __u32 xid; 124 125 u32 tcp_recm, 126 tcp_xid, 127 tcp_reclen, 128 tcp_offset; 129 unsigned long tcp_copied, 130 tcp_flags; 131 132 unsigned long connect_timeout, 133 bind_timeout, 134 reestablish_timeout; 135 struct work_struct connect_worker; 136 unsigned short port; 137 138 struct work_struct task_cleanup; 139 struct timer_list timer; 140 unsigned long last_used, 141 idle_timeout; 142 143 spinlock_t transport_lock; 144 spinlock_t reserve_lock; 145 struct rpc_task * snd_task; 146 147 struct list_head recv; 148 149 struct { 150 unsigned long bind_count, 151 connect_count, 152 connect_start, 153 connect_time, 154 sends, 155 recvs, 156 bad_xids; 157 158 unsigned long long req_u, 159 bklog_u; 160 } stat; 161 162 void (*old_data_ready)(struct sock *, int); 163 void (*old_state_change)(struct sock *); 164 void (*old_write_space)(struct sock *); 165 }; 166 167 #define XPRT_LAST_FRAG (1 << 0) 168 #define XPRT_COPY_RECM (1 << 1) 169 #define XPRT_COPY_XID (1 << 2) 170 #define XPRT_COPY_DATA (1 << 3) 171 172 #endif 173