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