Skip to content

Commit

Permalink
ibdiags: Add missing static to variables
Browse files Browse the repository at this point in the history
Found by sparse. Also drop redundant = 0's for global values.

Reviewed-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
  • Loading branch information
jgunthorpe authored and weiny2 committed Apr 15, 2019
1 parent 7735a87 commit c9d98a6
Show file tree
Hide file tree
Showing 20 changed files with 103 additions and 105 deletions.
50 changes: 25 additions & 25 deletions libibnetdisc/src/chassis.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,120 +355,120 @@ static int is_line(ibnd_node_t * n)
}

/* these structs help find Line (Anafa) slot number while using spine portnum */
char line_slot_2_sfb4[37] = {
static const char line_slot_2_sfb4[37] = {
0,
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
char anafa_line_slot_2_sfb4[37] = {
static const char anafa_line_slot_2_sfb4[37] = {
0,
1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2,
1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

char line_slot_2_sfb12[37] = {
static const char line_slot_2_sfb12[37] = {
0,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
char anafa_line_slot_2_sfb12[37] = {
static const char anafa_line_slot_2_sfb12[37] = {
0,
1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
1, 2, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* LB slot = table[spine port] */
char line_slot_2_sfb18[37] = {
static const char line_slot_2_sfb18[37] = {
0,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18};
/* LB asic num = table[spine port] */
char anafa_line_slot_2_sfb18[37] = {
static const char anafa_line_slot_2_sfb18[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};

/* LB slot = table[spine port] */
char line_slot_2_sfb18x2[37] = {
static const char line_slot_2_sfb18x2[37] = {
0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/* LB asic num = table[spine port] */
char anafa_line_slot_2_sfb18x2[37] = {
static const char anafa_line_slot_2_sfb18x2[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* LB slot = table[spine port] */
char line_slot_2_sfb4200[37] = {
static const char line_slot_2_sfb4200[37] = {
0,
1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9};
/* LB asic num = table[spine port] */
char anafa_line_slot_2_sfb4200[37] = {
static const char anafa_line_slot_2_sfb4200[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};

/* IPR FCR modules connectivity while using sFB4 port as reference */
char ipr_slot_2_sfb4_port[37] = {
static const char ipr_slot_2_sfb4_port[37] = {
0,
3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1,
3, 2, 1, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* these structs help find Spine (Anafa) slot number while using spine portnum */
char spine12_slot_2_slb[37] = {
static const char spine12_slot_2_slb[37] = {
0,
1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
char anafa_spine12_slot_2_slb[37] = {
static const char anafa_spine12_slot_2_slb[37] = {
0,
1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

char spine4_slot_2_slb[37] = {
static const char spine4_slot_2_slb[37] = {
0,
1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
char anafa_spine4_slot_2_slb[37] = {
static const char anafa_spine4_slot_2_slb[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* FB slot = table[line port] */
char spine18_slot_2_slb[37] = {
static const char spine18_slot_2_slb[37] = {
0,
1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* FB asic = table[line port] */
char anafa_spine18_slot_2_slb[37] = {
static const char anafa_spine18_slot_2_slb[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
char anafa_spine18x2_slot_2_slb[37] = {
static const char anafa_spine18x2_slot_2_slb[37] = {
0,
2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

/* FB slot = table[line port] */
char sfb4200_slot_2_slb[37] = {
static const char sfb4200_slot_2_slb[37] = {
0,
1, 1, 1, 1, 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* FB asic = table[line port] */
char anafa_sfb4200_slot_2_slb[37] = {
static const char anafa_sfb4200_slot_2_slb[37] = {
0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Expand Down Expand Up @@ -1111,34 +1111,34 @@ A2 int port | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
*/

int int2ext_map_slb24[2][25] = {
static int int2ext_map_slb24[2][25] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 5, 4, 18, 17, 16, 1, 2, 3,
13, 14, 15},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 11, 10, 24, 23, 22, 7, 8, 9,
19, 20, 21}
};

int int2ext_map_slb8[2][25] = {
static int int2ext_map_slb8[2][25] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 6, 6, 6, 1, 1, 1, 5, 5,
5},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 8, 8, 8, 3, 3, 3, 7, 7,
7}
};

int int2ext_map_slb2024[2][25] = {
static int int2ext_map_slb2024[2][25] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12}
};

int int2ext_map_slb4018[37] = {
static int int2ext_map_slb4018[37] = {
0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
};

int int2ext_map_sfb4700x2[2][37] = {
static int int2ext_map_sfb4700x2[2][37] = {
{0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12},
Expand Down
2 changes: 1 addition & 1 deletion libibnetdisc/test/testleaks.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include <infiniband/complib/cl_nodenamemap.h>
#include <infiniband/ibnetdisc.h>

const char *argv0 = "iblinkinfotest";
static const char *argv0 = "iblinkinfotest";
static FILE *f;

static void usage(void)
Expand Down
6 changes: 3 additions & 3 deletions src/dump_fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

#include "ibdiag_common.h"

struct ibmad_port *srcport;
static struct ibmad_port *srcport;

unsigned startlid = 0, endlid = 0;
static unsigned startlid, endlid;

static int brief, dump_all, multicast;

Expand Down Expand Up @@ -107,7 +107,7 @@ static int dump_mlid(char *str, int strlen, unsigned mlid, unsigned nports,
return i * 2;
}

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

static void dump_multicast_tables(ibnd_node_t *node, unsigned startl,
unsigned endl, struct ibmad_port *mad_port)
Expand Down
2 changes: 1 addition & 1 deletion src/ibaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

#include "ibdiag_common.h"

struct ibmad_port *srcport;
static struct ibmad_port *srcport;

static int ib_resolve_addr(ib_portid_t * portid, int portnum, int show_lid,
int show_gid)
Expand Down
32 changes: 16 additions & 16 deletions src/ibcacheedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@

#include "ibdiag_common.h"

uint64_t switchguid_before = 0;
uint64_t switchguid_after = 0;
int switchguid_flag = 0;

uint64_t caguid_before = 0;
uint64_t caguid_after = 0;
int caguid_flag = 0;

uint64_t sysimgguid_before = 0;
uint64_t sysimgguid_after = 0;
int sysimgguid_flag = 0;

uint64_t portguid_nodeguid = 0;
uint64_t portguid_before = 0;
uint64_t portguid_after = 0;
int portguid_flag = 0;
static uint64_t switchguid_before;
static uint64_t switchguid_after;
static int switchguid_flag;

static uint64_t caguid_before;
static uint64_t caguid_after;
static int caguid_flag;

static uint64_t sysimgguid_before;
static uint64_t sysimgguid_after;
static int sysimgguid_flag;

static uint64_t portguid_nodeguid;
static uint64_t portguid_before;
static uint64_t portguid_after;
static int portguid_flag;

struct guids {
uint64_t searchguid;
Expand Down
4 changes: 2 additions & 2 deletions src/ibccconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

#include "ibdiag_common.h"

struct ibmad_port *srcport;
static struct ibmad_port *srcport;

static op_fn_t congestion_key_info;
static op_fn_t switch_congestion_setting;
Expand All @@ -77,7 +77,7 @@ static const match_rec_t match_tbl[] = {
{0}
};

uint64_t cckey = 0;
static uint64_t cckey;

/*******************************************/
static const char *parselonglongint(char *arg, uint64_t *val)
Expand Down
4 changes: 2 additions & 2 deletions src/ibccquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#include "ibdiag_common.h"

struct ibmad_port *srcport;
static struct ibmad_port *srcport;

static op_fn_t class_port_info;
static op_fn_t congestion_info;
Expand All @@ -75,7 +75,7 @@ static const match_rec_t match_tbl[] = {
{0}
};

uint64_t cckey = 0;
static uint64_t cckey = 0;

/*******************************************/
static const char *class_port_info(ib_portid_t *dest, char **argv, int argc)
Expand Down
2 changes: 1 addition & 1 deletion src/ibping.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "ibdiag_common.h"

struct ibmad_port *srcport;
static struct ibmad_port *srcport;

static uint64_t time_stamp(void)
{
Expand Down
30 changes: 15 additions & 15 deletions src/ibportstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ enum port_ops {
OFF
};

struct ibmad_port *srcport;
uint64_t speed = 0; /* no state change */
uint64_t espeed = 0; /* no state change */
uint64_t fdr10 = 0; /* no state change */
uint64_t width = 0; /* no state change */
uint64_t lid;
uint64_t smlid;
uint64_t lmc;
uint64_t mtu;
uint64_t vls = 0; /* no state change */
uint64_t mkey;
uint64_t mkeylease;
uint64_t mkeyprot;

struct {
static struct ibmad_port *srcport;
static uint64_t speed; /* no state change */
static uint64_t espeed; /* no state change */
static uint64_t fdr10; /* no state change */
static uint64_t width; /* no state change */
static uint64_t lid;
static uint64_t smlid;
static uint64_t lmc;
static uint64_t mtu;
static uint64_t vls; /* no state change */
static uint64_t mkey;
static uint64_t mkeylease;
static uint64_t mkeyprot;

static struct {
const char *name;
uint64_t *val;
int set;
Expand Down

0 comments on commit c9d98a6

Please sign in to comment.