Whamcloud - gitweb
LU-1757 brw: added OBD short io connect flag
[fs/lustre-release.git] / lustre / utils / wirecheck.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2011, 2012, Whamcloud, Inc.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #include <stdio.h>
38 #include <sys/types.h>
39 #include <sys/wait.h>
40 #include <liblustre.h>
41 #include <lustre_lib.h>
42 #include <lustre/lustre_idl.h>
43 #include <lustre_disk.h>
44
45 #define BLANK_LINE()                                            \
46 do {                                                            \
47         printf("\n");                                           \
48 } while(0)
49
50 #define COMMENT(c)                                              \
51 do {                                                            \
52         printf("        /* "c" */\n");                          \
53 } while(0)
54
55 #define STRINGIFY(a) #a
56
57 #define CHECK_CDEFINE(a)                                        \
58         printf("        CLASSERT("#a" == "STRINGIFY(a) ");\n")
59
60 #define CHECK_CVALUE(a)                                         \
61         printf("        CLASSERT("#a" == %lld);\n", (long long)a)
62
63 #define CHECK_CVALUE_X(a)                                       \
64         printf("        CLASSERT("#a" == 0x%.8x);\n", a)
65
66 #define CHECK_DEFINE(a)                                         \
67 do {                                                            \
68         printf("        LASSERTF("#a" == "STRINGIFY(a)          \
69                ", \"found %%lld\\n\",\n                 "       \
70                "(long long)"#a");\n");                          \
71 } while(0)
72
73 #define CHECK_DEFINE_X(a)                                       \
74 do {                                                            \
75         printf("        LASSERTF("#a" == "STRINGIFY(a)          \
76                ", \"found 0x%%.8x\\n\",\n                 "#a   \
77                ");\n");                                         \
78 } while(0)
79
80 #define CHECK_DEFINE_64X(a)                                     \
81 do {                                                            \
82         printf("        LASSERTF("#a" == "STRINGIFY(a)          \
83                ", \"found 0x%%.16llxULL\\n\",\n                "\
84                " "#a");\n");                                    \
85 } while(0)
86
87 #define CHECK_VALUE(a)                                          \
88 do {                                                            \
89         printf("        LASSERTF("#a                            \
90                " == %lld, \"found %%lld\\n\",\n                "\
91                " (long long)"#a");\n", (long long)a);           \
92 } while(0)
93
94 #define CHECK_VALUE_X(a)                                        \
95 do {                                                            \
96         printf("        LASSERTF("#a                            \
97                " == 0x%.8xUL, \"found 0x%%.8xUL\\n\",\n        "\
98                "         (unsigned)"#a");\n", (unsigned)a);     \
99 } while(0)
100
101 #define CHECK_VALUE_O(a)                                        \
102 do {                                                            \
103         printf("        LASSERTF("#a                            \
104                " == 0%.11oUL, \"found 0%%.11oUL\\n\",\n        "\
105                "         "#a");\n", a);                         \
106 } while(0)
107
108 #define CHECK_VALUE_64X(a)                                      \
109 do {                                                            \
110         printf("        LASSERTF("#a" == 0x%.16llxULL, "        \
111                "\"found 0x%%.16llxULL\\n\",\n                 " \
112                "(long long)"#a");\n", (long long)a);            \
113 } while(0)
114
115 #define CHECK_VALUE_64O(a)                                      \
116 do {                                                            \
117         printf("        LASSERTF("#a" == 0%.22lloULL, "         \
118                "\"found 0%%.22lloULL\\n\",\n                 "  \
119                "(long long)"#a");\n", (long long)a);            \
120 } while(0)
121
122 #define CHECK_MEMBER_OFFSET(s,m)                                \
123 do {                                                            \
124         CHECK_VALUE((int)offsetof(struct s, m));                \
125 } while(0)
126
127 #define CHECK_MEMBER_OFFSET_TYPEDEF(s,m)                        \
128 do {                                                            \
129         CHECK_VALUE((int)offsetof(s, m));                       \
130 } while(0)
131
132 #define CHECK_MEMBER_SIZEOF(s,m)                                \
133 do {                                                            \
134         CHECK_VALUE((int)sizeof(((struct s *)0)->m));           \
135 } while(0)
136
137 #define CHECK_MEMBER_SIZEOF_TYPEDEF(s,m)                        \
138 do {                                                            \
139         CHECK_VALUE((int)sizeof(((s *)0)->m));                  \
140 } while(0)
141
142 #define CHECK_MEMBER(s,m)                                       \
143 do {                                                            \
144         CHECK_MEMBER_OFFSET(s, m);                              \
145         CHECK_MEMBER_SIZEOF(s, m);                              \
146 } while(0)
147
148 #define CHECK_MEMBER_TYPEDEF(s,m)                               \
149 do {                                                            \
150         CHECK_MEMBER_OFFSET_TYPEDEF(s, m);                      \
151         CHECK_MEMBER_SIZEOF_TYPEDEF(s, m);                      \
152 } while(0)
153
154 #define CHECK_STRUCT(s)                                         \
155 do {                                                            \
156         COMMENT("Checks for struct "#s);                        \
157                 CHECK_VALUE((int)sizeof(struct s));             \
158 } while(0)
159
160 #define CHECK_STRUCT_TYPEDEF(s)                                 \
161 do {                                                            \
162         COMMENT("Checks for type "#s);                          \
163                 CHECK_VALUE((int)sizeof(s));                    \
164 } while(0)
165
166 #define CHECK_UNION(s)                                          \
167 do {                                                            \
168         COMMENT("Checks for union "#s);                         \
169         CHECK_VALUE((int)sizeof(union s));                      \
170 } while(0)
171
172 #define CHECK_VALUE_SAME(v1, v2)                                \
173 do {                                                            \
174         printf("\tLASSERTF("#v1" == "#v2", "                    \
175                "\"%%d != %%d\\n\",\n"                           \
176                "\t\t "#v1", "#v2");\n");                        \
177 } while (0)
178
179 #define CHECK_MEMBER_SAME(s1, s2, m)                            \
180 do {                                                            \
181         CHECK_VALUE_SAME((int)offsetof(struct s1, m),           \
182                          (int)offsetof(struct s2, m));          \
183         CHECK_VALUE_SAME((int)sizeof(((struct s1 *)0)->m),      \
184                          (int)sizeof(((struct s2 *)0)->m));     \
185 } while (0)
186
187 static void
188 check_lu_seq_range(void)
189 {
190         BLANK_LINE();
191         CHECK_STRUCT(lu_seq_range);
192         CHECK_MEMBER(lu_seq_range, lsr_start);
193         CHECK_MEMBER(lu_seq_range, lsr_end);
194         CHECK_MEMBER(lu_seq_range, lsr_index);
195         CHECK_MEMBER(lu_seq_range, lsr_flags);
196
197         CHECK_VALUE(LU_SEQ_RANGE_MDT);
198         CHECK_VALUE(LU_SEQ_RANGE_OST);
199 }
200
201 static void
202 check_lustre_mdt_attrs(void)
203 {
204         BLANK_LINE();
205         CHECK_STRUCT(lustre_mdt_attrs);
206         CHECK_MEMBER(lustre_mdt_attrs, lma_compat);
207         CHECK_MEMBER(lustre_mdt_attrs, lma_incompat);
208         CHECK_MEMBER(lustre_mdt_attrs, lma_self_fid);
209         CHECK_MEMBER(lustre_mdt_attrs, lma_flags);
210         CHECK_MEMBER(lustre_mdt_attrs, lma_ioepoch);
211         CHECK_MEMBER(lustre_mdt_attrs, lma_som_size);
212         CHECK_MEMBER(lustre_mdt_attrs, lma_som_blocks);
213         CHECK_MEMBER(lustre_mdt_attrs, lma_som_mountid);
214
215         CHECK_DEFINE(LMA_INCOMPAT_SUPP);
216
217         CHECK_VALUE_X(LMAC_HSM);
218         CHECK_VALUE_X(LMAC_SOM);
219 }
220
221 static void
222 check_ost_id(void)
223 {
224         BLANK_LINE();
225         CHECK_STRUCT(ost_id);
226         CHECK_MEMBER(ost_id, oi_id);
227         CHECK_MEMBER(ost_id, oi_seq);
228
229         CHECK_VALUE(LUSTRE_FID_INIT_OID);
230
231         CHECK_VALUE(FID_SEQ_OST_MDT0);
232         CHECK_VALUE(FID_SEQ_LLOG);
233         CHECK_VALUE(FID_SEQ_ECHO);
234         CHECK_VALUE(FID_SEQ_OST_MDT1);
235         CHECK_VALUE(FID_SEQ_OST_MAX);
236         CHECK_VALUE(FID_SEQ_RSVD);
237         CHECK_VALUE(FID_SEQ_IGIF);
238         CHECK_VALUE_64X(FID_SEQ_IGIF_MAX);
239         CHECK_VALUE_64X(FID_SEQ_IDIF);
240         CHECK_VALUE_64X(FID_SEQ_IDIF_MAX);
241         CHECK_VALUE_64X(FID_SEQ_START);
242         CHECK_VALUE_64X(FID_SEQ_LOCAL_FILE);
243         CHECK_VALUE_64X(FID_SEQ_DOT_LUSTRE);
244         CHECK_VALUE_64X(FID_SEQ_SPECIAL);
245         CHECK_VALUE_64X(FID_SEQ_QUOTA);
246         CHECK_VALUE_64X(FID_SEQ_QUOTA_GLB);
247         CHECK_VALUE_64X(FID_SEQ_NORMAL);
248         CHECK_VALUE_64X(FID_SEQ_LOV_DEFAULT);
249
250         CHECK_VALUE_X(FID_OID_SPECIAL_BFL);
251         CHECK_VALUE_X(FID_OID_DOT_LUSTRE);
252         CHECK_VALUE_X(FID_OID_DOT_LUSTRE_OBF);
253 }
254
255 static void
256 check_lu_dirent(void)
257 {
258         BLANK_LINE();
259         CHECK_STRUCT(lu_dirent);
260         CHECK_MEMBER(lu_dirent, lde_fid);
261         CHECK_MEMBER(lu_dirent, lde_hash);
262         CHECK_MEMBER(lu_dirent, lde_reclen);
263         CHECK_MEMBER(lu_dirent, lde_namelen);
264         CHECK_MEMBER(lu_dirent, lde_attrs);
265         CHECK_MEMBER(lu_dirent, lde_name[0]);
266
267         CHECK_VALUE_X(LUDA_FID);
268         CHECK_VALUE_X(LUDA_TYPE);
269         CHECK_VALUE_X(LUDA_64BITHASH);
270 }
271
272 static void
273 check_luda_type(void)
274 {
275         BLANK_LINE();
276         CHECK_STRUCT(luda_type);
277         CHECK_MEMBER(luda_type, lt_type);
278 }
279
280 static void
281 check_lu_dirpage(void)
282 {
283         BLANK_LINE();
284         CHECK_STRUCT(lu_dirpage);
285         CHECK_MEMBER(lu_dirpage, ldp_hash_start);
286         CHECK_MEMBER(lu_dirpage, ldp_hash_end);
287         CHECK_MEMBER(lu_dirpage, ldp_flags);
288         CHECK_MEMBER(lu_dirpage, ldp_pad0);
289         CHECK_MEMBER(lu_dirpage, ldp_entries[0]);
290
291         CHECK_VALUE(LDF_EMPTY);
292         CHECK_VALUE(LDF_COLLIDE);
293         CHECK_VALUE(LU_PAGE_SIZE);
294         CHECK_UNION(lu_page);
295 }
296
297 static void
298 check_lustre_handle(void)
299 {
300         BLANK_LINE();
301         CHECK_STRUCT(lustre_handle);
302         CHECK_MEMBER(lustre_handle, cookie);
303 }
304
305 static void
306 check_lustre_msg_v2(void)
307 {
308         BLANK_LINE();
309         CHECK_STRUCT(lustre_msg_v2);
310         CHECK_MEMBER(lustre_msg_v2, lm_bufcount);
311         CHECK_MEMBER(lustre_msg_v2, lm_secflvr);
312         CHECK_MEMBER(lustre_msg_v2, lm_magic);
313         CHECK_MEMBER(lustre_msg_v2, lm_repsize);
314         CHECK_MEMBER(lustre_msg_v2, lm_cksum);
315         CHECK_MEMBER(lustre_msg_v2, lm_flags);
316         CHECK_MEMBER(lustre_msg_v2, lm_padding_2);
317         CHECK_MEMBER(lustre_msg_v2, lm_padding_3);
318         CHECK_MEMBER(lustre_msg_v2, lm_buflens[0]);
319
320         CHECK_DEFINE_X(LUSTRE_MSG_MAGIC_V1);
321         CHECK_DEFINE_X(LUSTRE_MSG_MAGIC_V2);
322         CHECK_DEFINE_X(LUSTRE_MSG_MAGIC_V1_SWABBED);
323         CHECK_DEFINE_X(LUSTRE_MSG_MAGIC_V2_SWABBED);
324 }
325
326 static void
327 check_ptlrpc_body(void)
328 {
329         BLANK_LINE();
330         CHECK_STRUCT(ptlrpc_body);
331         CHECK_MEMBER(ptlrpc_body, pb_handle);
332         CHECK_MEMBER(ptlrpc_body, pb_type);
333         CHECK_MEMBER(ptlrpc_body, pb_version);
334         CHECK_MEMBER(ptlrpc_body, pb_opc);
335         CHECK_MEMBER(ptlrpc_body, pb_status);
336         CHECK_MEMBER(ptlrpc_body, pb_last_xid);
337         CHECK_MEMBER(ptlrpc_body, pb_last_seen);
338         CHECK_MEMBER(ptlrpc_body, pb_last_committed);
339         CHECK_MEMBER(ptlrpc_body, pb_transno);
340         CHECK_MEMBER(ptlrpc_body, pb_flags);
341         CHECK_MEMBER(ptlrpc_body, pb_op_flags);
342         CHECK_MEMBER(ptlrpc_body, pb_conn_cnt);
343         CHECK_MEMBER(ptlrpc_body, pb_timeout);
344         CHECK_MEMBER(ptlrpc_body, pb_service_time);
345         CHECK_MEMBER(ptlrpc_body, pb_limit);
346         CHECK_MEMBER(ptlrpc_body, pb_slv);
347         CHECK_CVALUE(PTLRPC_NUM_VERSIONS);
348         CHECK_MEMBER(ptlrpc_body, pb_pre_versions);
349         CHECK_MEMBER(ptlrpc_body, pb_padding);
350         CHECK_CVALUE(JOBSTATS_JOBID_SIZE);
351         CHECK_MEMBER(ptlrpc_body, pb_jobid);
352
353         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_handle);
354         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_type);
355         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_version);
356         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_opc);
357         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_status);
358         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_last_xid);
359         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_last_seen);
360         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_last_committed);
361         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_transno);
362         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_flags);
363         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_op_flags);
364         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_conn_cnt);
365         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_timeout);
366         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_service_time);
367         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_limit);
368         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_slv);
369         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_pre_versions);
370         CHECK_MEMBER_SAME(ptlrpc_body_v3, ptlrpc_body_v2, pb_padding);
371
372         CHECK_VALUE(MSG_PTLRPC_BODY_OFF);
373         CHECK_VALUE(REQ_REC_OFF);
374         CHECK_VALUE(REPLY_REC_OFF);
375         CHECK_VALUE(DLM_LOCKREQ_OFF);
376         CHECK_VALUE(DLM_REQ_REC_OFF);
377         CHECK_VALUE(DLM_INTENT_IT_OFF);
378         CHECK_VALUE(DLM_INTENT_REC_OFF);
379         CHECK_VALUE(DLM_LOCKREPLY_OFF);
380         CHECK_VALUE(DLM_REPLY_REC_OFF);
381         CHECK_VALUE(MSG_PTLRPC_HEADER_OFF);
382
383         CHECK_DEFINE_X(PTLRPC_MSG_VERSION);
384         CHECK_DEFINE_X(LUSTRE_VERSION_MASK);
385         CHECK_DEFINE_X(LUSTRE_OBD_VERSION);
386         CHECK_DEFINE_X(LUSTRE_MDS_VERSION);
387         CHECK_DEFINE_X(LUSTRE_OST_VERSION);
388         CHECK_DEFINE_X(LUSTRE_DLM_VERSION);
389         CHECK_DEFINE_X(LUSTRE_LOG_VERSION);
390         CHECK_DEFINE_X(LUSTRE_MGS_VERSION);
391
392         CHECK_VALUE(MSGHDR_AT_SUPPORT);
393         CHECK_VALUE(MSGHDR_CKSUM_INCOMPAT18);
394
395         CHECK_VALUE_X(MSG_OP_FLAG_MASK);
396         CHECK_VALUE(MSG_OP_FLAG_SHIFT);
397         CHECK_VALUE_X(MSG_GEN_FLAG_MASK);
398
399         CHECK_VALUE_X(MSG_LAST_REPLAY);
400         CHECK_VALUE_X(MSG_RESENT);
401         CHECK_VALUE_X(MSG_REPLAY);
402         CHECK_VALUE_X(MSG_DELAY_REPLAY);
403         CHECK_VALUE_X(MSG_VERSION_REPLAY);
404         CHECK_VALUE_X(MSG_REQ_REPLAY_DONE);
405         CHECK_VALUE_X(MSG_LOCK_REPLAY_DONE);
406
407         CHECK_VALUE_X(MSG_CONNECT_RECOVERING);
408         CHECK_VALUE_X(MSG_CONNECT_RECONNECT);
409         CHECK_VALUE_X(MSG_CONNECT_REPLAYABLE);
410         CHECK_VALUE_X(MSG_CONNECT_LIBCLIENT);
411         CHECK_VALUE_X(MSG_CONNECT_INITIAL);
412         CHECK_VALUE_X(MSG_CONNECT_ASYNC);
413         CHECK_VALUE_X(MSG_CONNECT_NEXT_VER);
414         CHECK_VALUE_X(MSG_CONNECT_TRANSNO);
415 }
416
417 static void
418 check_obd_connect_data(void)
419 {
420         BLANK_LINE();
421         CHECK_STRUCT(obd_connect_data);
422         CHECK_MEMBER(obd_connect_data, ocd_connect_flags);
423         CHECK_MEMBER(obd_connect_data, ocd_version);
424         CHECK_MEMBER(obd_connect_data, ocd_grant);
425         CHECK_MEMBER(obd_connect_data, ocd_index);
426         CHECK_MEMBER(obd_connect_data, ocd_brw_size);
427         CHECK_MEMBER(obd_connect_data, ocd_ibits_known);
428         CHECK_MEMBER(obd_connect_data, ocd_blocksize);
429         CHECK_MEMBER(obd_connect_data, ocd_inodespace);
430         CHECK_MEMBER(obd_connect_data, ocd_grant_extent);
431         CHECK_MEMBER(obd_connect_data, ocd_unused);
432         CHECK_MEMBER(obd_connect_data, ocd_transno);
433         CHECK_MEMBER(obd_connect_data, ocd_group);
434         CHECK_MEMBER(obd_connect_data, ocd_cksum_types);
435         CHECK_MEMBER(obd_connect_data, ocd_max_easize);
436         CHECK_MEMBER(obd_connect_data, ocd_instance);
437         CHECK_MEMBER(obd_connect_data, ocd_maxbytes);
438         CHECK_MEMBER(obd_connect_data, padding1);
439         CHECK_MEMBER(obd_connect_data, padding2);
440         CHECK_MEMBER(obd_connect_data, padding3);
441         CHECK_MEMBER(obd_connect_data, padding4);
442         CHECK_MEMBER(obd_connect_data, padding5);
443         CHECK_MEMBER(obd_connect_data, padding6);
444         CHECK_MEMBER(obd_connect_data, padding7);
445         CHECK_MEMBER(obd_connect_data, padding8);
446         CHECK_MEMBER(obd_connect_data, padding9);
447         CHECK_MEMBER(obd_connect_data, paddingA);
448         CHECK_MEMBER(obd_connect_data, paddingB);
449         CHECK_MEMBER(obd_connect_data, paddingC);
450         CHECK_MEMBER(obd_connect_data, paddingD);
451         CHECK_MEMBER(obd_connect_data, paddingE);
452         CHECK_MEMBER(obd_connect_data, paddingF);
453
454         CHECK_DEFINE_64X(OBD_CONNECT_RDONLY);
455         CHECK_DEFINE_64X(OBD_CONNECT_INDEX);
456         CHECK_DEFINE_64X(OBD_CONNECT_MDS);
457         CHECK_DEFINE_64X(OBD_CONNECT_GRANT);
458         CHECK_DEFINE_64X(OBD_CONNECT_SRVLOCK);
459         CHECK_DEFINE_64X(OBD_CONNECT_VERSION);
460         CHECK_DEFINE_64X(OBD_CONNECT_REQPORTAL);
461         CHECK_DEFINE_64X(OBD_CONNECT_ACL);
462         CHECK_DEFINE_64X(OBD_CONNECT_XATTR);
463         CHECK_DEFINE_64X(OBD_CONNECT_CROW);
464         CHECK_DEFINE_64X(OBD_CONNECT_TRUNCLOCK);
465         CHECK_DEFINE_64X(OBD_CONNECT_TRANSNO);
466         CHECK_DEFINE_64X(OBD_CONNECT_IBITS);
467         CHECK_DEFINE_64X(OBD_CONNECT_JOIN);
468         CHECK_DEFINE_64X(OBD_CONNECT_ATTRFID);
469         CHECK_DEFINE_64X(OBD_CONNECT_NODEVOH);
470         CHECK_DEFINE_64X(OBD_CONNECT_RMT_CLIENT);
471         CHECK_DEFINE_64X(OBD_CONNECT_RMT_CLIENT_FORCE);
472         CHECK_DEFINE_64X(OBD_CONNECT_BRW_SIZE);
473         CHECK_DEFINE_64X(OBD_CONNECT_QUOTA64);
474         CHECK_DEFINE_64X(OBD_CONNECT_MDS_CAPA);
475         CHECK_DEFINE_64X(OBD_CONNECT_OSS_CAPA);
476         CHECK_DEFINE_64X(OBD_CONNECT_CANCELSET);
477         CHECK_DEFINE_64X(OBD_CONNECT_SOM);
478         CHECK_DEFINE_64X(OBD_CONNECT_AT);
479         CHECK_DEFINE_64X(OBD_CONNECT_LRU_RESIZE);
480         CHECK_DEFINE_64X(OBD_CONNECT_MDS_MDS);
481         CHECK_DEFINE_64X(OBD_CONNECT_REAL);
482         CHECK_DEFINE_64X(OBD_CONNECT_CHANGE_QS);
483         CHECK_DEFINE_64X(OBD_CONNECT_CKSUM);
484         CHECK_DEFINE_64X(OBD_CONNECT_FID);
485         CHECK_DEFINE_64X(OBD_CONNECT_VBR);
486         CHECK_DEFINE_64X(OBD_CONNECT_LOV_V3);
487         CHECK_DEFINE_64X(OBD_CONNECT_GRANT_SHRINK);
488         CHECK_DEFINE_64X(OBD_CONNECT_SKIP_ORPHAN);
489         CHECK_DEFINE_64X(OBD_CONNECT_MAX_EASIZE);
490         CHECK_DEFINE_64X(OBD_CONNECT_FULL20);
491         CHECK_DEFINE_64X(OBD_CONNECT_LAYOUTLOCK);
492         CHECK_DEFINE_64X(OBD_CONNECT_64BITHASH);
493         CHECK_DEFINE_64X(OBD_CONNECT_MAXBYTES);
494         CHECK_DEFINE_64X(OBD_CONNECT_IMP_RECOV);
495         CHECK_DEFINE_64X(OBD_CONNECT_JOBSTATS);
496         CHECK_DEFINE_64X(OBD_CONNECT_UMASK);
497         CHECK_DEFINE_64X(OBD_CONNECT_EINPROGRESS);
498         CHECK_DEFINE_64X(OBD_CONNECT_GRANT_PARAM);
499         CHECK_DEFINE_64X(OBD_CONNECT_LIGHTWEIGHT);
500         CHECK_DEFINE_64X(OBD_CONNECT_SHORTIO);
501
502         CHECK_VALUE_X(OBD_CKSUM_CRC32);
503         CHECK_VALUE_X(OBD_CKSUM_ADLER);
504         CHECK_VALUE_X(OBD_CKSUM_CRC32C);
505 }
506
507 static void
508 check_obdo(void)
509 {
510         BLANK_LINE();
511         CHECK_STRUCT(obdo);
512         CHECK_MEMBER(obdo, o_valid);
513         CHECK_MEMBER(obdo, o_id);
514         CHECK_MEMBER(obdo, o_seq);
515         CHECK_MEMBER(obdo, o_parent_seq);
516         CHECK_MEMBER(obdo, o_size);
517         CHECK_MEMBER(obdo, o_mtime);
518         CHECK_MEMBER(obdo, o_atime);
519         CHECK_MEMBER(obdo, o_ctime);
520         CHECK_MEMBER(obdo, o_blocks);
521         CHECK_MEMBER(obdo, o_grant);
522         CHECK_MEMBER(obdo, o_blksize);
523         CHECK_MEMBER(obdo, o_mode);
524         CHECK_MEMBER(obdo, o_uid);
525         CHECK_MEMBER(obdo, o_gid);
526         CHECK_MEMBER(obdo, o_flags);
527         CHECK_MEMBER(obdo, o_nlink);
528         CHECK_MEMBER(obdo, o_parent_oid);
529         CHECK_MEMBER(obdo, o_misc);
530         CHECK_MEMBER(obdo, o_ioepoch);
531         CHECK_MEMBER(obdo, o_stripe_idx);
532         CHECK_MEMBER(obdo, o_parent_ver);
533         CHECK_MEMBER(obdo, o_handle);
534         CHECK_MEMBER(obdo, o_lcookie);
535         CHECK_MEMBER(obdo, o_uid_h);
536         CHECK_MEMBER(obdo, o_gid_h);
537         CHECK_MEMBER(obdo, o_data_version);
538         CHECK_MEMBER(obdo, o_padding_4);
539         CHECK_MEMBER(obdo, o_padding_5);
540         CHECK_MEMBER(obdo, o_padding_6);
541
542         CHECK_DEFINE_64X(OBD_MD_FLID);
543         CHECK_DEFINE_64X(OBD_MD_FLATIME);
544         CHECK_DEFINE_64X(OBD_MD_FLMTIME);
545         CHECK_DEFINE_64X(OBD_MD_FLCTIME);
546         CHECK_DEFINE_64X(OBD_MD_FLSIZE);
547         CHECK_DEFINE_64X(OBD_MD_FLBLOCKS);
548         CHECK_DEFINE_64X(OBD_MD_FLBLKSZ);
549         CHECK_DEFINE_64X(OBD_MD_FLMODE);
550         CHECK_DEFINE_64X(OBD_MD_FLTYPE);
551         CHECK_DEFINE_64X(OBD_MD_FLUID);
552         CHECK_DEFINE_64X(OBD_MD_FLGID);
553         CHECK_DEFINE_64X(OBD_MD_FLFLAGS);
554         CHECK_DEFINE_64X(OBD_MD_FLNLINK);
555         CHECK_DEFINE_64X(OBD_MD_FLGENER);
556         CHECK_DEFINE_64X(OBD_MD_FLRDEV);
557         CHECK_DEFINE_64X(OBD_MD_FLEASIZE);
558         CHECK_DEFINE_64X(OBD_MD_LINKNAME);
559         CHECK_DEFINE_64X(OBD_MD_FLHANDLE);
560         CHECK_DEFINE_64X(OBD_MD_FLCKSUM);
561         CHECK_DEFINE_64X(OBD_MD_FLQOS);
562         CHECK_DEFINE_64X(OBD_MD_FLCOOKIE);
563         CHECK_DEFINE_64X(OBD_MD_FLGROUP);
564         CHECK_DEFINE_64X(OBD_MD_FLFID);
565         CHECK_DEFINE_64X(OBD_MD_FLEPOCH);
566         CHECK_DEFINE_64X(OBD_MD_FLGRANT);
567         CHECK_DEFINE_64X(OBD_MD_FLDIREA);
568         CHECK_DEFINE_64X(OBD_MD_FLUSRQUOTA);
569         CHECK_DEFINE_64X(OBD_MD_FLGRPQUOTA);
570         CHECK_DEFINE_64X(OBD_MD_FLMODEASIZE);
571         CHECK_DEFINE_64X(OBD_MD_MDS);
572         CHECK_DEFINE_64X(OBD_MD_REINT);
573         CHECK_DEFINE_64X(OBD_MD_MEA);
574         CHECK_DEFINE_64X(OBD_MD_MDTIDX);
575         CHECK_DEFINE_64X(OBD_MD_FLXATTR);
576         CHECK_DEFINE_64X(OBD_MD_FLXATTRLS);
577         CHECK_DEFINE_64X(OBD_MD_FLXATTRRM);
578         CHECK_DEFINE_64X(OBD_MD_FLACL);
579         CHECK_DEFINE_64X(OBD_MD_FLRMTPERM);
580         CHECK_DEFINE_64X(OBD_MD_FLMDSCAPA);
581         CHECK_DEFINE_64X(OBD_MD_FLOSSCAPA);
582         CHECK_DEFINE_64X(OBD_MD_FLCKSPLIT);
583         CHECK_DEFINE_64X(OBD_MD_FLCROSSREF);
584         CHECK_DEFINE_64X(OBD_MD_FLGETATTRLOCK);
585         CHECK_DEFINE_64X(OBD_MD_FLRMTLSETFACL);
586         CHECK_DEFINE_64X(OBD_MD_FLRMTLGETFACL);
587         CHECK_DEFINE_64X(OBD_MD_FLRMTRSETFACL);
588         CHECK_DEFINE_64X(OBD_MD_FLRMTRGETFACL);
589         CHECK_DEFINE_64X(OBD_MD_FLDATAVERSION);
590
591         CHECK_CVALUE_X(OBD_FL_INLINEDATA);
592         CHECK_CVALUE_X(OBD_FL_OBDMDEXISTS);
593         CHECK_CVALUE_X(OBD_FL_DELORPHAN);
594         CHECK_CVALUE_X(OBD_FL_NORPC);
595         CHECK_CVALUE_X(OBD_FL_IDONLY);
596         CHECK_CVALUE_X(OBD_FL_RECREATE_OBJS);
597         CHECK_CVALUE_X(OBD_FL_DEBUG_CHECK);
598         CHECK_CVALUE_X(OBD_FL_NO_USRQUOTA);
599         CHECK_CVALUE_X(OBD_FL_NO_GRPQUOTA);
600         CHECK_CVALUE_X(OBD_FL_CREATE_CROW);
601         CHECK_CVALUE_X(OBD_FL_SRVLOCK);
602         CHECK_CVALUE_X(OBD_FL_CKSUM_CRC32);
603         CHECK_CVALUE_X(OBD_FL_CKSUM_ADLER);
604         CHECK_CVALUE_X(OBD_FL_CKSUM_CRC32C);
605         CHECK_CVALUE_X(OBD_FL_CKSUM_RSVD2);
606         CHECK_CVALUE_X(OBD_FL_CKSUM_RSVD3);
607         CHECK_CVALUE_X(OBD_FL_SHRINK_GRANT);
608         CHECK_CVALUE_X(OBD_FL_MMAP);
609         CHECK_CVALUE_X(OBD_FL_RECOV_RESEND);
610         CHECK_CVALUE_X(OBD_FL_NOSPC_BLK);
611         CHECK_CVALUE_X(OBD_FL_LOCAL_MASK);
612 }
613
614 static void
615 check_lov_ost_data_v1(void)
616 {
617         BLANK_LINE();
618         CHECK_STRUCT(lov_ost_data_v1);
619         CHECK_MEMBER(lov_ost_data_v1, l_object_id);
620         CHECK_MEMBER(lov_ost_data_v1, l_object_seq);
621         CHECK_MEMBER(lov_ost_data_v1, l_ost_gen);
622         CHECK_MEMBER(lov_ost_data_v1, l_ost_idx);
623 }
624
625 static void
626 check_lov_mds_md_v1(void)
627 {
628         BLANK_LINE();
629         CHECK_STRUCT(lov_mds_md_v1);
630         CHECK_MEMBER(lov_mds_md_v1, lmm_magic);
631         CHECK_MEMBER(lov_mds_md_v1, lmm_pattern);
632         CHECK_MEMBER(lov_mds_md_v1, lmm_object_id);
633         CHECK_MEMBER(lov_mds_md_v1, lmm_object_seq);
634         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_size);
635         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_count);
636         CHECK_MEMBER(lov_mds_md_v1, lmm_layout_gen);
637         CHECK_MEMBER(lov_mds_md_v1, lmm_objects[0]);
638
639         CHECK_CDEFINE(LOV_MAGIC_V1);
640 }
641
642 static void
643 check_lov_mds_md_v3(void)
644 {
645         BLANK_LINE();
646         CHECK_STRUCT(lov_mds_md_v3);
647         CHECK_MEMBER(lov_mds_md_v3, lmm_magic);
648         CHECK_MEMBER(lov_mds_md_v3, lmm_pattern);
649         CHECK_MEMBER(lov_mds_md_v3, lmm_object_id);
650         CHECK_MEMBER(lov_mds_md_v3, lmm_object_seq);
651         CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_size);
652         CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_count);
653         CHECK_MEMBER(lov_mds_md_v3, lmm_layout_gen);
654         CHECK_CVALUE(LOV_MAXPOOLNAME);
655         CHECK_MEMBER(lov_mds_md_v3, lmm_pool_name[LOV_MAXPOOLNAME]);
656         CHECK_MEMBER(lov_mds_md_v3, lmm_objects[0]);
657
658         CHECK_CDEFINE(LOV_MAGIC_V3);
659
660         CHECK_VALUE_X(LOV_PATTERN_RAID0);
661         CHECK_VALUE_X(LOV_PATTERN_RAID1);
662         CHECK_VALUE_X(LOV_PATTERN_FIRST);
663         CHECK_VALUE_X(LOV_PATTERN_CMOBD);
664 }
665
666 static void
667 check_obd_statfs(void)
668 {
669         BLANK_LINE();
670         CHECK_STRUCT(obd_statfs);
671         CHECK_MEMBER(obd_statfs, os_type);
672         CHECK_MEMBER(obd_statfs, os_blocks);
673         CHECK_MEMBER(obd_statfs, os_bfree);
674         CHECK_MEMBER(obd_statfs, os_bavail);
675         CHECK_MEMBER(obd_statfs, os_ffree);
676         CHECK_MEMBER(obd_statfs, os_fsid);
677         CHECK_MEMBER(obd_statfs, os_bsize);
678         CHECK_MEMBER(obd_statfs, os_namelen);
679         CHECK_MEMBER(obd_statfs, os_state);
680         CHECK_MEMBER(obd_statfs, os_spare1);
681         CHECK_MEMBER(obd_statfs, os_spare2);
682         CHECK_MEMBER(obd_statfs, os_spare3);
683         CHECK_MEMBER(obd_statfs, os_spare4);
684         CHECK_MEMBER(obd_statfs, os_spare5);
685         CHECK_MEMBER(obd_statfs, os_spare6);
686         CHECK_MEMBER(obd_statfs, os_spare7);
687         CHECK_MEMBER(obd_statfs, os_spare8);
688         CHECK_MEMBER(obd_statfs, os_spare9);
689 }
690
691 static void
692 check_obd_ioobj(void)
693 {
694         BLANK_LINE();
695         CHECK_STRUCT(obd_ioobj);
696         CHECK_MEMBER(obd_ioobj, ioo_id);
697         CHECK_MEMBER(obd_ioobj, ioo_seq);
698         CHECK_MEMBER(obd_ioobj, ioo_type);
699         CHECK_MEMBER(obd_ioobj, ioo_bufcnt);
700 }
701
702 static void
703 check_obd_quotactl(void)
704 {
705
706         BLANK_LINE();
707         CHECK_UNION(lquota_id);
708
709         BLANK_LINE();
710         CHECK_VALUE(QUOTABLOCK_BITS);
711         CHECK_VALUE(QUOTABLOCK_SIZE);
712
713         BLANK_LINE();
714         CHECK_STRUCT(obd_quotactl);
715         CHECK_MEMBER(obd_quotactl, qc_cmd);
716         CHECK_MEMBER(obd_quotactl, qc_type);
717         CHECK_MEMBER(obd_quotactl, qc_id);
718         CHECK_MEMBER(obd_quotactl, qc_stat);
719         CHECK_MEMBER(obd_quotactl, qc_dqinfo);
720         CHECK_MEMBER(obd_quotactl, qc_dqblk);
721
722         BLANK_LINE();
723         CHECK_STRUCT(obd_dqinfo);
724         CHECK_MEMBER(obd_dqinfo, dqi_bgrace);
725         CHECK_MEMBER(obd_dqinfo, dqi_igrace);
726         CHECK_MEMBER(obd_dqinfo, dqi_flags);
727         CHECK_MEMBER(obd_dqinfo, dqi_valid);
728
729         BLANK_LINE();
730         CHECK_STRUCT(obd_dqblk);
731         CHECK_MEMBER(obd_dqblk, dqb_bhardlimit);
732         CHECK_MEMBER(obd_dqblk, dqb_bsoftlimit);
733         CHECK_MEMBER(obd_dqblk, dqb_curspace);
734         CHECK_MEMBER(obd_dqblk, dqb_ihardlimit);
735         CHECK_MEMBER(obd_dqblk, dqb_isoftlimit);
736         CHECK_MEMBER(obd_dqblk, dqb_curinodes);
737         CHECK_MEMBER(obd_dqblk, dqb_btime);
738         CHECK_MEMBER(obd_dqblk, dqb_itime);
739         CHECK_MEMBER(obd_dqblk, dqb_valid);
740         CHECK_MEMBER(obd_dqblk, dqb_padding);
741
742         CHECK_DEFINE_X(Q_QUOTACHECK);
743         CHECK_DEFINE_X(Q_INITQUOTA);
744         CHECK_DEFINE_X(Q_GETOINFO);
745         CHECK_DEFINE_X(Q_GETOQUOTA);
746         CHECK_DEFINE_X(Q_FINVALIDATE);
747
748         BLANK_LINE();
749         CHECK_STRUCT(lquota_acct_rec);
750         CHECK_MEMBER(lquota_acct_rec, bspace);
751         CHECK_MEMBER(lquota_acct_rec, ispace);
752
753         BLANK_LINE();
754         CHECK_STRUCT(lquota_glb_rec);
755         CHECK_MEMBER(lquota_glb_rec, qbr_hardlimit);
756         CHECK_MEMBER(lquota_glb_rec, qbr_softlimit);
757         CHECK_MEMBER(lquota_glb_rec, qbr_time);
758         CHECK_MEMBER(lquota_glb_rec, qbr_granted);
759
760         BLANK_LINE();
761         CHECK_STRUCT(lquota_slv_rec);
762         CHECK_MEMBER(lquota_slv_rec, qsr_granted);
763
764 }
765
766 static void
767 check_obd_idx_read(void)
768 {
769         BLANK_LINE();
770         CHECK_STRUCT(idx_info);
771         CHECK_MEMBER(idx_info, ii_magic);
772         CHECK_MEMBER(idx_info, ii_flags);
773         CHECK_MEMBER(idx_info, ii_count);
774         CHECK_MEMBER(idx_info, ii_pad0);
775         CHECK_MEMBER(idx_info, ii_attrs);
776         CHECK_MEMBER(idx_info, ii_fid);
777         CHECK_MEMBER(idx_info, ii_version);
778         CHECK_MEMBER(idx_info, ii_hash_start);
779         CHECK_MEMBER(idx_info, ii_hash_end);
780         CHECK_MEMBER(idx_info, ii_keysize);
781         CHECK_MEMBER(idx_info, ii_recsize);
782         CHECK_MEMBER(idx_info, ii_pad1);
783         CHECK_MEMBER(idx_info, ii_pad2);
784         CHECK_MEMBER(idx_info, ii_pad3);
785         CHECK_CDEFINE(IDX_INFO_MAGIC);
786
787         BLANK_LINE();
788         CHECK_STRUCT(lu_idxpage);
789         CHECK_MEMBER(lu_idxpage, lip_magic);
790         CHECK_MEMBER(lu_idxpage, lip_flags);
791         CHECK_MEMBER(lu_idxpage, lip_nr);
792         CHECK_MEMBER(lu_idxpage, lip_pad0);
793
794         CHECK_CDEFINE(LIP_MAGIC);
795         CHECK_VALUE(LIP_HDR_SIZE);
796
797         CHECK_VALUE(II_FL_NOHASH);
798         CHECK_VALUE(II_FL_VARKEY);
799         CHECK_VALUE(II_FL_VARREC);
800         CHECK_VALUE(II_FL_NONUNQ);
801 }
802
803 static void
804 check_niobuf_remote(void)
805 {
806         BLANK_LINE();
807         CHECK_STRUCT(niobuf_remote);
808         CHECK_MEMBER(niobuf_remote, offset);
809         CHECK_MEMBER(niobuf_remote, len);
810         CHECK_MEMBER(niobuf_remote, flags);
811
812         CHECK_DEFINE_X(OBD_BRW_READ);
813         CHECK_DEFINE_X(OBD_BRW_WRITE);
814         CHECK_DEFINE_X(OBD_BRW_SYNC);
815         CHECK_DEFINE_X(OBD_BRW_CHECK);
816         CHECK_DEFINE_X(OBD_BRW_FROM_GRANT);
817         CHECK_DEFINE_X(OBD_BRW_GRANTED);
818         CHECK_DEFINE_X(OBD_BRW_NOCACHE);
819         CHECK_DEFINE_X(OBD_BRW_NOQUOTA);
820         CHECK_DEFINE_X(OBD_BRW_SRVLOCK);
821         CHECK_DEFINE_X(OBD_BRW_ASYNC);
822         CHECK_DEFINE_X(OBD_BRW_MEMALLOC);
823 }
824
825 static void
826 check_ost_body(void)
827 {
828         BLANK_LINE();
829         CHECK_STRUCT(ost_body);
830         CHECK_MEMBER(ost_body, oa);
831 }
832
833 static void
834 check_ll_fid(void)
835 {
836         BLANK_LINE();
837         CHECK_STRUCT(ll_fid);
838         CHECK_MEMBER(ll_fid, id);
839         CHECK_MEMBER(ll_fid, generation);
840         CHECK_MEMBER(ll_fid, f_type);
841 }
842
843 static void
844 check_mdt_body(void)
845 {
846         BLANK_LINE();
847         CHECK_STRUCT(mdt_body);
848         CHECK_MEMBER(mdt_body, fid1);
849         CHECK_MEMBER(mdt_body, fid2);
850         CHECK_MEMBER(mdt_body, handle);
851         CHECK_MEMBER(mdt_body, valid);
852         CHECK_MEMBER(mdt_body, size);
853         CHECK_MEMBER(mdt_body, mtime);
854         CHECK_MEMBER(mdt_body, atime);
855         CHECK_MEMBER(mdt_body, ctime);
856         CHECK_MEMBER(mdt_body, blocks);
857         CHECK_MEMBER(mdt_body, ino);
858         CHECK_MEMBER(mdt_body, fsuid);
859         CHECK_MEMBER(mdt_body, fsgid);
860         CHECK_MEMBER(mdt_body, capability);
861         CHECK_MEMBER(mdt_body, mode);
862         CHECK_MEMBER(mdt_body, uid);
863         CHECK_MEMBER(mdt_body, gid);
864         CHECK_MEMBER(mdt_body, flags);
865         CHECK_MEMBER(mdt_body, rdev);
866         CHECK_MEMBER(mdt_body, nlink);
867         CHECK_MEMBER(mdt_body, generation);
868         CHECK_MEMBER(mdt_body, suppgid);
869         CHECK_MEMBER(mdt_body, eadatasize);
870         CHECK_MEMBER(mdt_body, aclsize);
871         CHECK_MEMBER(mdt_body, max_mdsize);
872         CHECK_MEMBER(mdt_body, max_cookiesize);
873         CHECK_MEMBER(mdt_body, uid_h);
874         CHECK_MEMBER(mdt_body, gid_h);
875         CHECK_MEMBER(mdt_body, padding_5);
876         CHECK_MEMBER(mdt_body, padding_6);
877         CHECK_MEMBER(mdt_body, padding_7);
878         CHECK_MEMBER(mdt_body, padding_8);
879         CHECK_MEMBER(mdt_body, padding_9);
880         CHECK_MEMBER(mdt_body, padding_10);
881
882         CHECK_VALUE_O(MDS_FMODE_CLOSED);
883         CHECK_VALUE_O(MDS_FMODE_EXEC);
884         CHECK_VALUE_O(MDS_FMODE_EPOCH);
885         CHECK_VALUE_O(MDS_FMODE_TRUNC);
886         CHECK_VALUE_O(MDS_FMODE_SOM);
887
888         CHECK_VALUE_O(MDS_OPEN_CREATED);
889         CHECK_VALUE_O(MDS_OPEN_CROSS);
890         CHECK_VALUE_O(MDS_OPEN_CREAT);
891         CHECK_VALUE_O(MDS_OPEN_EXCL);
892         CHECK_VALUE_O(MDS_OPEN_TRUNC);
893         CHECK_VALUE_O(MDS_OPEN_APPEND);
894         CHECK_VALUE_O(MDS_OPEN_SYNC);
895         CHECK_VALUE_O(MDS_OPEN_DIRECTORY);
896         CHECK_VALUE_O(MDS_OPEN_BY_FID);
897         CHECK_VALUE_O(MDS_OPEN_DELAY_CREATE);
898         CHECK_VALUE_O(MDS_OPEN_OWNEROVERRIDE);
899         CHECK_VALUE_O(MDS_OPEN_JOIN_FILE);
900         CHECK_VALUE_O(MDS_CREATE_RMT_ACL);
901         CHECK_VALUE_O(MDS_CREATE_SLAVE_OBJ);
902         CHECK_VALUE_O(MDS_OPEN_LOCK);
903         CHECK_VALUE_O(MDS_OPEN_HAS_EA);
904         CHECK_VALUE_O(MDS_OPEN_HAS_OBJS);
905         CHECK_VALUE_64O(MDS_OPEN_NORESTORE);
906         CHECK_VALUE_64O(MDS_OPEN_NEWSTRIPE);
907
908         /* these should be identical to their EXT3_*_FL counterparts, and
909          * are redefined only to avoid dragging in ext3_fs.h */
910         CHECK_DEFINE_X(LUSTRE_SYNC_FL);
911         CHECK_DEFINE_X(LUSTRE_IMMUTABLE_FL);
912         CHECK_DEFINE_X(LUSTRE_APPEND_FL);
913         CHECK_DEFINE_X(LUSTRE_NOATIME_FL);
914         CHECK_DEFINE_X(LUSTRE_DIRSYNC_FL);
915
916         CHECK_DEFINE_X(MDS_INODELOCK_LOOKUP);
917         CHECK_DEFINE_X(MDS_INODELOCK_UPDATE);
918         CHECK_DEFINE_X(MDS_INODELOCK_OPEN);
919         CHECK_DEFINE_X(MDS_INODELOCK_LAYOUT);
920 }
921
922 static void
923 check_mdt_ioepoch(void)
924 {
925         BLANK_LINE();
926         CHECK_STRUCT(mdt_ioepoch);
927         CHECK_MEMBER(mdt_ioepoch, handle);
928         CHECK_MEMBER(mdt_ioepoch, ioepoch);
929         CHECK_MEMBER(mdt_ioepoch, flags);
930         CHECK_MEMBER(mdt_ioepoch, padding);
931 }
932
933 static void
934 check_mdt_remote_perm(void)
935 {
936         BLANK_LINE();
937         CHECK_STRUCT(mdt_remote_perm);
938         CHECK_MEMBER(mdt_remote_perm, rp_uid);
939         CHECK_MEMBER(mdt_remote_perm, rp_gid);
940         CHECK_MEMBER(mdt_remote_perm, rp_fsuid);
941         CHECK_MEMBER(mdt_remote_perm, rp_fsgid);
942         CHECK_MEMBER(mdt_remote_perm, rp_access_perm);
943         CHECK_MEMBER(mdt_remote_perm, rp_padding);
944
945         CHECK_VALUE_X(CFS_SETUID_PERM);
946         CHECK_VALUE_X(CFS_SETGID_PERM);
947         CHECK_VALUE_X(CFS_SETGRP_PERM);
948         CHECK_VALUE_X(CFS_RMTACL_PERM);
949         CHECK_VALUE_X(CFS_RMTOWN_PERM);
950 }
951
952 static void
953 check_mdt_rec_setattr(void)
954 {
955         BLANK_LINE();
956         CHECK_STRUCT(mdt_rec_setattr);
957         CHECK_MEMBER(mdt_rec_setattr, sa_opcode);
958         CHECK_MEMBER(mdt_rec_setattr, sa_cap);
959         CHECK_MEMBER(mdt_rec_setattr, sa_fsuid);
960         CHECK_MEMBER(mdt_rec_setattr, sa_fsuid_h);
961         CHECK_MEMBER(mdt_rec_setattr, sa_fsgid);
962         CHECK_MEMBER(mdt_rec_setattr, sa_fsgid_h);
963         CHECK_MEMBER(mdt_rec_setattr, sa_suppgid);
964         CHECK_MEMBER(mdt_rec_setattr, sa_suppgid_h);
965         CHECK_MEMBER(mdt_rec_setattr, sa_padding_1);
966         CHECK_MEMBER(mdt_rec_setattr, sa_padding_1_h);
967         CHECK_MEMBER(mdt_rec_setattr, sa_fid);
968         CHECK_MEMBER(mdt_rec_setattr, sa_valid);
969         CHECK_MEMBER(mdt_rec_setattr, sa_uid);
970         CHECK_MEMBER(mdt_rec_setattr, sa_gid);
971         CHECK_MEMBER(mdt_rec_setattr, sa_size);
972         CHECK_MEMBER(mdt_rec_setattr, sa_blocks);
973         CHECK_MEMBER(mdt_rec_setattr, sa_mtime);
974         CHECK_MEMBER(mdt_rec_setattr, sa_atime);
975         CHECK_MEMBER(mdt_rec_setattr, sa_ctime);
976         CHECK_MEMBER(mdt_rec_setattr, sa_attr_flags);
977         CHECK_MEMBER(mdt_rec_setattr, sa_mode);
978         CHECK_MEMBER(mdt_rec_setattr, sa_padding_2);
979         CHECK_MEMBER(mdt_rec_setattr, sa_padding_3);
980         CHECK_MEMBER(mdt_rec_setattr, sa_padding_4);
981         CHECK_MEMBER(mdt_rec_setattr, sa_padding_5);
982 }
983
984 static void
985 check_mdt_rec_create(void)
986 {
987         BLANK_LINE();
988         CHECK_STRUCT(mdt_rec_create);
989         CHECK_MEMBER(mdt_rec_create, cr_opcode);
990         CHECK_MEMBER(mdt_rec_create, cr_cap);
991         CHECK_MEMBER(mdt_rec_create, cr_fsuid);
992         CHECK_MEMBER(mdt_rec_create, cr_fsuid_h);
993         CHECK_MEMBER(mdt_rec_create, cr_fsgid);
994         CHECK_MEMBER(mdt_rec_create, cr_fsgid_h);
995         CHECK_MEMBER(mdt_rec_create, cr_suppgid1);
996         CHECK_MEMBER(mdt_rec_create, cr_suppgid1_h);
997         CHECK_MEMBER(mdt_rec_create, cr_suppgid2);
998         CHECK_MEMBER(mdt_rec_create, cr_suppgid2_h);
999         CHECK_MEMBER(mdt_rec_create, cr_fid1);
1000         CHECK_MEMBER(mdt_rec_create, cr_fid2);
1001         CHECK_MEMBER(mdt_rec_create, cr_old_handle);
1002         CHECK_MEMBER(mdt_rec_create, cr_time);
1003         CHECK_MEMBER(mdt_rec_create, cr_rdev);
1004         CHECK_MEMBER(mdt_rec_create, cr_ioepoch);
1005         CHECK_MEMBER(mdt_rec_create, cr_padding_1);
1006         CHECK_MEMBER(mdt_rec_create, cr_mode);
1007         CHECK_MEMBER(mdt_rec_create, cr_bias);
1008         CHECK_MEMBER(mdt_rec_create, cr_flags_l);
1009         CHECK_MEMBER(mdt_rec_create, cr_flags_h);
1010         CHECK_MEMBER(mdt_rec_create, cr_padding_3);
1011         CHECK_MEMBER(mdt_rec_create, cr_padding_4);
1012 }
1013
1014 static void
1015 check_mdt_rec_link(void)
1016 {
1017         BLANK_LINE();
1018         CHECK_STRUCT(mdt_rec_link);
1019         CHECK_MEMBER(mdt_rec_link, lk_opcode);
1020         CHECK_MEMBER(mdt_rec_link, lk_cap);
1021         CHECK_MEMBER(mdt_rec_link, lk_fsuid);
1022         CHECK_MEMBER(mdt_rec_link, lk_fsuid_h);
1023         CHECK_MEMBER(mdt_rec_link, lk_fsgid);
1024         CHECK_MEMBER(mdt_rec_link, lk_fsgid_h);
1025         CHECK_MEMBER(mdt_rec_link, lk_suppgid1);
1026         CHECK_MEMBER(mdt_rec_link, lk_suppgid1_h);
1027         CHECK_MEMBER(mdt_rec_link, lk_suppgid2);
1028         CHECK_MEMBER(mdt_rec_link, lk_suppgid2_h);
1029         CHECK_MEMBER(mdt_rec_link, lk_fid1);
1030         CHECK_MEMBER(mdt_rec_link, lk_fid2);
1031         CHECK_MEMBER(mdt_rec_link, lk_time);
1032         CHECK_MEMBER(mdt_rec_link, lk_padding_1);
1033         CHECK_MEMBER(mdt_rec_link, lk_padding_2);
1034         CHECK_MEMBER(mdt_rec_link, lk_padding_3);
1035         CHECK_MEMBER(mdt_rec_link, lk_padding_4);
1036         CHECK_MEMBER(mdt_rec_link, lk_bias);
1037         CHECK_MEMBER(mdt_rec_link, lk_padding_5);
1038         CHECK_MEMBER(mdt_rec_link, lk_padding_6);
1039         CHECK_MEMBER(mdt_rec_link, lk_padding_7);
1040         CHECK_MEMBER(mdt_rec_link, lk_padding_8);
1041         CHECK_MEMBER(mdt_rec_link, lk_padding_9);
1042 }
1043
1044 static void
1045 check_mdt_rec_unlink(void)
1046 {
1047         BLANK_LINE();
1048         CHECK_STRUCT(mdt_rec_unlink);
1049         CHECK_MEMBER(mdt_rec_unlink, ul_opcode);
1050         CHECK_MEMBER(mdt_rec_unlink, ul_cap);
1051         CHECK_MEMBER(mdt_rec_unlink, ul_fsuid);
1052         CHECK_MEMBER(mdt_rec_unlink, ul_fsuid_h);
1053         CHECK_MEMBER(mdt_rec_unlink, ul_fsgid);
1054         CHECK_MEMBER(mdt_rec_unlink, ul_fsgid_h);
1055         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid1);
1056         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid1_h);
1057         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid2);
1058         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid2_h);
1059         CHECK_MEMBER(mdt_rec_unlink, ul_fid1);
1060         CHECK_MEMBER(mdt_rec_unlink, ul_fid2);
1061         CHECK_MEMBER(mdt_rec_unlink, ul_time);
1062         CHECK_MEMBER(mdt_rec_unlink, ul_padding_2);
1063         CHECK_MEMBER(mdt_rec_unlink, ul_padding_3);
1064         CHECK_MEMBER(mdt_rec_unlink, ul_padding_4);
1065         CHECK_MEMBER(mdt_rec_unlink, ul_padding_5);
1066         CHECK_MEMBER(mdt_rec_unlink, ul_bias);
1067         CHECK_MEMBER(mdt_rec_unlink, ul_mode);
1068         CHECK_MEMBER(mdt_rec_unlink, ul_padding_6);
1069         CHECK_MEMBER(mdt_rec_unlink, ul_padding_7);
1070         CHECK_MEMBER(mdt_rec_unlink, ul_padding_8);
1071         CHECK_MEMBER(mdt_rec_unlink, ul_padding_9);
1072 }
1073
1074 static void
1075 check_mdt_rec_rename(void)
1076 {
1077         BLANK_LINE();
1078         CHECK_STRUCT(mdt_rec_rename);
1079         CHECK_MEMBER(mdt_rec_rename, rn_opcode);
1080         CHECK_MEMBER(mdt_rec_rename, rn_cap);
1081         CHECK_MEMBER(mdt_rec_rename, rn_fsuid);
1082         CHECK_MEMBER(mdt_rec_rename, rn_fsuid_h);
1083         CHECK_MEMBER(mdt_rec_rename, rn_fsgid);
1084         CHECK_MEMBER(mdt_rec_rename, rn_fsgid_h);
1085         CHECK_MEMBER(mdt_rec_rename, rn_suppgid1);
1086         CHECK_MEMBER(mdt_rec_rename, rn_suppgid1_h);
1087         CHECK_MEMBER(mdt_rec_rename, rn_suppgid2);
1088         CHECK_MEMBER(mdt_rec_rename, rn_suppgid2_h);
1089         CHECK_MEMBER(mdt_rec_rename, rn_fid1);
1090         CHECK_MEMBER(mdt_rec_rename, rn_fid2);
1091         CHECK_MEMBER(mdt_rec_rename, rn_time);
1092         CHECK_MEMBER(mdt_rec_rename, rn_padding_1);
1093         CHECK_MEMBER(mdt_rec_rename, rn_padding_2);
1094         CHECK_MEMBER(mdt_rec_rename, rn_padding_3);
1095         CHECK_MEMBER(mdt_rec_rename, rn_padding_4);
1096         CHECK_MEMBER(mdt_rec_rename, rn_bias);
1097         CHECK_MEMBER(mdt_rec_rename, rn_mode);
1098         CHECK_MEMBER(mdt_rec_rename, rn_padding_5);
1099         CHECK_MEMBER(mdt_rec_rename, rn_padding_6);
1100         CHECK_MEMBER(mdt_rec_rename, rn_padding_7);
1101         CHECK_MEMBER(mdt_rec_rename, rn_padding_8);
1102 }
1103
1104 static void
1105 check_mdt_rec_setxattr(void)
1106 {
1107         BLANK_LINE();
1108         CHECK_STRUCT(mdt_rec_setxattr);
1109         CHECK_MEMBER(mdt_rec_setxattr, sx_opcode);
1110         CHECK_MEMBER(mdt_rec_setxattr, sx_cap);
1111         CHECK_MEMBER(mdt_rec_setxattr, sx_fsuid);
1112         CHECK_MEMBER(mdt_rec_setxattr, sx_fsuid_h);
1113         CHECK_MEMBER(mdt_rec_setxattr, sx_fsgid);
1114         CHECK_MEMBER(mdt_rec_setxattr, sx_fsgid_h);
1115         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid1);
1116         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid1_h);
1117         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid2);
1118         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid2_h);
1119         CHECK_MEMBER(mdt_rec_setxattr, sx_fid);
1120         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_1);
1121         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_2);
1122         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_3);
1123         CHECK_MEMBER(mdt_rec_setxattr, sx_valid);
1124         CHECK_MEMBER(mdt_rec_setxattr, sx_time);
1125         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_5);
1126         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_6);
1127         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_7);
1128         CHECK_MEMBER(mdt_rec_setxattr, sx_size);
1129         CHECK_MEMBER(mdt_rec_setxattr, sx_flags);
1130         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_8);
1131         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_9);
1132         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_10);
1133         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_11);
1134 }
1135
1136 static void
1137 check_mdt_rec_reint(void)
1138 {
1139         BLANK_LINE();
1140         CHECK_STRUCT(mdt_rec_reint);
1141         CHECK_MEMBER(mdt_rec_reint, rr_opcode);
1142         CHECK_MEMBER(mdt_rec_reint, rr_cap);
1143         CHECK_MEMBER(mdt_rec_reint, rr_fsuid);
1144         CHECK_MEMBER(mdt_rec_reint, rr_fsuid_h);
1145         CHECK_MEMBER(mdt_rec_reint, rr_fsgid);
1146         CHECK_MEMBER(mdt_rec_reint, rr_fsgid_h);
1147         CHECK_MEMBER(mdt_rec_reint, rr_suppgid1);
1148         CHECK_MEMBER(mdt_rec_reint, rr_suppgid1_h);
1149         CHECK_MEMBER(mdt_rec_reint, rr_suppgid2);
1150         CHECK_MEMBER(mdt_rec_reint, rr_suppgid2_h);
1151         CHECK_MEMBER(mdt_rec_reint, rr_fid1);
1152         CHECK_MEMBER(mdt_rec_reint, rr_fid2);
1153         CHECK_MEMBER(mdt_rec_reint, rr_mtime);
1154         CHECK_MEMBER(mdt_rec_reint, rr_atime);
1155         CHECK_MEMBER(mdt_rec_reint, rr_ctime);
1156         CHECK_MEMBER(mdt_rec_reint, rr_size);
1157         CHECK_MEMBER(mdt_rec_reint, rr_blocks);
1158         CHECK_MEMBER(mdt_rec_reint, rr_bias);
1159         CHECK_MEMBER(mdt_rec_reint, rr_mode);
1160         CHECK_MEMBER(mdt_rec_reint, rr_flags);
1161         CHECK_MEMBER(mdt_rec_reint, rr_padding_2);
1162         CHECK_MEMBER(mdt_rec_reint, rr_padding_3);
1163         CHECK_MEMBER(mdt_rec_reint, rr_padding_4);
1164 }
1165
1166 static void
1167 check_lmv_desc(void)
1168 {
1169         BLANK_LINE();
1170         CHECK_STRUCT(lmv_desc);
1171         CHECK_MEMBER(lmv_desc, ld_tgt_count);
1172         CHECK_MEMBER(lmv_desc, ld_active_tgt_count);
1173         CHECK_MEMBER(lmv_desc, ld_default_stripe_count);
1174         CHECK_MEMBER(lmv_desc, ld_pattern);
1175         CHECK_MEMBER(lmv_desc, ld_default_hash_size);
1176         CHECK_MEMBER(lmv_desc, ld_padding_1);
1177         CHECK_MEMBER(lmv_desc, ld_padding_2);
1178         CHECK_MEMBER(lmv_desc, ld_qos_maxage);
1179         CHECK_MEMBER(lmv_desc, ld_padding_3);
1180         CHECK_MEMBER(lmv_desc, ld_padding_4);
1181         CHECK_MEMBER(lmv_desc, ld_uuid);
1182 }
1183
1184 static void
1185 check_lmv_stripe_md(void)
1186 {
1187         BLANK_LINE();
1188         CHECK_STRUCT(lmv_stripe_md);
1189         CHECK_MEMBER(lmv_stripe_md, mea_magic);
1190         CHECK_MEMBER(lmv_stripe_md, mea_count);
1191         CHECK_MEMBER(lmv_stripe_md, mea_master);
1192         CHECK_MEMBER(lmv_stripe_md, mea_padding);
1193         CHECK_CVALUE(LOV_MAXPOOLNAME);
1194         CHECK_MEMBER(lmv_stripe_md, mea_pool_name[LOV_MAXPOOLNAME]);
1195         CHECK_MEMBER(lmv_stripe_md, mea_ids[0]);
1196 }
1197
1198 static void
1199 check_lov_desc(void)
1200 {
1201         BLANK_LINE();
1202         CHECK_STRUCT(lov_desc);
1203         CHECK_MEMBER(lov_desc, ld_tgt_count);
1204         CHECK_MEMBER(lov_desc, ld_active_tgt_count);
1205         CHECK_MEMBER(lov_desc, ld_default_stripe_count);
1206         CHECK_MEMBER(lov_desc, ld_pattern);
1207         CHECK_MEMBER(lov_desc, ld_default_stripe_size);
1208         CHECK_MEMBER(lov_desc, ld_default_stripe_offset);
1209         CHECK_MEMBER(lov_desc, ld_padding_0);
1210         CHECK_MEMBER(lov_desc, ld_qos_maxage);
1211         CHECK_MEMBER(lov_desc, ld_padding_1);
1212         CHECK_MEMBER(lov_desc, ld_padding_2);
1213         CHECK_MEMBER(lov_desc, ld_uuid);
1214
1215         CHECK_CDEFINE(LOV_DESC_MAGIC);
1216 }
1217
1218 static void
1219 check_ldlm_res_id(void)
1220 {
1221         BLANK_LINE();
1222         CHECK_STRUCT(ldlm_res_id);
1223         CHECK_CVALUE(RES_NAME_SIZE);
1224         CHECK_MEMBER(ldlm_res_id, name[RES_NAME_SIZE]);
1225 }
1226
1227 static void
1228 check_ldlm_extent(void)
1229 {
1230         BLANK_LINE();
1231         CHECK_STRUCT(ldlm_extent);
1232         CHECK_MEMBER(ldlm_extent, start);
1233         CHECK_MEMBER(ldlm_extent, end);
1234         CHECK_MEMBER(ldlm_extent, gid);
1235 }
1236
1237 static void
1238 check_ldlm_inodebits(void)
1239 {
1240         BLANK_LINE();
1241         CHECK_STRUCT(ldlm_inodebits);
1242         CHECK_MEMBER(ldlm_inodebits, bits);
1243 }
1244
1245 static void
1246 check_ldlm_flock(void)
1247 {
1248         BLANK_LINE();
1249         CHECK_STRUCT(ldlm_flock_wire);
1250         CHECK_MEMBER(ldlm_flock_wire, lfw_start);
1251         CHECK_MEMBER(ldlm_flock_wire, lfw_end);
1252         CHECK_MEMBER(ldlm_flock_wire, lfw_owner);
1253         CHECK_MEMBER(ldlm_flock_wire, lfw_padding);
1254         CHECK_MEMBER(ldlm_flock_wire, lfw_pid);
1255 }
1256
1257 static void
1258 check_ldlm_intent(void)
1259 {
1260         BLANK_LINE();
1261         CHECK_STRUCT(ldlm_intent);
1262         CHECK_MEMBER(ldlm_intent, opc);
1263 }
1264
1265 static void
1266 check_ldlm_resource_desc(void)
1267 {
1268         BLANK_LINE();
1269         CHECK_STRUCT(ldlm_resource_desc);
1270         CHECK_MEMBER(ldlm_resource_desc, lr_type);
1271         CHECK_MEMBER(ldlm_resource_desc, lr_padding);
1272         CHECK_MEMBER(ldlm_resource_desc, lr_name);
1273 }
1274
1275 static void
1276 check_ldlm_lock_desc(void)
1277 {
1278         BLANK_LINE();
1279         CHECK_STRUCT(ldlm_lock_desc);
1280         CHECK_MEMBER(ldlm_lock_desc, l_resource);
1281         CHECK_MEMBER(ldlm_lock_desc, l_req_mode);
1282         CHECK_MEMBER(ldlm_lock_desc, l_granted_mode);
1283         CHECK_MEMBER(ldlm_lock_desc, l_policy_data);
1284 }
1285
1286 static void
1287 check_ldlm_request(void)
1288 {
1289         BLANK_LINE();
1290         CHECK_STRUCT(ldlm_request);
1291         CHECK_MEMBER(ldlm_request, lock_flags);
1292         CHECK_MEMBER(ldlm_request, lock_count);
1293         CHECK_MEMBER(ldlm_request, lock_desc);
1294         CHECK_MEMBER(ldlm_request, lock_handle);
1295 }
1296
1297 static void
1298 check_ldlm_reply(void)
1299 {
1300         BLANK_LINE();
1301         CHECK_STRUCT(ldlm_reply);
1302         CHECK_MEMBER(ldlm_reply, lock_flags);
1303         CHECK_MEMBER(ldlm_reply, lock_padding);
1304         CHECK_MEMBER(ldlm_reply, lock_desc);
1305         CHECK_MEMBER(ldlm_reply, lock_handle);
1306         CHECK_MEMBER(ldlm_reply, lock_policy_res1);
1307         CHECK_MEMBER(ldlm_reply, lock_policy_res2);
1308 }
1309
1310 static void
1311 check_ldlm_ost_lvb(void)
1312 {
1313         BLANK_LINE();
1314         CHECK_STRUCT(ost_lvb);
1315         CHECK_MEMBER(ost_lvb, lvb_size);
1316         CHECK_MEMBER(ost_lvb, lvb_mtime);
1317         CHECK_MEMBER(ost_lvb, lvb_atime);
1318         CHECK_MEMBER(ost_lvb, lvb_ctime);
1319         CHECK_MEMBER(ost_lvb, lvb_blocks);
1320 }
1321
1322 static void
1323 check_ldlm_lquota_lvb(void)
1324 {
1325         BLANK_LINE();
1326         CHECK_STRUCT(lquota_lvb);
1327         CHECK_MEMBER(lquota_lvb, lvb_flags);
1328         CHECK_MEMBER(lquota_lvb, lvb_id_may_rel);
1329         CHECK_MEMBER(lquota_lvb, lvb_id_rel);
1330         CHECK_MEMBER(lquota_lvb, lvb_id_qunit);
1331         CHECK_MEMBER(lquota_lvb, lvb_pad1);
1332         CHECK_VALUE(LQUOTA_FL_EDQUOT);
1333 }
1334
1335 static void
1336 check_ldlm_gl_lquota_desc(void)
1337 {
1338         BLANK_LINE();
1339         CHECK_STRUCT(ldlm_gl_lquota_desc);
1340         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_id);
1341         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_flags);
1342         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_ver);
1343         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_hardlimit);
1344         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_softlimit);
1345         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_pad1);
1346         CHECK_MEMBER(ldlm_gl_lquota_desc, gl_pad2);
1347 }
1348
1349
1350 static void
1351 check_mgs_send_param(void)
1352 {
1353         BLANK_LINE();
1354         CHECK_STRUCT(mgs_send_param);
1355         CHECK_CVALUE(MGS_PARAM_MAXLEN);
1356         CHECK_MEMBER(mgs_send_param, mgs_param[MGS_PARAM_MAXLEN]);
1357 }
1358
1359 static void
1360 check_cfg_marker(void)
1361 {
1362         BLANK_LINE();
1363         CHECK_STRUCT(cfg_marker);
1364         CHECK_MEMBER(cfg_marker, cm_step);
1365         CHECK_MEMBER(cfg_marker, cm_flags);
1366         CHECK_MEMBER(cfg_marker, cm_vers);
1367         CHECK_MEMBER(cfg_marker, cm_padding);
1368         CHECK_MEMBER(cfg_marker, cm_createtime);
1369         CHECK_MEMBER(cfg_marker, cm_canceltime);
1370         CHECK_MEMBER(cfg_marker, cm_tgtname);
1371         CHECK_MEMBER(cfg_marker, cm_comment);
1372 }
1373
1374 static void
1375 check_llog_logid(void)
1376 {
1377         BLANK_LINE();
1378         CHECK_STRUCT(llog_logid);
1379         CHECK_MEMBER(llog_logid, lgl_oid);
1380         CHECK_MEMBER(llog_logid, lgl_oseq);
1381         CHECK_MEMBER(llog_logid, lgl_ogen);
1382
1383         CHECK_CVALUE(OST_SZ_REC);
1384         CHECK_CVALUE(MDS_UNLINK_REC);
1385         CHECK_CVALUE(MDS_UNLINK64_REC);
1386         CHECK_CVALUE(MDS_SETATTR64_REC);
1387         CHECK_CVALUE(OBD_CFG_REC);
1388         CHECK_CVALUE(LLOG_GEN_REC);
1389         CHECK_CVALUE(CHANGELOG_REC);
1390         CHECK_CVALUE(CHANGELOG_USER_REC);
1391         CHECK_CVALUE(LLOG_HDR_MAGIC);
1392         CHECK_CVALUE(LLOG_LOGID_MAGIC);
1393 }
1394
1395 static void
1396 check_llog_catid(void)
1397 {
1398         BLANK_LINE();
1399         CHECK_STRUCT(llog_catid);
1400         CHECK_MEMBER(llog_catid, lci_logid);
1401         CHECK_MEMBER(llog_catid, lci_padding1);
1402         CHECK_MEMBER(llog_catid, lci_padding2);
1403         CHECK_MEMBER(llog_catid, lci_padding3);
1404 }
1405
1406 static void
1407 check_llog_rec_hdr(void)
1408 {
1409         BLANK_LINE();
1410         CHECK_STRUCT(llog_rec_hdr);
1411         CHECK_MEMBER(llog_rec_hdr, lrh_len);
1412         CHECK_MEMBER(llog_rec_hdr, lrh_index);
1413         CHECK_MEMBER(llog_rec_hdr, lrh_type);
1414         CHECK_MEMBER(llog_rec_hdr, lrh_id);
1415 }
1416
1417 static void
1418 check_llog_rec_tail(void)
1419 {
1420         BLANK_LINE();
1421         CHECK_STRUCT(llog_rec_tail);
1422         CHECK_MEMBER(llog_rec_tail, lrt_len);
1423         CHECK_MEMBER(llog_rec_tail, lrt_index);
1424 }
1425
1426 static void
1427 check_llog_logid_rec(void)
1428 {
1429         BLANK_LINE();
1430         CHECK_STRUCT(llog_logid_rec);
1431         CHECK_MEMBER(llog_logid_rec, lid_hdr);
1432         CHECK_MEMBER(llog_logid_rec, lid_id);
1433         CHECK_MEMBER(llog_logid_rec, lid_padding1);
1434         CHECK_MEMBER(llog_logid_rec, lid_padding2);
1435         CHECK_MEMBER(llog_logid_rec, lid_padding3);
1436         CHECK_MEMBER(llog_logid_rec, lid_tail);
1437 }
1438
1439 static void
1440 check_llog_unlink_rec(void)
1441 {
1442         BLANK_LINE();
1443         CHECK_STRUCT(llog_unlink_rec);
1444         CHECK_MEMBER(llog_unlink_rec, lur_hdr);
1445         CHECK_MEMBER(llog_unlink_rec, lur_oid);
1446         CHECK_MEMBER(llog_unlink_rec, lur_oseq);
1447         CHECK_MEMBER(llog_unlink_rec, lur_count);
1448         CHECK_MEMBER(llog_unlink_rec, lur_tail);
1449 }
1450
1451 static void
1452 check_llog_unlink64_rec(void)
1453 {
1454         CHECK_STRUCT(llog_unlink64_rec);
1455         CHECK_MEMBER(llog_unlink64_rec, lur_hdr);
1456         CHECK_MEMBER(llog_unlink64_rec, lur_fid);
1457         CHECK_MEMBER(llog_unlink64_rec, lur_count);
1458         CHECK_MEMBER(llog_unlink64_rec, lur_tail);
1459         CHECK_MEMBER(llog_unlink64_rec, lur_padding1);
1460         CHECK_MEMBER(llog_unlink64_rec, lur_padding2);
1461         CHECK_MEMBER(llog_unlink64_rec, lur_padding3);
1462 }
1463
1464 static void
1465 check_llog_setattr64_rec(void)
1466 {
1467         BLANK_LINE();
1468         CHECK_STRUCT(llog_setattr64_rec);
1469         CHECK_MEMBER(llog_setattr64_rec, lsr_hdr);
1470         CHECK_MEMBER(llog_setattr64_rec, lsr_oid);
1471         CHECK_MEMBER(llog_setattr64_rec, lsr_oseq);
1472         CHECK_MEMBER(llog_setattr64_rec, lsr_uid);
1473         CHECK_MEMBER(llog_setattr64_rec, lsr_uid_h);
1474         CHECK_MEMBER(llog_setattr64_rec, lsr_gid);
1475         CHECK_MEMBER(llog_setattr64_rec, lsr_gid_h);
1476         CHECK_MEMBER(llog_setattr64_rec, lsr_padding);
1477         CHECK_MEMBER(llog_setattr64_rec, lsr_tail);
1478 }
1479
1480 static void
1481 check_llog_size_change_rec(void)
1482 {
1483         BLANK_LINE();
1484         CHECK_STRUCT(llog_size_change_rec);
1485         CHECK_MEMBER(llog_size_change_rec, lsc_hdr);
1486         CHECK_MEMBER(llog_size_change_rec, lsc_fid);
1487         CHECK_MEMBER(llog_size_change_rec, lsc_ioepoch);
1488         CHECK_MEMBER(llog_size_change_rec, lsc_padding1);
1489         CHECK_MEMBER(llog_size_change_rec, lsc_padding2);
1490         CHECK_MEMBER(llog_size_change_rec, lsc_padding3);
1491         CHECK_MEMBER(llog_size_change_rec, lsc_tail);
1492 }
1493
1494 static void
1495 check_changelog_rec(void)
1496 {
1497         BLANK_LINE();
1498         CHECK_STRUCT(changelog_rec);
1499         CHECK_MEMBER(changelog_rec, cr_namelen);
1500         CHECK_MEMBER(changelog_rec, cr_flags);
1501         CHECK_MEMBER(changelog_rec, cr_type);
1502         CHECK_MEMBER(changelog_rec, cr_index);
1503         CHECK_MEMBER(changelog_rec, cr_prev);
1504         CHECK_MEMBER(changelog_rec, cr_time);
1505         CHECK_MEMBER(changelog_rec, cr_tfid);
1506         CHECK_MEMBER(changelog_rec, cr_pfid);
1507 }
1508
1509 static void
1510 check_changelog_rec_ext(void)
1511 {
1512         BLANK_LINE();
1513         CHECK_STRUCT(changelog_ext_rec);
1514         CHECK_MEMBER(changelog_ext_rec, cr_namelen);
1515         CHECK_MEMBER(changelog_ext_rec, cr_flags);
1516         CHECK_MEMBER(changelog_ext_rec, cr_type);
1517         CHECK_MEMBER(changelog_ext_rec, cr_index);
1518         CHECK_MEMBER(changelog_ext_rec, cr_prev);
1519         CHECK_MEMBER(changelog_ext_rec, cr_time);
1520         CHECK_MEMBER(changelog_ext_rec, cr_tfid);
1521         CHECK_MEMBER(changelog_ext_rec, cr_pfid);
1522         CHECK_MEMBER(changelog_ext_rec, cr_sfid);
1523         CHECK_MEMBER(changelog_ext_rec, cr_spfid);
1524 }
1525
1526 static void
1527 check_changelog_setinfo(void)
1528 {
1529         BLANK_LINE();
1530         CHECK_STRUCT(changelog_setinfo);
1531         CHECK_MEMBER(changelog_setinfo, cs_recno);
1532         CHECK_MEMBER(changelog_setinfo, cs_id);
1533 }
1534
1535 static void
1536 check_llog_changelog_rec(void)
1537 {
1538         BLANK_LINE();
1539         CHECK_STRUCT(llog_changelog_rec);
1540         CHECK_MEMBER(llog_changelog_rec, cr_hdr);
1541         CHECK_MEMBER(llog_changelog_rec, cr);
1542         CHECK_MEMBER(llog_changelog_rec, cr_tail);
1543 }
1544
1545 static void
1546 check_llog_changelog_user_rec(void)
1547 {
1548         BLANK_LINE();
1549         CHECK_STRUCT(llog_changelog_user_rec);
1550         CHECK_MEMBER(llog_changelog_user_rec, cur_hdr);
1551         CHECK_MEMBER(llog_changelog_user_rec, cur_id);
1552         CHECK_MEMBER(llog_changelog_user_rec, cur_padding);
1553         CHECK_MEMBER(llog_changelog_user_rec, cur_endrec);
1554         CHECK_MEMBER(llog_changelog_user_rec, cur_tail);
1555 }
1556
1557 static void
1558 check_llog_gen(void)
1559 {
1560         BLANK_LINE();
1561         CHECK_STRUCT(llog_gen);
1562         CHECK_MEMBER(llog_gen, mnt_cnt);
1563         CHECK_MEMBER(llog_gen, conn_cnt);
1564 }
1565
1566 static void
1567 check_llog_gen_rec(void)
1568 {
1569         BLANK_LINE();
1570         CHECK_STRUCT(llog_gen_rec);
1571         CHECK_MEMBER(llog_gen_rec, lgr_hdr);
1572         CHECK_MEMBER(llog_gen_rec, lgr_gen);
1573         CHECK_MEMBER(llog_gen_rec, lgr_tail);
1574 }
1575
1576 static void
1577 check_llog_log_hdr(void)
1578 {
1579         BLANK_LINE();
1580         CHECK_STRUCT(llog_log_hdr);
1581         CHECK_MEMBER(llog_log_hdr, llh_hdr);
1582         CHECK_MEMBER(llog_log_hdr, llh_timestamp);
1583         CHECK_MEMBER(llog_log_hdr, llh_count);
1584         CHECK_MEMBER(llog_log_hdr, llh_bitmap_offset);
1585         CHECK_MEMBER(llog_log_hdr, llh_size);
1586         CHECK_MEMBER(llog_log_hdr, llh_flags);
1587         CHECK_MEMBER(llog_log_hdr, llh_cat_idx);
1588         CHECK_MEMBER(llog_log_hdr, llh_tgtuuid);
1589         CHECK_MEMBER(llog_log_hdr, llh_reserved);
1590         CHECK_MEMBER(llog_log_hdr, llh_bitmap);
1591         CHECK_MEMBER(llog_log_hdr, llh_tail);
1592 }
1593
1594 static void
1595 check_llog_cookie(void)
1596 {
1597         BLANK_LINE();
1598         CHECK_STRUCT(llog_cookie);
1599         CHECK_MEMBER(llog_cookie, lgc_lgl);
1600         CHECK_MEMBER(llog_cookie, lgc_subsys);
1601         CHECK_MEMBER(llog_cookie, lgc_index);
1602         CHECK_MEMBER(llog_cookie, lgc_padding);
1603 }
1604
1605 static void
1606 check_llogd_body(void)
1607 {
1608         BLANK_LINE();
1609         CHECK_STRUCT(llogd_body);
1610         CHECK_MEMBER(llogd_body, lgd_logid);
1611         CHECK_MEMBER(llogd_body, lgd_ctxt_idx);
1612         CHECK_MEMBER(llogd_body, lgd_llh_flags);
1613         CHECK_MEMBER(llogd_body, lgd_index);
1614         CHECK_MEMBER(llogd_body, lgd_saved_index);
1615         CHECK_MEMBER(llogd_body, lgd_len);
1616         CHECK_MEMBER(llogd_body, lgd_cur_offset);
1617
1618         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CREATE);
1619         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
1620         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_READ_HEADER);
1621         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_WRITE_REC);
1622         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CLOSE);
1623         CHECK_CVALUE(LLOG_ORIGIN_CONNECT);
1624         CHECK_CVALUE(LLOG_CATINFO);
1625         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_PREV_BLOCK);
1626         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_DESTROY);
1627         CHECK_CVALUE(LLOG_FIRST_OPC);
1628         CHECK_CVALUE(LLOG_LAST_OPC);
1629 }
1630
1631 static void
1632 check_llogd_conn_body(void)
1633 {
1634         BLANK_LINE();
1635         CHECK_STRUCT(llogd_conn_body);
1636         CHECK_MEMBER(llogd_conn_body, lgdc_gen);
1637         CHECK_MEMBER(llogd_conn_body, lgdc_logid);
1638         CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx);
1639 }
1640
1641 static void
1642 check_ll_fiemap_info_key(void)
1643 {
1644         BLANK_LINE();
1645         CHECK_STRUCT(ll_fiemap_info_key);
1646         CHECK_MEMBER(ll_fiemap_info_key, name[8]);
1647         CHECK_MEMBER(ll_fiemap_info_key, oa);
1648         CHECK_MEMBER(ll_fiemap_info_key, fiemap);
1649 }
1650
1651 static void
1652 check_quota_body(void)
1653 {
1654         BLANK_LINE();
1655         CHECK_STRUCT(quota_body);
1656         CHECK_MEMBER(quota_body, qb_fid);
1657         CHECK_MEMBER(quota_body, qb_id);
1658         CHECK_MEMBER(quota_body, qb_flags);
1659         CHECK_MEMBER(quota_body, qb_padding);
1660         CHECK_MEMBER(quota_body, qb_count);
1661         CHECK_MEMBER(quota_body, qb_usage);
1662         CHECK_MEMBER(quota_body, qb_slv_ver);
1663         CHECK_MEMBER(quota_body, qb_lockh);
1664         CHECK_MEMBER(quota_body, qb_glb_lockh);
1665         CHECK_MEMBER(quota_body, qb_padding1[4]);
1666 }
1667
1668 static void
1669 check_mgs_target_info(void)
1670 {
1671         BLANK_LINE();
1672         CHECK_STRUCT(mgs_target_info);
1673         CHECK_MEMBER(mgs_target_info, mti_lustre_ver);
1674         CHECK_MEMBER(mgs_target_info, mti_stripe_index);
1675         CHECK_MEMBER(mgs_target_info, mti_config_ver);
1676         CHECK_MEMBER(mgs_target_info, mti_flags);
1677         CHECK_MEMBER(mgs_target_info, mti_nid_count);
1678         CHECK_MEMBER(mgs_target_info, mti_instance);
1679         CHECK_MEMBER(mgs_target_info, mti_fsname);
1680         CHECK_MEMBER(mgs_target_info, mti_svname);
1681         CHECK_MEMBER(mgs_target_info, mti_uuid);
1682         CHECK_MEMBER(mgs_target_info, mti_nids);
1683         CHECK_MEMBER(mgs_target_info, mti_params);
1684 }
1685
1686 static void
1687 check_lustre_capa(void)
1688 {
1689         BLANK_LINE();
1690         CHECK_STRUCT(lustre_capa);
1691         CHECK_MEMBER(lustre_capa, lc_fid);
1692         CHECK_MEMBER(lustre_capa, lc_opc);
1693         CHECK_MEMBER(lustre_capa, lc_uid);
1694         CHECK_MEMBER(lustre_capa, lc_gid);
1695         CHECK_MEMBER(lustre_capa, lc_flags);
1696         CHECK_MEMBER(lustre_capa, lc_keyid);
1697         CHECK_MEMBER(lustre_capa, lc_timeout);
1698         CHECK_MEMBER(lustre_capa, lc_expiry);
1699         CHECK_CVALUE(CAPA_HMAC_MAX_LEN);
1700         CHECK_MEMBER(lustre_capa, lc_hmac[CAPA_HMAC_MAX_LEN]);
1701 }
1702
1703 static void
1704 check_lustre_capa_key(void)
1705 {
1706         BLANK_LINE();
1707         CHECK_STRUCT(lustre_capa_key);
1708         CHECK_MEMBER(lustre_capa_key, lk_seq);
1709         CHECK_MEMBER(lustre_capa_key, lk_keyid);
1710         CHECK_MEMBER(lustre_capa_key, lk_padding);
1711         CHECK_CVALUE(CAPA_HMAC_KEY_MAX_LEN);
1712         CHECK_MEMBER(lustre_capa_key, lk_key[CAPA_HMAC_KEY_MAX_LEN]);
1713 }
1714
1715 static void
1716 check_getinfo_fid2path(void)
1717 {
1718         BLANK_LINE();
1719         CHECK_STRUCT(getinfo_fid2path);
1720         CHECK_MEMBER(getinfo_fid2path, gf_fid);
1721         CHECK_MEMBER(getinfo_fid2path, gf_recno);
1722         CHECK_MEMBER(getinfo_fid2path, gf_linkno);
1723         CHECK_MEMBER(getinfo_fid2path, gf_pathlen);
1724         CHECK_MEMBER(getinfo_fid2path, gf_path[0]);
1725 }
1726
1727 static void
1728 check_posix_acl_xattr_entry(void)
1729 {
1730         BLANK_LINE();
1731         CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry);
1732         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag);
1733         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm);
1734         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id);
1735 }
1736
1737 static void
1738 check_posix_acl_xattr_header(void)
1739 {
1740         BLANK_LINE();
1741         CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header);
1742         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version);
1743         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries);
1744 }
1745
1746 static void
1747 check_ll_user_fiemap(void)
1748 {
1749         BLANK_LINE();
1750         CHECK_STRUCT(ll_user_fiemap);
1751         CHECK_MEMBER(ll_user_fiemap, fm_start);
1752         CHECK_MEMBER(ll_user_fiemap, fm_length);
1753         CHECK_MEMBER(ll_user_fiemap, fm_flags);
1754         CHECK_MEMBER(ll_user_fiemap, fm_mapped_extents);
1755         CHECK_MEMBER(ll_user_fiemap, fm_extent_count);
1756         CHECK_MEMBER(ll_user_fiemap, fm_reserved);
1757         CHECK_MEMBER(ll_user_fiemap, fm_extents);
1758
1759         CHECK_CDEFINE(FIEMAP_FLAG_SYNC);
1760         CHECK_CDEFINE(FIEMAP_FLAG_XATTR);
1761         CHECK_CDEFINE(FIEMAP_FLAG_DEVICE_ORDER);
1762 }
1763
1764 static void
1765 check_ll_fiemap_extent(void)
1766 {
1767         BLANK_LINE();
1768         CHECK_STRUCT(ll_fiemap_extent);
1769         CHECK_MEMBER(ll_fiemap_extent, fe_logical);
1770         CHECK_MEMBER(ll_fiemap_extent, fe_physical);
1771         CHECK_MEMBER(ll_fiemap_extent, fe_length);
1772         CHECK_MEMBER(ll_fiemap_extent, fe_flags);
1773         CHECK_MEMBER(ll_fiemap_extent, fe_device);
1774
1775         CHECK_CDEFINE(FIEMAP_EXTENT_LAST);
1776         CHECK_CDEFINE(FIEMAP_EXTENT_UNKNOWN);
1777         CHECK_CDEFINE(FIEMAP_EXTENT_DELALLOC);
1778         CHECK_CDEFINE(FIEMAP_EXTENT_ENCODED);
1779         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_ENCRYPTED);
1780         CHECK_CDEFINE(FIEMAP_EXTENT_NOT_ALIGNED);
1781         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_INLINE);
1782         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_TAIL);
1783         CHECK_CDEFINE(FIEMAP_EXTENT_UNWRITTEN);
1784         CHECK_CDEFINE(FIEMAP_EXTENT_MERGED);
1785         CHECK_CDEFINE(FIEMAP_EXTENT_NO_DIRECT);
1786         CHECK_CDEFINE(FIEMAP_EXTENT_NET);
1787 }
1788
1789 static void
1790 check_link_ea_header(void)
1791 {
1792         BLANK_LINE();
1793         CHECK_STRUCT(link_ea_header);
1794         CHECK_MEMBER(link_ea_header, leh_magic);
1795         CHECK_MEMBER(link_ea_header, leh_reccount);
1796         CHECK_MEMBER(link_ea_header, leh_len);
1797         CHECK_MEMBER(link_ea_header, padding1);
1798         CHECK_MEMBER(link_ea_header, padding2);
1799
1800         CHECK_CDEFINE(LINK_EA_MAGIC);
1801 }
1802
1803 static void
1804 check_link_ea_entry(void)
1805 {
1806         BLANK_LINE();
1807         CHECK_STRUCT(link_ea_entry);
1808         CHECK_MEMBER(link_ea_entry, lee_reclen);
1809         CHECK_MEMBER(link_ea_entry, lee_parent_fid);
1810         CHECK_MEMBER(link_ea_entry, lee_name);
1811 }
1812
1813 static void
1814 check_hsm_user_item(void)
1815 {
1816         BLANK_LINE();
1817         CHECK_STRUCT(hsm_user_item);
1818         CHECK_MEMBER(hsm_user_item, hui_fid);
1819         CHECK_MEMBER(hsm_user_item, hui_extent);
1820 }
1821
1822 static void
1823 check_hsm_user_request(void)
1824 {
1825         BLANK_LINE();
1826         CHECK_STRUCT(hsm_user_request);
1827         CHECK_MEMBER(hsm_user_request, hur_action);
1828         CHECK_MEMBER(hsm_user_request, hur_archive_num);
1829         CHECK_MEMBER(hsm_user_request, hur_itemcount);
1830         CHECK_MEMBER(hsm_user_request, hur_data_len);
1831 }
1832
1833 static void
1834 check_hsm_user_state(void)
1835 {
1836         BLANK_LINE();
1837         CHECK_STRUCT(hsm_user_state);
1838         CHECK_MEMBER(hsm_user_state, hus_states);
1839         CHECK_MEMBER(hsm_user_state, hus_archive_num);
1840         CHECK_MEMBER(hsm_user_state, hus_in_progress_state);
1841         CHECK_MEMBER(hsm_user_state, hus_in_progress_action);
1842         CHECK_MEMBER(hsm_user_state, hus_in_progress_location);
1843 }
1844
1845 static void
1846 system_string (char *cmdline, char *str, int len)
1847 {
1848         int   fds[2];
1849         int   rc;
1850         pid_t pid;
1851
1852         rc = pipe(fds);
1853         if (rc != 0)
1854                 abort();
1855
1856         pid = fork();
1857         if (pid == 0) {
1858                 /* child */
1859                 int   fd = fileno(stdout);
1860
1861                 rc = dup2(fds[1], fd);
1862                 if (rc != fd)
1863                         abort();
1864
1865                 exit(system(cmdline));
1866                 /* notreached */
1867         } else if ((int)pid < 0) {
1868                 abort();
1869         } else {
1870                 FILE *f = fdopen(fds[0], "r");
1871
1872                 if (f == NULL)
1873                         abort();
1874
1875                 close(fds[1]);
1876
1877                 if (fgets(str, len, f) == NULL)
1878                         abort();
1879
1880                 if (waitpid(pid, &rc, 0) != pid)
1881                         abort();
1882
1883                 if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
1884                         abort();
1885
1886                 if (strnlen(str, len) == len)
1887                         str[len - 1] = 0;
1888
1889                 if (str[strlen(str) - 1] == '\n')
1890                         str[strlen(str) - 1] = 0;
1891
1892                 fclose(f);
1893         }
1894 }
1895
1896 int
1897 main(int argc, char **argv)
1898 {
1899         char unameinfo[80];
1900         char gccinfo[80];
1901
1902         system_string("uname -a", unameinfo, sizeof(unameinfo));
1903         system_string(CC " -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
1904
1905         printf ("void lustre_assert_wire_constants(void)\n"
1906                 "{\n"
1907                 "        /* Wire protocol assertions generated by 'wirecheck'\n"
1908                 "         * (make -C lustre/utils newwiretest)\n"
1909                 "         * running on %s\n"
1910                 "         * with %s */\n"
1911                 "\n", unameinfo, gccinfo);
1912
1913         BLANK_LINE ();
1914
1915         COMMENT("Constants...");
1916         CHECK_VALUE(PTL_RPC_MSG_REQUEST);
1917         CHECK_VALUE(PTL_RPC_MSG_ERR);
1918         CHECK_VALUE(PTL_RPC_MSG_REPLY);
1919
1920         CHECK_DEFINE_64X(MDS_DIR_END_OFF);
1921
1922         CHECK_DEFINE_64X(DEAD_HANDLE_MAGIC);
1923
1924         CHECK_CVALUE(MTI_NAME_MAXLEN);
1925
1926         CHECK_VALUE(OST_REPLY);
1927         CHECK_VALUE(OST_GETATTR);
1928         CHECK_VALUE(OST_SETATTR);
1929         CHECK_VALUE(OST_READ);
1930         CHECK_VALUE(OST_WRITE);
1931         CHECK_VALUE(OST_CREATE);
1932         CHECK_VALUE(OST_DESTROY);
1933         CHECK_VALUE(OST_GET_INFO);
1934         CHECK_VALUE(OST_CONNECT);
1935         CHECK_VALUE(OST_DISCONNECT);
1936         CHECK_VALUE(OST_PUNCH);
1937         CHECK_VALUE(OST_OPEN);
1938         CHECK_VALUE(OST_CLOSE);
1939         CHECK_VALUE(OST_STATFS);
1940         CHECK_VALUE(OST_SYNC);
1941         CHECK_VALUE(OST_SET_INFO);
1942         CHECK_VALUE(OST_QUOTACHECK);
1943         CHECK_VALUE(OST_QUOTACTL);
1944         CHECK_VALUE(OST_QUOTA_ADJUST_QUNIT);
1945         CHECK_VALUE(OST_LAST_OPC);
1946
1947         CHECK_DEFINE_64X(OBD_OBJECT_EOF);
1948
1949         CHECK_VALUE(OST_MIN_PRECREATE);
1950         CHECK_VALUE(OST_MAX_PRECREATE);
1951
1952         CHECK_DEFINE_64X(OST_LVB_ERR_INIT);
1953         CHECK_DEFINE_64X(OST_LVB_ERR_MASK);
1954
1955         CHECK_VALUE(MDS_FIRST_OPC);
1956         CHECK_VALUE(MDS_GETATTR);
1957         CHECK_VALUE(MDS_GETATTR_NAME);
1958         CHECK_VALUE(MDS_CLOSE);
1959         CHECK_VALUE(MDS_REINT);
1960         CHECK_VALUE(MDS_READPAGE);
1961         CHECK_VALUE(MDS_CONNECT);
1962         CHECK_VALUE(MDS_DISCONNECT);
1963         CHECK_VALUE(MDS_GETSTATUS);
1964         CHECK_VALUE(MDS_STATFS);
1965         CHECK_VALUE(MDS_PIN);
1966         CHECK_VALUE(MDS_UNPIN);
1967         CHECK_VALUE(MDS_SYNC);
1968         CHECK_VALUE(MDS_DONE_WRITING);
1969         CHECK_VALUE(MDS_SET_INFO);
1970         CHECK_VALUE(MDS_QUOTACHECK);
1971         CHECK_VALUE(MDS_QUOTACTL);
1972         CHECK_VALUE(MDS_GETXATTR);
1973         CHECK_VALUE(MDS_SETXATTR);
1974         CHECK_VALUE(MDS_WRITEPAGE);
1975         CHECK_VALUE(MDS_IS_SUBDIR);
1976         CHECK_VALUE(MDS_GET_INFO);
1977         CHECK_VALUE(MDS_LAST_OPC);
1978
1979         CHECK_VALUE(REINT_SETATTR);
1980         CHECK_VALUE(REINT_CREATE);
1981         CHECK_VALUE(REINT_LINK);
1982         CHECK_VALUE(REINT_UNLINK);
1983         CHECK_VALUE(REINT_RENAME);
1984         CHECK_VALUE(REINT_OPEN);
1985         CHECK_VALUE(REINT_SETXATTR);
1986         CHECK_VALUE(REINT_MAX);
1987
1988         CHECK_VALUE_X(DISP_IT_EXECD);
1989         CHECK_VALUE_X(DISP_LOOKUP_EXECD);
1990         CHECK_VALUE_X(DISP_LOOKUP_NEG);
1991         CHECK_VALUE_X(DISP_LOOKUP_POS);
1992         CHECK_VALUE_X(DISP_OPEN_CREATE);
1993         CHECK_VALUE_X(DISP_OPEN_OPEN);
1994         CHECK_VALUE_X(DISP_ENQ_COMPLETE);
1995         CHECK_VALUE_X(DISP_ENQ_OPEN_REF);
1996         CHECK_VALUE_X(DISP_ENQ_CREATE_REF);
1997         CHECK_VALUE_X(DISP_OPEN_LOCK);
1998
1999         CHECK_VALUE(MDS_STATUS_CONN);
2000         CHECK_VALUE(MDS_STATUS_LOV);
2001
2002         CHECK_VALUE(LUSTRE_BFLAG_UNCOMMITTED_WRITES);
2003
2004         CHECK_VALUE_X(MF_SOM_CHANGE);
2005         CHECK_VALUE_X(MF_EPOCH_OPEN);
2006         CHECK_VALUE_X(MF_EPOCH_CLOSE);
2007         CHECK_VALUE_X(MF_MDC_CANCEL_FID1);
2008         CHECK_VALUE_X(MF_MDC_CANCEL_FID2);
2009         CHECK_VALUE_X(MF_MDC_CANCEL_FID3);
2010         CHECK_VALUE_X(MF_MDC_CANCEL_FID4);
2011         CHECK_VALUE_X(MF_SOM_AU);
2012         CHECK_VALUE_X(MF_GETATTR_LOCK);
2013
2014         CHECK_VALUE_64X(MDS_ATTR_MODE);
2015         CHECK_VALUE_64X(MDS_ATTR_UID);
2016         CHECK_VALUE_64X(MDS_ATTR_GID);
2017         CHECK_VALUE_64X(MDS_ATTR_SIZE);
2018         CHECK_VALUE_64X(MDS_ATTR_ATIME);
2019         CHECK_VALUE_64X(MDS_ATTR_MTIME);
2020         CHECK_VALUE_64X(MDS_ATTR_CTIME);
2021         CHECK_VALUE_64X(MDS_ATTR_ATIME_SET);
2022         CHECK_VALUE_64X(MDS_ATTR_MTIME_SET);
2023         CHECK_VALUE_64X(MDS_ATTR_FORCE);
2024         CHECK_VALUE_64X(MDS_ATTR_ATTR_FLAG);
2025         CHECK_VALUE_64X(MDS_ATTR_KILL_SUID);
2026         CHECK_VALUE_64X(MDS_ATTR_KILL_SGID);
2027         CHECK_VALUE_64X(MDS_ATTR_CTIME_SET);
2028         CHECK_VALUE_64X(MDS_ATTR_FROM_OPEN);
2029         CHECK_VALUE_64X(MDS_ATTR_BLOCKS);
2030
2031         CHECK_VALUE(FLD_QUERY);
2032         CHECK_VALUE(FLD_FIRST_OPC);
2033         CHECK_VALUE(FLD_LAST_OPC);
2034
2035         CHECK_VALUE(SEQ_QUERY);
2036         CHECK_VALUE(SEQ_FIRST_OPC);
2037         CHECK_VALUE(SEQ_LAST_OPC);
2038
2039         CHECK_VALUE(SEQ_ALLOC_SUPER);
2040         CHECK_VALUE(SEQ_ALLOC_META);
2041
2042         CHECK_VALUE(LDLM_ENQUEUE);
2043         CHECK_VALUE(LDLM_CONVERT);
2044         CHECK_VALUE(LDLM_CANCEL);
2045         CHECK_VALUE(LDLM_BL_CALLBACK);
2046         CHECK_VALUE(LDLM_CP_CALLBACK);
2047         CHECK_VALUE(LDLM_GL_CALLBACK);
2048         CHECK_VALUE(LDLM_SET_INFO);
2049         CHECK_VALUE(LDLM_LAST_OPC);
2050
2051         CHECK_VALUE(LCK_MINMODE);
2052         CHECK_VALUE(LCK_EX);
2053         CHECK_VALUE(LCK_PW);
2054         CHECK_VALUE(LCK_PR);
2055         CHECK_VALUE(LCK_CW);
2056         CHECK_VALUE(LCK_CR);
2057         CHECK_VALUE(LCK_NL);
2058         CHECK_VALUE(LCK_GROUP);
2059         CHECK_VALUE(LCK_COS);
2060         CHECK_VALUE(LCK_MAXMODE);
2061         CHECK_VALUE(LCK_MODE_NUM);
2062
2063         CHECK_CVALUE(LDLM_PLAIN);
2064         CHECK_CVALUE(LDLM_EXTENT);
2065         CHECK_CVALUE(LDLM_FLOCK);
2066         CHECK_CVALUE(LDLM_IBITS);
2067         CHECK_CVALUE(LDLM_MAX_TYPE);
2068
2069         CHECK_CVALUE(LUSTRE_RES_ID_SEQ_OFF);
2070         CHECK_CVALUE(LUSTRE_RES_ID_VER_OID_OFF);
2071         /* CHECK_CVALUE(LUSTRE_RES_ID_WAS_VER_OFF); packed with OID */
2072         CHECK_CVALUE(LUSTRE_RES_ID_QUOTA_SEQ_OFF);
2073         CHECK_CVALUE(LUSTRE_RES_ID_QUOTA_VER_OID_OFF);
2074         CHECK_CVALUE(LUSTRE_RES_ID_HSH_OFF);
2075
2076         CHECK_CVALUE(LQUOTA_TYPE_USR);
2077         CHECK_CVALUE(LQUOTA_TYPE_GRP);
2078
2079         CHECK_CVALUE(LQUOTA_RES_MD);
2080         CHECK_CVALUE(LQUOTA_RES_DT);
2081
2082         CHECK_VALUE(OBD_PING);
2083         CHECK_VALUE(OBD_LOG_CANCEL);
2084         CHECK_VALUE(OBD_QC_CALLBACK);
2085         CHECK_VALUE(OBD_IDX_READ);
2086         CHECK_VALUE(OBD_LAST_OPC);
2087
2088         CHECK_VALUE(QUOTA_DQACQ);
2089         CHECK_VALUE(QUOTA_DQREL);
2090         CHECK_VALUE(QUOTA_LAST_OPC);
2091
2092         CHECK_VALUE(MGS_CONNECT);
2093         CHECK_VALUE(MGS_DISCONNECT);
2094         CHECK_VALUE(MGS_EXCEPTION);
2095         CHECK_VALUE(MGS_TARGET_REG);
2096         CHECK_VALUE(MGS_TARGET_DEL);
2097         CHECK_VALUE(MGS_SET_INFO);
2098         CHECK_VALUE(MGS_LAST_OPC);
2099
2100         CHECK_VALUE(SEC_CTX_INIT);
2101         CHECK_VALUE(SEC_CTX_INIT_CONT);
2102         CHECK_VALUE(SEC_CTX_FINI);
2103         CHECK_VALUE(SEC_LAST_OPC);
2104
2105         COMMENT("Sizes and Offsets");
2106         BLANK_LINE();
2107         CHECK_STRUCT(obd_uuid);
2108         check_lu_seq_range();
2109         check_lustre_mdt_attrs();
2110         check_ost_id();
2111         check_lu_dirent();
2112         check_luda_type();
2113         check_lu_dirpage();
2114         check_lustre_handle();
2115         check_lustre_msg_v2();
2116         check_ptlrpc_body();
2117         check_obd_connect_data();
2118         check_obdo();
2119         check_lov_ost_data_v1();
2120         check_lov_mds_md_v1();
2121         check_lov_mds_md_v3();
2122         check_obd_statfs();
2123         check_obd_ioobj();
2124         check_obd_quotactl();
2125         check_obd_idx_read();
2126         check_niobuf_remote();
2127         check_ost_body();
2128         check_ll_fid();
2129         check_mdt_body();
2130         check_mdt_ioepoch();
2131         check_mdt_remote_perm();
2132         check_mdt_rec_setattr();
2133         check_mdt_rec_create();
2134         check_mdt_rec_link();
2135         check_mdt_rec_unlink();
2136         check_mdt_rec_rename();
2137         check_mdt_rec_setxattr();
2138         check_mdt_rec_reint();
2139         check_lmv_desc();
2140         check_lmv_stripe_md();
2141         check_lov_desc();
2142         check_ldlm_res_id();
2143         check_ldlm_extent();
2144         check_ldlm_inodebits();
2145         check_ldlm_flock();
2146         check_ldlm_intent();
2147         check_ldlm_resource_desc();
2148         check_ldlm_lock_desc();
2149         check_ldlm_request();
2150         check_ldlm_reply();
2151         check_ldlm_ost_lvb();
2152         check_ldlm_lquota_lvb();
2153         check_ldlm_gl_lquota_desc();
2154         check_mgs_send_param();
2155         check_cfg_marker();
2156         check_llog_logid();
2157         check_llog_catid();
2158         check_llog_rec_hdr();
2159         check_llog_rec_tail();
2160         check_llog_logid_rec();
2161         check_llog_unlink_rec();
2162         check_llog_unlink64_rec();
2163         check_llog_setattr64_rec();
2164         check_llog_size_change_rec();
2165         check_changelog_rec();
2166         check_changelog_rec_ext();
2167         check_changelog_setinfo();
2168         check_llog_changelog_rec();
2169         check_llog_changelog_user_rec();
2170         check_llog_gen();
2171         check_llog_gen_rec();
2172         check_llog_log_hdr();
2173         check_llog_cookie();
2174         check_llogd_body();
2175         check_llogd_conn_body();
2176         check_ll_fiemap_info_key();
2177         check_quota_body();
2178         check_mgs_target_info();
2179         check_lustre_capa();
2180         check_lustre_capa_key();
2181         check_getinfo_fid2path();
2182         check_ll_user_fiemap();
2183         check_ll_fiemap_extent();
2184         printf("#ifdef LIBLUSTRE_POSIX_ACL\n");
2185 #ifndef LIBLUSTRE_POSIX_ACL
2186 #error build generator without LIBLUSTRE_POSIX_ACL defined - produce wrong check code.
2187 #endif
2188         check_posix_acl_xattr_entry();
2189         check_posix_acl_xattr_header();
2190         printf("#endif\n");
2191         check_link_ea_header();
2192         check_link_ea_entry();
2193         check_hsm_user_item();
2194         check_hsm_user_request();
2195         check_hsm_user_state();
2196
2197         printf("}\n\n");
2198
2199         return(0);
2200 }