Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/rpc/xdr_ioq.h
$ cat -n /usr/include/ntirpc/rpc/xdr_ioq.h 1 /* 2 * Copyright (c) 2013 Linux Box Corporation. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 #ifndef XDR_IOQ_H 27 #define XDR_IOQ_H 28 29 #include
30 #include
31 #include
32 #include
33 #include
34 #include
35 #include
36 37 struct xdr_ioq_uv 38 { 39 struct poolq_entry uvq; 40 41 /* spliced buffers, if any */ 42 struct xdr_uio u; 43 44 /* Each xdr_ioq_uv can have a different kind of buffer or data source, 45 * as indicated by the uio_flags, needing different release techniques. 46 * Note: overloads uio_release with uio_p1 for pool. 47 */ 48 struct xdr_vio v; /* immediately follows u (uio_vio[0]) */ 49 }; 50 51 #define IOQ_(p) (opr_containerof((p), struct xdr_ioq_uv, uvq)) 52 #define IOQU(p) (opr_containerof((p), struct xdr_ioq_uv, u)) 53 #define IOQV(p) (opr_containerof((p), struct xdr_ioq_uv, v)) 54 55 #define ioquv_length(uv) \ 56 ((uintptr_t)((uv)->v.vio_tail) - (uintptr_t)((uv)->v.vio_head)) 57 #define ioquv_more(uv) \ 58 ((uintptr_t)((uv)->v.vio_wrap) - (uintptr_t)((uv)->v.vio_tail)) 59 #define ioquv_size(uv) \ 60 ((uintptr_t)((uv)->v.vio_wrap) - (uintptr_t)((uv)->v.vio_base)) 61 62 struct xdr_ioq; 63 64 struct xdr_ioq_uv_head { 65 struct poolq_head uvqh; 66 67 /* Each xdr_ioq_uv can have a different kind of buffer or data source, 68 * as indicated by the uio_flags, needing different create techniques. 69 */ 70 struct poolq_entry *(*uvq_fetch)(struct xdr_ioq *xioq, 71 struct poolq_head *ioqh, 72 char *comment, u_int count, 73 u_int ioq_flags); 74 75 size_t min_bsize; /* multiple of pagesize */ 76 size_t max_bsize; /* multiple of min_bsize */ 77 size_t plength; /* sub-total of previous lengths, not including 78 * any length in this xdr_ioq_uv */ 79 u_int pcount; /* fill index (0..m) in the current stream */ 80 }; 81 82 struct xdr_ioq { 83 XDR xdrs[1]; 84 struct work_pool_entry ioq_wpe; 85 struct poolq_entry ioq_s; /* segment of stream */ 86 pthread_cond_t ioq_cond; 87 88 struct poolq_head *ioq_pool; 89 struct xdr_ioq_uv_head ioq_uv; /* header/vectors */ 90 91 uint64_t id; 92 uint32_t write_start; /* Position to start write at */ 93 int frag_hdr_bytes_sent; /* Indicates a fragment header has been sent */ 94 bool has_blocked; 95 struct rpc_dplx_rec *rec; 96 }; 97 98 #define _IOQ(p) (opr_containerof((p), struct xdr_ioq, ioq_s)) 99 #define XIOQ(p) (opr_containerof((p), struct xdr_ioq, xdrs)) 100 101 /* avoid conflicts with UIO_FLAG */ 102 #define IOQ_FLAG_NONE 0x0000 103 /* ioq_s.qflags */ 104 #define IOQ_FLAG_SEGMENT 0x0100 105 #define IOQ_FLAG_WORKING 0x0200 /* (atomic) using ioq_wpe */ 106 /* uint32_t instructions */ 107 #define IOQ_FLAG_LOCKED 0x00010000 108 #define IOQ_FLAG_UNLOCK 0x00020000 109 #define IOQ_FLAG_BALLOC 0x00040000 110 111 extern struct xdr_ioq_uv *xdr_ioq_uv_create(size_t size, u_int uio_flags); 112 extern struct poolq_entry *xdr_ioq_uv_fetch(struct xdr_ioq *xioq, 113 struct poolq_head *ioqh, 114 char *comment, 115 u_int count, 116 u_int ioq_flags); 117 extern struct poolq_entry *xdr_ioq_uv_fetch_nothing(struct xdr_ioq *xioq, 118 struct poolq_head *ioqh, 119 char *comment, 120 u_int count, 121 u_int ioq_flags); 122 extern void xdr_ioq_uv_release(struct xdr_ioq_uv *uv); 123 124 extern struct xdr_ioq *xdr_ioq_create(size_t min_bsize, size_t max_bsize, 125 u_int uio_flags); 126 extern void xdr_ioq_release(struct poolq_head *ioqh); 127 extern void xdr_ioq_reset(struct xdr_ioq *xioq, u_int wh_pos); 128 extern void xdr_ioq_setup(struct xdr_ioq *xioq); 129 130 extern void xdr_ioq_destroy(struct xdr_ioq *xioq, size_t qsize); 131 extern void xdr_ioq_destroy_pool(struct poolq_head *ioqh); 132 133 extern const struct xdr_ops xdr_ioq_ops; 134 135 #endif /* XDR_IOQ_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™