opensm: Fix issues causing const warnings for strings
PATCH v2 1/1 opensm: Fix issues causing const warnings for strings
---
Changes since v1:
Change config_file declaration from char * to const char *
complib/Makefile.am +1 -1
@@ -9,7 +9,7 @@ else DBGFLAGS = -g endif -libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 +libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 if HAVE_LD_VERSION_SCRIPT libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
complib/cl_nodenamemap.c +1 -1
@@ -74,7 +74,7 @@ static int map_name(void *cxt, uint64_t guid, char *p)return 0 ; } -nn_map_t *open_node_name_map (char *node_name_map) +nn_map_t *open_node_name_map (const char *node_name_map) {nn_map_t *map;char linebuf[PARSE_NODE_MAP_BUFLEN +1 ];
include/complib/cl_nodenamemap.h +1 -1
@@ -54,7 +54,7 @@ typedef cl_qmap_t nn_map_t;* Node name map interface. * It is OK to pass NULL for the node_name_map[_fp] parameters. */ -nn_map_t *open_node_name_map (char *node_name_map); +nn_map_t *open_node_name_map (const char *node_name_map);void close_node_name_map (nn_map_t *map);char *remap_node_name (nn_map_t *map,uint64_t target_guid,char *nodedesc);/* NOTE: parameter "nodedesc" may be modified here. */
include/opensm/osm_db.h +1 -1
@@ -212,7 +212,7 @@ int osm_db_init(IN osm_db_t * p_db, IN struct osm_log * p_log);* * SYNOPSIS */ -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 * p_db, IN const char *domain_name);/* * PARAMETERS *
include/opensm/osm_subnet.h +2 -2
@@ -243,7 +243,7 @@ typedef struct osm_cct {* SYNOPSIS */ typedef struct osm_subn_opt { - char *config_file; + const char *config_file; ib_net64_t guid; ib_net64_t m_key; ib_net64_t sm_key;
@@ -1506,7 +1506,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt);* * SYNOPSIS */ -int osm_subn_parse_conf_file (char *conf_file,osm_subn_opt_t * p_opt); +int osm_subn_parse_conf_file (const char *conf_file,osm_subn_opt_t * p_opt);/* * PARAMETERS *
libvendor/Makefile.am +1 -1
@@ -11,7 +11,7 @@ INCLUDES = $(OSMV_INCLUDES) lib_LTLIBRARIES = libosmvendor.la -libosmvendor_la_CFLAGS = -Wall $(DBGFLAGS) +libosmvendor_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) if HAVE_LD_VERSION_SCRIPT libosmvendor_version_script = -Wl,--version-script=$(srcdir)/libosmvendor.map
opensm/Makefile.am +1 -1
@@ -1,7 +1,7 @@ INCLUDES = $(OSMV_INCLUDES) -AM_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 +AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 lib_LTLIBRARIES = libopensm.la
opensm/main.c +2 -1
@@ -603,7 +603,8 @@ int main(int argc, char *argv[])boolean_t run_once_flag = FALSE;int32_t vendor_debug =0 ;int next_option; -char *conf_template =NULL , *config_file =NULL ; +char *conf_template =NULL ; +const char *config_file =NULL ;uint32_t val;const char *const short_option ="F:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANZ:WBIQvVhoryxp:n:q:k:C:G:H:" ;
opensm/osm_console.c +1 -1
@@ -62,7 +62,7 @@ extern void osm_update_node_desc(IN osm_opensm_t *osm);struct command { -char *name; +const char *name;void (*help_function) (FILE * out,int detail);void (*parse_function) (char **p_last,osm_opensm_t * p_osm,FILE * out);
opensm/osm_db_files.c +2 -2
@@ -108,7 +108,7 @@ typedef struct osm_db_domain_imp {* SYNOPSIS */ typedef struct osm_db_imp { -char *db_dir_name; +const char *db_dir_name; }osm_db_imp_t ;/* * FIELDS
@@ -206,7 +206,7 @@ err:return 1 ; } -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 * p_db, IN const char *domain_name) {osm_db_domain_t *p_domain;osm_db_domain_imp_t *p_domain_imp;
opensm/osm_dump.c +3 -3
@@ -370,7 +370,7 @@ static void dump_topology_node(cl_map_item_t * item, FILE * file, void *cxt)osm_node_t *p_nbnode;osm_physp_t *p_physp, *p_default_physp, *p_rphysp;uint8_t link_speed_act; -char *link_speed_act_str; +const char *link_speed_act_str;if (!p_node->node_info.num_ports)return ;
@@ -493,8 +493,8 @@ static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt)ib_slvl_table_t *p_tbl;int i, n;char buf[1024 ]; -char * header_line ="#in out : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" ; -char * separator_line ="#--------------------------------------------------------" ; +const char * header_line ="#in out : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" ; +const char * separator_line ="#--------------------------------------------------------" ;if (!num_ports)return ;
opensm/osm_log.c +1 -1
@@ -62,7 +62,7 @@ static int log_exit_count = 0;#include <unistd.h> #include <complib/cl_timer.h> -static char *month_str[] = { +static const char *month_str[] = {"Jan" ,"Feb" ,"Mar" ,
opensm/osm_perfmgr_db.c +1 -1
@@ -733,7 +733,7 @@ static void dump_node_mr(db_node_t * node, FILE * fp)static void dump_hr_dc (FILE *fp,uint64_t val64,int data) { -char *unit ="" ; +const char *unit ="" ;uint64_t tmp = val64;float val =0.0 ;int ui =0 ;
opensm/osm_pkey_mgr.c +1 -1
@@ -92,7 +92,7 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,osm_node_t *p_node =osm_physp_get_node_ptr (p_physp);osm_pkey_tbl_t *p_pkey_tbl;ib_net16_t *p_orig_pkey; -char *stat =NULL ; +const char *stat =NULL ;osm_pending_pkey_t *p_pending; p_pkey_tbl = &p_physp->pkeys;
opensm/osm_qos_policy.c +1 -1
@@ -748,7 +748,7 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(static osm_qos_level_t *__qos_policy_get_qos_level_by_name (const osm_qos_policy_t * p_qos_policy, -char *name) +const char *name) {osm_qos_level_t *p_qos_level =NULL ;cl_list_iterator_t list_iterator;
opensm/osm_subnet.c +1 -1
@@ -2061,7 +2061,7 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)return 0 ; } -int osm_subn_parse_conf_file (char *file_name,osm_subn_opt_t * p_opts) +int osm_subn_parse_conf_file (const char *file_name,osm_subn_opt_t * p_opts) {char line[1024 ];FILE *opts_file;
opensm/osm_torus.c +1 -1
@@ -1547,7 +1547,7 @@ bool link_tswitches(struct torus *t, int cdir,int p;struct port_grp *pg0, *pg1;struct f_switch *f_sw0, *f_sw1; -char *cdir_name ="unknown" ; +const char *cdir_name ="unknown" ;unsigned port_cnt;int success = false;
opensm/osm_ucast_ftree.c +2 -2
@@ -277,7 +277,7 @@ static inline boolean_t tuple_assigned(IN ftree_tuple_t tuple)#define FTREE_TUPLE_BUFFERS_NUM 6 -static char *tuple_to_str(IN ftree_tuple_t tuple) +static const char *tuple_to_str(IN ftree_tuple_t tuple) {static char buffer[FTREE_TUPLE_BUFFERS_NUM ][FTREE_TUPLE_BUFF_LEN ];static uint8_t ind =0 ;
@@ -1269,7 +1269,7 @@ static void fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)char path[1024 ];FILE *p_hca_ordering_file; -char *filename ="opensm-ftree-ca-order.dump" ; +const char *filename ="opensm-ftree-ca-order.dump" ;snprintf (path,sizeof (path),"%s/%s" , p_ftree->p_osm->subn.opt.dump_files_dir, filename);
osmeventplugin/Makefile.am +1 -1
@@ -10,7 +10,7 @@ else DBGFLAGS = -g endif -libosmeventplugin_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 +libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 if HAVE_LD_VERSION_SCRIPT libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map
osmtest/Makefile.am +1 -1
@@ -13,7 +13,7 @@ osmtest_SOURCES = main.c osmtest.c osmt_service.c osmt_slvl_vl_arb.c \ if OSMV_VAPI osmtest_SOURCES += osmt_mtl_regular_qp.c endif -osmtest_CFLAGS = -Wall $(DBGFLAGS) +osmtest_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) osmtest_LDADD = -L../complib -losmcomp -L../libvendor -losmvendor -L../opensm -lopensm $(OSMV_LDADD) EXTRA_DIST = $(srcdir)/include/osmt_inform.h \
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html