[ewg] [OPENSM] match functions to prototypes in header file
MS compiler errors on function definition not matching header file prototype. Add missing 'const' qualifiers. In the modified file osm_helper.c lined up so the 'IN' qualifiers lined up. >From the looks of the cut-n-past from git diff output the emailer is not >expanding tabs as envisioned, hence the attached Linux EOL patch file; grrr. Signed-off-by: stan smith diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c index 4b4e320..28edb04 100644 --- a/opensm/opensm/osm_helper.c +++ b/opensm/opensm/osm_helper.c @@ -780,10 +780,11 @@ static void dbg_get_capabilities_str(IN char *p_buf, IN const uint32_t buf_size, /** **/ -void osm_dump_port_info(IN osm_log_t * p_log, IN const ib_net64_t node_guid, +void osm_dump_port_info(IN osm_log_t * const p_log, + IN const ib_net64_t node_guid, IN const ib_net64_t port_guid, IN const uint8_t port_num, - IN const ib_port_info_t * p_pi, + IN const ib_port_info_t * const p_pi, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -870,8 +871,8 @@ void osm_dump_port_info(IN osm_log_t * p_log, IN const ib_net64_t node_guid, /** **/ -void osm_dump_portinfo_record(IN osm_log_t * p_log, - IN const ib_portinfo_record_t * p_pir, +void osm_dump_portinfo_record(IN osm_log_t * const p_log, + IN const ib_portinfo_record_t * const p_pir, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -956,8 +957,8 @@ void osm_dump_portinfo_record(IN osm_log_t * p_log, /** **/ -void osm_dump_guidinfo_record(IN osm_log_t * p_log, - IN const ib_guidinfo_record_t * p_gir, +void osm_dump_guidinfo_record(IN osm_log_t * const p_log, + IN const ib_guidinfo_record_t * const p_gir, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -995,7 +996,8 @@ void osm_dump_guidinfo_record(IN osm_log_t * p_log, /** **/ -void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni, +void osm_dump_node_info(IN osm_log_t * const p_log, + IN const ib_node_info_t * const p_ni, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -1030,8 +1032,8 @@ void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni, /** **/ -void osm_dump_node_record(IN osm_log_t * p_log, - IN const ib_node_record_t * p_nr, +void osm_dump_node_record(IN osm_log_t * const p_log, + IN const ib_node_record_t * const p_nr, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -1080,7 +1082,8 @@ void osm_dump_node_record(IN osm_log_t * p_log, /** **/ -void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr, +void osm_dump_path_record(IN osm_log_t * const p_log, + IN const ib_path_rec_t * const p_pr, IN const osm_log_level_t log_level) { if (osm_log_is_active(p_log, log_level)) { @@ -1106,9 +1109,9 @@ void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr, "\t\t\t\tresv2...0x%X\n" "\t\t\t\tresv3...0x%X\n", cl_ntoh64(p_pr->service_id), - inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, + inet_ntop(AF_INET6, (void*)p_pr->dgid.raw, gid_str, sizeof gid_str), - inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2, + inet_ntop(AF_INET6, (void*)p_pr->sgid.raw, gid_str2, sizeof gid_str2), cl_ntoh16(p_pr->dlid), cl_ntoh16(p_pr->slid), @@ -1129,8 +1132,8 @@ v
[ewg] [OPENSM] cast to remove compiler warning.
MS compiler squawks about uint32_t --> const uint16_t conversion with possible loss of data. Cast to eliminate compiler warning. Signed-off-by: stan smith diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c index 3894677..6f51404 100644 --- a/opensm/opensm/osm_mcast_mgr.c +++ b/opensm/opensm/osm_mcast_mgr.c @@ -322,7 +322,7 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw, p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw); - if (osm_mcast_tbl_get_block(p_tbl, block_num, + if (osm_mcast_tbl_get_block(p_tbl, (uint16_t) block_num, (uint8_t) position, block)) { block_id_ho = block_num + (position << 28); ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] cast to remove warnings about signed vs. unsigned comparisons
Use (unsigned) cast to remove compiler warnings for signed component in comparison (for loops) . In a couple of cases use unsigned instead of int for the variable declaration. Signed-off-by: Stan Smith diff --git a/opensm/opensm/osm_mesh.c b/opensm/opensm/osm_mesh.c index 260e2f8..8235e55 100644 --- a/opensm/opensm/osm_mesh.c +++ b/opensm/opensm/osm_mesh.c @@ -622,7 +622,7 @@ static int get_switch_metric(lash_t *p_lash, int sw) s2 = p_lash->switches[sw2]; if (s2->node->temp == LARGE) continue; - for (j = 0; j < s2->node->num_links; j++) { + for (j = 0; (unsigned)j < s2->node->num_links; j++) { sw3 = s2->node->links[j]->switch_id; s3 = p_lash->switches[sw3]; @@ -742,7 +742,7 @@ static void remove_edges(lash_t *p_lash) osm_log_t *p_log = &p_lash->p_osm->log; int sw; mesh_node_t *n, *nn; - int i; + unsigned i; OSM_LOG_ENTER(p_log); @@ -892,7 +892,7 @@ done: */ static inline int opposite(switch_t *s, int axis) { - int i, j; + unsigned i, j; int negaxis = 1 + (1 ^ (axis - 1)); if (!s->node->matrix) @@ -956,7 +956,7 @@ static void make_geometry(lash_t *p_lash, int sw) /* * ignore chain fragments */ - if (n < seed->node->num_links && n <= 2) + if ((unsigned)n < seed->node->num_links && n <= 2) continue; /* @@ -1068,11 +1068,11 @@ static void make_geometry(lash_t *p_lash, int sw) * find switch (other than s1) that neighbors i and j * have in common */ - for (k = 0; k < s1->node->num_links; k++) { + for (k = 0; (unsigned)k < s1->node->num_links; k++) { if (s1->node->links[k]->switch_id == sw1) continue; - for (l = 0; l < s2->node->num_links; l++) { + for (l = 0; (unsigned)l < s2->node->num_links; l++) { if (s2->node->links[l]->switch_id == sw1) continue; @@ -1228,7 +1228,7 @@ static int make_coord(lash_t *p_lash, mesh_t *mesh, int seed) for (i = 0; i < dimension; i++) s->node->coord[i] = (sw == seed) ? 0 : LARGE; - for (i = 0; i < s->node->num_links; i++) + for (i = 0; (unsigned)i < s->node->num_links; i++) if (s->node->axes[i] == 0) unassigned_axes++; else @@ -1246,7 +1246,7 @@ static int make_coord(lash_t *p_lash, mesh_t *mesh, int seed) if (s->node->coord[0] == LARGE) continue; - for (j = 0; j < s->node->num_links; j++) { + for (j = 0; (unsigned)j < s->node->num_links; j++) { if (!s->node->axes[j]) continue; @@ -1426,7 +1426,7 @@ static void sort_switches(lash_t *p_lash, mesh_t *mesh) s = p_lash->switches[comp[i].index]; switches[i] = s; s->id = i; - for (j = 0; j < s->node->num_links; j++) + for (j = 0; (unsigned)j < s->node->num_links; j++) s->node->links[j]->switch_id = reverse[s->node->links[j]->switch_id]; } @@ -1493,7 +1493,7 @@ err: void osm_mesh_node_delete(lash_t *p_lash, switch_t *sw) { osm_log_t *p_log = &p_lash->p_osm->log; - int i; + unsigned i; mesh_node_t *node = sw->node; unsigned num_ports = sw->p_sw->num_ports; @@ -1535,7 +1535,7 @@ void osm_mesh_node_delete(lash_t *p_lash, switch_t *sw) int osm_mesh_node_create(lash_t *p_lash, switch_t *sw) { osm_log_t *p_log = &p_lash->p_osm->log; - int i; + unsigned i; mesh_node_t *node; unsigned num_ports = sw->p_sw->num_ports; ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] osm_sa.c - void * arithmetic causes problems
The Microsoft WDK (Windows Driver Kit) compiler does not understand void* arithmetic. Replace void* with 'unsigned char *'. Signed-off-by: stan smith diff --git a/opensm/opensm/osm_sa.c b/opensm/opensm/osm_sa.c index 02737c2..b1a3d5e 100644 --- a/opensm/opensm/osm_sa.c +++ b/opensm/opensm/osm_sa.c @@ -411,7 +411,7 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size, #ifndef VENDOR_RMPP_SUPPORT unsigned trim_num_rec; #endif - void *p; + unsigned char *p; sa_mad = osm_madw_get_sa_mad_ptr(madw); num_rec = cl_qlist_count(list); ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] osm_helper.c use explicit value for struct init
Signed-off-by Stan Smith (stan.sm...@intel.com) diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c index 4b4e320..35da131 100644 --- a/opensm/opensm/osm_helper.c +++ b/opensm/opensm/osm_helper.c @@ -548,7 +548,7 @@ const char *ib_get_trap_str(ib_net16_t trap_num) return "Unknown"; } -const ib_gid_t ib_zero_gid = { }; +const ib_gid_t ib_zero_gid = { 0 }; /** **/ ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] use standard varargs syntax in macro OSM_LOG()
Signed-off-by: Stan Smith (stan.sm...@intel.com) diff --git a/opensm/include/opensm/osm_log.h b/opensm/include/opensm/osm_log.h index 20999d9..135e752 100644 --- a/opensm/include/opensm/osm_log.h +++ b/opensm/include/opensm/osm_log.h @@ -390,10 +390,10 @@ extern void osm_log_msg_box(osm_log_t *log, osm_log_level_t level, extern void osm_log_raw(IN osm_log_t * const p_log, IN const osm_log_level_t verbosity, IN const char *p_buf); -#define OSM_LOG(log, level, fmt, arg...) do { \ - if (osm_log_is_active(log, (level))) \ - osm_log(log, level, "%s: " fmt, __func__, ##arg); \ - } while (0) +#define OSM_LOG(log, level, fmt, ...) do { \ + if (osm_log_is_active(log, (level))) \ + osm_log(log, level, "%s: " fmt, __func__, ## __VA_ARGS__); \ +} while (0) #define OSM_LOG_MSG_BOX(log, level, msg) \ osm_log_msg_box(log, level, __func__, msg) inc_opensm.pat Description: Binary data ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] add Windows syntax for varags in a macro
Hello, Adding Windows version of OSM_LOG macro to accommodate windows syntax for cpp varargs. Signed-off-by: Stan Smith (stan.sm...@intel.com) diff --git a/opensm/include/opensm/osm_log.h b/opensm/include/opensm/osm_log.h index 20999d9..54c8ea4 100644 --- a/opensm/include/opensm/osm_log.h +++ b/opensm/include/opensm/osm_log.h @@ -390,10 +390,18 @@ extern void osm_log_msg_box(osm_log_t *log, osm_log_level_t level, extern void osm_log_raw(IN osm_log_t * const p_log, IN const osm_log_level_t verbosity, IN const char *p_buf); +#ifdef __WIN__ +#define OSM_LOG(log, level, fmt, ...) \ +do { \ + if (osm_log_is_active(log, (level))) \ + osm_log(log, level, "%s: " fmt, __func__, ## __VA_ARGS__); \ +} while (0) +#else #define OSM_LOG(log, level, fmt, arg...) do { \ if (osm_log_is_active(log, (level))) \ osm_log(log, level, "%s: " fmt, __func__, ##arg); \ } while (0) +#endif #define OSM_LOG_MSG_BOX(log, level, msg) \ ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] update functions to match .h prototypes
Hello, The following patches address inconsistencies between header file function prototypes and .c function definitions; missing 'const' attribute. Attached is a Linux EOL patch file in case a mailer hacks/reformats the text. Signed-off-by: Stan Smith (stan.sm...@intel.com) diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c index 9b451bd..7d55a06 100644 --- a/opensm/opensm/osm_inform.c +++ b/opensm/opensm/osm_inform.c @@ -61,7 +61,7 @@ typedef struct osm_infr_match_ctxt { /** **/ -void osm_infr_delete(IN osm_infr_t * p_infr) +void osm_infr_delete(IN osm_infr_t * const p_infr) { free(p_infr); } @@ -214,7 +214,7 @@ Exit: **/ osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn, IN osm_log_t * p_log, - IN osm_infr_t * p_infr_rec) + IN osm_infr_t * const p_infr_rec) { cl_list_item_t *p_list_item; @@ -572,7 +572,7 @@ static void log_notice(osm_log_t * log, osm_log_level_t level, sizeof gid_str)); } -ib_api_status_t osm_report_notice(IN osm_log_t * p_log, IN osm_subn_t * p_subn, +ib_api_status_t osm_report_notice(IN osm_log_t * const p_log, IN osm_subn_t * p_subn, IN ib_mad_notice_attr_t * p_ntc) { osm_infr_match_ctxt_t context; diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c index 34625ba..8b620c3 100644 --- a/opensm/opensm/osm_lid_mgr.c +++ b/opensm/opensm/osm_lid_mgr.c @@ -106,14 +106,14 @@ typedef struct osm_lid_mgr_range { /** **/ -void osm_lid_mgr_construct(IN osm_lid_mgr_t * p_mgr) +void osm_lid_mgr_construct(IN osm_lid_mgr_t * const p_mgr) { memset(p_mgr, 0, sizeof(*p_mgr)); } /** **/ -void osm_lid_mgr_destroy(IN osm_lid_mgr_t * p_mgr) +void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr) { cl_list_item_t *p_item; @@ -224,7 +224,7 @@ Exit: /** **/ -ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * p_mgr, IN osm_sm_t * sm) +ib_api_status_t osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN osm_sm_t * sm) { ib_api_status_t status = IB_SUCCESS; @@ -1145,7 +1145,7 @@ Exit: /** **/ -int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr) +int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr) { int ret; @@ -1173,7 +1173,7 @@ int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr) 1.2 if a change is required send the port info 2 if any change send the signal PENDING... **/ -int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr) +int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr) { cl_qmap_t *p_port_guid_tbl; osm_port_t *p_port; diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c index c80dae7..bd4245b 100644 --- a/opensm/opensm/osm_sa_mcmember_record.c +++ b/opensm/opensm/osm_sa_mcmember_record.c @@ -888,7 +888,7 @@ osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid) ib_api_status_t osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa, IN ib_net64_t comp_mask, IN ib_member_rec_t * -p_recvd_mcmember_rec, +const p_recvd_mcmember_rec, OUT osm_mgrp_t ** pp_mgrp) { opensm.pat Description: Binary data ___ ewg mailing list ewg@lists.openfabrics.org http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg
[ewg] [OPENSM] update osm_db_files.c & osm_pack.c functions to match .h prototypes
Hello, The following patches address inconsistancies between header file function prototypes and .c function definitions; missing 'const' attribute. Attched is a Linux EOL patch file in case a mailer hacks/reformats the text. Signed-off-by: Stan Smith (stan.sm...@intel.com) diff --git a/opensm/opensm/osm_db_files.c b/opensm/opensm/osm_db_files.c index 0c01597..c30f7a8 100644 --- a/opensm/opensm/osm_db_files.c +++ b/opensm/opensm/osm_db_files.c @@ -119,7 +119,7 @@ typedef struct osm_db_imp { /*** ***/ -void osm_db_construct(IN osm_db_t * p_db) +void osm_db_construct(IN osm_db_t * const p_db) { memset(p_db, 0, sizeof(osm_db_t)); cl_list_construct(&p_db->domains); @@ -143,7 +143,7 @@ void osm_db_domain_destroy(IN osm_db_domain_t * p_db_domain) /*** ***/ -void osm_db_destroy(IN osm_db_t * p_db) +void osm_db_destroy(IN osm_db_t * const p_db) { osm_db_domain_t *p_domain; @@ -157,7 +157,7 @@ void osm_db_destroy(IN osm_db_t * p_db) /*** ***/ -int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log) +int osm_db_init(IN osm_db_t * const p_db, IN osm_log_t * p_log) { osm_db_imp_t *p_db_imp; struct stat dstat; @@ -201,7 +201,7 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log) /*** ***/ -osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name) +osm_db_domain_t *osm_db_domain_init(IN osm_db_t * const p_db, IN char *domain_name) { osm_db_domain_t *p_domain; osm_db_domain_imp_t *p_domain_imp; @@ -537,7 +537,7 @@ int osm_db_keys(IN osm_db_domain_t * p_domain, OUT cl_list_t * p_key_list) /*** ***/ -char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key) +char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char * const p_key) { osm_db_domain_imp_t *p_domain_imp = (osm_db_domain_imp_t *) p_domain->p_domain_imp; @@ -555,7 +555,7 @@ char *osm_db_lookup(IN osm_db_domain_t * p_domain, IN char *p_key) /*** ***/ -int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val) +int osm_db_update(IN osm_db_domain_t * p_domain, IN char * const p_key, IN char * const p_val) { osm_log_t *p_log = p_domain->p_db->p_log; osm_db_domain_imp_t *p_domain_imp = @@ -595,7 +595,7 @@ int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val) /*** ***/ -int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key) +int osm_db_delete(IN osm_db_domain_t * p_domain, IN char * const p_key) { osm_log_t *p_log = p_domain->p_db->p_log; osm_db_domain_imp_t *p_domain_imp = diff --git a/opensm/opensm/osm_db_pack.c b/opensm/opensm/osm_db_pack.c index 6af2694..3b4b4d7 100644 --- a/opensm/opensm/osm_db_pack.c +++ b/opensm/opensm/osm_db_pack.c @@ -83,7 +83,7 @@ static inline int unpack_lids(IN char *p_lid_str, OUT uint16_t * p_min_lid, return 0; } -int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l, +int osm_db_guid2lid_guids(IN osm_db_domain_t * const p_g2l, OUT cl_qlist_t * p_guid_list) { char *p_key; @@ -109,7 +109,7 @@ int osm_db_guid2lid_guids(IN osm_db_domain_t * p_g2l, return 0; } -int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid, +int osm_db_guid2lid_get(IN osm_db_domain_t * const p_g2l, IN uint64_t guid, OUT uint16_t * p_min_lid, OUT uint16_t * p_max_lid) { char guid_str[20]; @@ -131,7 +131,7 @@ int osm_db_guid2lid_get(IN osm_db_domain_t * p_g2l, IN uint64_t guid, return 0; } -int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid, +int osm_db_guid2lid_set(IN osm_db_domain_t * const p_g2l, IN uint64_t guid, IN uint16_t min_lid, IN uint16_t max_lid) { char guid_str[20]; @@ -143,7 +143,7 @@ int osm_db_guid2lid_set(IN osm_db_domain_t * p_g2l, IN uint64_t guid, return (osm_db_update(p_g2l, guid_str, lid_str)); } -int osm_db_guid2lid_delete