X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Futils%2Fwirecheck.c;h=4edc523637101fc59fd85446daef4c042719d2e9;hb=refs%2Fchanges%2F44%2F49044%2F3;hp=ad8c6b1dab9201277be2544b32450faa7dbfe28f;hpb=05ad99f1f3a9f85756bf3355505722bb4f20f420;p=fs%2Flustre-release.git diff --git a/lnet/utils/wirecheck.c b/lnet/utils/wirecheck.c index ad8c6b1..4edc523 100644 --- a/lnet/utils/wirecheck.c +++ b/lnet/utils/wirecheck.c @@ -27,7 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef _GNU_SOURCE @@ -41,7 +40,7 @@ #include #include #include -#include +#include #ifndef HAVE_STRNLEN #define strnlen(s, i) strlen(s) @@ -61,12 +60,12 @@ do { \ #define CHECK_DEFINE(a) \ do { \ - printf (" CLASSERT ("#a" == "STRINGIFY(a)");\n"); \ + printf (" BUILD_BUG_ON("#a" != "STRINGIFY(a)");\n"); \ } while (0) -#define CHECK_VALUE(a) \ -do { \ - printf (" CLASSERT ("#a" == %d);\n", a); \ +#define CHECK_VALUE(a) \ +do { \ + printf (" BUILD_BUG_ON("#a" != %d);\n", a); \ } while (0) #define CHECK_MEMBER_OFFSET(s,m) \ @@ -110,51 +109,96 @@ check_lnet_magicversion (void) } void -check_lnet_hdr (void) +check_lnet_hdr_nid4(void) { - CHECK_STRUCT(struct lnet_hdr); - CHECK_MEMBER(struct lnet_hdr, dest_nid); - CHECK_MEMBER(struct lnet_hdr, src_nid); - CHECK_MEMBER(struct lnet_hdr, dest_pid); - CHECK_MEMBER(struct lnet_hdr, src_pid); - CHECK_MEMBER(struct lnet_hdr, type); - CHECK_MEMBER(struct lnet_hdr, payload_length); - CHECK_MEMBER(struct lnet_hdr, msg); + CHECK_STRUCT(struct _lnet_hdr_nid4); + CHECK_MEMBER(struct _lnet_hdr_nid4, dest_nid); + CHECK_MEMBER(struct _lnet_hdr_nid4, src_nid); + CHECK_MEMBER(struct _lnet_hdr_nid4, dest_pid); + CHECK_MEMBER(struct _lnet_hdr_nid4, src_pid); + CHECK_MEMBER(struct _lnet_hdr_nid4, type); + CHECK_MEMBER(struct _lnet_hdr_nid4, payload_length); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg); BLANK_LINE (); COMMENT ("Ack"); - CHECK_MEMBER(struct lnet_hdr, msg.ack.dst_wmd); - CHECK_MEMBER(struct lnet_hdr, msg.ack.match_bits); - CHECK_MEMBER(struct lnet_hdr, msg.ack.mlength); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.ack.dst_wmd); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.ack.match_bits); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.ack.mlength); BLANK_LINE (); COMMENT ("Put"); - CHECK_MEMBER(struct lnet_hdr, msg.put.ack_wmd); - CHECK_MEMBER(struct lnet_hdr, msg.put.match_bits); - CHECK_MEMBER(struct lnet_hdr, msg.put.hdr_data); - CHECK_MEMBER(struct lnet_hdr, msg.put.ptl_index); - CHECK_MEMBER(struct lnet_hdr, msg.put.offset); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.put.ack_wmd); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.put.match_bits); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.put.hdr_data); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.put.ptl_index); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.put.offset); BLANK_LINE (); COMMENT ("Get"); - CHECK_MEMBER(struct lnet_hdr, msg.get.return_wmd); - CHECK_MEMBER(struct lnet_hdr, msg.get.match_bits); - CHECK_MEMBER(struct lnet_hdr, msg.get.ptl_index); - CHECK_MEMBER(struct lnet_hdr, msg.get.src_offset); - CHECK_MEMBER(struct lnet_hdr, msg.get.sink_length); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.get.return_wmd); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.get.match_bits); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.get.ptl_index); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.get.src_offset); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.get.sink_length); BLANK_LINE (); COMMENT ("Reply"); - CHECK_MEMBER(struct lnet_hdr, msg.reply.dst_wmd); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.reply.dst_wmd); BLANK_LINE (); COMMENT ("Hello"); - CHECK_MEMBER(struct lnet_hdr, msg.hello.incarnation); - CHECK_MEMBER(struct lnet_hdr, msg.hello.type); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.hello.incarnation); + CHECK_MEMBER(struct _lnet_hdr_nid4, msg.hello.type); } void -system_string (char *cmdline, char *str, int len) +check_lnet_ni_status(void) +{ + BLANK_LINE(); + COMMENT("Checks for struct lnet_ni_status and related constants"); + + CHECK_DEFINE(LNET_NI_STATUS_INVALID); + CHECK_DEFINE(LNET_NI_STATUS_UP); + CHECK_DEFINE(LNET_NI_STATUS_DOWN); + + CHECK_STRUCT(struct lnet_ni_status); + CHECK_MEMBER(struct lnet_ni_status, ns_nid); + CHECK_MEMBER(struct lnet_ni_status, ns_status); + CHECK_MEMBER(struct lnet_ni_status, ns_msg_size); + + CHECK_STRUCT(struct lnet_ni_large_status); + CHECK_MEMBER(struct lnet_ni_large_status, ns_status); + CHECK_MEMBER(struct lnet_ni_large_status, ns_nid); +} + +void +check_lnet_ping_info(void) +{ + BLANK_LINE(); + COMMENT("Checks for struct lnet_ping_info and related constants"); + + CHECK_DEFINE(LNET_PROTO_PING_MAGIC); + CHECK_VALUE(LNET_PING_FEAT_INVAL); + CHECK_VALUE(LNET_PING_FEAT_BASE); + CHECK_VALUE(LNET_PING_FEAT_NI_STATUS); + CHECK_VALUE(LNET_PING_FEAT_RTE_DISABLED); + CHECK_VALUE(LNET_PING_FEAT_MULTI_RAIL); + CHECK_VALUE(LNET_PING_FEAT_DISCOVERY); + CHECK_VALUE(LNET_PING_FEAT_LARGE_ADDR); + CHECK_VALUE(LNET_PING_FEAT_PRIMARY_LARGE); + CHECK_VALUE(LNET_PING_FEAT_BITS); + + CHECK_STRUCT(struct lnet_ping_info); + CHECK_MEMBER(struct lnet_ping_info, pi_magic); + CHECK_MEMBER(struct lnet_ping_info, pi_features); + CHECK_MEMBER(struct lnet_ping_info, pi_pid); + CHECK_MEMBER(struct lnet_ping_info, pi_nnis); + CHECK_MEMBER(struct lnet_ping_info, pi_ni); +} + +void +system_string(char *cmdline, char *str, int len) { int fds[2]; int rc; @@ -237,9 +281,11 @@ main (int argc, char **argv) CHECK_VALUE (LNET_MSG_REPLY); CHECK_VALUE (LNET_MSG_HELLO); - check_lnet_handle_wire (); - check_lnet_magicversion (); - check_lnet_hdr (); + check_lnet_handle_wire(); + check_lnet_magicversion(); + check_lnet_hdr_nid4(); + check_lnet_ni_status(); + check_lnet_ping_info(); printf ("}\n\n");