Skip to content

Commit

Permalink
ibdiags: Make functions used in only one file static
Browse files Browse the repository at this point in the history
Fixes the compiler warning
 warning: no previous prototype for ‘dump_multicast_tables’ [-Wmissing-prototypes]

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
jgunthorpe committed Mar 8, 2019
1 parent dd5365d commit 09922b3
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 70 deletions.
2 changes: 1 addition & 1 deletion libibnetdisc/test/testleaks.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
const char *argv0 = "iblinkinfotest";
static FILE *f;

void usage(void)
static void usage(void)
{
fprintf(stderr,
"Usage: %s [-hclp -D <direct route> -C <ca_name> -P <ca_port>]\n"
Expand Down
26 changes: 13 additions & 13 deletions src/dump_fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ static nn_map_t *node_name_map = NULL;

#define IB_MLIDS_IN_BLOCK (IB_SMP_DATA_SIZE/2)

int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,
uint16_t mft[16][IB_MLIDS_IN_BLOCK])
static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,
uint16_t mft[16][IB_MLIDS_IN_BLOCK])
{
uint16_t mask;
unsigned i, chunk, bit, nonzero = 0;
Expand Down Expand Up @@ -110,8 +110,8 @@ int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,

uint16_t mft[16][IB_MLIDS_IN_BLOCK] = { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0}, { 0 }, { 0 } };

void dump_multicast_tables(ibnd_node_t * node, unsigned startlid,
unsigned endlid, struct ibmad_port * mad_port)
static void dump_multicast_tables(ibnd_node_t *node, unsigned startlid,
unsigned endlid, struct ibmad_port *mad_port)
{
ib_portid_t *portid = &node->path_portid;
char nd[IB_SMP_DATA_SIZE] = { 0 };
Expand Down Expand Up @@ -225,10 +225,9 @@ void dump_multicast_tables(ibnd_node_t * node, unsigned startlid,
free(mapnd);
}

int dump_lid(char *str, int str_len, int lid, int valid,
ibnd_fabric_t *fabric,
int * last_port_lid, int * base_port_lid,
uint64_t * portguid)
static int dump_lid(char *str, int str_len, int lid, int valid,
ibnd_fabric_t *fabric, int *last_port_lid,
int *base_port_lid, uint64_t *portguid)
{
char nd[IB_SMP_DATA_SIZE] = { 0 };

Expand Down Expand Up @@ -302,8 +301,9 @@ int dump_lid(char *str, int str_len, int lid, int valid,
return rc;
}

void dump_unicast_tables(ibnd_node_t * node, int startlid, int endlid,
struct ibmad_port *mad_port, ibnd_fabric_t *fabric)
static void dump_unicast_tables(ibnd_node_t *node, int startlid, int endlid,
struct ibmad_port *mad_port,
ibnd_fabric_t *fabric)
{
ib_portid_t * portid = &node->path_portid;
char lft[IB_SMP_DATA_SIZE] = { 0 };
Expand Down Expand Up @@ -379,8 +379,8 @@ void dump_unicast_tables(ibnd_node_t * node, int startlid, int endlid,
free(mapnd);
}

void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port,
ibnd_fabric_t *fabric)
static void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port,
ibnd_fabric_t *fabric)
{
if (multicast)
dump_multicast_tables(node, startlid, endlid, mad_port);
Expand All @@ -389,7 +389,7 @@ void dump_node(ibnd_node_t *node, struct ibmad_port *mad_port,
mad_port, fabric);
}

void process_switch(ibnd_node_t * node, void *fabric)
static void process_switch(ibnd_node_t *node, void *fabric)
{
dump_node(node, srcport, (ibnd_fabric_t *)fabric);
}
Expand Down
14 changes: 7 additions & 7 deletions src/ibdiag_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static inline int val_str_true(const char *val_str)
(strncmp(val_str, "true", strlen("true")) == 0));
}

void read_ibdiag_config(const char *file)
static void read_ibdiag_config(const char *file)
{
char buf[1024];
FILE *config_fd = NULL;
Expand Down Expand Up @@ -633,9 +633,9 @@ int resolve_self(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
return 0;
}

int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t * portid,
ibmad_gid_t gid, ib_portid_t * sm_id,
const struct ibmad_port *srcport)
static int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
ibmad_gid_t gid, ib_portid_t *sm_id,
const struct ibmad_port *srcport)
{
ib_portid_t sm_portid;
char buf[IB_SA_DATA_SIZE] = { 0 };
Expand All @@ -653,9 +653,9 @@ int resolve_gid(char *ca_name, uint8_t ca_port, ib_portid_t * portid,
return 0;
}

int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
uint64_t *guid, ib_portid_t *sm_id,
const struct ibmad_port *srcport)
static int resolve_guid(char *ca_name, uint8_t ca_port, ib_portid_t *portid,
uint64_t *guid, ib_portid_t *sm_id,
const struct ibmad_port *srcport)
{
ib_portid_t sm_portid;
uint8_t buf[IB_SA_DATA_SIZE] = { 0 };
Expand Down
20 changes: 11 additions & 9 deletions src/iblinkinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static int add_sw_settings = 0;
static int only_flag = 0;
static int only_type = 0;

int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port)
static int filterdownport_check(ibnd_node_t *node, ibnd_port_t *port)
{
ibnd_node_t *fsw;
ibnd_port_t *fport;
Expand All @@ -104,7 +104,8 @@ int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port)
return (fistate == IB_LINK_DOWN) ? 1 : 0;
}

void print_port(ibnd_node_t *node, ibnd_port_t *port, const char *out_prefix)
static void print_port(ibnd_node_t *node, ibnd_port_t *port,
const char *out_prefix)
{
char width[64], speed[64], state[64], physstate[64];
char remote_guid_str[256];
Expand Down Expand Up @@ -271,7 +272,7 @@ static inline const char *nodetype_str(ibnd_node_t * node)
return "??";
}

void print_node_header(ibnd_node_t *node, int *out_header_flag,
static void print_node_header(ibnd_node_t *node, int *out_header_flag,
const char *out_prefix)
{
uint64_t guid = 0;
Expand All @@ -298,7 +299,7 @@ void print_node_header(ibnd_node_t *node, int *out_header_flag,
}
}

void print_node(ibnd_node_t * node, void *user_data)
static void print_node(ibnd_node_t *node, void *user_data)
{
int i = 0;
int head_print = 0;
Expand All @@ -325,8 +326,9 @@ struct iter_diff_data {
const char *fabric2_prefix;
};

void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node,
int *head_print, struct iter_diff_data *data)
static void diff_node_ports(ibnd_node_t *fabric1_node,
ibnd_node_t *fabric2_node, int *head_print,
struct iter_diff_data *data)
{
int i = 0;

Expand Down Expand Up @@ -407,7 +409,7 @@ void diff_node_ports(ibnd_node_t * fabric1_node, ibnd_node_t * fabric2_node,
}
}

void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data)
static void diff_node_iter(ibnd_node_t *fabric1_node, void *iter_user_data)
{
struct iter_diff_data *data = iter_user_data;
ibnd_node_t *fabric2_node;
Expand Down Expand Up @@ -453,8 +455,8 @@ void diff_node_iter(ibnd_node_t * fabric1_node, void *iter_user_data)
}
}

int diff_node(ibnd_node_t * node, ibnd_fabric_t * orig_fabric,
ibnd_fabric_t * new_fabric)
static int diff_node(ibnd_node_t *node, ibnd_fabric_t *orig_fabric,
ibnd_fabric_t *new_fabric)
{
struct iter_diff_data iter_diff_data;

Expand Down
41 changes: 21 additions & 20 deletions src/ibnetdiscover.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int full_info;
* Define our own conversion functions to maintain compatibility with the old
* ibnetdiscover which did not use the ibmad conversion functions.
*/
const char *dump_linkspeed_compat(uint32_t speed)
static const char *dump_linkspeed_compat(uint32_t speed)
{
switch (speed) {
case 1:
Expand All @@ -100,8 +100,8 @@ const char *dump_linkspeed_compat(uint32_t speed)
return ("???");
}

const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed,
uint32_t fdr10)
static const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed,
uint32_t fdr10)
{
switch (espeed) {
case 0:
Expand All @@ -123,7 +123,7 @@ const char *dump_linkspeedext_compat(uint32_t espeed, uint32_t speed,
return ("???");
}

const char *dump_linkwidth_compat(uint32_t width)
static const char *dump_linkwidth_compat(uint32_t width)
{
switch (width) {
case 1:
Expand Down Expand Up @@ -158,7 +158,7 @@ static inline const char *ports_nt_str_compat(ibnd_node_t * node)
return "??";
}

char *node_name(ibnd_node_t * node)
static char *node_name(ibnd_node_t * node)
{
static char buf[256];

Expand All @@ -181,9 +181,9 @@ char *node_name(ibnd_node_t * node)
return buf;
}

void list_node(ibnd_node_t * node, void *user_data)
static void list_node(ibnd_node_t *node, void *user_data)
{
char *node_type;
const char *node_type;
char *nodename = remap_node_name(node_name_map, node->guid,
node->nodedesc);

Expand Down Expand Up @@ -211,7 +211,7 @@ void list_node(ibnd_node_t * node, void *user_data)
free(nodename);
}

void list_nodes(ibnd_fabric_t * fabric, int list)
static void list_nodes(ibnd_fabric_t *fabric, int list)
{
if (list & LIST_CA_NODE)
ibnd_iter_nodes_type(fabric, list_node, IB_NODE_CA, NULL);
Expand All @@ -221,7 +221,8 @@ void list_nodes(ibnd_fabric_t * fabric, int list)
ibnd_iter_nodes_type(fabric, list_node, IB_NODE_ROUTER, NULL);
}

void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix)
static void out_ids(ibnd_node_t *node, int group, char *chname,
const char *out_prefix)
{
uint64_t sysimgguid =
mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F);
Expand All @@ -247,7 +248,7 @@ void out_ids(ibnd_node_t *node, int group, char *chname, const char *out_prefix)
fprintf(f, "\n");
}

uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum)
static uint64_t out_chassis(ibnd_fabric_t *fabric, unsigned char chassisnum)
{
uint64_t guid;

Expand All @@ -259,7 +260,7 @@ uint64_t out_chassis(ibnd_fabric_t * fabric, unsigned char chassisnum)
return guid;
}

void out_switch_detail(ibnd_node_t * node, const char *sw_prefix)
static void out_switch_detail(ibnd_node_t *node, const char *sw_prefix)
{
char *nodename = NULL;

Expand All @@ -273,8 +274,8 @@ void out_switch_detail(ibnd_node_t * node, const char *sw_prefix)
free(nodename);
}

void out_switch(ibnd_node_t *node, int group, char *chname,
const char *id_prefix, const char *sw_prefix)
static void out_switch(ibnd_node_t *node, int group, char *chname,
const char *id_prefix, const char *sw_prefix)
{
const char *str;
char str2[256];
Expand All @@ -299,7 +300,7 @@ void out_switch(ibnd_node_t *node, int group, char *chname,
fprintf(f, "\n");
}

void out_ca_detail(ibnd_node_t *node, const char *ca_prefix)
static void out_ca_detail(ibnd_node_t *node, const char *ca_prefix)
{
const char *node_type;

Expand All @@ -320,8 +321,8 @@ void out_ca_detail(ibnd_node_t *node, const char *ca_prefix)
clean_nodedesc(node->nodedesc));
}

void out_ca(ibnd_node_t *node, int group, char *chname, const char *id_prefix,
const char *ca_prefix)
static void out_ca(ibnd_node_t *node, int group, char *chname,
const char *id_prefix, const char *ca_prefix)
{
const char *node_type;

Expand Down Expand Up @@ -429,7 +430,7 @@ static void out_switch_port(ibnd_port_t *port, int group,
free(rem_nodename);
}

void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix)
static void out_ca_port(ibnd_port_t *port, int group, const char *out_prefix)
{
char *str = NULL;
char *rem_nodename = NULL;
Expand Down Expand Up @@ -545,7 +546,7 @@ static void router_iter_func(ibnd_node_t * node, void *iter_user_data)
}
}

int dump_topology(int group, ibnd_fabric_t * fabric)
static int dump_topology(int group, ibnd_fabric_t *fabric)
{
ibnd_node_t *node;
ibnd_port_t *port;
Expand Down Expand Up @@ -687,7 +688,7 @@ int dump_topology(int group, ibnd_fabric_t * fabric)
return i;
}

void dump_ports_report(ibnd_node_t * node, void *user_data)
static void dump_ports_report(ibnd_node_t *node, void *user_data)
{
int p = 0;
ibnd_port_t *port = NULL;
Expand Down Expand Up @@ -968,7 +969,7 @@ static int diff_common(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric,
return 0;
}

int diff(ibnd_fabric_t * orig_fabric, ibnd_fabric_t * new_fabric)
static int diff(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric)
{
if (diffcheck_flags & DIFF_FLAG_SWITCH)
diff_common(orig_fabric, new_fabric, IB_NODE_SWITCH,
Expand Down
2 changes: 1 addition & 1 deletion src/ibping.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static uint64_t minrtt = ~0ull, maxrtt, total_rtt;
static uint64_t start, total_time, replied, lost, ntrans;
static ib_portid_t portid = { 0 };

void report(int sig)
static void report(int sig)
{
total_time = cl_get_time_stamp() - start;

Expand Down
8 changes: 4 additions & 4 deletions src/ibqueryerrors.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,9 +673,9 @@ static int print_errors(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_ma
header_printed, pc_ext, cap_mask, cap_mask2));
}

uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t * dest,
int port, unsigned mask, unsigned timeout,
const struct ibmad_port * srcport)
static uint8_t *reset_pc_ext(void *rcvbuf, ib_portid_t *dest, int port,
unsigned mask, unsigned timeout,
const struct ibmad_port *srcport)
{
ib_rpc_t rpc = { 0 };
int lid = dest->lid;
Expand Down Expand Up @@ -770,7 +770,7 @@ static void clear_port(ib_portid_t * portid, uint16_t cap_mask, uint32_t cap_mas
}
}

void print_node(ibnd_node_t * node, void *user_data)
static void print_node(ibnd_node_t *node, void *user_data)
{
int header_printed = 0;
int p = 0;
Expand Down

0 comments on commit 09922b3

Please sign in to comment.