1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
8 #include <linux/lustre_lib.h>
9 #include <linux/lustre_idl.h>
11 #define BLANK_LINE() \
18 printf(" /* "c" */\n"); \
21 #define STRINGIFY(a) #a
23 #define CHECK_DEFINE(a) \
25 printf(" LASSERTF("#a" == "STRINGIFY(a) \
26 ",\" found %%lld\\n\",\n " \
27 "(long long)"#a");\n"); \
30 #define CHECK_VALUE(a) \
32 printf(" LASSERTF("#a \
33 " == %d, \" found %%lld\\n\",\n "\
34 "(long long)"#a");\n",a);\
37 #define CHECK_MEMBER_OFFSET(s,m) \
39 CHECK_VALUE(offsetof(struct s, m)); \
42 #define CHECK_MEMBER_SIZEOF(s,m) \
44 CHECK_VALUE((int)sizeof(((struct s *)0)->m)); \
47 #define CHECK_MEMBER(s,m) \
49 CHECK_MEMBER_OFFSET(s, m); \
50 CHECK_MEMBER_SIZEOF(s, m); \
53 #define CHECK_STRUCT(s) \
55 COMMENT("Checks for struct "#s); \
56 CHECK_VALUE((int)sizeof(struct s)); \
70 check_lustre_handle(void)
73 CHECK_STRUCT(lustre_handle);
74 CHECK_MEMBER(lustre_handle, cookie);
78 check_lustre_msg(void)
81 CHECK_STRUCT(lustre_msg);
82 CHECK_MEMBER(lustre_msg, handle);
83 CHECK_MEMBER(lustre_msg, magic);
84 CHECK_MEMBER(lustre_msg, type);
85 CHECK_MEMBER(lustre_msg, version);
86 CHECK_MEMBER(lustre_msg, opc);
87 CHECK_MEMBER(lustre_msg, last_xid);
88 CHECK_MEMBER(lustre_msg, last_committed);
89 CHECK_MEMBER(lustre_msg, transno);
90 CHECK_MEMBER(lustre_msg, status);
91 CHECK_MEMBER(lustre_msg, flags);
92 CHECK_MEMBER(lustre_msg, bufcount);
93 CHECK_MEMBER(lustre_msg, buflens[7]);
101 CHECK_MEMBER(obdo, o_id);
102 CHECK_MEMBER(obdo, o_gr);
103 CHECK_MEMBER(obdo, o_atime);
104 CHECK_MEMBER(obdo, o_mtime);
105 CHECK_MEMBER(obdo, o_ctime);
106 CHECK_MEMBER(obdo, o_size);
107 CHECK_MEMBER(obdo, o_blocks);
108 CHECK_MEMBER(obdo, o_grant);
109 CHECK_MEMBER(obdo, o_blksize);
110 CHECK_MEMBER(obdo, o_mode);
111 CHECK_MEMBER(obdo, o_uid);
112 CHECK_MEMBER(obdo, o_gid);
113 CHECK_MEMBER(obdo, o_flags);
114 CHECK_MEMBER(obdo, o_nlink);
115 CHECK_MEMBER(obdo, o_generation);
116 CHECK_MEMBER(obdo, o_valid);
117 CHECK_MEMBER(obdo, o_misc);
118 CHECK_MEMBER(obdo, o_easize);
119 CHECK_MEMBER(obdo, o_inline);
121 CHECK_VALUE(OBD_MD_FLID);
122 CHECK_VALUE(OBD_MD_FLATIME);
123 CHECK_VALUE(OBD_MD_FLMTIME);
124 CHECK_VALUE(OBD_MD_FLCTIME);
125 CHECK_VALUE(OBD_MD_FLSIZE);
126 CHECK_VALUE(OBD_MD_FLBLOCKS);
127 CHECK_VALUE(OBD_MD_FLBLKSZ);
128 CHECK_VALUE(OBD_MD_FLMODE);
129 CHECK_VALUE(OBD_MD_FLTYPE);
130 CHECK_VALUE(OBD_MD_FLUID);
131 CHECK_VALUE(OBD_MD_FLGID);
132 CHECK_VALUE(OBD_MD_FLFLAGS);
133 CHECK_VALUE(OBD_MD_FLNLINK);
134 CHECK_VALUE(OBD_MD_FLGENER);
135 CHECK_VALUE(OBD_MD_FLINLINE);
136 CHECK_VALUE(OBD_MD_FLRDEV);
137 CHECK_VALUE(OBD_MD_FLEASIZE);
138 CHECK_VALUE(OBD_MD_LINKNAME);
139 CHECK_VALUE(OBD_MD_FLHANDLE);
140 CHECK_VALUE(OBD_MD_FLCKSUM);
141 CHECK_VALUE(OBD_MD_FLQOS);
142 CHECK_VALUE(OBD_MD_FLOSCOPQ);
143 CHECK_VALUE(OBD_MD_FLCOOKIE);
144 CHECK_VALUE(OBD_MD_FLGROUP);
146 CHECK_VALUE(OBD_FL_INLINEDATA);
147 CHECK_VALUE(OBD_FL_OBDMDEXISTS);
148 CHECK_VALUE(OBD_FL_DELORPHAN);
149 CHECK_VALUE(OBD_FL_NORPC);
150 CHECK_VALUE(OBD_FL_IDONLY);
151 CHECK_VALUE(OBD_FL_RECREATE_OBJS);
155 check_lov_mds_md_v1(void)
158 CHECK_STRUCT(lov_mds_md_v1);
159 CHECK_MEMBER(lov_mds_md_v1, lmm_magic);
160 CHECK_MEMBER(lov_mds_md_v1, lmm_pattern);
161 CHECK_MEMBER(lov_mds_md_v1, lmm_object_id);
162 CHECK_MEMBER(lov_mds_md_v1, lmm_object_gr);
163 CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_size);
164 CHECK_MEMBER(lov_mds_md_v1, lmm_stripe_count);
165 CHECK_MEMBER(lov_mds_md_v1, lmm_objects);
168 CHECK_STRUCT(lov_ost_data_v1);
169 CHECK_MEMBER(lov_ost_data_v1, l_object_id);
170 CHECK_MEMBER(lov_ost_data_v1, l_object_gr);
171 CHECK_MEMBER(lov_ost_data_v1, l_ost_gen);
172 CHECK_MEMBER(lov_ost_data_v1, l_ost_idx);
174 CHECK_VALUE(LOV_MAGIC_V0);
175 CHECK_VALUE(LOV_MAGIC_V1);
177 CHECK_VALUE(LOV_PATTERN_RAID0);
178 CHECK_VALUE(LOV_PATTERN_RAID1);
182 check_obd_statfs(void)
185 CHECK_STRUCT(obd_statfs);
186 CHECK_MEMBER(obd_statfs, os_type);
187 CHECK_MEMBER(obd_statfs, os_blocks);
188 CHECK_MEMBER(obd_statfs, os_bfree);
189 CHECK_MEMBER(obd_statfs, os_bavail);
190 CHECK_MEMBER(obd_statfs, os_ffree);
191 CHECK_MEMBER(obd_statfs, os_fsid);
192 CHECK_MEMBER(obd_statfs, os_bsize);
193 CHECK_MEMBER(obd_statfs, os_namelen);
194 CHECK_MEMBER(obd_statfs, os_spare);
198 check_obd_ioobj(void)
201 CHECK_STRUCT(obd_ioobj);
202 CHECK_MEMBER(obd_ioobj, ioo_id);
203 CHECK_MEMBER(obd_ioobj, ioo_gr);
204 CHECK_MEMBER(obd_ioobj, ioo_type);
205 CHECK_MEMBER(obd_ioobj, ioo_bufcnt);
209 check_niobuf_remote(void)
212 CHECK_STRUCT(niobuf_remote);
213 CHECK_MEMBER(niobuf_remote, offset);
214 CHECK_MEMBER(niobuf_remote, len);
215 CHECK_MEMBER(niobuf_remote, flags);
217 CHECK_VALUE(OBD_BRW_READ);
218 CHECK_VALUE(OBD_BRW_WRITE);
219 CHECK_VALUE(OBD_BRW_SYNC);
220 CHECK_VALUE(OBD_BRW_FROM_GRANT);
227 CHECK_STRUCT(ost_body);
228 CHECK_MEMBER(ost_body, oa);
235 CHECK_STRUCT(ll_fid);
236 CHECK_MEMBER(ll_fid, id);
237 CHECK_MEMBER(ll_fid, generation);
238 CHECK_MEMBER(ll_fid, f_type);
242 check_mds_status_req(void)
245 CHECK_STRUCT(mds_status_req);
246 CHECK_MEMBER(mds_status_req, flags);
247 CHECK_MEMBER(mds_status_req, repbuf);
254 CHECK_STRUCT(mds_body);
255 CHECK_MEMBER(mds_body, fid1);
256 CHECK_MEMBER(mds_body, fid2);
257 CHECK_MEMBER(mds_body, handle);
258 CHECK_MEMBER(mds_body, size);
259 CHECK_MEMBER(mds_body, blocks);
260 CHECK_MEMBER(mds_body, io_epoch);
261 CHECK_MEMBER(mds_body, ino);
262 CHECK_MEMBER(mds_body, valid);
263 CHECK_MEMBER(mds_body, fsuid);
264 CHECK_MEMBER(mds_body, fsgid);
265 CHECK_MEMBER(mds_body, capability);
266 CHECK_MEMBER(mds_body, mode);
267 CHECK_MEMBER(mds_body, uid);
268 CHECK_MEMBER(mds_body, gid);
269 CHECK_MEMBER(mds_body, mtime);
270 CHECK_MEMBER(mds_body, ctime);
271 CHECK_MEMBER(mds_body, atime);
272 CHECK_MEMBER(mds_body, flags);
273 CHECK_MEMBER(mds_body, rdev);
274 CHECK_MEMBER(mds_body, nlink);
275 CHECK_MEMBER(mds_body, generation);
276 CHECK_MEMBER(mds_body, suppgid);
277 CHECK_MEMBER(mds_body, eadatasize);
279 CHECK_VALUE(FMODE_READ);
280 CHECK_VALUE(FMODE_WRITE);
281 CHECK_VALUE(FMODE_EXEC);
282 CHECK_VALUE(MDS_OPEN_CREAT);
283 CHECK_VALUE(MDS_OPEN_EXCL);
284 CHECK_VALUE(MDS_OPEN_TRUNC);
285 CHECK_VALUE(MDS_OPEN_APPEND);
286 CHECK_VALUE(MDS_OPEN_SYNC);
287 CHECK_VALUE(MDS_OPEN_DIRECTORY);
288 CHECK_VALUE(MDS_OPEN_DELAY_CREATE);
289 CHECK_VALUE(MDS_OPEN_HAS_EA);
293 check_mds_rec_setattr(void)
296 CHECK_STRUCT(mds_rec_setattr);
297 CHECK_MEMBER(mds_rec_setattr, sa_opcode);
298 CHECK_MEMBER(mds_rec_setattr, sa_fsuid);
299 CHECK_MEMBER(mds_rec_setattr, sa_fsgid);
300 CHECK_MEMBER(mds_rec_setattr, sa_cap);
301 CHECK_MEMBER(mds_rec_setattr, sa_suppgid);
302 CHECK_MEMBER(mds_rec_setattr, sa_valid);
303 CHECK_MEMBER(mds_rec_setattr, sa_fid);
304 CHECK_MEMBER(mds_rec_setattr, sa_mode);
305 CHECK_MEMBER(mds_rec_setattr, sa_uid);
306 CHECK_MEMBER(mds_rec_setattr, sa_gid);
307 CHECK_MEMBER(mds_rec_setattr, sa_attr_flags);
308 CHECK_MEMBER(mds_rec_setattr, sa_size);
309 CHECK_MEMBER(mds_rec_setattr, sa_atime);
310 CHECK_MEMBER(mds_rec_setattr, sa_mtime);
311 CHECK_MEMBER(mds_rec_setattr, sa_ctime);
315 check_mds_rec_create(void)
318 CHECK_STRUCT(mds_rec_create);
319 CHECK_MEMBER(mds_rec_create, cr_opcode);
320 CHECK_MEMBER(mds_rec_create, cr_fsuid);
321 CHECK_MEMBER(mds_rec_create, cr_fsgid);
322 CHECK_MEMBER(mds_rec_create, cr_cap);
323 CHECK_MEMBER(mds_rec_create, cr_flags);
324 CHECK_MEMBER(mds_rec_create, cr_mode);
325 CHECK_MEMBER(mds_rec_create, cr_fid);
326 CHECK_MEMBER(mds_rec_create, cr_replayfid);
327 CHECK_MEMBER(mds_rec_create, cr_time);
328 CHECK_MEMBER(mds_rec_create, cr_rdev);
329 CHECK_MEMBER(mds_rec_create, cr_suppgid);
333 check_mds_rec_link(void)
336 CHECK_STRUCT(mds_rec_link);
337 CHECK_MEMBER(mds_rec_link, lk_opcode);
338 CHECK_MEMBER(mds_rec_link, lk_fsuid);
339 CHECK_MEMBER(mds_rec_link, lk_fsgid);
340 CHECK_MEMBER(mds_rec_link, lk_cap);
341 CHECK_MEMBER(mds_rec_link, lk_suppgid1);
342 CHECK_MEMBER(mds_rec_link, lk_suppgid2);
343 CHECK_MEMBER(mds_rec_link, lk_fid1);
344 CHECK_MEMBER(mds_rec_link, lk_fid2);
345 CHECK_MEMBER(mds_rec_link, lk_time);
349 check_mds_rec_unlink(void)
352 CHECK_STRUCT(mds_rec_unlink);
353 CHECK_MEMBER(mds_rec_unlink, ul_opcode);
354 CHECK_MEMBER(mds_rec_unlink, ul_fsuid);
355 CHECK_MEMBER(mds_rec_unlink, ul_fsgid);
356 CHECK_MEMBER(mds_rec_unlink, ul_cap);
357 CHECK_MEMBER(mds_rec_unlink, ul_suppgid);
358 CHECK_MEMBER(mds_rec_unlink, ul_mode);
359 CHECK_MEMBER(mds_rec_unlink, ul_fid1);
360 CHECK_MEMBER(mds_rec_unlink, ul_fid2);
361 CHECK_MEMBER(mds_rec_unlink, ul_time);
365 check_mds_rec_rename(void)
368 CHECK_STRUCT(mds_rec_rename);
369 CHECK_MEMBER(mds_rec_rename, rn_opcode);
370 CHECK_MEMBER(mds_rec_rename, rn_fsuid);
371 CHECK_MEMBER(mds_rec_rename, rn_fsgid);
372 CHECK_MEMBER(mds_rec_rename, rn_cap);
373 CHECK_MEMBER(mds_rec_rename, rn_suppgid1);
374 CHECK_MEMBER(mds_rec_rename, rn_suppgid2);
375 CHECK_MEMBER(mds_rec_rename, rn_fid1);
376 CHECK_MEMBER(mds_rec_rename, rn_fid2);
377 CHECK_MEMBER(mds_rec_rename, rn_time);
384 CHECK_STRUCT(lov_desc);
385 CHECK_MEMBER(lov_desc, ld_tgt_count);
386 CHECK_MEMBER(lov_desc, ld_active_tgt_count);
387 CHECK_MEMBER(lov_desc, ld_default_stripe_count);
388 CHECK_MEMBER(lov_desc, ld_pattern);
389 CHECK_MEMBER(lov_desc, ld_default_stripe_size);
390 CHECK_MEMBER(lov_desc, ld_default_stripe_offset);
391 CHECK_MEMBER(lov_desc, ld_uuid);
395 check_ldlm_res_id(void)
398 CHECK_STRUCT(ldlm_res_id);
399 CHECK_MEMBER(ldlm_res_id, name[RES_NAME_SIZE]);
403 check_ldlm_extent(void)
406 CHECK_STRUCT(ldlm_extent);
407 CHECK_MEMBER(ldlm_extent, start);
408 CHECK_MEMBER(ldlm_extent, end);
409 CHECK_MEMBER(ldlm_extent, gid);
413 check_ldlm_flock(void)
416 CHECK_STRUCT(ldlm_flock);
417 CHECK_MEMBER(ldlm_flock, start);
418 CHECK_MEMBER(ldlm_flock, end);
419 CHECK_MEMBER(ldlm_flock, pid);
420 CHECK_MEMBER(ldlm_flock, blocking_pid);
421 CHECK_MEMBER(ldlm_flock, blocking_export);
425 check_ldlm_intent(void)
428 CHECK_STRUCT(ldlm_intent);
429 CHECK_MEMBER(ldlm_intent, opc);
433 check_ldlm_resource_desc(void)
436 CHECK_STRUCT(ldlm_resource_desc);
437 CHECK_MEMBER(ldlm_resource_desc, lr_type);
438 CHECK_MEMBER(ldlm_resource_desc, lr_name);
442 check_ldlm_lock_desc(void)
445 CHECK_STRUCT(ldlm_lock_desc);
446 CHECK_MEMBER(ldlm_lock_desc, l_resource);
447 CHECK_MEMBER(ldlm_lock_desc, l_req_mode);
448 CHECK_MEMBER(ldlm_lock_desc, l_granted_mode);
449 CHECK_MEMBER(ldlm_lock_desc, l_policy_data);
453 check_ldlm_request(void)
456 CHECK_STRUCT(ldlm_request);
457 CHECK_MEMBER(ldlm_request, lock_flags);
458 CHECK_MEMBER(ldlm_request, lock_desc);
459 CHECK_MEMBER(ldlm_request, lock_handle1);
460 CHECK_MEMBER(ldlm_request, lock_handle2);
464 check_ldlm_reply(void)
467 CHECK_STRUCT(ldlm_reply);
468 CHECK_MEMBER(ldlm_reply, lock_flags);
469 CHECK_MEMBER(ldlm_request, lock_desc);
470 CHECK_MEMBER(ldlm_reply, lock_handle);
471 CHECK_MEMBER(ldlm_reply, lock_policy_res1);
472 CHECK_MEMBER(ldlm_reply, lock_policy_res2);
479 CHECK_STRUCT(ost_lvb);
480 CHECK_MEMBER(ost_lvb, lvb_size);
481 CHECK_MEMBER(ost_lvb, lvb_mtime);
482 CHECK_MEMBER(ost_lvb, lvb_atime);
483 CHECK_MEMBER(ost_lvb, lvb_ctime);
484 CHECK_MEMBER(ost_lvb, lvb_blocks);
491 CHECK_STRUCT(ptlbd_op);
492 CHECK_MEMBER(ptlbd_op, op_cmd);
493 CHECK_MEMBER(ptlbd_op, op_lun);
494 CHECK_MEMBER(ptlbd_op, op_niob_cnt);
495 CHECK_MEMBER(ptlbd_op, op__padding);
496 CHECK_MEMBER(ptlbd_op, op_block_cnt);
500 check_ptlbd_niob(void)
503 CHECK_STRUCT(ptlbd_niob);
504 CHECK_MEMBER(ptlbd_niob, n_xid);
505 CHECK_MEMBER(ptlbd_niob, n_block_nr);
506 CHECK_MEMBER(ptlbd_niob, n_offset);
507 CHECK_MEMBER(ptlbd_niob, n_length);
511 check_ptlbd_rsp(void)
514 CHECK_STRUCT(ptlbd_rsp);
515 CHECK_MEMBER(ptlbd_rsp, r_status);
516 CHECK_MEMBER(ptlbd_rsp, r_error_cnt);
520 check_llog_logid(void)
523 CHECK_STRUCT(llog_logid);
524 CHECK_MEMBER(llog_logid, lgl_oid);
525 CHECK_MEMBER(llog_logid, lgl_ogr);
526 CHECK_MEMBER(llog_logid, lgl_ogen);
528 CHECK_VALUE(OST_SZ_REC);
529 CHECK_VALUE(OST_RAID1_REC);
530 CHECK_VALUE(MDS_UNLINK_REC);
531 CHECK_VALUE(OBD_CFG_REC);
532 CHECK_VALUE(PTL_CFG_REC);
533 CHECK_VALUE(LLOG_GEN_REC);
534 CHECK_VALUE(LLOG_HDR_MAGIC);
535 CHECK_VALUE(LLOG_LOGID_MAGIC);
539 check_llog_catid(void)
542 CHECK_STRUCT(llog_catid);
543 CHECK_MEMBER(llog_catid, lci_logid);
547 check_llog_rec_hdr(void)
550 CHECK_STRUCT(llog_rec_hdr);
551 CHECK_MEMBER(llog_rec_hdr, lrh_len);
552 CHECK_MEMBER(llog_rec_hdr, lrh_index);
553 CHECK_MEMBER(llog_rec_hdr, lrh_type);
557 check_llog_rec_tail(void)
560 CHECK_STRUCT(llog_rec_tail);
561 CHECK_MEMBER(llog_rec_tail, lrt_len);
562 CHECK_MEMBER(llog_rec_tail, lrt_index);
566 check_llog_logid_rec(void)
569 CHECK_STRUCT(llog_logid_rec);
570 CHECK_MEMBER(llog_logid_rec, lid_hdr);
571 CHECK_MEMBER(llog_logid_rec, lid_id);
572 CHECK_MEMBER(llog_logid_rec, lid_tail);
576 check_llog_create_rec(void)
579 CHECK_STRUCT(llog_create_rec);
580 CHECK_MEMBER(llog_create_rec, lcr_hdr);
581 CHECK_MEMBER(llog_create_rec, lcr_fid);
582 CHECK_MEMBER(llog_create_rec, lcr_oid);
583 CHECK_MEMBER(llog_create_rec, lcr_ogen);
587 check_llog_orphan_rec(void)
590 CHECK_STRUCT(llog_orphan_rec);
591 CHECK_MEMBER(llog_orphan_rec, lor_hdr);
592 CHECK_MEMBER(llog_orphan_rec, lor_oid);
593 CHECK_MEMBER(llog_orphan_rec, lor_ogen);
594 CHECK_MEMBER(llog_orphan_rec, lor_tail);
598 check_llog_unlink_rec(void)
601 CHECK_STRUCT(llog_unlink_rec);
602 CHECK_MEMBER(llog_unlink_rec, lur_hdr);
603 CHECK_MEMBER(llog_unlink_rec, lur_oid);
604 CHECK_MEMBER(llog_unlink_rec, lur_ogen);
605 CHECK_MEMBER(llog_unlink_rec, lur_tail);
609 check_llog_size_change_rec(void)
612 CHECK_STRUCT(llog_size_change_rec);
613 CHECK_MEMBER(llog_size_change_rec, lsc_hdr);
614 CHECK_MEMBER(llog_size_change_rec, lsc_fid);
615 CHECK_MEMBER(llog_size_change_rec, lsc_io_epoch);
616 CHECK_MEMBER(llog_size_change_rec, lsc_tail);
623 CHECK_STRUCT(llog_gen);
624 CHECK_MEMBER(llog_gen, mnt_cnt);
625 CHECK_MEMBER(llog_gen, conn_cnt);
629 check_llog_gen_rec(void)
632 CHECK_STRUCT(llog_gen_rec);
633 CHECK_MEMBER(llog_gen_rec, lgr_hdr);
634 CHECK_MEMBER(llog_gen_rec, lgr_gen);
635 CHECK_MEMBER(llog_gen_rec, lgr_tail);
639 check_llog_log_hdr(void)
642 CHECK_STRUCT(llog_log_hdr);
643 CHECK_MEMBER(llog_log_hdr, llh_hdr);
644 CHECK_MEMBER(llog_log_hdr, llh_timestamp);
645 CHECK_MEMBER(llog_log_hdr, llh_count);
646 CHECK_MEMBER(llog_log_hdr, llh_bitmap_offset);
647 CHECK_MEMBER(llog_log_hdr, llh_size);
648 CHECK_MEMBER(llog_log_hdr, llh_flags);
649 CHECK_MEMBER(llog_log_hdr, llh_cat_idx);
650 CHECK_MEMBER(llog_log_hdr, llh_tgtuuid);
651 CHECK_MEMBER(llog_log_hdr, llh_reserved);
652 CHECK_MEMBER(llog_log_hdr, llh_bitmap);
653 CHECK_MEMBER(llog_log_hdr, llh_tail);
657 check_llog_cookie(void)
660 CHECK_STRUCT(llog_cookie);
661 CHECK_MEMBER(llog_cookie, lgc_lgl);
662 CHECK_MEMBER(llog_cookie, lgc_subsys);
663 CHECK_MEMBER(llog_cookie, lgc_index);
667 check_llogd_body(void)
670 CHECK_STRUCT(llogd_body);
671 CHECK_MEMBER(llogd_body, lgd_logid);
672 CHECK_MEMBER(llogd_body, lgd_ctxt_idx);
673 CHECK_MEMBER(llogd_body, lgd_llh_flags);
674 CHECK_MEMBER(llogd_body, lgd_index);
675 CHECK_MEMBER(llogd_body, lgd_saved_index);
676 CHECK_MEMBER(llogd_body, lgd_len);
677 CHECK_MEMBER(llogd_body, lgd_cur_offset);
679 CHECK_VALUE(LLOG_ORIGIN_HANDLE_CREATE);
680 CHECK_VALUE(LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
681 CHECK_VALUE(LLOG_ORIGIN_HANDLE_READ_HEADER);
682 CHECK_VALUE(LLOG_ORIGIN_HANDLE_WRITE_REC);
683 CHECK_VALUE(LLOG_ORIGIN_HANDLE_CLOSE);
684 CHECK_VALUE(LLOG_ORIGIN_CONNECT);
685 CHECK_VALUE(LLOG_CATINFO);
689 check_llogd_conn_body(void)
692 CHECK_STRUCT(llogd_conn_body);
693 CHECK_MEMBER(llogd_conn_body, lgdc_gen);
694 CHECK_MEMBER(llogd_conn_body, lgdc_logid);
695 CHECK_MEMBER(llogd_conn_body, lgdc_ctxt_idx);
699 system_string (char *cmdline, char *str, int len)
712 int fd = fileno(stdout);
714 rc = dup2(fds[1], fd);
718 exit(system(cmdline));
720 } else if ((int)pid < 0) {
723 FILE *f = fdopen(fds[0], "r");
730 if (fgets(str, len, f) == NULL)
733 if (waitpid(pid, &rc, 0) != pid)
736 if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
739 if (strnlen(str, len) == len)
742 if (str[strlen(str) - 1] == '\n')
743 str[strlen(str) - 1] = 0;
750 main(int argc, char **argv)
755 system_string("uname -a", unameinfo, sizeof(unameinfo));
756 system_string("gcc -v 2>&1 | tail -1", gccinfo, sizeof(gccinfo));
758 printf ("void lustre_assert_wire_constants(void)\n"
760 " /* Wire protocol assertions generated by 'wirecheck'\n"
763 "\n", unameinfo, gccinfo);
767 COMMENT("Constants...");
768 CHECK_DEFINE(PTLRPC_MSG_MAGIC);
769 CHECK_DEFINE(PTLRPC_MSG_VERSION);
771 CHECK_VALUE(PTL_RPC_MSG_REQUEST);
772 CHECK_VALUE(PTL_RPC_MSG_ERR);
773 CHECK_VALUE(PTL_RPC_MSG_REPLY);
775 CHECK_VALUE(MSG_LAST_REPLAY);
776 CHECK_VALUE(MSG_RESENT);
777 CHECK_VALUE(MSG_REPLAY);
779 CHECK_VALUE(MSG_CONNECT_RECOVERING);
780 CHECK_VALUE(MSG_CONNECT_RECONNECT);
781 CHECK_VALUE(MSG_CONNECT_REPLAYABLE);
783 CHECK_VALUE(OST_REPLY);
784 CHECK_VALUE(OST_GETATTR);
785 CHECK_VALUE(OST_SETATTR);
786 CHECK_VALUE(OST_READ);
787 CHECK_VALUE(OST_WRITE);
788 CHECK_VALUE(OST_CREATE);
789 CHECK_VALUE(OST_DESTROY);
790 CHECK_VALUE(OST_GET_INFO);
791 CHECK_VALUE(OST_CONNECT);
792 CHECK_VALUE(OST_DISCONNECT);
793 CHECK_VALUE(OST_PUNCH);
794 CHECK_VALUE(OST_OPEN);
795 CHECK_VALUE(OST_CLOSE);
796 CHECK_VALUE(OST_STATFS);
797 CHECK_VALUE(OST_SAN_READ);
798 CHECK_VALUE(OST_SAN_WRITE);
799 CHECK_VALUE(OST_SYNC);
800 CHECK_VALUE(OST_LAST_OPC);
802 CHECK_DEFINE(OBD_OBJECT_EOF);
804 CHECK_VALUE(OST_REQ_HAS_OA1);
806 CHECK_VALUE(MDS_GETATTR);
807 CHECK_VALUE(MDS_GETATTR_NAME);
808 CHECK_VALUE(MDS_CLOSE);
809 CHECK_VALUE(MDS_REINT);
810 CHECK_VALUE(MDS_READPAGE);
811 CHECK_VALUE(MDS_CONNECT);
812 CHECK_VALUE(MDS_DISCONNECT);
813 CHECK_VALUE(MDS_GETSTATUS);
814 CHECK_VALUE(MDS_STATFS);
815 CHECK_VALUE(MDS_PIN);
816 CHECK_VALUE(MDS_UNPIN);
817 CHECK_VALUE(MDS_SYNC);
818 CHECK_VALUE(MDS_DONE_WRITING);
819 CHECK_VALUE(MDS_LAST_OPC);
821 CHECK_VALUE(REINT_SETATTR);
822 CHECK_VALUE(REINT_CREATE);
823 CHECK_VALUE(REINT_LINK);
824 CHECK_VALUE(REINT_UNLINK);
825 CHECK_VALUE(REINT_RENAME);
826 CHECK_VALUE(REINT_OPEN);
827 CHECK_VALUE(REINT_MAX);
829 CHECK_VALUE(DISP_IT_EXECD);
830 CHECK_VALUE(DISP_LOOKUP_EXECD);
831 CHECK_VALUE(DISP_LOOKUP_NEG);
832 CHECK_VALUE(DISP_LOOKUP_POS);
833 CHECK_VALUE(DISP_OPEN_CREATE);
834 CHECK_VALUE(DISP_OPEN_OPEN);
836 CHECK_VALUE(MDS_STATUS_CONN);
837 CHECK_VALUE(MDS_STATUS_LOV);
839 CHECK_VALUE(MDS_OPEN_HAS_EA);
841 CHECK_VALUE(LDLM_ENQUEUE);
842 CHECK_VALUE(LDLM_CONVERT);
843 CHECK_VALUE(LDLM_CANCEL);
844 CHECK_VALUE(LDLM_BL_CALLBACK);
845 CHECK_VALUE(LDLM_CP_CALLBACK);
846 CHECK_VALUE(LDLM_LAST_OPC);
855 CHECK_VALUE(PTLBD_QUERY);
856 CHECK_VALUE(PTLBD_READ);
857 CHECK_VALUE(PTLBD_WRITE);
858 CHECK_VALUE(PTLBD_FLUSH);
859 CHECK_VALUE(PTLBD_CONNECT);
860 CHECK_VALUE(PTLBD_DISCONNECT);
861 CHECK_VALUE(PTLBD_LAST_OPC);
863 CHECK_VALUE(MGMT_CONNECT);
864 CHECK_VALUE(MGMT_DISCONNECT);
865 CHECK_VALUE(MGMT_EXCEPTION);
867 CHECK_VALUE(OBD_PING);
868 CHECK_VALUE(OBD_LOG_CANCEL);
869 CHECK_VALUE(OBD_LAST_OPC);
871 COMMENT("Sizes and Offsets");
873 check_lustre_handle();
876 check_lov_mds_md_v1();
879 check_niobuf_remote();
882 check_mds_status_req();
884 check_mds_rec_setattr();
885 check_mds_rec_create();
886 check_mds_rec_link();
887 check_mds_rec_unlink();
888 check_mds_rec_rename();
894 check_ldlm_resource_desc();
895 check_ldlm_lock_desc();
896 check_ldlm_request();
904 check_llog_rec_hdr();
905 check_llog_rec_tail();
906 check_llog_logid_rec();
907 check_llog_create_rec();
908 check_llog_orphan_rec();
909 check_llog_unlink_rec();
910 check_llog_size_change_rec();
912 check_llog_gen_rec();
913 check_llog_log_hdr();
916 check_llogd_conn_body();