Motr  M0
xcode_xc.c
Go to the documentation of this file.
1 /* This file is automatically generated from net/sock/xcode.h */
2 
3 #include "lib/misc.h" /* offsetof */
4 #include "lib/assert.h"
5 #include "xcode/xcode.h"
6 
7 #include "net/sock/xcode.h"
8 #include "net/sock/xcode_xc.h"
9 
14 
15 static struct _addrdata_s {
18 } _addrdata = {
19  ._type = {
21  .xct_name = "addrdata",
22  .xct_sizeof = sizeof (struct addrdata),
23  .xct_nr = 1,
24  .xct_flags = M0_XCODE_TYPE_FLAG_DOM_RPC,
25  }
26 };
27 
29 M0_BASSERT(offsetof(struct _addrdata_s, _child[0]) ==
30  offsetof(struct m0_xcode_type, xct_child[0]));
31 
32 static struct _addr_s {
35 } _addr = {
36  ._type = {
38  .xct_name = "addr",
39  .xct_sizeof = sizeof (struct addr),
40  .xct_nr = 5,
41  .xct_flags = M0_XCODE_TYPE_FLAG_DOM_RPC,
42  }
43 };
44 
45 struct m0_xcode_type *addr_xc = &_addr._type;
46 M0_BASSERT(offsetof(struct _addr_s, _child[0]) ==
47  offsetof(struct m0_xcode_type, xct_child[0]));
48 
49 static struct _bdesc_s {
52 } _bdesc = {
53  ._type = {
55  .xct_name = "bdesc",
56  .xct_sizeof = sizeof (struct bdesc),
57  .xct_nr = 2,
58  .xct_flags = M0_XCODE_TYPE_FLAG_DOM_RPC,
59  }
60 };
61 
63 M0_BASSERT(offsetof(struct _bdesc_s, _child[0]) ==
64  offsetof(struct m0_xcode_type, xct_child[0]));
65 
66 static struct _packet_s {
69 } _packet = {
70  ._type = {
72  .xct_name = "packet",
73  .xct_sizeof = sizeof (struct packet),
74  .xct_nr = 9,
75  .xct_flags = M0_XCODE_TYPE_FLAG_DOM_RPC,
76  }
77 };
78 
80 M0_BASSERT(offsetof(struct _packet_s, _child[0]) ==
81  offsetof(struct m0_xcode_type, xct_child[0]));
82 
83 
84 M0_BASSERT(sizeof(struct addrdata) == 16U);
85 
86 M0_BASSERT(sizeof ((struct addrdata *)0)->v_data == 16U);
87 M0_BASSERT(offsetof(struct addrdata, v_data) == 0U);
88 
89 M0_BASSERT(sizeof(struct addr) == 32U);
90 
91 M0_BASSERT(sizeof ((struct addr *)0)->a_family == 4U);
92 M0_BASSERT(offsetof(struct addr, a_family) == 0U);
93 M0_BASSERT(sizeof ((struct addr *)0)->a_socktype == 4U);
94 M0_BASSERT(offsetof(struct addr, a_socktype) == 4U);
95 M0_BASSERT(sizeof ((struct addr *)0)->a_protocol == 4U);
96 M0_BASSERT(offsetof(struct addr, a_protocol) == 8U);
97 M0_BASSERT(sizeof ((struct addr *)0)->a_port == 4U);
98 M0_BASSERT(offsetof(struct addr, a_port) == 12U);
99 M0_BASSERT(sizeof ((struct addr *)0)->a_data == 16U);
100 M0_BASSERT(offsetof(struct addr, a_data) == 16U);
101 
102 M0_BASSERT(sizeof(struct bdesc) == 48U);
103 
104 M0_BASSERT(sizeof ((struct bdesc *)0)->bd_addr == 32U);
105 M0_BASSERT(offsetof(struct bdesc, bd_addr) == 0U);
106 M0_BASSERT(sizeof ((struct bdesc *)0)->bd_cookie == 16U);
107 M0_BASSERT(offsetof(struct bdesc, bd_cookie) == 32U);
108 
109 M0_BASSERT(sizeof(struct packet) == 160U);
110 
111 M0_BASSERT(sizeof ((struct packet *)0)->p_header == 16U);
112 M0_BASSERT(offsetof(struct packet, p_header) == 0U);
113 M0_BASSERT(sizeof ((struct packet *)0)->p_src == 48U);
114 M0_BASSERT(offsetof(struct packet, p_src) == 16U);
115 M0_BASSERT(sizeof ((struct packet *)0)->p_dst == 48U);
116 M0_BASSERT(offsetof(struct packet, p_dst) == 64U);
117 M0_BASSERT(sizeof ((struct packet *)0)->p_idx == 4U);
118 M0_BASSERT(offsetof(struct packet, p_idx) == 112U);
119 M0_BASSERT(sizeof ((struct packet *)0)->p_nr == 4U);
120 M0_BASSERT(offsetof(struct packet, p_nr) == 116U);
121 M0_BASSERT(sizeof ((struct packet *)0)->p_size == 8U);
122 M0_BASSERT(offsetof(struct packet, p_size) == 120U);
123 M0_BASSERT(sizeof ((struct packet *)0)->p_offset == 8U);
124 M0_BASSERT(offsetof(struct packet, p_offset) == 128U);
125 M0_BASSERT(sizeof ((struct packet *)0)->p_totalsize == 8U);
126 M0_BASSERT(offsetof(struct packet, p_totalsize) == 136U);
127 M0_BASSERT(sizeof ((struct packet *)0)->p_footer == 16U);
128 M0_BASSERT(offsetof(struct packet, p_footer) == 144U);
129 
130 
131 
132 M0_INTERNAL void m0_xc_addrdata_struct_init(void)
133 {
134  _addrdata._child[0] = (struct m0_xcode_field) {
135  .xf_name = "v_data",
136 
137  .xf_type = &M0_XT_U8,
138 
139  .xf_tag = 16,
140  .xf_opaque = NULL,
141  .xf_offset = offsetof(struct addrdata, v_data),
142  .xf_read = NULL,
143  .xf_decor = {
145  }
146  };
147  m0_xc_u8_init();
148 
150 }
151 
152 M0_INTERNAL void m0_xc_addr_struct_init(void)
153 {
154  _addr._child[0] = (struct m0_xcode_field) {
155  .xf_name = "a_family",
156 
157  .xf_type = &M0_XT_U32,
158 
159  .xf_tag = 0,
160  .xf_opaque = NULL,
161  .xf_offset = offsetof(struct addr, a_family),
162  .xf_read = NULL,
163  .xf_decor = {
165  }
166  };
167  m0_xc_u32_init();
168 
169  _addr._child[1] = (struct m0_xcode_field) {
170  .xf_name = "a_socktype",
171 
172  .xf_type = &M0_XT_U32,
173 
174  .xf_tag = 0,
175  .xf_opaque = NULL,
176  .xf_offset = offsetof(struct addr, a_socktype),
177  .xf_read = NULL,
178  .xf_decor = {
180  }
181  };
182  m0_xc_u32_init();
183 
184  _addr._child[2] = (struct m0_xcode_field) {
185  .xf_name = "a_protocol",
186 
187  .xf_type = &M0_XT_U32,
188 
189  .xf_tag = 0,
190  .xf_opaque = NULL,
191  .xf_offset = offsetof(struct addr, a_protocol),
192  .xf_read = NULL,
193  .xf_decor = {
195  }
196  };
197  m0_xc_u32_init();
198 
199  _addr._child[3] = (struct m0_xcode_field) {
200  .xf_name = "a_port",
201 
202  .xf_type = &M0_XT_U32,
203 
204  .xf_tag = 0,
205  .xf_opaque = NULL,
206  .xf_offset = offsetof(struct addr, a_port),
207  .xf_read = NULL,
208  .xf_decor = {
210  }
211  };
212  m0_xc_u32_init();
213 
214  _addr._child[4] = (struct m0_xcode_field) {
215  .xf_name = "a_data",
216 
217  .xf_type = addrdata_xc,
218 
219  .xf_tag = 0,
220  .xf_opaque = NULL,
221  .xf_offset = offsetof(struct addr, a_data),
222  .xf_read = NULL,
223  .xf_decor = {
225  }
226  };
228 
230 }
231 
232 M0_INTERNAL void m0_xc_bdesc_struct_init(void)
233 {
234  _bdesc._child[0] = (struct m0_xcode_field) {
235  .xf_name = "bd_addr",
236 
237  .xf_type = addr_xc,
238 
239  .xf_tag = 0,
240  .xf_opaque = NULL,
241  .xf_offset = offsetof(struct bdesc, bd_addr),
242  .xf_read = NULL,
243  .xf_decor = {
245  }
246  };
248 
249  _bdesc._child[1] = (struct m0_xcode_field) {
250  .xf_name = "bd_cookie",
251 
252  .xf_type = m0_cookie_xc,
253 
254  .xf_tag = 0,
255  .xf_opaque = NULL,
256  .xf_offset = offsetof(struct bdesc, bd_cookie),
257  .xf_read = NULL,
258  .xf_decor = {
260  }
261  };
263 
265 }
266 
267 M0_INTERNAL void m0_xc_packet_struct_init(void)
268 {
269  _packet._child[0] = (struct m0_xcode_field) {
270  .xf_name = "p_header",
271 
272  .xf_type = m0_format_header_xc,
273 
274  .xf_tag = 0,
275  .xf_opaque = NULL,
276  .xf_offset = offsetof(struct packet, p_header),
277  .xf_read = NULL,
278  .xf_decor = {
280  }
281  };
283 
284  _packet._child[1] = (struct m0_xcode_field) {
285  .xf_name = "p_src",
286 
287  .xf_type = bdesc_xc,
288 
289  .xf_tag = 0,
290  .xf_opaque = NULL,
291  .xf_offset = offsetof(struct packet, p_src),
292  .xf_read = NULL,
293  .xf_decor = {
295  }
296  };
298 
299  _packet._child[2] = (struct m0_xcode_field) {
300  .xf_name = "p_dst",
301 
302  .xf_type = bdesc_xc,
303 
304  .xf_tag = 0,
305  .xf_opaque = NULL,
306  .xf_offset = offsetof(struct packet, p_dst),
307  .xf_read = NULL,
308  .xf_decor = {
310  }
311  };
313 
314  _packet._child[3] = (struct m0_xcode_field) {
315  .xf_name = "p_idx",
316 
317  .xf_type = &M0_XT_U32,
318 
319  .xf_tag = 0,
320  .xf_opaque = NULL,
321  .xf_offset = offsetof(struct packet, p_idx),
322  .xf_read = NULL,
323  .xf_decor = {
325  }
326  };
327  m0_xc_u32_init();
328 
329  _packet._child[4] = (struct m0_xcode_field) {
330  .xf_name = "p_nr",
331 
332  .xf_type = &M0_XT_U32,
333 
334  .xf_tag = 0,
335  .xf_opaque = NULL,
336  .xf_offset = offsetof(struct packet, p_nr),
337  .xf_read = NULL,
338  .xf_decor = {
340  }
341  };
342  m0_xc_u32_init();
343 
344  _packet._child[5] = (struct m0_xcode_field) {
345  .xf_name = "p_size",
346 
347  .xf_type = &M0_XT_U64,
348 
349  .xf_tag = 0,
350  .xf_opaque = NULL,
351  .xf_offset = offsetof(struct packet, p_size),
352  .xf_read = NULL,
353  .xf_decor = {
355  }
356  };
357  m0_xc_u64_init();
358 
359  _packet._child[6] = (struct m0_xcode_field) {
360  .xf_name = "p_offset",
361 
362  .xf_type = &M0_XT_U64,
363 
364  .xf_tag = 0,
365  .xf_opaque = NULL,
366  .xf_offset = offsetof(struct packet, p_offset),
367  .xf_read = NULL,
368  .xf_decor = {
370  }
371  };
372  m0_xc_u64_init();
373 
374  _packet._child[7] = (struct m0_xcode_field) {
375  .xf_name = "p_totalsize",
376 
377  .xf_type = &M0_XT_U64,
378 
379  .xf_tag = 0,
380  .xf_opaque = NULL,
381  .xf_offset = offsetof(struct packet, p_totalsize),
382  .xf_read = NULL,
383  .xf_decor = {
385  }
386  };
387  m0_xc_u64_init();
388 
389  _packet._child[8] = (struct m0_xcode_field) {
390  .xf_name = "p_footer",
391 
392  .xf_type = m0_format_footer_xc,
393 
394  .xf_tag = 0,
395  .xf_opaque = NULL,
396  .xf_offset = offsetof(struct packet, p_footer),
397  .xf_read = NULL,
398  .xf_decor = {
400  }
401  };
403 
405 }
406 
407 M0_INTERNAL void m0_xc_net_sock_xcode_init(void)
408 {
413 }
414 
415 M0_INTERNAL void m0_xc_net_sock_xcode_fini(void)
416 {
417 }
M0_INTERNAL void m0_xc_packet_struct_init(void)
Definition: xcode_xc.c:267
struct m0_xcode_field _child[5]
Definition: xcode_xc.c:34
M0_INTERNAL void m0_xc_net_sock_xcode_fini(void)
Definition: xcode_xc.c:415
struct bdesc p_dst
Definition: xcode.h:71
uint32_t p_idx
Definition: xcode.h:73
char v_data[WADDR_LEN]
Definition: xcode.h:66
struct m0_format_footer p_footer
Definition: xcode.h:86
#define NULL
Definition: misc.h:38
uint32_t a_protocol
Definition: xcode.h:68
uint32_t a_socktype
Definition: xcode.h:67
struct m0_xcode_field _child[2]
Definition: xcode_xc.c:51
M0_INTERNAL void m0_xc_m0_format_footer_struct_init(void)
Definition: format_xc.c:226
uint32_t p_nr
Definition: xcode.h:78
Definition: xcode.h:68
M0_INTERNAL void m0_xc_m0_cookie_struct_init(void)
Definition: cookie_xc.c:39
M0_INTERNAL void m0_xc_addrdata_struct_init(void)
Definition: xcode_xc.c:132
struct addr bd_addr
Definition: xcode.h:66
M0_INTERNAL void m0_xc_addr_struct_init(void)
Definition: xcode_xc.c:152
static struct _packet_s _packet
struct m0_xcode_field xct_child[0]
Definition: xcode.h:345
m0_bindex_t p_offset
Definition: xcode.h:82
struct m0_xcode_type _type
Definition: xcode_xc.c:67
struct addrdata a_data
Definition: xcode.h:70
static struct _addrdata_s _addrdata
struct m0_xcode_type _type
Definition: xcode_xc.c:50
uint32_t a_family
Definition: xcode.h:66
struct m0_xcode_field _child[1]
Definition: xcode_xc.c:17
struct m0_xcode_type _type
Definition: xcode_xc.c:16
struct m0_xcode_field _child[9]
Definition: xcode_xc.c:68
uint32_t a_port
Definition: xcode.h:69
struct m0_cookie bd_cookie
Definition: xcode.h:67
Definition: xcode.h:89
Definition: xcode.h:95
#define M0_POST(cond)
Definition: xcode.h:73
bool m0_xcode_type_invariant(const struct m0_xcode_type *xt)
Definition: xcode.c:74
struct m0_xcode_type * addrdata_xc
Definition: xcode_xc.c:10
M0_INTERNAL void m0_xc_m0_format_header_struct_init(void)
Definition: format_xc.c:191
m0_bcount_t p_size
Definition: xcode.h:80
M0_INTERNAL void m0_xc_bdesc_struct_init(void)
Definition: xcode_xc.c:232
struct m0_xcode_type * bdesc_xc
Definition: xcode_xc.c:12
void m0_xc_u64_init(void)
Definition: xcode.c:904
static struct _addr_s _addr
struct m0_xcode_type * packet_xc
Definition: xcode_xc.c:13
m0_bcount_t p_totalsize
Definition: xcode.h:84
struct m0_xcode_type _type
Definition: xcode_xc.c:33
const struct m0_xcode_type M0_XT_U32
Definition: xcode.c:932
enum m0_xcode_aggr xct_aggr
Definition: xcode.h:316
struct m0_xcode_type * m0_format_header_xc
Definition: format_xc.c:10
const struct m0_xcode_type M0_XT_U8
Definition: xcode.c:924
struct bdesc p_src
Definition: xcode.h:69
void m0_xc_u8_init(void)
Definition: xcode.c:892
void m0_xc_u32_init(void)
Definition: xcode.c:900
struct m0_xcode_type * m0_cookie_xc
Definition: cookie_xc.c:10
M0_INTERNAL void m0_xc_net_sock_xcode_init(void)
Definition: xcode_xc.c:407
M0_BASSERT(offsetof(struct _addrdata_s, _child[0])==offsetof(struct m0_xcode_type, xct_child[0]))
const char * xf_name
Definition: xcode.h:251
const struct m0_xcode_type M0_XT_U64
Definition: xcode.c:940
static struct _bdesc_s _bdesc
#define offsetof(typ, memb)
Definition: misc.h:29
struct m0_xcode_type * addr_xc
Definition: xcode_xc.c:11
struct m0_format_header p_header
Definition: xcode.h:67
struct m0_xcode_type * m0_format_footer_xc
Definition: format_xc.c:11