Whamcloud - gitweb
291075417142a55ed397c21fbe3cd14b4e582651
[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
501         CHECK_VALUE_X(OBD_CKSUM_CRC32);
502         CHECK_VALUE_X(OBD_CKSUM_ADLER);
503         CHECK_VALUE_X(OBD_CKSUM_CRC32C);
504 }
505
506 static void
507 check_obdo(void)
508 {
509         BLANK_LINE();
510         CHECK_STRUCT(obdo);
511         CHECK_MEMBER(obdo, o_valid);
512         CHECK_MEMBER(obdo, o_id);
513         CHECK_MEMBER(obdo, o_seq);
514         CHECK_MEMBER(obdo, o_parent_seq);
515         CHECK_MEMBER(obdo, o_size);
516         CHECK_MEMBER(obdo, o_mtime);
517         CHECK_MEMBER(obdo, o_atime);
518         CHECK_MEMBER(obdo, o_ctime);
519         CHECK_MEMBER(obdo, o_blocks);
520         CHECK_MEMBER(obdo, o_grant);
521         CHECK_MEMBER(obdo, o_blksize);
522         CHECK_MEMBER(obdo, o_mode);
523         CHECK_MEMBER(obdo, o_uid);
524         CHECK_MEMBER(obdo, o_gid);
525         CHECK_MEMBER(obdo, o_flags);
526         CHECK_MEMBER(obdo, o_nlink);
527         CHECK_MEMBER(obdo, o_parent_oid);
528         CHECK_MEMBER(obdo, o_misc);
529         CHECK_MEMBER(obdo, o_ioepoch);
530         CHECK_MEMBER(obdo, o_stripe_idx);
531         CHECK_MEMBER(obdo, o_parent_ver);
532         CHECK_MEMBER(obdo, o_handle);
533         CHECK_MEMBER(obdo, o_lcookie);
534         CHECK_MEMBER(obdo, o_uid_h);
535         CHECK_MEMBER(obdo, o_gid_h);
536         CHECK_MEMBER(obdo, o_data_version);
537         CHECK_MEMBER(obdo, o_padding_4);
538         CHECK_MEMBER(obdo, o_padding_5);
539         CHECK_MEMBER(obdo, o_padding_6);
540
541         CHECK_DEFINE_64X(OBD_MD_FLID);
542         CHECK_DEFINE_64X(OBD_MD_FLATIME);
543         CHECK_DEFINE_64X(OBD_MD_FLMTIME);
544         CHECK_DEFINE_64X(OBD_MD_FLCTIME);
545         CHECK_DEFINE_64X(OBD_MD_FLSIZE);
546         CHECK_DEFINE_64X(OBD_MD_FLBLOCKS);
547         CHECK_DEFINE_64X(OBD_MD_FLBLKSZ);
548         CHECK_DEFINE_64X(OBD_MD_FLMODE);
549         CHECK_DEFINE_64X(OBD_MD_FLTYPE);
550         CHECK_DEFINE_64X(OBD_MD_FLUID);
551         CHECK_DEFINE_64X(OBD_MD_FLGID);
552         CHECK_DEFINE_64X(OBD_MD_FLFLAGS);
553         CHECK_DEFINE_64X(OBD_MD_FLNLINK);
554         CHECK_DEFINE_64X(OBD_MD_FLGENER);
555         CHECK_DEFINE_64X(OBD_MD_FLRDEV);
556         CHECK_DEFINE_64X(OBD_MD_FLEASIZE);
557         CHECK_DEFINE_64X(OBD_MD_LINKNAME);
558         CHECK_DEFINE_64X(OBD_MD_FLHANDLE);
559         CHECK_DEFINE_64X(OBD_MD_FLCKSUM);
560         CHECK_DEFINE_64X(OBD_MD_FLQOS);
561         CHECK_DEFINE_64X(OBD_MD_FLCOOKIE);
562         CHECK_DEFINE_64X(OBD_MD_FLGROUP);
563         CHECK_DEFINE_64X(OBD_MD_FLFID);
564         CHECK_DEFINE_64X(OBD_MD_FLEPOCH);
565         CHECK_DEFINE_64X(OBD_MD_FLGRANT);
566         CHECK_DEFINE_64X(OBD_MD_FLDIREA);
567         CHECK_DEFINE_64X(OBD_MD_FLUSRQUOTA);
568         CHECK_DEFINE_64X(OBD_MD_FLGRPQUOTA);
569         CHECK_DEFINE_64X(OBD_MD_FLMODEASIZE);
570         CHECK_DEFINE_64X(OBD_MD_MDS);
571         CHECK_DEFINE_64X(OBD_MD_REINT);
572         CHECK_DEFINE_64X(OBD_MD_MEA);
573         CHECK_DEFINE_64X(OBD_MD_MDTIDX);
574         CHECK_DEFINE_64X(OBD_MD_FLXATTR);
575         CHECK_DEFINE_64X(OBD_MD_FLXATTRLS);
576         CHECK_DEFINE_64X(OBD_MD_FLXATTRRM);
577         CHECK_DEFINE_64X(OBD_MD_FLACL);
578         CHECK_DEFINE_64X(OBD_MD_FLRMTPERM);
579         CHECK_DEFINE_64X(OBD_MD_FLMDSCAPA);
580         CHECK_DEFINE_64X(OBD_MD_FLOSSCAPA);
581         CHECK_DEFINE_64X(OBD_MD_FLCKSPLIT);
582         CHECK_DEFINE_64X(OBD_MD_FLCROSSREF);
583         CHECK_DEFINE_64X(OBD_MD_FLGETATTRLOCK);
584         CHECK_DEFINE_64X(OBD_MD_FLRMTLSETFACL);
585         CHECK_DEFINE_64X(OBD_MD_FLRMTLGETFACL);
586         CHECK_DEFINE_64X(OBD_MD_FLRMTRSETFACL);
587         CHECK_DEFINE_64X(OBD_MD_FLRMTRGETFACL);
588         CHECK_DEFINE_64X(OBD_MD_FLDATAVERSION);
589
590         CHECK_CVALUE_X(OBD_FL_INLINEDATA);
591         CHECK_CVALUE_X(OBD_FL_OBDMDEXISTS);
592         CHECK_CVALUE_X(OBD_FL_DELORPHAN);
593         CHECK_CVALUE_X(OBD_FL_NORPC);
594         CHECK_CVALUE_X(OBD_FL_IDONLY);
595         CHECK_CVALUE_X(OBD_FL_RECREATE_OBJS);
596         CHECK_CVALUE_X(OBD_FL_DEBUG_CHECK);
597         CHECK_CVALUE_X(OBD_FL_NO_USRQUOTA);
598         CHECK_CVALUE_X(OBD_FL_NO_GRPQUOTA);
599         CHECK_CVALUE_X(OBD_FL_CREATE_CROW);
600         CHECK_CVALUE_X(OBD_FL_SRVLOCK);
601         CHECK_CVALUE_X(OBD_FL_CKSUM_CRC32);
602         CHECK_CVALUE_X(OBD_FL_CKSUM_ADLER);
603         CHECK_CVALUE_X(OBD_FL_CKSUM_CRC32C);
604         CHECK_CVALUE_X(OBD_FL_CKSUM_RSVD2);
605         CHECK_CVALUE_X(OBD_FL_CKSUM_RSVD3);
606         CHECK_CVALUE_X(OBD_FL_SHRINK_GRANT);
607         CHECK_CVALUE_X(OBD_FL_MMAP);
608         CHECK_CVALUE_X(OBD_FL_RECOV_RESEND);
609         CHECK_CVALUE_X(OBD_FL_NOSPC_BLK);
610         CHECK_CVALUE_X(OBD_FL_LOCAL_MASK);
611 }
612
613 static void
614 check_lov_ost_data_v1(void)
615 {
616         BLANK_LINE();
617         CHECK_STRUCT(lov_ost_data_v1);
618         CHECK_MEMBER(lov_ost_data_v1, l_object_id);
619         CHECK_MEMBER(lov_ost_data_v1, l_object_seq);
620         CHECK_MEMBER(lov_ost_data_v1, l_ost_gen);
621         CHECK_MEMBER(lov_ost_data_v1, l_ost_idx);
622 }
623
624 static void
625 check_lov_mds_md_v1(void)
626 {
627         BLANK_LINE();
628         CHECK_STRUCT(lov_mds_md_v1);
629         CHECK_MEMBER(lov_mds_md_v1, lmm_magic);
630         CHECK_MEMBER(lov_mds_md_v1, lmm_pattern);
631         CHECK_MEMBER(lov_mds_md_v1, lmm_object_id);
632         CHECK_MEMBER(lov_mds_md_v1, lmm_object_seq);
633         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_size);
634         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_count);
635         CHECK_MEMBER(lov_mds_md_v1, lmm_layout_gen);
636         CHECK_MEMBER(lov_mds_md_v1, lmm_objects[0]);
637
638         CHECK_CDEFINE(LOV_MAGIC_V1);
639 }
640
641 static void
642 check_lov_mds_md_v3(void)
643 {
644         BLANK_LINE();
645         CHECK_STRUCT(lov_mds_md_v3);
646         CHECK_MEMBER(lov_mds_md_v3, lmm_magic);
647         CHECK_MEMBER(lov_mds_md_v3, lmm_pattern);
648         CHECK_MEMBER(lov_mds_md_v3, lmm_object_id);
649         CHECK_MEMBER(lov_mds_md_v3, lmm_object_seq);
650         CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_size);
651         CHECK_MEMBER(lov_mds_md_v3, lmm_stripe_count);
652         CHECK_MEMBER(lov_mds_md_v3, lmm_layout_gen);
653         CHECK_CVALUE(LOV_MAXPOOLNAME);
654         CHECK_MEMBER(lov_mds_md_v3, lmm_pool_name[LOV_MAXPOOLNAME]);
655         CHECK_MEMBER(lov_mds_md_v3, lmm_objects[0]);
656
657         CHECK_CDEFINE(LOV_MAGIC_V3);
658
659         CHECK_VALUE_X(LOV_PATTERN_RAID0);
660         CHECK_VALUE_X(LOV_PATTERN_RAID1);
661         CHECK_VALUE_X(LOV_PATTERN_FIRST);
662         CHECK_VALUE_X(LOV_PATTERN_CMOBD);
663 }
664
665 static void
666 check_obd_statfs(void)
667 {
668         BLANK_LINE();
669         CHECK_STRUCT(obd_statfs);
670         CHECK_MEMBER(obd_statfs, os_type);
671         CHECK_MEMBER(obd_statfs, os_blocks);
672         CHECK_MEMBER(obd_statfs, os_bfree);
673         CHECK_MEMBER(obd_statfs, os_bavail);
674         CHECK_MEMBER(obd_statfs, os_ffree);
675         CHECK_MEMBER(obd_statfs, os_fsid);
676         CHECK_MEMBER(obd_statfs, os_bsize);
677         CHECK_MEMBER(obd_statfs, os_namelen);
678         CHECK_MEMBER(obd_statfs, os_state);
679         CHECK_MEMBER(obd_statfs, os_spare1);
680         CHECK_MEMBER(obd_statfs, os_spare2);
681         CHECK_MEMBER(obd_statfs, os_spare3);
682         CHECK_MEMBER(obd_statfs, os_spare4);
683         CHECK_MEMBER(obd_statfs, os_spare5);
684         CHECK_MEMBER(obd_statfs, os_spare6);
685         CHECK_MEMBER(obd_statfs, os_spare7);
686         CHECK_MEMBER(obd_statfs, os_spare8);
687         CHECK_MEMBER(obd_statfs, os_spare9);
688 }
689
690 static void
691 check_obd_ioobj(void)
692 {
693         BLANK_LINE();
694         CHECK_STRUCT(obd_ioobj);
695         CHECK_MEMBER(obd_ioobj, ioo_id);
696         CHECK_MEMBER(obd_ioobj, ioo_seq);
697         CHECK_MEMBER(obd_ioobj, ioo_type);
698         CHECK_MEMBER(obd_ioobj, ioo_bufcnt);
699 }
700
701 static void
702 check_obd_quotactl(void)
703 {
704         BLANK_LINE();
705         CHECK_UNION(lquota_id);
706
707         BLANK_LINE();
708         CHECK_STRUCT(obd_quotactl);
709         CHECK_MEMBER(obd_quotactl, qc_cmd);
710         CHECK_MEMBER(obd_quotactl, qc_type);
711         CHECK_MEMBER(obd_quotactl, qc_id);
712         CHECK_MEMBER(obd_quotactl, qc_stat);
713         CHECK_MEMBER(obd_quotactl, qc_dqinfo);
714         CHECK_MEMBER(obd_quotactl, qc_dqblk);
715
716         BLANK_LINE();
717         CHECK_STRUCT(obd_dqinfo);
718         CHECK_MEMBER(obd_dqinfo, dqi_bgrace);
719         CHECK_MEMBER(obd_dqinfo, dqi_igrace);
720         CHECK_MEMBER(obd_dqinfo, dqi_flags);
721         CHECK_MEMBER(obd_dqinfo, dqi_valid);
722
723         BLANK_LINE();
724         CHECK_STRUCT(obd_dqblk);
725         CHECK_MEMBER(obd_dqblk, dqb_bhardlimit);
726         CHECK_MEMBER(obd_dqblk, dqb_bsoftlimit);
727         CHECK_MEMBER(obd_dqblk, dqb_curspace);
728         CHECK_MEMBER(obd_dqblk, dqb_ihardlimit);
729         CHECK_MEMBER(obd_dqblk, dqb_isoftlimit);
730         CHECK_MEMBER(obd_dqblk, dqb_curinodes);
731         CHECK_MEMBER(obd_dqblk, dqb_btime);
732         CHECK_MEMBER(obd_dqblk, dqb_itime);
733         CHECK_MEMBER(obd_dqblk, dqb_valid);
734         CHECK_MEMBER(obd_dqblk, dqb_padding);
735
736         CHECK_DEFINE_X(Q_QUOTACHECK);
737         CHECK_DEFINE_X(Q_INITQUOTA);
738         CHECK_DEFINE_X(Q_GETOINFO);
739         CHECK_DEFINE_X(Q_GETOQUOTA);
740         CHECK_DEFINE_X(Q_FINVALIDATE);
741
742         BLANK_LINE();
743         CHECK_STRUCT(lquota_acct_rec);
744         CHECK_MEMBER(lquota_acct_rec, bspace);
745         CHECK_MEMBER(lquota_acct_rec, ispace);
746
747         BLANK_LINE();
748         CHECK_STRUCT(lquota_glb_rec);
749         CHECK_MEMBER(lquota_glb_rec, qbr_hardlimit);
750         CHECK_MEMBER(lquota_glb_rec, qbr_softlimit);
751         CHECK_MEMBER(lquota_glb_rec, qbr_time);
752         CHECK_MEMBER(lquota_glb_rec, qbr_granted);
753
754         BLANK_LINE();
755         CHECK_STRUCT(lquota_slv_rec);
756         CHECK_MEMBER(lquota_slv_rec, qsr_granted);
757
758 }
759
760 static void
761 check_obd_idx_read(void)
762 {
763         BLANK_LINE();
764         CHECK_STRUCT(idx_info);
765         CHECK_MEMBER(idx_info, ii_magic);
766         CHECK_MEMBER(idx_info, ii_flags);
767         CHECK_MEMBER(idx_info, ii_count);
768         CHECK_MEMBER(idx_info, ii_pad0);
769         CHECK_MEMBER(idx_info, ii_attrs);
770         CHECK_MEMBER(idx_info, ii_fid);
771         CHECK_MEMBER(idx_info, ii_version);
772         CHECK_MEMBER(idx_info, ii_hash_start);
773         CHECK_MEMBER(idx_info, ii_hash_end);
774         CHECK_MEMBER(idx_info, ii_keysize);
775         CHECK_MEMBER(idx_info, ii_recsize);
776         CHECK_MEMBER(idx_info, ii_pad1);
777         CHECK_MEMBER(idx_info, ii_pad2);
778         CHECK_MEMBER(idx_info, ii_pad3);
779         CHECK_CDEFINE(IDX_INFO_MAGIC);
780
781         BLANK_LINE();
782         CHECK_STRUCT(lu_idxpage);
783         CHECK_MEMBER(lu_idxpage, lip_magic);
784         CHECK_MEMBER(lu_idxpage, lip_flags);
785         CHECK_MEMBER(lu_idxpage, lip_nr);
786         CHECK_MEMBER(lu_idxpage, lip_pad0);
787
788         CHECK_CDEFINE(LIP_MAGIC);
789         CHECK_VALUE(LIP_HDR_SIZE);
790
791         CHECK_VALUE(II_FL_NOHASH);
792         CHECK_VALUE(II_FL_VARKEY);
793         CHECK_VALUE(II_FL_VARREC);
794         CHECK_VALUE(II_FL_NONUNQ);
795 }
796
797 static void
798 check_niobuf_remote(void)
799 {
800         BLANK_LINE();
801         CHECK_STRUCT(niobuf_remote);
802         CHECK_MEMBER(niobuf_remote, offset);
803         CHECK_MEMBER(niobuf_remote, len);
804         CHECK_MEMBER(niobuf_remote, flags);
805
806         CHECK_DEFINE_X(OBD_BRW_READ);
807         CHECK_DEFINE_X(OBD_BRW_WRITE);
808         CHECK_DEFINE_X(OBD_BRW_SYNC);
809         CHECK_DEFINE_X(OBD_BRW_CHECK);
810         CHECK_DEFINE_X(OBD_BRW_FROM_GRANT);
811         CHECK_DEFINE_X(OBD_BRW_GRANTED);
812         CHECK_DEFINE_X(OBD_BRW_NOCACHE);
813         CHECK_DEFINE_X(OBD_BRW_NOQUOTA);
814         CHECK_DEFINE_X(OBD_BRW_SRVLOCK);
815         CHECK_DEFINE_X(OBD_BRW_ASYNC);
816         CHECK_DEFINE_X(OBD_BRW_MEMALLOC);
817 }
818
819 static void
820 check_ost_body(void)
821 {
822         BLANK_LINE();
823         CHECK_STRUCT(ost_body);
824         CHECK_MEMBER(ost_body, oa);
825 }
826
827 static void
828 check_ll_fid(void)
829 {
830         BLANK_LINE();
831         CHECK_STRUCT(ll_fid);
832         CHECK_MEMBER(ll_fid, id);
833         CHECK_MEMBER(ll_fid, generation);
834         CHECK_MEMBER(ll_fid, f_type);
835 }
836
837 static void
838 check_mdt_body(void)
839 {
840         BLANK_LINE();
841         CHECK_STRUCT(mdt_body);
842         CHECK_MEMBER(mdt_body, fid1);
843         CHECK_MEMBER(mdt_body, fid2);
844         CHECK_MEMBER(mdt_body, handle);
845         CHECK_MEMBER(mdt_body, valid);
846         CHECK_MEMBER(mdt_body, size);
847         CHECK_MEMBER(mdt_body, mtime);
848         CHECK_MEMBER(mdt_body, atime);
849         CHECK_MEMBER(mdt_body, ctime);
850         CHECK_MEMBER(mdt_body, blocks);
851         CHECK_MEMBER(mdt_body, ino);
852         CHECK_MEMBER(mdt_body, fsuid);
853         CHECK_MEMBER(mdt_body, fsgid);
854         CHECK_MEMBER(mdt_body, capability);
855         CHECK_MEMBER(mdt_body, mode);
856         CHECK_MEMBER(mdt_body, uid);
857         CHECK_MEMBER(mdt_body, gid);
858         CHECK_MEMBER(mdt_body, flags);
859         CHECK_MEMBER(mdt_body, rdev);
860         CHECK_MEMBER(mdt_body, nlink);
861         CHECK_MEMBER(mdt_body, generation);
862         CHECK_MEMBER(mdt_body, suppgid);
863         CHECK_MEMBER(mdt_body, eadatasize);
864         CHECK_MEMBER(mdt_body, aclsize);
865         CHECK_MEMBER(mdt_body, max_mdsize);
866         CHECK_MEMBER(mdt_body, max_cookiesize);
867         CHECK_MEMBER(mdt_body, uid_h);
868         CHECK_MEMBER(mdt_body, gid_h);
869         CHECK_MEMBER(mdt_body, padding_5);
870         CHECK_MEMBER(mdt_body, padding_6);
871         CHECK_MEMBER(mdt_body, padding_7);
872         CHECK_MEMBER(mdt_body, padding_8);
873         CHECK_MEMBER(mdt_body, padding_9);
874         CHECK_MEMBER(mdt_body, padding_10);
875
876         CHECK_VALUE_O(MDS_FMODE_CLOSED);
877         CHECK_VALUE_O(MDS_FMODE_EXEC);
878         CHECK_VALUE_O(MDS_FMODE_EPOCH);
879         CHECK_VALUE_O(MDS_FMODE_TRUNC);
880         CHECK_VALUE_O(MDS_FMODE_SOM);
881
882         CHECK_VALUE_O(MDS_OPEN_CREATED);
883         CHECK_VALUE_O(MDS_OPEN_CROSS);
884         CHECK_VALUE_O(MDS_OPEN_CREAT);
885         CHECK_VALUE_O(MDS_OPEN_EXCL);
886         CHECK_VALUE_O(MDS_OPEN_TRUNC);
887         CHECK_VALUE_O(MDS_OPEN_APPEND);
888         CHECK_VALUE_O(MDS_OPEN_SYNC);
889         CHECK_VALUE_O(MDS_OPEN_DIRECTORY);
890         CHECK_VALUE_O(MDS_OPEN_BY_FID);
891         CHECK_VALUE_O(MDS_OPEN_DELAY_CREATE);
892         CHECK_VALUE_O(MDS_OPEN_OWNEROVERRIDE);
893         CHECK_VALUE_O(MDS_OPEN_JOIN_FILE);
894         CHECK_VALUE_O(MDS_CREATE_RMT_ACL);
895         CHECK_VALUE_O(MDS_CREATE_SLAVE_OBJ);
896         CHECK_VALUE_O(MDS_OPEN_LOCK);
897         CHECK_VALUE_O(MDS_OPEN_HAS_EA);
898         CHECK_VALUE_O(MDS_OPEN_HAS_OBJS);
899         CHECK_VALUE_64O(MDS_OPEN_NORESTORE);
900         CHECK_VALUE_64O(MDS_OPEN_NEWSTRIPE);
901
902         /* these should be identical to their EXT3_*_FL counterparts, and
903          * are redefined only to avoid dragging in ext3_fs.h */
904         CHECK_DEFINE_X(LUSTRE_SYNC_FL);
905         CHECK_DEFINE_X(LUSTRE_IMMUTABLE_FL);
906         CHECK_DEFINE_X(LUSTRE_APPEND_FL);
907         CHECK_DEFINE_X(LUSTRE_NOATIME_FL);
908         CHECK_DEFINE_X(LUSTRE_DIRSYNC_FL);
909
910         CHECK_DEFINE_X(MDS_INODELOCK_LOOKUP);
911         CHECK_DEFINE_X(MDS_INODELOCK_UPDATE);
912         CHECK_DEFINE_X(MDS_INODELOCK_OPEN);
913         CHECK_DEFINE_X(MDS_INODELOCK_LAYOUT);
914 }
915
916 static void
917 check_mdt_ioepoch(void)
918 {
919         BLANK_LINE();
920         CHECK_STRUCT(mdt_ioepoch);
921         CHECK_MEMBER(mdt_ioepoch, handle);
922         CHECK_MEMBER(mdt_ioepoch, ioepoch);
923         CHECK_MEMBER(mdt_ioepoch, flags);
924         CHECK_MEMBER(mdt_ioepoch, padding);
925 }
926
927 static void
928 check_mdt_remote_perm(void)
929 {
930         BLANK_LINE();
931         CHECK_STRUCT(mdt_remote_perm);
932         CHECK_MEMBER(mdt_remote_perm, rp_uid);
933         CHECK_MEMBER(mdt_remote_perm, rp_gid);
934         CHECK_MEMBER(mdt_remote_perm, rp_fsuid);
935         CHECK_MEMBER(mdt_remote_perm, rp_fsgid);
936         CHECK_MEMBER(mdt_remote_perm, rp_access_perm);
937         CHECK_MEMBER(mdt_remote_perm, rp_padding);
938
939         CHECK_VALUE_X(CFS_SETUID_PERM);
940         CHECK_VALUE_X(CFS_SETGID_PERM);
941         CHECK_VALUE_X(CFS_SETGRP_PERM);
942         CHECK_VALUE_X(CFS_RMTACL_PERM);
943         CHECK_VALUE_X(CFS_RMTOWN_PERM);
944 }
945
946 static void
947 check_mdt_rec_setattr(void)
948 {
949         BLANK_LINE();
950         CHECK_STRUCT(mdt_rec_setattr);
951         CHECK_MEMBER(mdt_rec_setattr, sa_opcode);
952         CHECK_MEMBER(mdt_rec_setattr, sa_cap);
953         CHECK_MEMBER(mdt_rec_setattr, sa_fsuid);
954         CHECK_MEMBER(mdt_rec_setattr, sa_fsuid_h);
955         CHECK_MEMBER(mdt_rec_setattr, sa_fsgid);
956         CHECK_MEMBER(mdt_rec_setattr, sa_fsgid_h);
957         CHECK_MEMBER(mdt_rec_setattr, sa_suppgid);
958         CHECK_MEMBER(mdt_rec_setattr, sa_suppgid_h);
959         CHECK_MEMBER(mdt_rec_setattr, sa_padding_1);
960         CHECK_MEMBER(mdt_rec_setattr, sa_padding_1_h);
961         CHECK_MEMBER(mdt_rec_setattr, sa_fid);
962         CHECK_MEMBER(mdt_rec_setattr, sa_valid);
963         CHECK_MEMBER(mdt_rec_setattr, sa_uid);
964         CHECK_MEMBER(mdt_rec_setattr, sa_gid);
965         CHECK_MEMBER(mdt_rec_setattr, sa_size);
966         CHECK_MEMBER(mdt_rec_setattr, sa_blocks);
967         CHECK_MEMBER(mdt_rec_setattr, sa_mtime);
968         CHECK_MEMBER(mdt_rec_setattr, sa_atime);
969         CHECK_MEMBER(mdt_rec_setattr, sa_ctime);
970         CHECK_MEMBER(mdt_rec_setattr, sa_attr_flags);
971         CHECK_MEMBER(mdt_rec_setattr, sa_mode);
972         CHECK_MEMBER(mdt_rec_setattr, sa_padding_2);
973         CHECK_MEMBER(mdt_rec_setattr, sa_padding_3);
974         CHECK_MEMBER(mdt_rec_setattr, sa_padding_4);
975         CHECK_MEMBER(mdt_rec_setattr, sa_padding_5);
976 }
977
978 static void
979 check_mdt_rec_create(void)
980 {
981         BLANK_LINE();
982         CHECK_STRUCT(mdt_rec_create);
983         CHECK_MEMBER(mdt_rec_create, cr_opcode);
984         CHECK_MEMBER(mdt_rec_create, cr_cap);
985         CHECK_MEMBER(mdt_rec_create, cr_fsuid);
986         CHECK_MEMBER(mdt_rec_create, cr_fsuid_h);
987         CHECK_MEMBER(mdt_rec_create, cr_fsgid);
988         CHECK_MEMBER(mdt_rec_create, cr_fsgid_h);
989         CHECK_MEMBER(mdt_rec_create, cr_suppgid1);
990         CHECK_MEMBER(mdt_rec_create, cr_suppgid1_h);
991         CHECK_MEMBER(mdt_rec_create, cr_suppgid2);
992         CHECK_MEMBER(mdt_rec_create, cr_suppgid2_h);
993         CHECK_MEMBER(mdt_rec_create, cr_fid1);
994         CHECK_MEMBER(mdt_rec_create, cr_fid2);
995         CHECK_MEMBER(mdt_rec_create, cr_old_handle);
996         CHECK_MEMBER(mdt_rec_create, cr_time);
997         CHECK_MEMBER(mdt_rec_create, cr_rdev);
998         CHECK_MEMBER(mdt_rec_create, cr_ioepoch);
999         CHECK_MEMBER(mdt_rec_create, cr_padding_1);
1000         CHECK_MEMBER(mdt_rec_create, cr_mode);
1001         CHECK_MEMBER(mdt_rec_create, cr_bias);
1002         CHECK_MEMBER(mdt_rec_create, cr_flags_l);
1003         CHECK_MEMBER(mdt_rec_create, cr_flags_h);
1004         CHECK_MEMBER(mdt_rec_create, cr_padding_3);
1005         CHECK_MEMBER(mdt_rec_create, cr_padding_4);
1006 }
1007
1008 static void
1009 check_mdt_rec_link(void)
1010 {
1011         BLANK_LINE();
1012         CHECK_STRUCT(mdt_rec_link);
1013         CHECK_MEMBER(mdt_rec_link, lk_opcode);
1014         CHECK_MEMBER(mdt_rec_link, lk_cap);
1015         CHECK_MEMBER(mdt_rec_link, lk_fsuid);
1016         CHECK_MEMBER(mdt_rec_link, lk_fsuid_h);
1017         CHECK_MEMBER(mdt_rec_link, lk_fsgid);
1018         CHECK_MEMBER(mdt_rec_link, lk_fsgid_h);
1019         CHECK_MEMBER(mdt_rec_link, lk_suppgid1);
1020         CHECK_MEMBER(mdt_rec_link, lk_suppgid1_h);
1021         CHECK_MEMBER(mdt_rec_link, lk_suppgid2);
1022         CHECK_MEMBER(mdt_rec_link, lk_suppgid2_h);
1023         CHECK_MEMBER(mdt_rec_link, lk_fid1);
1024         CHECK_MEMBER(mdt_rec_link, lk_fid2);
1025         CHECK_MEMBER(mdt_rec_link, lk_time);
1026         CHECK_MEMBER(mdt_rec_link, lk_padding_1);
1027         CHECK_MEMBER(mdt_rec_link, lk_padding_2);
1028         CHECK_MEMBER(mdt_rec_link, lk_padding_3);
1029         CHECK_MEMBER(mdt_rec_link, lk_padding_4);
1030         CHECK_MEMBER(mdt_rec_link, lk_bias);
1031         CHECK_MEMBER(mdt_rec_link, lk_padding_5);
1032         CHECK_MEMBER(mdt_rec_link, lk_padding_6);
1033         CHECK_MEMBER(mdt_rec_link, lk_padding_7);
1034         CHECK_MEMBER(mdt_rec_link, lk_padding_8);
1035         CHECK_MEMBER(mdt_rec_link, lk_padding_9);
1036 }
1037
1038 static void
1039 check_mdt_rec_unlink(void)
1040 {
1041         BLANK_LINE();
1042         CHECK_STRUCT(mdt_rec_unlink);
1043         CHECK_MEMBER(mdt_rec_unlink, ul_opcode);
1044         CHECK_MEMBER(mdt_rec_unlink, ul_cap);
1045         CHECK_MEMBER(mdt_rec_unlink, ul_fsuid);
1046         CHECK_MEMBER(mdt_rec_unlink, ul_fsuid_h);
1047         CHECK_MEMBER(mdt_rec_unlink, ul_fsgid);
1048         CHECK_MEMBER(mdt_rec_unlink, ul_fsgid_h);
1049         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid1);
1050         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid1_h);
1051         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid2);
1052         CHECK_MEMBER(mdt_rec_unlink, ul_suppgid2_h);
1053         CHECK_MEMBER(mdt_rec_unlink, ul_fid1);
1054         CHECK_MEMBER(mdt_rec_unlink, ul_fid2);
1055         CHECK_MEMBER(mdt_rec_unlink, ul_time);
1056         CHECK_MEMBER(mdt_rec_unlink, ul_padding_2);
1057         CHECK_MEMBER(mdt_rec_unlink, ul_padding_3);
1058         CHECK_MEMBER(mdt_rec_unlink, ul_padding_4);
1059         CHECK_MEMBER(mdt_rec_unlink, ul_padding_5);
1060         CHECK_MEMBER(mdt_rec_unlink, ul_bias);
1061         CHECK_MEMBER(mdt_rec_unlink, ul_mode);
1062         CHECK_MEMBER(mdt_rec_unlink, ul_padding_6);
1063         CHECK_MEMBER(mdt_rec_unlink, ul_padding_7);
1064         CHECK_MEMBER(mdt_rec_unlink, ul_padding_8);
1065         CHECK_MEMBER(mdt_rec_unlink, ul_padding_9);
1066 }
1067
1068 static void
1069 check_mdt_rec_rename(void)
1070 {
1071         BLANK_LINE();
1072         CHECK_STRUCT(mdt_rec_rename);
1073         CHECK_MEMBER(mdt_rec_rename, rn_opcode);
1074         CHECK_MEMBER(mdt_rec_rename, rn_cap);
1075         CHECK_MEMBER(mdt_rec_rename, rn_fsuid);
1076         CHECK_MEMBER(mdt_rec_rename, rn_fsuid_h);
1077         CHECK_MEMBER(mdt_rec_rename, rn_fsgid);
1078         CHECK_MEMBER(mdt_rec_rename, rn_fsgid_h);
1079         CHECK_MEMBER(mdt_rec_rename, rn_suppgid1);
1080         CHECK_MEMBER(mdt_rec_rename, rn_suppgid1_h);
1081         CHECK_MEMBER(mdt_rec_rename, rn_suppgid2);
1082         CHECK_MEMBER(mdt_rec_rename, rn_suppgid2_h);
1083         CHECK_MEMBER(mdt_rec_rename, rn_fid1);
1084         CHECK_MEMBER(mdt_rec_rename, rn_fid2);
1085         CHECK_MEMBER(mdt_rec_rename, rn_time);
1086         CHECK_MEMBER(mdt_rec_rename, rn_padding_1);
1087         CHECK_MEMBER(mdt_rec_rename, rn_padding_2);
1088         CHECK_MEMBER(mdt_rec_rename, rn_padding_3);
1089         CHECK_MEMBER(mdt_rec_rename, rn_padding_4);
1090         CHECK_MEMBER(mdt_rec_rename, rn_bias);
1091         CHECK_MEMBER(mdt_rec_rename, rn_mode);
1092         CHECK_MEMBER(mdt_rec_rename, rn_padding_5);
1093         CHECK_MEMBER(mdt_rec_rename, rn_padding_6);
1094         CHECK_MEMBER(mdt_rec_rename, rn_padding_7);
1095         CHECK_MEMBER(mdt_rec_rename, rn_padding_8);
1096 }
1097
1098 static void
1099 check_mdt_rec_setxattr(void)
1100 {
1101         BLANK_LINE();
1102         CHECK_STRUCT(mdt_rec_setxattr);
1103         CHECK_MEMBER(mdt_rec_setxattr, sx_opcode);
1104         CHECK_MEMBER(mdt_rec_setxattr, sx_cap);
1105         CHECK_MEMBER(mdt_rec_setxattr, sx_fsuid);
1106         CHECK_MEMBER(mdt_rec_setxattr, sx_fsuid_h);
1107         CHECK_MEMBER(mdt_rec_setxattr, sx_fsgid);
1108         CHECK_MEMBER(mdt_rec_setxattr, sx_fsgid_h);
1109         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid1);
1110         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid1_h);
1111         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid2);
1112         CHECK_MEMBER(mdt_rec_setxattr, sx_suppgid2_h);
1113         CHECK_MEMBER(mdt_rec_setxattr, sx_fid);
1114         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_1);
1115         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_2);
1116         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_3);
1117         CHECK_MEMBER(mdt_rec_setxattr, sx_valid);
1118         CHECK_MEMBER(mdt_rec_setxattr, sx_time);
1119         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_5);
1120         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_6);
1121         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_7);
1122         CHECK_MEMBER(mdt_rec_setxattr, sx_size);
1123         CHECK_MEMBER(mdt_rec_setxattr, sx_flags);
1124         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_8);
1125         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_9);
1126         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_10);
1127         CHECK_MEMBER(mdt_rec_setxattr, sx_padding_11);
1128 }
1129
1130 static void
1131 check_mdt_rec_reint(void)
1132 {
1133         BLANK_LINE();
1134         CHECK_STRUCT(mdt_rec_reint);
1135         CHECK_MEMBER(mdt_rec_reint, rr_opcode);
1136         CHECK_MEMBER(mdt_rec_reint, rr_cap);
1137         CHECK_MEMBER(mdt_rec_reint, rr_fsuid);
1138         CHECK_MEMBER(mdt_rec_reint, rr_fsuid_h);
1139         CHECK_MEMBER(mdt_rec_reint, rr_fsgid);
1140         CHECK_MEMBER(mdt_rec_reint, rr_fsgid_h);
1141         CHECK_MEMBER(mdt_rec_reint, rr_suppgid1);
1142         CHECK_MEMBER(mdt_rec_reint, rr_suppgid1_h);
1143         CHECK_MEMBER(mdt_rec_reint, rr_suppgid2);
1144         CHECK_MEMBER(mdt_rec_reint, rr_suppgid2_h);
1145         CHECK_MEMBER(mdt_rec_reint, rr_fid1);
1146         CHECK_MEMBER(mdt_rec_reint, rr_fid2);
1147         CHECK_MEMBER(mdt_rec_reint, rr_mtime);
1148         CHECK_MEMBER(mdt_rec_reint, rr_atime);
1149         CHECK_MEMBER(mdt_rec_reint, rr_ctime);
1150         CHECK_MEMBER(mdt_rec_reint, rr_size);
1151         CHECK_MEMBER(mdt_rec_reint, rr_blocks);
1152         CHECK_MEMBER(mdt_rec_reint, rr_bias);
1153         CHECK_MEMBER(mdt_rec_reint, rr_mode);
1154         CHECK_MEMBER(mdt_rec_reint, rr_flags);
1155         CHECK_MEMBER(mdt_rec_reint, rr_padding_2);
1156         CHECK_MEMBER(mdt_rec_reint, rr_padding_3);
1157         CHECK_MEMBER(mdt_rec_reint, rr_padding_4);
1158 }
1159
1160 static void
1161 check_lmv_desc(void)
1162 {
1163         BLANK_LINE();
1164         CHECK_STRUCT(lmv_desc);
1165         CHECK_MEMBER(lmv_desc, ld_tgt_count);
1166         CHECK_MEMBER(lmv_desc, ld_active_tgt_count);
1167         CHECK_MEMBER(lmv_desc, ld_default_stripe_count);
1168         CHECK_MEMBER(lmv_desc, ld_pattern);
1169         CHECK_MEMBER(lmv_desc, ld_default_hash_size);
1170         CHECK_MEMBER(lmv_desc, ld_padding_1);
1171         CHECK_MEMBER(lmv_desc, ld_padding_2);
1172         CHECK_MEMBER(lmv_desc, ld_qos_maxage);
1173         CHECK_MEMBER(lmv_desc, ld_padding_3);
1174         CHECK_MEMBER(lmv_desc, ld_padding_4);
1175         CHECK_MEMBER(lmv_desc, ld_uuid);
1176 }
1177
1178 static void
1179 check_lmv_stripe_md(void)
1180 {
1181         BLANK_LINE();
1182         CHECK_STRUCT(lmv_stripe_md);
1183         CHECK_MEMBER(lmv_stripe_md, mea_magic);
1184         CHECK_MEMBER(lmv_stripe_md, mea_count);
1185         CHECK_MEMBER(lmv_stripe_md, mea_master);
1186         CHECK_MEMBER(lmv_stripe_md, mea_padding);
1187         CHECK_CVALUE(LOV_MAXPOOLNAME);
1188         CHECK_MEMBER(lmv_stripe_md, mea_pool_name[LOV_MAXPOOLNAME]);
1189         CHECK_MEMBER(lmv_stripe_md, mea_ids[0]);
1190 }
1191
1192 static void
1193 check_lov_desc(void)
1194 {
1195         BLANK_LINE();
1196         CHECK_STRUCT(lov_desc);
1197         CHECK_MEMBER(lov_desc, ld_tgt_count);
1198         CHECK_MEMBER(lov_desc, ld_active_tgt_count);
1199         CHECK_MEMBER(lov_desc, ld_default_stripe_count);
1200         CHECK_MEMBER(lov_desc, ld_pattern);
1201         CHECK_MEMBER(lov_desc, ld_default_stripe_size);
1202         CHECK_MEMBER(lov_desc, ld_default_stripe_offset);
1203         CHECK_MEMBER(lov_desc, ld_padding_0);
1204         CHECK_MEMBER(lov_desc, ld_qos_maxage);
1205         CHECK_MEMBER(lov_desc, ld_padding_1);
1206         CHECK_MEMBER(lov_desc, ld_padding_2);
1207         CHECK_MEMBER(lov_desc, ld_uuid);
1208
1209         CHECK_CDEFINE(LOV_DESC_MAGIC);
1210 }
1211
1212 static void
1213 check_ldlm_res_id(void)
1214 {
1215         BLANK_LINE();
1216         CHECK_STRUCT(ldlm_res_id);
1217         CHECK_CVALUE(RES_NAME_SIZE);
1218         CHECK_MEMBER(ldlm_res_id, name[RES_NAME_SIZE]);
1219 }
1220
1221 static void
1222 check_ldlm_extent(void)
1223 {
1224         BLANK_LINE();
1225         CHECK_STRUCT(ldlm_extent);
1226         CHECK_MEMBER(ldlm_extent, start);
1227         CHECK_MEMBER(ldlm_extent, end);
1228         CHECK_MEMBER(ldlm_extent, gid);
1229 }
1230
1231 static void
1232 check_ldlm_inodebits(void)
1233 {
1234         BLANK_LINE();
1235         CHECK_STRUCT(ldlm_inodebits);
1236         CHECK_MEMBER(ldlm_inodebits, bits);
1237 }
1238
1239 static void
1240 check_ldlm_flock(void)
1241 {
1242         BLANK_LINE();
1243         CHECK_STRUCT(ldlm_flock_wire);
1244         CHECK_MEMBER(ldlm_flock_wire, lfw_start);
1245         CHECK_MEMBER(ldlm_flock_wire, lfw_end);
1246         CHECK_MEMBER(ldlm_flock_wire, lfw_owner);
1247         CHECK_MEMBER(ldlm_flock_wire, lfw_padding);
1248         CHECK_MEMBER(ldlm_flock_wire, lfw_pid);
1249 }
1250
1251 static void
1252 check_ldlm_intent(void)
1253 {
1254         BLANK_LINE();
1255         CHECK_STRUCT(ldlm_intent);
1256         CHECK_MEMBER(ldlm_intent, opc);
1257 }
1258
1259 static void
1260 check_ldlm_resource_desc(void)
1261 {
1262         BLANK_LINE();
1263         CHECK_STRUCT(ldlm_resource_desc);
1264         CHECK_MEMBER(ldlm_resource_desc, lr_type);
1265         CHECK_MEMBER(ldlm_resource_desc, lr_padding);
1266         CHECK_MEMBER(ldlm_resource_desc, lr_name);
1267 }
1268
1269 static void
1270 check_ldlm_lock_desc(void)
1271 {
1272         BLANK_LINE();
1273         CHECK_STRUCT(ldlm_lock_desc);
1274         CHECK_MEMBER(ldlm_lock_desc, l_resource);
1275         CHECK_MEMBER(ldlm_lock_desc, l_req_mode);
1276         CHECK_MEMBER(ldlm_lock_desc, l_granted_mode);
1277         CHECK_MEMBER(ldlm_lock_desc, l_policy_data);
1278 }
1279
1280 static void
1281 check_ldlm_request(void)
1282 {
1283         BLANK_LINE();
1284         CHECK_STRUCT(ldlm_request);
1285         CHECK_MEMBER(ldlm_request, lock_flags);
1286         CHECK_MEMBER(ldlm_request, lock_count);
1287         CHECK_MEMBER(ldlm_request, lock_desc);
1288         CHECK_MEMBER(ldlm_request, lock_handle);
1289 }
1290
1291 static void
1292 check_ldlm_reply(void)
1293 {
1294         BLANK_LINE();
1295         CHECK_STRUCT(ldlm_reply);
1296         CHECK_MEMBER(ldlm_reply, lock_flags);
1297         CHECK_MEMBER(ldlm_reply, lock_padding);
1298         CHECK_MEMBER(ldlm_reply, lock_desc);
1299         CHECK_MEMBER(ldlm_reply, lock_handle);
1300         CHECK_MEMBER(ldlm_reply, lock_policy_res1);
1301         CHECK_MEMBER(ldlm_reply, lock_policy_res2);
1302 }
1303
1304 static void
1305 check_ldlm_lvb(void)
1306 {
1307         BLANK_LINE();
1308         CHECK_STRUCT(ost_lvb);
1309         CHECK_MEMBER(ost_lvb, lvb_size);
1310         CHECK_MEMBER(ost_lvb, lvb_mtime);
1311         CHECK_MEMBER(ost_lvb, lvb_atime);
1312         CHECK_MEMBER(ost_lvb, lvb_ctime);
1313         CHECK_MEMBER(ost_lvb, lvb_blocks);
1314 }
1315
1316 static void
1317 check_mgs_send_param(void)
1318 {
1319         BLANK_LINE();
1320         CHECK_STRUCT(mgs_send_param);
1321         CHECK_CVALUE(MGS_PARAM_MAXLEN);
1322         CHECK_MEMBER(mgs_send_param, mgs_param[MGS_PARAM_MAXLEN]);
1323 }
1324
1325 static void
1326 check_cfg_marker(void)
1327 {
1328         BLANK_LINE();
1329         CHECK_STRUCT(cfg_marker);
1330         CHECK_MEMBER(cfg_marker, cm_step);
1331         CHECK_MEMBER(cfg_marker, cm_flags);
1332         CHECK_MEMBER(cfg_marker, cm_vers);
1333         CHECK_MEMBER(cfg_marker, cm_padding);
1334         CHECK_MEMBER(cfg_marker, cm_createtime);
1335         CHECK_MEMBER(cfg_marker, cm_canceltime);
1336         CHECK_MEMBER(cfg_marker, cm_tgtname);
1337         CHECK_MEMBER(cfg_marker, cm_comment);
1338 }
1339
1340 static void
1341 check_llog_logid(void)
1342 {
1343         BLANK_LINE();
1344         CHECK_STRUCT(llog_logid);
1345         CHECK_MEMBER(llog_logid, lgl_oid);
1346         CHECK_MEMBER(llog_logid, lgl_oseq);
1347         CHECK_MEMBER(llog_logid, lgl_ogen);
1348
1349         CHECK_CVALUE(OST_SZ_REC);
1350         CHECK_CVALUE(MDS_UNLINK_REC);
1351         CHECK_CVALUE(MDS_UNLINK64_REC);
1352         CHECK_CVALUE(MDS_SETATTR64_REC);
1353         CHECK_CVALUE(OBD_CFG_REC);
1354         CHECK_CVALUE(LLOG_GEN_REC);
1355         CHECK_CVALUE(CHANGELOG_REC);
1356         CHECK_CVALUE(CHANGELOG_USER_REC);
1357         CHECK_CVALUE(LLOG_HDR_MAGIC);
1358         CHECK_CVALUE(LLOG_LOGID_MAGIC);
1359 }
1360
1361 static void
1362 check_llog_catid(void)
1363 {
1364         BLANK_LINE();
1365         CHECK_STRUCT(llog_catid);
1366         CHECK_MEMBER(llog_catid, lci_logid);
1367         CHECK_MEMBER(llog_catid, lci_padding1);
1368         CHECK_MEMBER(llog_catid, lci_padding2);
1369         CHECK_MEMBER(llog_catid, lci_padding3);
1370 }
1371
1372 static void
1373 check_llog_rec_hdr(void)
1374 {
1375         BLANK_LINE();
1376         CHECK_STRUCT(llog_rec_hdr);
1377         CHECK_MEMBER(llog_rec_hdr, lrh_len);
1378         CHECK_MEMBER(llog_rec_hdr, lrh_index);
1379         CHECK_MEMBER(llog_rec_hdr, lrh_type);
1380         CHECK_MEMBER(llog_rec_hdr, lrh_id);
1381 }
1382
1383 static void
1384 check_llog_rec_tail(void)
1385 {
1386         BLANK_LINE();
1387         CHECK_STRUCT(llog_rec_tail);
1388         CHECK_MEMBER(llog_rec_tail, lrt_len);
1389         CHECK_MEMBER(llog_rec_tail, lrt_index);
1390 }
1391
1392 static void
1393 check_llog_logid_rec(void)
1394 {
1395         BLANK_LINE();
1396         CHECK_STRUCT(llog_logid_rec);
1397         CHECK_MEMBER(llog_logid_rec, lid_hdr);
1398         CHECK_MEMBER(llog_logid_rec, lid_id);
1399         CHECK_MEMBER(llog_logid_rec, lid_padding1);
1400         CHECK_MEMBER(llog_logid_rec, lid_padding2);
1401         CHECK_MEMBER(llog_logid_rec, lid_padding3);
1402         CHECK_MEMBER(llog_logid_rec, lid_tail);
1403 }
1404
1405 static void
1406 check_llog_unlink_rec(void)
1407 {
1408         BLANK_LINE();
1409         CHECK_STRUCT(llog_unlink_rec);
1410         CHECK_MEMBER(llog_unlink_rec, lur_hdr);
1411         CHECK_MEMBER(llog_unlink_rec, lur_oid);
1412         CHECK_MEMBER(llog_unlink_rec, lur_oseq);
1413         CHECK_MEMBER(llog_unlink_rec, lur_count);
1414         CHECK_MEMBER(llog_unlink_rec, lur_tail);
1415 }
1416
1417 static void
1418 check_llog_unlink64_rec(void)
1419 {
1420         CHECK_STRUCT(llog_unlink64_rec);
1421         CHECK_MEMBER(llog_unlink64_rec, lur_hdr);
1422         CHECK_MEMBER(llog_unlink64_rec, lur_fid);
1423         CHECK_MEMBER(llog_unlink64_rec, lur_count);
1424         CHECK_MEMBER(llog_unlink64_rec, lur_tail);
1425         CHECK_MEMBER(llog_unlink64_rec, lur_padding1);
1426         CHECK_MEMBER(llog_unlink64_rec, lur_padding2);
1427         CHECK_MEMBER(llog_unlink64_rec, lur_padding3);
1428 }
1429
1430 static void
1431 check_llog_setattr64_rec(void)
1432 {
1433         BLANK_LINE();
1434         CHECK_STRUCT(llog_setattr64_rec);
1435         CHECK_MEMBER(llog_setattr64_rec, lsr_hdr);
1436         CHECK_MEMBER(llog_setattr64_rec, lsr_oid);
1437         CHECK_MEMBER(llog_setattr64_rec, lsr_oseq);
1438         CHECK_MEMBER(llog_setattr64_rec, lsr_uid);
1439         CHECK_MEMBER(llog_setattr64_rec, lsr_uid_h);
1440         CHECK_MEMBER(llog_setattr64_rec, lsr_gid);
1441         CHECK_MEMBER(llog_setattr64_rec, lsr_gid_h);
1442         CHECK_MEMBER(llog_setattr64_rec, lsr_padding);
1443         CHECK_MEMBER(llog_setattr64_rec, lsr_tail);
1444 }
1445
1446 static void
1447 check_llog_size_change_rec(void)
1448 {
1449         BLANK_LINE();
1450         CHECK_STRUCT(llog_size_change_rec);
1451         CHECK_MEMBER(llog_size_change_rec, lsc_hdr);
1452         CHECK_MEMBER(llog_size_change_rec, lsc_fid);
1453         CHECK_MEMBER(llog_size_change_rec, lsc_ioepoch);
1454         CHECK_MEMBER(llog_size_change_rec, lsc_padding1);
1455         CHECK_MEMBER(llog_size_change_rec, lsc_padding2);
1456         CHECK_MEMBER(llog_size_change_rec, lsc_padding3);
1457         CHECK_MEMBER(llog_size_change_rec, lsc_tail);
1458 }
1459
1460 static void
1461 check_changelog_rec(void)
1462 {
1463         BLANK_LINE();
1464         CHECK_STRUCT(changelog_rec);
1465         CHECK_MEMBER(changelog_rec, cr_namelen);
1466         CHECK_MEMBER(changelog_rec, cr_flags);
1467         CHECK_MEMBER(changelog_rec, cr_type);
1468         CHECK_MEMBER(changelog_rec, cr_index);
1469         CHECK_MEMBER(changelog_rec, cr_prev);
1470         CHECK_MEMBER(changelog_rec, cr_time);
1471         CHECK_MEMBER(changelog_rec, cr_tfid);
1472         CHECK_MEMBER(changelog_rec, cr_pfid);
1473 }
1474
1475 static void
1476 check_changelog_rec_ext(void)
1477 {
1478         BLANK_LINE();
1479         CHECK_STRUCT(changelog_ext_rec);
1480         CHECK_MEMBER(changelog_ext_rec, cr_namelen);
1481         CHECK_MEMBER(changelog_ext_rec, cr_flags);
1482         CHECK_MEMBER(changelog_ext_rec, cr_type);
1483         CHECK_MEMBER(changelog_ext_rec, cr_index);
1484         CHECK_MEMBER(changelog_ext_rec, cr_prev);
1485         CHECK_MEMBER(changelog_ext_rec, cr_time);
1486         CHECK_MEMBER(changelog_ext_rec, cr_tfid);
1487         CHECK_MEMBER(changelog_ext_rec, cr_pfid);
1488         CHECK_MEMBER(changelog_ext_rec, cr_sfid);
1489         CHECK_MEMBER(changelog_ext_rec, cr_spfid);
1490 }
1491
1492 static void
1493 check_changelog_setinfo(void)
1494 {
1495         BLANK_LINE();
1496         CHECK_STRUCT(changelog_setinfo);
1497         CHECK_MEMBER(changelog_setinfo, cs_recno);
1498         CHECK_MEMBER(changelog_setinfo, cs_id);
1499 }
1500
1501 static void
1502 check_llog_changelog_rec(void)
1503 {
1504         BLANK_LINE();
1505         CHECK_STRUCT(llog_changelog_rec);
1506         CHECK_MEMBER(llog_changelog_rec, cr_hdr);
1507         CHECK_MEMBER(llog_changelog_rec, cr);
1508         CHECK_MEMBER(llog_changelog_rec, cr_tail);
1509 }
1510
1511 static void
1512 check_llog_changelog_user_rec(void)
1513 {
1514         BLANK_LINE();
1515         CHECK_STRUCT(llog_changelog_user_rec);
1516         CHECK_MEMBER(llog_changelog_user_rec, cur_hdr);
1517         CHECK_MEMBER(llog_changelog_user_rec, cur_id);
1518         CHECK_MEMBER(llog_changelog_user_rec, cur_padding);
1519         CHECK_MEMBER(llog_changelog_user_rec, cur_endrec);
1520         CHECK_MEMBER(llog_changelog_user_rec, cur_tail);
1521 }
1522
1523 static void
1524 check_llog_gen(void)
1525 {
1526         BLANK_LINE();
1527         CHECK_STRUCT(llog_gen);
1528         CHECK_MEMBER(llog_gen, mnt_cnt);
1529         CHECK_MEMBER(llog_gen, conn_cnt);
1530 }
1531
1532 static void
1533 check_llog_gen_rec(void)
1534 {
1535         BLANK_LINE();
1536         CHECK_STRUCT(llog_gen_rec);
1537         CHECK_MEMBER(llog_gen_rec, lgr_hdr);
1538         CHECK_MEMBER(llog_gen_rec, lgr_gen);
1539         CHECK_MEMBER(llog_gen_rec, lgr_tail);
1540 }
1541
1542 static void
1543 check_llog_log_hdr(void)
1544 {
1545         BLANK_LINE();
1546         CHECK_STRUCT(llog_log_hdr);
1547         CHECK_MEMBER(llog_log_hdr, llh_hdr);
1548         CHECK_MEMBER(llog_log_hdr, llh_timestamp);
1549         CHECK_MEMBER(llog_log_hdr, llh_count);
1550         CHECK_MEMBER(llog_log_hdr, llh_bitmap_offset);
1551         CHECK_MEMBER(llog_log_hdr, llh_size);
1552         CHECK_MEMBER(llog_log_hdr, llh_flags);
1553         CHECK_MEMBER(llog_log_hdr, llh_cat_idx);
1554         CHECK_MEMBER(llog_log_hdr, llh_tgtuuid);
1555         CHECK_MEMBER(llog_log_hdr, llh_reserved);
1556         CHECK_MEMBER(llog_log_hdr, llh_bitmap);
1557         CHECK_MEMBER(llog_log_hdr, llh_tail);
1558 }
1559
1560 static void
1561 check_llog_cookie(void)
1562 {
1563         BLANK_LINE();
1564         CHECK_STRUCT(llog_cookie);
1565         CHECK_MEMBER(llog_cookie, lgc_lgl);
1566         CHECK_MEMBER(llog_cookie, lgc_subsys);
1567         CHECK_MEMBER(llog_cookie, lgc_index);
1568         CHECK_MEMBER(llog_cookie, lgc_padding);
1569 }
1570
1571 static void
1572 check_llogd_body(void)
1573 {
1574         BLANK_LINE();
1575         CHECK_STRUCT(llogd_body);
1576         CHECK_MEMBER(llogd_body, lgd_logid);
1577         CHECK_MEMBER(llogd_body, lgd_ctxt_idx);
1578         CHECK_MEMBER(llogd_body, lgd_llh_flags);
1579         CHECK_MEMBER(llogd_body, lgd_index);
1580         CHECK_MEMBER(llogd_body, lgd_saved_index);
1581         CHECK_MEMBER(llogd_body, lgd_len);
1582         CHECK_MEMBER(llogd_body, lgd_cur_offset);
1583
1584         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CREATE);
1585         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
1586         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_READ_HEADER);
1587         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_WRITE_REC);
1588         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CLOSE);
1589         CHECK_CVALUE(LLOG_ORIGIN_CONNECT);
1590         CHECK_CVALUE(LLOG_CATINFO);
1591         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_PREV_BLOCK);
1592         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_DESTROY);
1593         CHECK_CVALUE(LLOG_FIRST_OPC);
1594         CHECK_CVALUE(LLOG_LAST_OPC);
1595 }
1596
1597 static void
1598 check_llogd_conn_body(void)
1599 {
1600         BLANK_LINE();
1601         CHECK_STRUCT(llogd_conn_body);
1602         CHECK_MEMBER(llogd_conn_body, lgdc_gen);
1603         CHECK_MEMBER(llogd_conn_body, lgdc_logid);
1604         CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx);
1605 }
1606
1607 static void
1608 check_ll_fiemap_info_key(void)
1609 {
1610         BLANK_LINE();
1611         CHECK_STRUCT(ll_fiemap_info_key);
1612         CHECK_MEMBER(ll_fiemap_info_key, name[8]);
1613         CHECK_MEMBER(ll_fiemap_info_key, oa);
1614         CHECK_MEMBER(ll_fiemap_info_key, fiemap);
1615 }
1616
1617 static void
1618 check_qunit_data(void)
1619 {
1620         BLANK_LINE();
1621         CHECK_STRUCT(qunit_data);
1622         CHECK_MEMBER(qunit_data, qd_id);
1623         CHECK_MEMBER(qunit_data, qd_flags);
1624         CHECK_MEMBER(qunit_data, qd_count);
1625         CHECK_MEMBER(qunit_data, qd_qunit);
1626         CHECK_MEMBER(qunit_data, padding);
1627 }
1628
1629 static void
1630 check_quota_body(void)
1631 {
1632         BLANK_LINE();
1633         CHECK_STRUCT(quota_body);
1634         CHECK_MEMBER(quota_body, qb_fid);
1635         CHECK_MEMBER(quota_body, qb_id);
1636         CHECK_MEMBER(quota_body, qb_flags);
1637         CHECK_MEMBER(quota_body, qb_padding);
1638         CHECK_MEMBER(quota_body, qb_count);
1639         CHECK_MEMBER(quota_body, qb_usage);
1640         CHECK_MEMBER(quota_body, qb_slv_ver);
1641         CHECK_MEMBER(quota_body, qb_lockh);
1642         CHECK_MEMBER(quota_body, qb_glb_lockh);
1643         CHECK_MEMBER(quota_body, qb_padding1[4]);
1644 }
1645
1646 static void
1647 check_mgs_target_info(void)
1648 {
1649         BLANK_LINE();
1650         CHECK_STRUCT(mgs_target_info);
1651         CHECK_MEMBER(mgs_target_info, mti_lustre_ver);
1652         CHECK_MEMBER(mgs_target_info, mti_stripe_index);
1653         CHECK_MEMBER(mgs_target_info, mti_config_ver);
1654         CHECK_MEMBER(mgs_target_info, mti_flags);
1655         CHECK_MEMBER(mgs_target_info, mti_nid_count);
1656         CHECK_MEMBER(mgs_target_info, mti_instance);
1657         CHECK_MEMBER(mgs_target_info, mti_fsname);
1658         CHECK_MEMBER(mgs_target_info, mti_svname);
1659         CHECK_MEMBER(mgs_target_info, mti_uuid);
1660         CHECK_MEMBER(mgs_target_info, mti_nids);
1661         CHECK_MEMBER(mgs_target_info, mti_params);
1662 }
1663
1664 static void
1665 check_lustre_capa(void)
1666 {
1667         BLANK_LINE();
1668         CHECK_STRUCT(lustre_capa);
1669         CHECK_MEMBER(lustre_capa, lc_fid);
1670         CHECK_MEMBER(lustre_capa, lc_opc);
1671         CHECK_MEMBER(lustre_capa, lc_uid);
1672         CHECK_MEMBER(lustre_capa, lc_gid);
1673         CHECK_MEMBER(lustre_capa, lc_flags);
1674         CHECK_MEMBER(lustre_capa, lc_keyid);
1675         CHECK_MEMBER(lustre_capa, lc_timeout);
1676         CHECK_MEMBER(lustre_capa, lc_expiry);
1677         CHECK_CVALUE(CAPA_HMAC_MAX_LEN);
1678         CHECK_MEMBER(lustre_capa, lc_hmac[CAPA_HMAC_MAX_LEN]);
1679 }
1680
1681 static void
1682 check_lustre_capa_key(void)
1683 {
1684         BLANK_LINE();
1685         CHECK_STRUCT(lustre_capa_key);
1686         CHECK_MEMBER(lustre_capa_key, lk_seq);
1687         CHECK_MEMBER(lustre_capa_key, lk_keyid);
1688         CHECK_MEMBER(lustre_capa_key, lk_padding);
1689         CHECK_CVALUE(CAPA_HMAC_KEY_MAX_LEN);
1690         CHECK_MEMBER(lustre_capa_key, lk_key[CAPA_HMAC_KEY_MAX_LEN]);
1691 }
1692
1693 static void
1694 check_getinfo_fid2path(void)
1695 {
1696         BLANK_LINE();
1697         CHECK_STRUCT(getinfo_fid2path);
1698         CHECK_MEMBER(getinfo_fid2path, gf_fid);
1699         CHECK_MEMBER(getinfo_fid2path, gf_recno);
1700         CHECK_MEMBER(getinfo_fid2path, gf_linkno);
1701         CHECK_MEMBER(getinfo_fid2path, gf_pathlen);
1702         CHECK_MEMBER(getinfo_fid2path, gf_path[0]);
1703 }
1704
1705 static void
1706 check_posix_acl_xattr_entry(void)
1707 {
1708         BLANK_LINE();
1709         CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry);
1710         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag);
1711         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm);
1712         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id);
1713 }
1714
1715 static void
1716 check_posix_acl_xattr_header(void)
1717 {
1718         BLANK_LINE();
1719         CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header);
1720         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version);
1721         CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries);
1722 }
1723
1724 static void
1725 check_quota_adjust_qunit(void)
1726 {
1727         BLANK_LINE();
1728         CHECK_STRUCT(quota_adjust_qunit);
1729         CHECK_MEMBER(quota_adjust_qunit, qaq_flags);
1730         CHECK_MEMBER(quota_adjust_qunit, qaq_id);
1731         CHECK_MEMBER(quota_adjust_qunit, qaq_bunit_sz);
1732         CHECK_MEMBER(quota_adjust_qunit, qaq_iunit_sz);
1733         CHECK_MEMBER(quota_adjust_qunit, padding1);
1734 }
1735
1736 static void
1737 check_ll_user_fiemap(void)
1738 {
1739         BLANK_LINE();
1740         CHECK_STRUCT(ll_user_fiemap);
1741         CHECK_MEMBER(ll_user_fiemap, fm_start);
1742         CHECK_MEMBER(ll_user_fiemap, fm_length);
1743         CHECK_MEMBER(ll_user_fiemap, fm_flags);
1744         CHECK_MEMBER(ll_user_fiemap, fm_mapped_extents);
1745         CHECK_MEMBER(ll_user_fiemap, fm_extent_count);
1746         CHECK_MEMBER(ll_user_fiemap, fm_reserved);
1747         CHECK_MEMBER(ll_user_fiemap, fm_extents);
1748
1749         CHECK_CDEFINE(FIEMAP_FLAG_SYNC);
1750         CHECK_CDEFINE(FIEMAP_FLAG_XATTR);
1751         CHECK_CDEFINE(FIEMAP_FLAG_DEVICE_ORDER);
1752 }
1753
1754 static void
1755 check_ll_fiemap_extent(void)
1756 {
1757         BLANK_LINE();
1758         CHECK_STRUCT(ll_fiemap_extent);
1759         CHECK_MEMBER(ll_fiemap_extent, fe_logical);
1760         CHECK_MEMBER(ll_fiemap_extent, fe_physical);
1761         CHECK_MEMBER(ll_fiemap_extent, fe_length);
1762         CHECK_MEMBER(ll_fiemap_extent, fe_flags);
1763         CHECK_MEMBER(ll_fiemap_extent, fe_device);
1764
1765         CHECK_CDEFINE(FIEMAP_EXTENT_LAST);
1766         CHECK_CDEFINE(FIEMAP_EXTENT_UNKNOWN);
1767         CHECK_CDEFINE(FIEMAP_EXTENT_DELALLOC);
1768         CHECK_CDEFINE(FIEMAP_EXTENT_ENCODED);
1769         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_ENCRYPTED);
1770         CHECK_CDEFINE(FIEMAP_EXTENT_NOT_ALIGNED);
1771         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_INLINE);
1772         CHECK_CDEFINE(FIEMAP_EXTENT_DATA_TAIL);
1773         CHECK_CDEFINE(FIEMAP_EXTENT_UNWRITTEN);
1774         CHECK_CDEFINE(FIEMAP_EXTENT_MERGED);
1775         CHECK_CDEFINE(FIEMAP_EXTENT_NO_DIRECT);
1776         CHECK_CDEFINE(FIEMAP_EXTENT_NET);
1777 }
1778
1779 static void
1780 check_link_ea_header(void)
1781 {
1782         BLANK_LINE();
1783         CHECK_STRUCT(link_ea_header);
1784         CHECK_MEMBER(link_ea_header, leh_magic);
1785         CHECK_MEMBER(link_ea_header, leh_reccount);
1786         CHECK_MEMBER(link_ea_header, leh_len);
1787         CHECK_MEMBER(link_ea_header, padding1);
1788         CHECK_MEMBER(link_ea_header, padding2);
1789
1790         CHECK_CDEFINE(LINK_EA_MAGIC);
1791 }
1792
1793 static void
1794 check_link_ea_entry(void)
1795 {
1796         BLANK_LINE();
1797         CHECK_STRUCT(link_ea_entry);
1798         CHECK_MEMBER(link_ea_entry, lee_reclen);
1799         CHECK_MEMBER(link_ea_entry, lee_parent_fid);
1800         CHECK_MEMBER(link_ea_entry, lee_name);
1801 }
1802
1803 static void
1804 check_hsm_user_item(void)
1805 {
1806         BLANK_LINE();
1807         CHECK_STRUCT(hsm_user_item);
1808         CHECK_MEMBER(hsm_user_item, hui_fid);
1809         CHECK_MEMBER(hsm_user_item, hui_extent);
1810 }
1811
1812 static void
1813 check_hsm_user_request(void)
1814 {
1815         BLANK_LINE();
1816         CHECK_STRUCT(hsm_user_request);
1817         CHECK_MEMBER(hsm_user_request, hur_action);
1818         CHECK_MEMBER(hsm_user_request, hur_archive_num);
1819         CHECK_MEMBER(hsm_user_request, hur_itemcount);
1820         CHECK_MEMBER(hsm_user_request, hur_data_len);
1821 }
1822
1823 static void
1824 check_hsm_user_state(void)
1825 {
1826         BLANK_LINE();
1827         CHECK_STRUCT(hsm_user_state);
1828         CHECK_MEMBER(hsm_user_state, hus_states);
1829         CHECK_MEMBER(hsm_user_state, hus_archive_num);
1830         CHECK_MEMBER(hsm_user_state, hus_in_progress_state);
1831         CHECK_MEMBER(hsm_user_state, hus_in_progress_action);
1832         CHECK_MEMBER(hsm_user_state, hus_in_progress_location);
1833 }
1834
1835 static void
1836 system_string (char *cmdline, char *str, int len)
1837 {
1838         int   fds[2];
1839         int   rc;
1840         pid_t pid;
1841
1842         rc = pipe(fds);
1843         if (rc != 0)
1844                 abort();
1845
1846         pid = fork();
1847         if (pid == 0) {
1848                 /* child */
1849                 int   fd = fileno(stdout);
1850
1851                 rc = dup2(fds[1], fd);
1852                 if (rc != fd)
1853                         abort();
1854
1855                 exit(system(cmdline));
1856                 /* notreached */
1857         } else if ((int)pid < 0) {
1858                 abort();
1859         } else {
1860                 FILE *f = fdopen(fds[0], "r");
1861
1862                 if (f == NULL)
1863                         abort();
1864
1865                 close(fds[1]);
1866
1867                 if (fgets(str, len, f) == NULL)
1868                         abort();
1869
1870                 if (waitpid(pid, &rc, 0) != pid)
1871                         abort();
1872
1873                 if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
1874                         abort();
1875
1876                 if (strnlen(str, len) == len)
1877                         str[len - 1] = 0;
1878
1879                 if (str[strlen(str) - 1] == '\n')
1880                         str[strlen(str) - 1] = 0;
1881
1882                 fclose(f);
1883         }
1884 }
1885
1886 int
1887 main(int argc, char **argv)
1888 {
1889         char unameinfo[80];
1890         char gccinfo[80];
1891
1892         system_string("uname -a", unameinfo, sizeof(unameinfo));
1893         system_string(CC " -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
1894
1895         printf ("void lustre_assert_wire_constants(void)\n"
1896                 "{\n"
1897                 "        /* Wire protocol assertions generated by 'wirecheck'\n"
1898                 "         * (make -C lustre/utils newwiretest)\n"
1899                 "         * running on %s\n"
1900                 "         * with %s */\n"
1901                 "\n", unameinfo, gccinfo);
1902
1903         BLANK_LINE ();
1904
1905         COMMENT("Constants...");
1906         CHECK_VALUE(PTL_RPC_MSG_REQUEST);
1907         CHECK_VALUE(PTL_RPC_MSG_ERR);
1908         CHECK_VALUE(PTL_RPC_MSG_REPLY);
1909
1910         CHECK_DEFINE_64X(MDS_DIR_END_OFF);
1911
1912         CHECK_DEFINE_64X(DEAD_HANDLE_MAGIC);
1913
1914         CHECK_CVALUE(MTI_NAME_MAXLEN);
1915
1916         CHECK_VALUE(OST_REPLY);
1917         CHECK_VALUE(OST_GETATTR);
1918         CHECK_VALUE(OST_SETATTR);
1919         CHECK_VALUE(OST_READ);
1920         CHECK_VALUE(OST_WRITE);
1921         CHECK_VALUE(OST_CREATE);
1922         CHECK_VALUE(OST_DESTROY);
1923         CHECK_VALUE(OST_GET_INFO);
1924         CHECK_VALUE(OST_CONNECT);
1925         CHECK_VALUE(OST_DISCONNECT);
1926         CHECK_VALUE(OST_PUNCH);
1927         CHECK_VALUE(OST_OPEN);
1928         CHECK_VALUE(OST_CLOSE);
1929         CHECK_VALUE(OST_STATFS);
1930         CHECK_VALUE(OST_SYNC);
1931         CHECK_VALUE(OST_SET_INFO);
1932         CHECK_VALUE(OST_QUOTACHECK);
1933         CHECK_VALUE(OST_QUOTACTL);
1934         CHECK_VALUE(OST_QUOTA_ADJUST_QUNIT);
1935         CHECK_VALUE(OST_LAST_OPC);
1936
1937         CHECK_DEFINE_64X(OBD_OBJECT_EOF);
1938
1939         CHECK_VALUE(OST_MIN_PRECREATE);
1940         CHECK_VALUE(OST_MAX_PRECREATE);
1941
1942         CHECK_DEFINE_64X(OST_LVB_ERR_INIT);
1943         CHECK_DEFINE_64X(OST_LVB_ERR_MASK);
1944
1945         CHECK_VALUE(MDS_FIRST_OPC);
1946         CHECK_VALUE(MDS_GETATTR);
1947         CHECK_VALUE(MDS_GETATTR_NAME);
1948         CHECK_VALUE(MDS_CLOSE);
1949         CHECK_VALUE(MDS_REINT);
1950         CHECK_VALUE(MDS_READPAGE);
1951         CHECK_VALUE(MDS_CONNECT);
1952         CHECK_VALUE(MDS_DISCONNECT);
1953         CHECK_VALUE(MDS_GETSTATUS);
1954         CHECK_VALUE(MDS_STATFS);
1955         CHECK_VALUE(MDS_PIN);
1956         CHECK_VALUE(MDS_UNPIN);
1957         CHECK_VALUE(MDS_SYNC);
1958         CHECK_VALUE(MDS_DONE_WRITING);
1959         CHECK_VALUE(MDS_SET_INFO);
1960         CHECK_VALUE(MDS_QUOTACHECK);
1961         CHECK_VALUE(MDS_QUOTACTL);
1962         CHECK_VALUE(MDS_GETXATTR);
1963         CHECK_VALUE(MDS_SETXATTR);
1964         CHECK_VALUE(MDS_WRITEPAGE);
1965         CHECK_VALUE(MDS_IS_SUBDIR);
1966         CHECK_VALUE(MDS_GET_INFO);
1967         CHECK_VALUE(MDS_LAST_OPC);
1968
1969         CHECK_VALUE(REINT_SETATTR);
1970         CHECK_VALUE(REINT_CREATE);
1971         CHECK_VALUE(REINT_LINK);
1972         CHECK_VALUE(REINT_UNLINK);
1973         CHECK_VALUE(REINT_RENAME);
1974         CHECK_VALUE(REINT_OPEN);
1975         CHECK_VALUE(REINT_SETXATTR);
1976         CHECK_VALUE(REINT_MAX);
1977
1978         CHECK_VALUE_X(DISP_IT_EXECD);
1979         CHECK_VALUE_X(DISP_LOOKUP_EXECD);
1980         CHECK_VALUE_X(DISP_LOOKUP_NEG);
1981         CHECK_VALUE_X(DISP_LOOKUP_POS);
1982         CHECK_VALUE_X(DISP_OPEN_CREATE);
1983         CHECK_VALUE_X(DISP_OPEN_OPEN);
1984         CHECK_VALUE_X(DISP_ENQ_COMPLETE);
1985         CHECK_VALUE_X(DISP_ENQ_OPEN_REF);
1986         CHECK_VALUE_X(DISP_ENQ_CREATE_REF);
1987         CHECK_VALUE_X(DISP_OPEN_LOCK);
1988
1989         CHECK_VALUE(MDS_STATUS_CONN);
1990         CHECK_VALUE(MDS_STATUS_LOV);
1991
1992         CHECK_VALUE(LUSTRE_BFLAG_UNCOMMITTED_WRITES);
1993
1994         CHECK_VALUE_X(MF_SOM_CHANGE);
1995         CHECK_VALUE_X(MF_EPOCH_OPEN);
1996         CHECK_VALUE_X(MF_EPOCH_CLOSE);
1997         CHECK_VALUE_X(MF_MDC_CANCEL_FID1);
1998         CHECK_VALUE_X(MF_MDC_CANCEL_FID2);
1999         CHECK_VALUE_X(MF_MDC_CANCEL_FID3);
2000         CHECK_VALUE_X(MF_MDC_CANCEL_FID4);
2001         CHECK_VALUE_X(MF_SOM_AU);
2002         CHECK_VALUE_X(MF_GETATTR_LOCK);
2003
2004         CHECK_VALUE(LQUOTA_FLAGS_GRP);
2005         CHECK_VALUE(LQUOTA_FLAGS_BLK);
2006         CHECK_VALUE(LQUOTA_FLAGS_ADJBLK);
2007         CHECK_VALUE(LQUOTA_FLAGS_ADJINO);
2008         CHECK_VALUE(LQUOTA_FLAGS_CHG_QS);
2009         CHECK_VALUE(LQUOTA_FLAGS_RECOVERY);
2010         CHECK_VALUE(LQUOTA_FLAGS_SETQUOTA);
2011
2012         CHECK_VALUE_X(LQUOTA_QAQ_CREATE_LQS);
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_HSH_OFF);
2073
2074         CHECK_CVALUE(LQUOTA_TYPE_USR);
2075         CHECK_CVALUE(LQUOTA_TYPE_GRP);
2076
2077         CHECK_CVALUE(LQUOTA_RES_MD);
2078         CHECK_CVALUE(LQUOTA_RES_DT);
2079
2080         CHECK_VALUE(OBD_PING);
2081         CHECK_VALUE(OBD_LOG_CANCEL);
2082         CHECK_VALUE(OBD_QC_CALLBACK);
2083         CHECK_VALUE(OBD_IDX_READ);
2084         CHECK_VALUE(OBD_LAST_OPC);
2085
2086         CHECK_VALUE(QUOTA_DQACQ);
2087         CHECK_VALUE(QUOTA_DQREL);
2088         CHECK_VALUE(QUOTA_LAST_OPC);
2089
2090         CHECK_VALUE(MGS_CONNECT);
2091         CHECK_VALUE(MGS_DISCONNECT);
2092         CHECK_VALUE(MGS_EXCEPTION);
2093         CHECK_VALUE(MGS_TARGET_REG);
2094         CHECK_VALUE(MGS_TARGET_DEL);
2095         CHECK_VALUE(MGS_SET_INFO);
2096         CHECK_VALUE(MGS_LAST_OPC);
2097
2098         CHECK_VALUE(SEC_CTX_INIT);
2099         CHECK_VALUE(SEC_CTX_INIT_CONT);
2100         CHECK_VALUE(SEC_CTX_FINI);
2101         CHECK_VALUE(SEC_LAST_OPC);
2102
2103         COMMENT("Sizes and Offsets");
2104         BLANK_LINE();
2105         CHECK_STRUCT(obd_uuid);
2106         check_lu_seq_range();
2107         check_lustre_mdt_attrs();
2108         check_ost_id();
2109         check_lu_dirent();
2110         check_luda_type();
2111         check_lu_dirpage();
2112         check_lustre_handle();
2113         check_lustre_msg_v2();
2114         check_ptlrpc_body();
2115         check_obd_connect_data();
2116         check_obdo();
2117         check_lov_ost_data_v1();
2118         check_lov_mds_md_v1();
2119         check_lov_mds_md_v3();
2120         check_obd_statfs();
2121         check_obd_ioobj();
2122         check_obd_quotactl();
2123         check_obd_idx_read();
2124         check_niobuf_remote();
2125         check_ost_body();
2126         check_ll_fid();
2127         check_mdt_body();
2128         check_mdt_ioepoch();
2129         check_mdt_remote_perm();
2130         check_mdt_rec_setattr();
2131         check_mdt_rec_create();
2132         check_mdt_rec_link();
2133         check_mdt_rec_unlink();
2134         check_mdt_rec_rename();
2135         check_mdt_rec_setxattr();
2136         check_mdt_rec_reint();
2137         check_lmv_desc();
2138         check_lmv_stripe_md();
2139         check_lov_desc();
2140         check_ldlm_res_id();
2141         check_ldlm_extent();
2142         check_ldlm_inodebits();
2143         check_ldlm_flock();
2144         check_ldlm_intent();
2145         check_ldlm_resource_desc();
2146         check_ldlm_lock_desc();
2147         check_ldlm_request();
2148         check_ldlm_reply();
2149         check_ldlm_lvb();
2150         check_mgs_send_param();
2151         check_cfg_marker();
2152         check_llog_logid();
2153         check_llog_catid();
2154         check_llog_rec_hdr();
2155         check_llog_rec_tail();
2156         check_llog_logid_rec();
2157         check_llog_unlink_rec();
2158         check_llog_unlink64_rec();
2159         check_llog_setattr64_rec();
2160         check_llog_size_change_rec();
2161         check_changelog_rec();
2162         check_changelog_rec_ext();
2163         check_changelog_setinfo();
2164         check_llog_changelog_rec();
2165         check_llog_changelog_user_rec();
2166         check_llog_gen();
2167         check_llog_gen_rec();
2168         check_llog_log_hdr();
2169         check_llog_cookie();
2170         check_llogd_body();
2171         check_llogd_conn_body();
2172         check_ll_fiemap_info_key();
2173         check_qunit_data();
2174         check_quota_body();
2175         check_quota_adjust_qunit();
2176         check_mgs_target_info();
2177         check_lustre_capa();
2178         check_lustre_capa_key();
2179         check_getinfo_fid2path();
2180         check_ll_user_fiemap();
2181         check_ll_fiemap_extent();
2182         printf("#ifdef LIBLUSTRE_POSIX_ACL\n");
2183 #ifndef LIBLUSTRE_POSIX_ACL
2184 #error build generator without LIBLUSTRE_POSIX_ACL defined - produce wrong check code.
2185 #endif
2186         check_posix_acl_xattr_entry();
2187         check_posix_acl_xattr_header();
2188         printf("#endif\n");
2189         check_link_ea_header();
2190         check_link_ea_entry();
2191         check_hsm_user_item();
2192         check_hsm_user_request();
2193         check_hsm_user_state();
2194
2195         printf("}\n\n");
2196
2197         return(0);
2198 }