Whamcloud - gitweb
b45ee6fbd713370a49d6d9fd4440d71150af0c88
[fs/lustre-release.git] / lustre / utils / wirecheck.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4 #include <stdio.h>
5 #include <sys/types.h>
6 #include <sys/wait.h>
7 #include <liblustre.h>
8 #include <lustre_lib.h>
9 #include <lustre/lustre_idl.h>
10 #include <lustre_disk.h>
11
12 #define BLANK_LINE()                                            \
13 do {                                                            \
14         printf("\n");                                           \
15 } while(0)
16
17 #define COMMENT(c)                                              \
18 do {                                                            \
19         printf("        /* "c" */\n");                          \
20 } while(0)
21
22 #define STRINGIFY(a) #a
23
24
25 #define CHECK_CDEFINE(a)                                        \
26         printf("        CLASSERT("#a" == "STRINGIFY(a) ");\n")
27
28 #define CHECK_CVALUE(a)                                         \
29         printf("        CLASSERT("#a" == %lld);\n", (long long)a)
30
31 #define CHECK_DEFINE(a)                                         \
32 do {                                                            \
33         printf("        LASSERTF("#a" == "STRINGIFY(a)          \
34                ",\" found %%lld\\n\",\n                 "       \
35                "(long long)"#a");\n");   \
36 } while(0)
37
38 #define CHECK_VALUE(a)                                          \
39 do {                                                            \
40         printf("        LASSERTF("#a                            \
41                " == %lld, \" found %%lld\\n\",\n                 "\
42                "(long long)"#a");\n", (long long)a);            \
43 } while(0)
44
45 #define CHECK_VALUE_64(a)                                       \
46 do {                                                            \
47         printf("        LASSERTF("#a                            \
48                " == %lldULL, \" found %%lld\\n\",\n                 "\
49                "(long long)"#a");\n", (long long)a);            \
50 } while(0)
51
52 #define CHECK_MEMBER_OFFSET(s,m)                                \
53 do {                                                            \
54         CHECK_VALUE((int)offsetof(struct s, m));                \
55 } while(0)
56
57 #define CHECK_MEMBER_SIZEOF(s,m)                                \
58 do {                                                            \
59         CHECK_VALUE((int)sizeof(((struct s *)0)->m));           \
60 } while(0)
61
62 #define CHECK_MEMBER(s,m)                                       \
63 do {                                                            \
64         CHECK_MEMBER_OFFSET(s, m);                              \
65         CHECK_MEMBER_SIZEOF(s, m);                              \
66 } while(0)
67
68 #define CHECK_STRUCT(s)                                         \
69 do {                                                            \
70         COMMENT("Checks for struct "#s);                        \
71                 CHECK_VALUE((int)sizeof(struct s));             \
72 } while(0)
73
74
75 static void
76 check_lustre_handle(void)
77 {
78         BLANK_LINE();
79         CHECK_STRUCT(lustre_handle);
80         CHECK_MEMBER(lustre_handle, cookie);
81 }
82
83 void
84 check_lustre_msg_v1(void)
85 {
86         BLANK_LINE();
87         CHECK_STRUCT(lustre_msg_v1);
88         CHECK_MEMBER(lustre_msg_v1, lm_handle);
89         CHECK_MEMBER(lustre_msg_v1, lm_magic);
90         CHECK_MEMBER(lustre_msg_v1, lm_type);
91         CHECK_MEMBER(lustre_msg_v1, lm_version);
92         CHECK_MEMBER(lustre_msg_v1, lm_opc);
93         CHECK_MEMBER(lustre_msg_v1, lm_last_xid);
94         CHECK_MEMBER(lustre_msg_v1, lm_last_committed);
95         CHECK_MEMBER(lustre_msg_v1, lm_transno);
96         CHECK_MEMBER(lustre_msg_v1, lm_status);
97         CHECK_MEMBER(lustre_msg_v1, lm_flags);
98         CHECK_MEMBER(lustre_msg_v1, lm_conn_cnt);
99         CHECK_MEMBER(lustre_msg_v1, lm_bufcount);
100         CHECK_MEMBER(lustre_msg_v1, lm_buflens[0]);
101 }
102
103 void
104 check_lustre_msg_v2(void)
105 {
106         BLANK_LINE();
107         CHECK_STRUCT(lustre_msg_v2);
108         CHECK_MEMBER(lustre_msg_v2, lm_bufcount);
109         CHECK_MEMBER(lustre_msg_v2, lm_secflvr);
110         CHECK_MEMBER(lustre_msg_v2, lm_magic);
111         CHECK_MEMBER(lustre_msg_v2, lm_repsize);
112         CHECK_MEMBER(lustre_msg_v2, lm_timeout);
113         CHECK_MEMBER(lustre_msg_v2, lm_padding_1);
114         CHECK_MEMBER(lustre_msg_v2, lm_padding_2);
115         CHECK_MEMBER(lustre_msg_v2, lm_padding_3);
116         CHECK_MEMBER(lustre_msg_v2, lm_buflens[0]);
117 }
118
119 void
120 check_ptlrpc_body(void)
121 {
122         BLANK_LINE();
123         CHECK_STRUCT(ptlrpc_body);
124         CHECK_MEMBER(ptlrpc_body, pb_handle);
125         CHECK_MEMBER(ptlrpc_body, pb_type);
126         CHECK_MEMBER(ptlrpc_body, pb_version);
127         CHECK_MEMBER(ptlrpc_body, pb_opc);
128         CHECK_MEMBER(ptlrpc_body, pb_status);
129         CHECK_MEMBER(ptlrpc_body, pb_last_xid);
130         CHECK_MEMBER(ptlrpc_body, pb_last_seen);
131         CHECK_MEMBER(ptlrpc_body, pb_last_committed);
132         CHECK_MEMBER(ptlrpc_body, pb_transno);
133         CHECK_MEMBER(ptlrpc_body, pb_flags);
134         CHECK_MEMBER(ptlrpc_body, pb_op_flags);
135         CHECK_MEMBER(ptlrpc_body, pb_conn_cnt);
136         CHECK_MEMBER(ptlrpc_body, pb_padding_1);
137         CHECK_MEMBER(ptlrpc_body, pb_padding_2);
138         CHECK_MEMBER(ptlrpc_body, pb_padding_3);
139         CHECK_MEMBER(ptlrpc_body, pb_padding_4);
140         CHECK_MEMBER(ptlrpc_body, pb_padding_5);
141 }
142
143 static void check_obd_connect_data(void)
144 {
145         BLANK_LINE();
146         CHECK_STRUCT(obd_connect_data);
147         CHECK_MEMBER(obd_connect_data, ocd_connect_flags);
148         CHECK_MEMBER(obd_connect_data, ocd_version);
149         CHECK_MEMBER(obd_connect_data, ocd_grant);
150         CHECK_MEMBER(obd_connect_data, ocd_index);
151         CHECK_MEMBER(obd_connect_data, ocd_brw_size);
152         CHECK_MEMBER(obd_connect_data, ocd_ibits_known);
153         CHECK_MEMBER(obd_connect_data, ocd_nllu);
154         CHECK_MEMBER(obd_connect_data, ocd_nllg);
155         CHECK_MEMBER(obd_connect_data, padding1);
156         CHECK_MEMBER(obd_connect_data, padding2);
157         CHECK_MEMBER(obd_connect_data, padding3);
158         CHECK_MEMBER(obd_connect_data, padding4);
159
160         CHECK_CDEFINE(OBD_CONNECT_RDONLY);
161         CHECK_CDEFINE(OBD_CONNECT_INDEX);
162         CHECK_CDEFINE(OBD_CONNECT_GRANT);
163         CHECK_CDEFINE(OBD_CONNECT_SRVLOCK);
164         CHECK_CDEFINE(OBD_CONNECT_VERSION);
165         CHECK_CDEFINE(OBD_CONNECT_REQPORTAL);
166         CHECK_CDEFINE(OBD_CONNECT_ACL);
167         CHECK_CDEFINE(OBD_CONNECT_XATTR);
168         CHECK_CDEFINE(OBD_CONNECT_CROW);
169         CHECK_CDEFINE(OBD_CONNECT_TRUNCLOCK);
170         CHECK_CDEFINE(OBD_CONNECT_TRANSNO);
171         CHECK_CDEFINE(OBD_CONNECT_IBITS);
172         CHECK_CDEFINE(OBD_CONNECT_JOIN);
173         CHECK_CDEFINE(OBD_CONNECT_ATTRFID);
174         CHECK_CDEFINE(OBD_CONNECT_NODEVOH);
175         CHECK_CDEFINE(OBD_CONNECT_LCL_CLIENT);
176         CHECK_CDEFINE(OBD_CONNECT_RMT_CLIENT);
177         CHECK_CDEFINE(OBD_CONNECT_BRW_SIZE);
178         CHECK_CDEFINE(OBD_CONNECT_QUOTA64);
179 }
180
181 static void
182 check_obdo(void)
183 {
184         BLANK_LINE();
185         CHECK_STRUCT(obdo);
186         CHECK_MEMBER(obdo, o_valid);
187         CHECK_MEMBER(obdo, o_id);
188         CHECK_MEMBER(obdo, o_gr);
189         CHECK_MEMBER(obdo, o_fid);
190         CHECK_MEMBER(obdo, o_size);
191         CHECK_MEMBER(obdo, o_mtime);
192         CHECK_MEMBER(obdo, o_atime);
193         CHECK_MEMBER(obdo, o_ctime);
194         CHECK_MEMBER(obdo, o_blocks);
195         CHECK_MEMBER(obdo, o_grant);
196         CHECK_MEMBER(obdo, o_blksize);
197         CHECK_MEMBER(obdo, o_mode);
198         CHECK_MEMBER(obdo, o_uid);
199         CHECK_MEMBER(obdo, o_gid);
200         CHECK_MEMBER(obdo, o_flags);
201         CHECK_MEMBER(obdo, o_nlink);
202         CHECK_MEMBER(obdo, o_generation);
203         CHECK_MEMBER(obdo, o_misc);
204         CHECK_MEMBER(obdo, o_easize);
205         CHECK_MEMBER(obdo, o_mds);
206         CHECK_MEMBER(obdo, o_stripe_idx);
207         CHECK_MEMBER(obdo, o_padding_1);
208         CHECK_MEMBER(obdo, o_inline);
209
210         CHECK_VALUE(OBD_INLINESZ);
211
212         CHECK_CDEFINE(OBD_MD_FLID);
213         CHECK_CDEFINE(OBD_MD_FLATIME);
214         CHECK_CDEFINE(OBD_MD_FLMTIME);
215         CHECK_CDEFINE(OBD_MD_FLCTIME);
216         CHECK_CDEFINE(OBD_MD_FLSIZE);
217         CHECK_CDEFINE(OBD_MD_FLBLOCKS);
218         CHECK_CDEFINE(OBD_MD_FLBLKSZ);
219         CHECK_CDEFINE(OBD_MD_FLMODE);
220         CHECK_CDEFINE(OBD_MD_FLTYPE);
221         CHECK_CDEFINE(OBD_MD_FLUID);
222         CHECK_CDEFINE(OBD_MD_FLGID);
223         CHECK_CDEFINE(OBD_MD_FLFLAGS);
224         CHECK_CDEFINE(OBD_MD_FLNLINK);
225         CHECK_CDEFINE(OBD_MD_FLGENER);
226         CHECK_CDEFINE(OBD_MD_FLINLINE);
227         CHECK_CDEFINE(OBD_MD_FLRDEV);
228         CHECK_CDEFINE(OBD_MD_FLEASIZE);
229         CHECK_CDEFINE(OBD_MD_LINKNAME);
230         CHECK_CDEFINE(OBD_MD_FLHANDLE);
231         CHECK_CDEFINE(OBD_MD_FLCKSUM);
232         CHECK_CDEFINE(OBD_MD_FLQOS);
233         CHECK_CDEFINE(OBD_MD_FLCOOKIE);
234         CHECK_CDEFINE(OBD_MD_FLGROUP);
235         CHECK_CDEFINE(OBD_MD_FLFID);
236         CHECK_CDEFINE(OBD_MD_FLEPOCH);
237         CHECK_CDEFINE(OBD_MD_FLGRANT);
238         CHECK_CDEFINE(OBD_MD_FLDIREA);
239         CHECK_CDEFINE(OBD_MD_FLUSRQUOTA);
240         CHECK_CDEFINE(OBD_MD_FLGRPQUOTA);
241         CHECK_CDEFINE(OBD_MD_FLMODEASIZE);
242         CHECK_CDEFINE(OBD_MD_MDS);
243         CHECK_CDEFINE(OBD_MD_REINT);
244         CHECK_CDEFINE(OBD_MD_FLXATTR);
245         CHECK_CDEFINE(OBD_MD_FLXATTRLS);
246         CHECK_CDEFINE(OBD_MD_FLXATTRRM);
247         CHECK_CDEFINE(OBD_MD_FLACL);
248
249         CHECK_CDEFINE(OBD_FL_INLINEDATA);
250         CHECK_CDEFINE(OBD_FL_OBDMDEXISTS);
251         CHECK_CDEFINE(OBD_FL_DELORPHAN);
252         CHECK_CDEFINE(OBD_FL_NORPC);
253         CHECK_CDEFINE(OBD_FL_IDONLY);
254         CHECK_CDEFINE(OBD_FL_RECREATE_OBJS);
255         CHECK_CDEFINE(OBD_FL_DEBUG_CHECK);
256         CHECK_CDEFINE(OBD_FL_NO_USRQUOTA);
257         CHECK_CDEFINE(OBD_FL_NO_GRPQUOTA);
258         CHECK_CDEFINE(OBD_FL_CREATE_CROW);
259 }
260
261 static void
262 check_lov_mds_md_v1(void)
263 {
264         BLANK_LINE();
265         CHECK_STRUCT(lov_mds_md_v1);
266         CHECK_MEMBER(lov_mds_md_v1, lmm_magic);
267         CHECK_MEMBER(lov_mds_md_v1, lmm_pattern);
268         CHECK_MEMBER(lov_mds_md_v1, lmm_object_id);
269         CHECK_MEMBER(lov_mds_md_v1, lmm_object_gr);
270         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_size);
271         CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_count);
272         CHECK_MEMBER(lov_mds_md_v1, lmm_objects);
273
274         BLANK_LINE();
275         CHECK_STRUCT(lov_ost_data_v1);
276         CHECK_MEMBER(lov_ost_data_v1, l_object_id);
277         CHECK_MEMBER(lov_ost_data_v1, l_object_gr);
278         CHECK_MEMBER(lov_ost_data_v1, l_ost_gen);
279         CHECK_MEMBER(lov_ost_data_v1, l_ost_idx);
280
281         CHECK_CDEFINE(LOV_MAGIC_V1);
282         CHECK_CDEFINE(LOV_MAGIC_JOIN);
283
284         CHECK_VALUE(LOV_PATTERN_RAID0);
285         CHECK_VALUE(LOV_PATTERN_RAID1);
286 }
287
288 static void
289 check_lov_mds_md_join(void)
290 {
291         BLANK_LINE();
292         CHECK_STRUCT(lov_mds_md_join);
293         CHECK_MEMBER(lov_mds_md_join, lmmj_md);
294         CHECK_MEMBER(lov_mds_md_join, lmmj_array_id);
295         CHECK_MEMBER(lov_mds_md_join, lmmj_extent_count);
296 }
297
298 static void
299 check_obd_statfs(void)
300 {
301         BLANK_LINE();
302         CHECK_STRUCT(obd_statfs);
303         CHECK_MEMBER(obd_statfs, os_type);
304         CHECK_MEMBER(obd_statfs, os_blocks);
305         CHECK_MEMBER(obd_statfs, os_bfree);
306         CHECK_MEMBER(obd_statfs, os_bavail);
307         CHECK_MEMBER(obd_statfs, os_ffree);
308         CHECK_MEMBER(obd_statfs, os_fsid);
309         CHECK_MEMBER(obd_statfs, os_bsize);
310         CHECK_MEMBER(obd_statfs, os_namelen);
311         CHECK_MEMBER(obd_statfs, os_state);
312         CHECK_MEMBER(obd_statfs, os_spare1);
313         CHECK_MEMBER(obd_statfs, os_spare2);
314         CHECK_MEMBER(obd_statfs, os_spare3);
315         CHECK_MEMBER(obd_statfs, os_spare4);
316         CHECK_MEMBER(obd_statfs, os_spare5);
317         CHECK_MEMBER(obd_statfs, os_spare6);
318         CHECK_MEMBER(obd_statfs, os_spare7);
319         CHECK_MEMBER(obd_statfs, os_spare8);
320         CHECK_MEMBER(obd_statfs, os_spare9);
321 }
322
323 static void
324 check_obd_ioobj(void)
325 {
326         BLANK_LINE();
327         CHECK_STRUCT(obd_ioobj);
328         CHECK_MEMBER(obd_ioobj, ioo_id);
329         CHECK_MEMBER(obd_ioobj, ioo_gr);
330         CHECK_MEMBER(obd_ioobj, ioo_type);
331         CHECK_MEMBER(obd_ioobj, ioo_bufcnt);
332 }
333
334 static void
335 check_obd_quotactl(void)
336 {
337         BLANK_LINE();
338         CHECK_STRUCT(obd_quotactl);
339         CHECK_MEMBER(obd_quotactl, qc_cmd);
340         CHECK_MEMBER(obd_quotactl, qc_type);
341         CHECK_MEMBER(obd_quotactl, qc_id);
342         CHECK_MEMBER(obd_quotactl, qc_stat);
343         CHECK_MEMBER(obd_quotactl, qc_dqinfo);
344         CHECK_MEMBER(obd_quotactl, qc_dqblk);
345
346         BLANK_LINE();
347         CHECK_STRUCT(obd_dqinfo);
348         CHECK_MEMBER(obd_dqinfo, dqi_bgrace);
349         CHECK_MEMBER(obd_dqinfo, dqi_igrace);
350         CHECK_MEMBER(obd_dqinfo, dqi_flags);
351         CHECK_MEMBER(obd_dqinfo, dqi_valid);
352
353         BLANK_LINE();
354         CHECK_STRUCT(obd_dqblk);
355         CHECK_MEMBER(obd_dqblk, dqb_bhardlimit);
356         CHECK_MEMBER(obd_dqblk, dqb_bsoftlimit);
357         CHECK_MEMBER(obd_dqblk, dqb_curspace);
358         CHECK_MEMBER(obd_dqblk, dqb_ihardlimit);
359         CHECK_MEMBER(obd_dqblk, dqb_isoftlimit);
360         CHECK_MEMBER(obd_dqblk, dqb_curinodes);
361         CHECK_MEMBER(obd_dqblk, dqb_btime);
362         CHECK_MEMBER(obd_dqblk, dqb_itime);
363         CHECK_MEMBER(obd_dqblk, dqb_valid);
364         CHECK_MEMBER(obd_dqblk, padding);
365
366         CHECK_DEFINE(Q_QUOTACHECK);
367         CHECK_DEFINE(Q_INITQUOTA);
368         CHECK_DEFINE(Q_GETOINFO);
369         CHECK_DEFINE(Q_GETOQUOTA);
370 }
371
372 static void
373 check_niobuf_remote(void)
374 {
375         BLANK_LINE();
376         CHECK_STRUCT(niobuf_remote);
377         CHECK_MEMBER(niobuf_remote, offset);
378         CHECK_MEMBER(niobuf_remote, len);
379         CHECK_MEMBER(niobuf_remote, flags);
380
381         CHECK_VALUE(OBD_BRW_READ);
382         CHECK_VALUE(OBD_BRW_WRITE);
383         CHECK_VALUE(OBD_BRW_SYNC);
384         CHECK_VALUE(OBD_BRW_FROM_GRANT);
385         CHECK_VALUE(OBD_BRW_NOQUOTA);
386 }
387
388 static void
389 check_ost_body(void)
390 {
391         BLANK_LINE();
392         CHECK_STRUCT(ost_body);
393         CHECK_MEMBER(ost_body, oa);
394 }
395
396 static void
397 check_ll_fid(void)
398 {
399         BLANK_LINE();
400         CHECK_STRUCT(ll_fid);
401         CHECK_MEMBER(ll_fid, id);
402         CHECK_MEMBER(ll_fid, generation);
403         CHECK_MEMBER(ll_fid, f_type);
404 }
405
406 static void
407 check_mds_status_req(void)
408 {
409         BLANK_LINE();
410         CHECK_STRUCT(mds_status_req);
411         CHECK_MEMBER(mds_status_req, flags);
412         CHECK_MEMBER(mds_status_req, repbuf);
413 }
414
415 static void
416 check_mds_body(void)
417 {
418         BLANK_LINE();
419         CHECK_STRUCT(mds_body);
420         CHECK_MEMBER(mds_body, fid1);
421         CHECK_MEMBER(mds_body, fid2);
422         CHECK_MEMBER(mds_body, handle);
423         CHECK_MEMBER(mds_body, size);
424         CHECK_MEMBER(mds_body, blocks);
425         CHECK_MEMBER(mds_body, io_epoch);
426         CHECK_MEMBER(mds_body, ino);
427         CHECK_MEMBER(mds_body, valid);
428         CHECK_MEMBER(mds_body, fsuid);
429         CHECK_MEMBER(mds_body, fsgid);
430         CHECK_MEMBER(mds_body, capability);
431         CHECK_MEMBER(mds_body, mode);
432         CHECK_MEMBER(mds_body, uid);
433         CHECK_MEMBER(mds_body, gid);
434         CHECK_MEMBER(mds_body, mtime);
435         CHECK_MEMBER(mds_body, ctime);
436         CHECK_MEMBER(mds_body, atime);
437         CHECK_MEMBER(mds_body, flags);
438         CHECK_MEMBER(mds_body, rdev);
439         CHECK_MEMBER(mds_body, nlink);
440         CHECK_MEMBER(mds_body, generation);
441         CHECK_MEMBER(mds_body, suppgid);
442         CHECK_MEMBER(mds_body, eadatasize);
443         CHECK_MEMBER(mds_body, aclsize);
444         CHECK_MEMBER(mds_body, max_mdsize);
445         CHECK_MEMBER(mds_body, max_cookiesize);
446         CHECK_MEMBER(mds_body, padding_4);
447
448         CHECK_VALUE(FMODE_READ);
449         CHECK_VALUE(FMODE_WRITE);
450         CHECK_VALUE(MDS_FMODE_EXEC);
451
452         CHECK_CDEFINE(MDS_OPEN_CREAT);
453         CHECK_CDEFINE(MDS_OPEN_EXCL);
454         CHECK_CDEFINE(MDS_OPEN_TRUNC);
455         CHECK_CDEFINE(MDS_OPEN_APPEND);
456         CHECK_CDEFINE(MDS_OPEN_SYNC);
457         CHECK_CDEFINE(MDS_OPEN_DIRECTORY);
458         CHECK_CDEFINE(MDS_OPEN_DELAY_CREATE);
459         CHECK_CDEFINE(MDS_OPEN_OWNEROVERRIDE);
460         CHECK_CDEFINE(MDS_OPEN_JOIN_FILE);
461         CHECK_CDEFINE(MDS_OPEN_HAS_EA);
462         CHECK_CDEFINE(MDS_OPEN_HAS_OBJS);
463
464         /* these should be identical to their EXT3_*_FL counterparts, and
465          * are redefined only to avoid dragging in ext3_fs.h */
466         CHECK_CDEFINE(MDS_SYNC_FL);
467         CHECK_CDEFINE(MDS_IMMUTABLE_FL);
468         CHECK_CDEFINE(MDS_APPEND_FL);
469         CHECK_CDEFINE(MDS_NOATIME_FL);
470         CHECK_CDEFINE(MDS_DIRSYNC_FL);
471         CHECK_CDEFINE(MDS_BFLAG_EXT_FLAGS);
472
473         CHECK_CDEFINE(MDS_INODELOCK_LOOKUP);
474         CHECK_CDEFINE(MDS_INODELOCK_UPDATE);
475         CHECK_CDEFINE(MDS_INODELOCK_OPEN);
476 }
477
478 static void
479 check_mds_rec_setattr(void)
480 {
481         BLANK_LINE();
482         CHECK_STRUCT(mds_rec_setattr);
483         CHECK_MEMBER(mds_rec_setattr, sa_opcode);
484         CHECK_MEMBER(mds_rec_setattr, sa_fsuid);
485         CHECK_MEMBER(mds_rec_setattr, sa_fsgid);
486         CHECK_MEMBER(mds_rec_setattr, sa_cap);
487         CHECK_MEMBER(mds_rec_setattr, sa_suppgid);
488         CHECK_MEMBER(mds_rec_setattr, sa_mode);
489         CHECK_MEMBER(mds_rec_setattr, sa_fid);
490         CHECK_MEMBER(mds_rec_setattr, sa_valid);
491         CHECK_MEMBER(mds_rec_setattr, sa_size);
492         CHECK_MEMBER(mds_rec_setattr, sa_mtime);
493         CHECK_MEMBER(mds_rec_setattr, sa_atime);
494         CHECK_MEMBER(mds_rec_setattr, sa_ctime);
495         CHECK_MEMBER(mds_rec_setattr, sa_uid);
496         CHECK_MEMBER(mds_rec_setattr, sa_gid);
497         CHECK_MEMBER(mds_rec_setattr, sa_attr_flags);
498 }
499
500 static void
501 check_mds_rec_create(void)
502 {
503         BLANK_LINE();
504         CHECK_STRUCT(mds_rec_create);
505         CHECK_MEMBER(mds_rec_create, cr_opcode);
506         CHECK_MEMBER(mds_rec_create, cr_fsuid);
507         CHECK_MEMBER(mds_rec_create, cr_fsgid);
508         CHECK_MEMBER(mds_rec_create, cr_cap);
509         CHECK_MEMBER(mds_rec_create, cr_flags);
510         CHECK_MEMBER(mds_rec_create, cr_mode);
511         CHECK_MEMBER(mds_rec_create, cr_fid);
512         CHECK_MEMBER(mds_rec_create, cr_replayfid);
513         CHECK_MEMBER(mds_rec_create, cr_time);
514         CHECK_MEMBER(mds_rec_create, cr_rdev);
515         CHECK_MEMBER(mds_rec_create, cr_suppgid);
516 }
517
518 static void
519 check_mds_rec_link(void)
520 {
521         BLANK_LINE();
522         CHECK_STRUCT(mds_rec_link);
523         CHECK_MEMBER(mds_rec_link, lk_opcode);
524         CHECK_MEMBER(mds_rec_link, lk_fsuid);
525         CHECK_MEMBER(mds_rec_link, lk_fsgid);
526         CHECK_MEMBER(mds_rec_link, lk_cap);
527         CHECK_MEMBER(mds_rec_link, lk_suppgid1);
528         CHECK_MEMBER(mds_rec_link, lk_suppgid2);
529         CHECK_MEMBER(mds_rec_link, lk_fid1);
530         CHECK_MEMBER(mds_rec_link, lk_fid2);
531         CHECK_MEMBER(mds_rec_link, lk_time);
532 }
533
534 static void
535 check_mds_rec_unlink(void)
536 {
537         BLANK_LINE();
538         CHECK_STRUCT(mds_rec_unlink);
539         CHECK_MEMBER(mds_rec_unlink, ul_opcode);
540         CHECK_MEMBER(mds_rec_unlink, ul_fsuid);
541         CHECK_MEMBER(mds_rec_unlink, ul_fsgid);
542         CHECK_MEMBER(mds_rec_unlink, ul_cap);
543         CHECK_MEMBER(mds_rec_unlink, ul_suppgid);
544         CHECK_MEMBER(mds_rec_unlink, ul_mode);
545         CHECK_MEMBER(mds_rec_unlink, ul_fid1);
546         CHECK_MEMBER(mds_rec_unlink, ul_fid2);
547         CHECK_MEMBER(mds_rec_unlink, ul_time);
548 }
549
550 static void
551 check_mds_rec_rename(void)
552 {
553         BLANK_LINE();
554         CHECK_STRUCT(mds_rec_rename);
555         CHECK_MEMBER(mds_rec_rename, rn_opcode);
556         CHECK_MEMBER(mds_rec_rename, rn_fsuid);
557         CHECK_MEMBER(mds_rec_rename, rn_fsgid);
558         CHECK_MEMBER(mds_rec_rename, rn_cap);
559         CHECK_MEMBER(mds_rec_rename, rn_suppgid1);
560         CHECK_MEMBER(mds_rec_rename, rn_suppgid2);
561         CHECK_MEMBER(mds_rec_rename, rn_fid1);
562         CHECK_MEMBER(mds_rec_rename, rn_fid2);
563         CHECK_MEMBER(mds_rec_rename, rn_time);
564 }
565
566 static void
567 check_mds_rec_join(void)
568 {
569         BLANK_LINE();
570         CHECK_STRUCT(mds_rec_join);
571         CHECK_MEMBER(mds_rec_join, jr_fid);
572         CHECK_MEMBER(mds_rec_join, jr_headsize);
573 }
574
575 static void
576 check_lov_desc(void)
577 {
578         BLANK_LINE();
579         CHECK_STRUCT(lov_desc);
580         CHECK_MEMBER(lov_desc, ld_tgt_count);
581         CHECK_MEMBER(lov_desc, ld_active_tgt_count);
582         CHECK_MEMBER(lov_desc, ld_default_stripe_count);
583         CHECK_MEMBER(lov_desc, ld_pattern);
584         CHECK_MEMBER(lov_desc, ld_default_stripe_size);
585         CHECK_MEMBER(lov_desc, ld_default_stripe_offset);
586         CHECK_MEMBER(lov_desc, ld_qos_maxage);
587         CHECK_MEMBER(lov_desc, ld_padding_1);
588         CHECK_MEMBER(lov_desc, ld_padding_2);
589         CHECK_MEMBER(lov_desc, ld_uuid);
590 }
591
592 static void
593 check_ldlm_res_id(void)
594 {
595         BLANK_LINE();
596         CHECK_STRUCT(ldlm_res_id);
597         CHECK_MEMBER(ldlm_res_id, name[RES_NAME_SIZE]);
598 }
599
600 static void
601 check_ldlm_extent(void)
602 {
603         BLANK_LINE();
604         CHECK_STRUCT(ldlm_extent);
605         CHECK_MEMBER(ldlm_extent, start);
606         CHECK_MEMBER(ldlm_extent, end);
607         CHECK_MEMBER(ldlm_extent, gid);
608 }
609
610 static void
611 check_ldlm_inodebits(void)
612 {
613         BLANK_LINE();
614         CHECK_STRUCT(ldlm_inodebits);
615         CHECK_MEMBER(ldlm_inodebits, bits);
616 }
617
618 static void
619 check_ldlm_flock(void)
620 {
621         BLANK_LINE();
622         CHECK_STRUCT(ldlm_flock);
623         CHECK_MEMBER(ldlm_flock, start);
624         CHECK_MEMBER(ldlm_flock, end);
625         CHECK_MEMBER(ldlm_flock, blocking_pid);
626         CHECK_MEMBER(ldlm_flock, pid);
627 }
628
629 static void
630 check_ldlm_intent(void)
631 {
632         BLANK_LINE();
633         CHECK_STRUCT(ldlm_intent);
634         CHECK_MEMBER(ldlm_intent, opc);
635 }
636
637 static void
638 check_ldlm_resource_desc(void)
639 {
640         BLANK_LINE();
641         CHECK_STRUCT(ldlm_resource_desc);
642         CHECK_MEMBER(ldlm_resource_desc, lr_type);
643         CHECK_MEMBER(ldlm_resource_desc, lr_padding);
644         CHECK_MEMBER(ldlm_resource_desc, lr_name);
645 }
646
647 static void
648 check_ldlm_lock_desc(void)
649 {
650         BLANK_LINE();
651         CHECK_STRUCT(ldlm_lock_desc);
652         CHECK_MEMBER(ldlm_lock_desc, l_resource);
653         CHECK_MEMBER(ldlm_lock_desc, l_req_mode);
654         CHECK_MEMBER(ldlm_lock_desc, l_granted_mode);
655         CHECK_MEMBER(ldlm_lock_desc, l_policy_data);
656 }
657
658 static void
659 check_ldlm_request(void)
660 {
661         BLANK_LINE();
662         CHECK_STRUCT(ldlm_request);
663         CHECK_MEMBER(ldlm_request, lock_flags);
664         CHECK_MEMBER(ldlm_request, lock_padding);
665         CHECK_MEMBER(ldlm_request, lock_desc);
666         CHECK_MEMBER(ldlm_request, lock_handle1);
667         CHECK_MEMBER(ldlm_request, lock_handle2);
668 }
669
670 static void
671 check_ldlm_reply(void)
672 {
673         BLANK_LINE();
674         CHECK_STRUCT(ldlm_reply);
675         CHECK_MEMBER(ldlm_reply, lock_flags);
676         CHECK_MEMBER(ldlm_request, lock_padding);
677         CHECK_MEMBER(ldlm_request, lock_desc);
678         CHECK_MEMBER(ldlm_reply, lock_handle);
679         CHECK_MEMBER(ldlm_reply, lock_policy_res1);
680         CHECK_MEMBER(ldlm_reply, lock_policy_res2);
681 }
682
683 static void
684 check_ldlm_lvb(void)
685 {
686         BLANK_LINE();
687         CHECK_STRUCT(ost_lvb);
688         CHECK_MEMBER(ost_lvb, lvb_size);
689         CHECK_MEMBER(ost_lvb, lvb_mtime);
690         CHECK_MEMBER(ost_lvb, lvb_atime);
691         CHECK_MEMBER(ost_lvb, lvb_ctime);
692         CHECK_MEMBER(ost_lvb, lvb_blocks);
693 }
694
695
696 static void
697 check_llog_logid(void)
698 {
699         BLANK_LINE();
700         CHECK_STRUCT(llog_logid);
701         CHECK_MEMBER(llog_logid, lgl_oid);
702         CHECK_MEMBER(llog_logid, lgl_ogr);
703         CHECK_MEMBER(llog_logid, lgl_ogen);
704
705         CHECK_CVALUE(OST_SZ_REC);
706         CHECK_CVALUE(OST_RAID1_REC);
707         CHECK_CVALUE(MDS_UNLINK_REC);
708         CHECK_CVALUE(MDS_SETATTR_REC);
709         CHECK_CVALUE(OBD_CFG_REC);
710         CHECK_CVALUE(PTL_CFG_REC);
711         CHECK_CVALUE(LLOG_GEN_REC);
712         CHECK_CVALUE(LLOG_JOIN_REC);
713         CHECK_CVALUE(LLOG_HDR_MAGIC);
714         CHECK_CVALUE(LLOG_LOGID_MAGIC);
715 }
716
717 static void
718 check_llog_catid(void)
719 {
720         BLANK_LINE();
721         CHECK_STRUCT(llog_catid);
722         CHECK_MEMBER(llog_catid, lci_logid);
723         CHECK_MEMBER(llog_catid, lci_padding1);
724         CHECK_MEMBER(llog_catid, lci_padding2);
725         CHECK_MEMBER(llog_catid, lci_padding3);
726 }
727
728 static void
729 check_llog_rec_hdr(void)
730 {
731         BLANK_LINE();
732         CHECK_STRUCT(llog_rec_hdr);
733         CHECK_MEMBER(llog_rec_hdr, lrh_len);
734         CHECK_MEMBER(llog_rec_hdr, lrh_index);
735         CHECK_MEMBER(llog_rec_hdr, lrh_type);
736         CHECK_MEMBER(llog_rec_hdr, padding);
737 }
738
739 static void
740 check_llog_rec_tail(void)
741 {
742         BLANK_LINE();
743         CHECK_STRUCT(llog_rec_tail);
744         CHECK_MEMBER(llog_rec_tail, lrt_len);
745         CHECK_MEMBER(llog_rec_tail, lrt_index);
746 }
747
748 static void
749 check_llog_logid_rec(void)
750 {
751         BLANK_LINE();
752         CHECK_STRUCT(llog_logid_rec);
753         CHECK_MEMBER(llog_logid_rec, lid_hdr);
754         CHECK_MEMBER(llog_logid_rec, lid_id);
755         CHECK_MEMBER(llog_logid_rec, padding1);
756         CHECK_MEMBER(llog_logid_rec, padding2);
757         CHECK_MEMBER(llog_logid_rec, padding3);
758         CHECK_MEMBER(llog_logid_rec, padding4);
759         CHECK_MEMBER(llog_logid_rec, padding5);
760         CHECK_MEMBER(llog_logid_rec, lid_tail);
761 }
762
763 static void
764 check_llog_create_rec(void)
765 {
766         BLANK_LINE();
767         CHECK_STRUCT(llog_create_rec);
768         CHECK_MEMBER(llog_create_rec, lcr_hdr);
769         CHECK_MEMBER(llog_create_rec, lcr_fid);
770         CHECK_MEMBER(llog_create_rec, lcr_oid);
771         CHECK_MEMBER(llog_create_rec, lcr_ogen);
772         CHECK_MEMBER(llog_create_rec, padding);
773 }
774
775 static void
776 check_llog_orphan_rec(void)
777 {
778         BLANK_LINE();
779         CHECK_STRUCT(llog_orphan_rec);
780         CHECK_MEMBER(llog_orphan_rec, lor_hdr);
781         CHECK_MEMBER(llog_orphan_rec, lor_oid);
782         CHECK_MEMBER(llog_orphan_rec, lor_ogen);
783         CHECK_MEMBER(llog_orphan_rec, padding);
784         CHECK_MEMBER(llog_orphan_rec, lor_tail);
785 }
786
787 static void
788 check_llog_unlink_rec(void)
789 {
790         BLANK_LINE();
791         CHECK_STRUCT(llog_unlink_rec);
792         CHECK_MEMBER(llog_unlink_rec, lur_hdr);
793         CHECK_MEMBER(llog_unlink_rec, lur_oid);
794         CHECK_MEMBER(llog_unlink_rec, lur_ogen);
795         CHECK_MEMBER(llog_unlink_rec, padding);
796         CHECK_MEMBER(llog_unlink_rec, lur_tail);
797 }
798
799 static void
800 check_llog_setattr_rec(void)
801 {
802         BLANK_LINE();
803         CHECK_STRUCT(llog_setattr_rec);
804         CHECK_MEMBER(llog_setattr_rec, lsr_hdr);
805         CHECK_MEMBER(llog_setattr_rec, lsr_oid);
806         CHECK_MEMBER(llog_setattr_rec, lsr_ogen);
807         CHECK_MEMBER(llog_setattr_rec, lsr_uid);
808         CHECK_MEMBER(llog_setattr_rec, lsr_gid);
809         CHECK_MEMBER(llog_setattr_rec, padding);
810         CHECK_MEMBER(llog_setattr_rec, lsr_tail);
811 }
812
813 static void
814 check_llog_size_change_rec(void)
815 {
816         BLANK_LINE();
817         CHECK_STRUCT(llog_size_change_rec);
818         CHECK_MEMBER(llog_size_change_rec, lsc_hdr);
819         CHECK_MEMBER(llog_size_change_rec, lsc_fid);
820         CHECK_MEMBER(llog_size_change_rec, lsc_io_epoch);
821         CHECK_MEMBER(llog_size_change_rec, padding);
822         CHECK_MEMBER(llog_size_change_rec, lsc_tail);
823 }
824
825 static void
826 check_llog_gen(void)
827 {
828         BLANK_LINE();
829         CHECK_STRUCT(llog_gen);
830         CHECK_MEMBER(llog_gen, mnt_cnt);
831         CHECK_MEMBER(llog_gen, conn_cnt);
832 }
833
834 static void
835 check_llog_gen_rec(void)
836 {
837         BLANK_LINE();
838         CHECK_STRUCT(llog_gen_rec);
839         CHECK_MEMBER(llog_gen_rec, lgr_hdr);
840         CHECK_MEMBER(llog_gen_rec, lgr_gen);
841         CHECK_MEMBER(llog_gen_rec, lgr_tail);
842 }
843
844 static void
845 check_llog_log_hdr(void)
846 {
847         BLANK_LINE();
848         CHECK_STRUCT(llog_log_hdr);
849         CHECK_MEMBER(llog_log_hdr, llh_hdr);
850         CHECK_MEMBER(llog_log_hdr, llh_timestamp);
851         CHECK_MEMBER(llog_log_hdr, llh_count);
852         CHECK_MEMBER(llog_log_hdr, llh_bitmap_offset);
853         CHECK_MEMBER(llog_log_hdr, llh_size);
854         CHECK_MEMBER(llog_log_hdr, llh_flags);
855         CHECK_MEMBER(llog_log_hdr, llh_cat_idx);
856         CHECK_MEMBER(llog_log_hdr, llh_tgtuuid);
857         CHECK_MEMBER(llog_log_hdr, llh_reserved);
858         CHECK_MEMBER(llog_log_hdr, llh_bitmap);
859         CHECK_MEMBER(llog_log_hdr, llh_tail);
860 }
861
862 static void
863 check_llog_cookie(void)
864 {
865         BLANK_LINE();
866         CHECK_STRUCT(llog_cookie);
867         CHECK_MEMBER(llog_cookie, lgc_lgl);
868         CHECK_MEMBER(llog_cookie, lgc_subsys);
869         CHECK_MEMBER(llog_cookie, lgc_index);
870         CHECK_MEMBER(llog_cookie, lgc_padding);
871 }
872
873 static void
874 check_llogd_body(void)
875 {
876         BLANK_LINE();
877         CHECK_STRUCT(llogd_body);
878         CHECK_MEMBER(llogd_body, lgd_logid);
879         CHECK_MEMBER(llogd_body, lgd_ctxt_idx);
880         CHECK_MEMBER(llogd_body, lgd_llh_flags);
881         CHECK_MEMBER(llogd_body, lgd_index);
882         CHECK_MEMBER(llogd_body, lgd_saved_index);
883         CHECK_MEMBER(llogd_body, lgd_len);
884         CHECK_MEMBER(llogd_body, lgd_cur_offset);
885
886         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CREATE);
887         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
888         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_READ_HEADER);
889         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_WRITE_REC);
890         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_CLOSE);
891         CHECK_CVALUE(LLOG_ORIGIN_CONNECT);
892         CHECK_CVALUE(LLOG_CATINFO);
893         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_PREV_BLOCK);
894         CHECK_CVALUE(LLOG_ORIGIN_HANDLE_DESTROY);
895 }
896
897 static void
898 check_llogd_conn_body(void)
899 {
900         BLANK_LINE();
901         CHECK_STRUCT(llogd_conn_body);
902         CHECK_MEMBER(llogd_conn_body, lgdc_gen);
903         CHECK_MEMBER(llogd_conn_body, lgdc_logid);
904         CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx);
905 }
906
907 static void
908 check_mds_extent_desc(void)
909 {
910         BLANK_LINE();
911         CHECK_STRUCT(mds_extent_desc);
912         CHECK_MEMBER(mds_extent_desc, med_start);
913         CHECK_MEMBER(mds_extent_desc, med_len);
914         CHECK_MEMBER(mds_extent_desc, med_lmm);
915 }
916
917 static void
918 check_llog_array_rec(void)
919 {
920         BLANK_LINE();
921         CHECK_STRUCT(llog_array_rec);
922         CHECK_MEMBER(llog_array_rec, lmr_hdr);
923         CHECK_MEMBER(llog_array_rec, lmr_med);
924         CHECK_MEMBER(llog_array_rec, lmr_tail);
925 }
926
927 static void
928 check_qunit_data(void)
929 {
930         BLANK_LINE();
931         CHECK_STRUCT(qunit_data);
932         CHECK_MEMBER(qunit_data, qd_id);
933         CHECK_MEMBER(qunit_data, qd_flags);
934         CHECK_MEMBER(qunit_data, qd_count);
935 }
936
937 static void
938 check_qunit_data_old(void)
939 {
940         BLANK_LINE();
941         CHECK_STRUCT(qunit_data_old);
942         CHECK_MEMBER(qunit_data_old, qd_id);
943         CHECK_MEMBER(qunit_data_old, qd_type);
944         CHECK_MEMBER(qunit_data_old, qd_count);
945         CHECK_MEMBER(qunit_data_old, qd_isblk);
946 }
947
948 static void
949 check_mgs_target_info(void)
950 {
951         BLANK_LINE();
952         CHECK_STRUCT(mgs_target_info);
953         CHECK_MEMBER(mgs_target_info, mti_lustre_ver);
954         CHECK_MEMBER(mgs_target_info, mti_stripe_index);
955         CHECK_MEMBER(mgs_target_info, mti_config_ver);
956         CHECK_MEMBER(mgs_target_info, mti_flags);
957         CHECK_MEMBER(mgs_target_info, mti_nid_count);
958         CHECK_MEMBER(mgs_target_info, mti_fsname);
959         CHECK_MEMBER(mgs_target_info, mti_svname);
960         CHECK_MEMBER(mgs_target_info, mti_uuid);
961         CHECK_MEMBER(mgs_target_info, mti_nids);
962         CHECK_MEMBER(mgs_target_info, mti_params);
963 }
964
965 static void
966 check_lustre_disk_data(void)
967 {
968         BLANK_LINE();
969         CHECK_STRUCT(lustre_disk_data);
970         CHECK_MEMBER(lustre_disk_data, ldd_magic);
971         CHECK_MEMBER(lustre_disk_data, ldd_feature_compat);
972         CHECK_MEMBER(lustre_disk_data, ldd_feature_rocompat);
973         CHECK_MEMBER(lustre_disk_data, ldd_feature_incompat);
974         CHECK_MEMBER(lustre_disk_data, ldd_config_ver);
975         CHECK_MEMBER(lustre_disk_data, ldd_flags);
976         CHECK_MEMBER(lustre_disk_data, ldd_svindex);
977         CHECK_MEMBER(lustre_disk_data, ldd_mount_type);
978         CHECK_MEMBER(lustre_disk_data, ldd_fsname);
979         CHECK_MEMBER(lustre_disk_data, ldd_svname);
980         CHECK_MEMBER(lustre_disk_data, ldd_uuid);
981         CHECK_MEMBER(lustre_disk_data, ldd_userdata);
982         CHECK_MEMBER(lustre_disk_data, ldd_mount_opts);
983         CHECK_MEMBER(lustre_disk_data, ldd_params);
984 }
985
986 static void
987 system_string (char *cmdline, char *str, int len)
988 {
989         int   fds[2];
990         int   rc;
991         pid_t pid;
992
993         rc = pipe(fds);
994         if (rc != 0)
995                 abort();
996
997         pid = fork();
998         if (pid == 0) {
999                 /* child */
1000                 int   fd = fileno(stdout);
1001
1002                 rc = dup2(fds[1], fd);
1003                 if (rc != fd)
1004                         abort();
1005
1006                 exit(system(cmdline));
1007                 /* notreached */
1008         } else if ((int)pid < 0) {
1009                 abort();
1010         } else {
1011                 FILE *f = fdopen(fds[0], "r");
1012
1013                 if (f == NULL)
1014                         abort();
1015
1016                 close(fds[1]);
1017
1018                 if (fgets(str, len, f) == NULL)
1019                         abort();
1020
1021                 if (waitpid(pid, &rc, 0) != pid)
1022                         abort();
1023
1024                 if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
1025                         abort();
1026
1027                 if (strnlen(str, len) == len)
1028                         str[len - 1] = 0;
1029
1030                 if (str[strlen(str) - 1] == '\n')
1031                         str[strlen(str) - 1] = 0;
1032
1033                 fclose(f);
1034         }
1035 }
1036
1037 int
1038 main(int argc, char **argv)
1039 {
1040         char unameinfo[80];
1041         char gccinfo[80];
1042
1043         system_string("uname -a", unameinfo, sizeof(unameinfo));
1044         system_string(CC " -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
1045
1046         printf ("void lustre_assert_wire_constants(void)\n"
1047                 "{\n"
1048                 "        /* Wire protocol assertions generated by 'wirecheck'\n"
1049                 "         * (make -C lustre/utils newwirecheck)\n"
1050                 "         * running on %s\n"
1051                 "         * with %s */\n"
1052                 "\n", unameinfo, gccinfo);
1053
1054         BLANK_LINE ();
1055
1056         COMMENT("Constants...");
1057         CHECK_DEFINE(LUSTRE_MSG_MAGIC_V1);
1058         CHECK_DEFINE(LUSTRE_MSG_MAGIC_V2);
1059         CHECK_DEFINE(PTLRPC_MSG_VERSION);
1060
1061         CHECK_VALUE(PTL_RPC_MSG_REQUEST);
1062         CHECK_VALUE(PTL_RPC_MSG_ERR);
1063         CHECK_VALUE(PTL_RPC_MSG_REPLY);
1064
1065         CHECK_VALUE(MSG_LAST_REPLAY);
1066         CHECK_VALUE(MSG_RESENT);
1067         CHECK_VALUE(MSG_REPLAY);
1068
1069         CHECK_VALUE(MSG_CONNECT_RECOVERING);
1070         CHECK_VALUE(MSG_CONNECT_RECONNECT);
1071         CHECK_VALUE(MSG_CONNECT_REPLAYABLE);
1072
1073         CHECK_VALUE(OST_REPLY);
1074         CHECK_VALUE(OST_GETATTR);
1075         CHECK_VALUE(OST_SETATTR);
1076         CHECK_VALUE(OST_READ);
1077         CHECK_VALUE(OST_WRITE);
1078         CHECK_VALUE(OST_CREATE);
1079         CHECK_VALUE(OST_DESTROY);
1080         CHECK_VALUE(OST_GET_INFO);
1081         CHECK_VALUE(OST_CONNECT);
1082         CHECK_VALUE(OST_DISCONNECT);
1083         CHECK_VALUE(OST_PUNCH);
1084         CHECK_VALUE(OST_OPEN);
1085         CHECK_VALUE(OST_CLOSE);
1086         CHECK_VALUE(OST_STATFS);
1087         CHECK_VALUE(OST_SYNC);
1088         CHECK_VALUE(OST_QUOTACHECK);
1089         CHECK_VALUE(OST_QUOTACTL);
1090         CHECK_VALUE(OST_LAST_OPC);
1091
1092         CHECK_DEFINE(OBD_OBJECT_EOF);
1093
1094         CHECK_VALUE(MDS_GETATTR);
1095         CHECK_VALUE(MDS_GETATTR_NAME);
1096         CHECK_VALUE(MDS_CLOSE);
1097         CHECK_VALUE(MDS_REINT);
1098         CHECK_VALUE(MDS_READPAGE);
1099         CHECK_VALUE(MDS_CONNECT);
1100         CHECK_VALUE(MDS_DISCONNECT);
1101         CHECK_VALUE(MDS_GETSTATUS);
1102         CHECK_VALUE(MDS_STATFS);
1103         CHECK_VALUE(MDS_PIN);
1104         CHECK_VALUE(MDS_UNPIN);
1105         CHECK_VALUE(MDS_SYNC);
1106         CHECK_VALUE(MDS_DONE_WRITING);
1107         CHECK_VALUE(MDS_SET_INFO);
1108         CHECK_VALUE(MDS_QUOTACHECK);
1109         CHECK_VALUE(MDS_QUOTACTL);
1110         CHECK_VALUE(MDS_LAST_OPC);
1111
1112         CHECK_VALUE(REINT_SETATTR);
1113         CHECK_VALUE(REINT_CREATE);
1114         CHECK_VALUE(REINT_LINK);
1115         CHECK_VALUE(REINT_UNLINK);
1116         CHECK_VALUE(REINT_RENAME);
1117         CHECK_VALUE(REINT_OPEN);
1118         CHECK_VALUE(REINT_MAX);
1119
1120         CHECK_VALUE(MGS_CONNECT);
1121         CHECK_VALUE(MGS_DISCONNECT);
1122         CHECK_VALUE(MGS_EXCEPTION);
1123         CHECK_VALUE(MGS_TARGET_REG);
1124         CHECK_VALUE(MGS_TARGET_DEL);
1125
1126         CHECK_VALUE(DISP_IT_EXECD);
1127         CHECK_VALUE(DISP_LOOKUP_EXECD);
1128         CHECK_VALUE(DISP_LOOKUP_NEG);
1129         CHECK_VALUE(DISP_LOOKUP_POS);
1130         CHECK_VALUE(DISP_OPEN_CREATE);
1131         CHECK_VALUE(DISP_OPEN_OPEN);
1132
1133         CHECK_VALUE(MDS_STATUS_CONN);
1134         CHECK_VALUE(MDS_STATUS_LOV);
1135
1136         CHECK_VALUE(LDLM_ENQUEUE);
1137         CHECK_VALUE(LDLM_CONVERT);
1138         CHECK_VALUE(LDLM_CANCEL);
1139         CHECK_VALUE(LDLM_BL_CALLBACK);
1140         CHECK_VALUE(LDLM_CP_CALLBACK);
1141         CHECK_VALUE(LDLM_GL_CALLBACK);
1142         CHECK_VALUE(LDLM_LAST_OPC);
1143
1144         CHECK_VALUE(LCK_EX);
1145         CHECK_VALUE(LCK_PW);
1146         CHECK_VALUE(LCK_PR);
1147         CHECK_VALUE(LCK_CW);
1148         CHECK_VALUE(LCK_CR);
1149         CHECK_VALUE(LCK_NL);
1150         CHECK_VALUE(LCK_GROUP);
1151         CHECK_VALUE(LCK_MAXMODE);
1152
1153         CHECK_CVALUE(LDLM_PLAIN);
1154         CHECK_CVALUE(LDLM_EXTENT);
1155         CHECK_CVALUE(LDLM_FLOCK);
1156         CHECK_CVALUE(LDLM_IBITS);
1157
1158         CHECK_VALUE(OBD_PING);
1159         CHECK_VALUE(OBD_LOG_CANCEL);
1160         CHECK_VALUE(OBD_QC_CALLBACK);
1161         CHECK_VALUE(OBD_LAST_OPC);
1162
1163         CHECK_VALUE(QUOTA_DQACQ);
1164         CHECK_VALUE(QUOTA_DQREL);
1165
1166         CHECK_VALUE(MGS_CONNECT);
1167         CHECK_VALUE(MGS_DISCONNECT);
1168         CHECK_VALUE(MGS_EXCEPTION);   
1169         CHECK_VALUE(MGS_TARGET_REG);
1170         CHECK_VALUE(MGS_TARGET_DEL);
1171
1172         COMMENT("Sizes and Offsets");
1173         BLANK_LINE();
1174         CHECK_STRUCT(obd_uuid);
1175         check_lustre_handle();
1176         check_lustre_msg_v1();
1177         check_lustre_msg_v2();
1178         printf("        LASSERT(offsetof(struct lustre_msg_v1, lm_magic) == "
1179                "offsetof(struct lustre_msg_v2, lm_magic));\n");
1180         check_ptlrpc_body();
1181         check_obd_connect_data();
1182         check_obdo();
1183         check_lov_mds_md_v1();
1184         check_lov_mds_md_join();
1185         check_obd_statfs();
1186         check_obd_ioobj();
1187         check_obd_quotactl();
1188         check_niobuf_remote();
1189         check_ost_body();
1190         check_ll_fid();
1191         check_mds_status_req();
1192         check_mds_body();
1193         check_mds_rec_setattr();
1194         check_mds_rec_create();
1195         check_mds_rec_link();
1196         check_mds_rec_unlink();
1197         check_mds_rec_rename();
1198         check_mds_rec_join();
1199         check_lov_desc();
1200         check_ldlm_res_id();
1201         check_ldlm_extent();
1202         check_ldlm_flock();
1203         check_ldlm_inodebits();
1204         check_ldlm_intent();
1205         check_ldlm_resource_desc();
1206         check_ldlm_lock_desc();
1207         check_ldlm_request();
1208         check_ldlm_reply();
1209         check_ldlm_lvb();
1210         check_llog_logid();
1211         check_llog_catid();
1212         check_llog_rec_hdr();
1213         check_llog_rec_tail();
1214         check_llog_logid_rec();
1215         check_llog_create_rec();
1216         check_llog_orphan_rec();
1217         check_llog_unlink_rec();
1218         check_llog_setattr_rec();
1219         check_llog_size_change_rec();
1220         check_llog_gen();
1221         check_llog_gen_rec();
1222         check_llog_log_hdr();
1223         check_llog_cookie();
1224         check_llogd_body();
1225         check_llogd_conn_body();
1226         check_llog_array_rec();
1227         check_mds_extent_desc();
1228         check_qunit_data();
1229         check_qunit_data_old();
1230         check_mgs_target_info();
1231         check_lustre_disk_data();
1232
1233
1234         printf("}\n\n");
1235
1236         return(0);
1237 }