summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/sff.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-10-24 18:54:11 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-10-24 18:54:11 +0000
commit9e11f6207f1e800e892fa509d93fc1e78dfff8d8 (patch)
treeaeb168ddeadd66d41808afaacf7006c3400857f9 /sbin/ifconfig/sff.c
parente6f81c82cb64bd9b0ef25aaa672a5b8f67aa9f05 (diff)
Fix ifconfig(8) compiler warnings regarding variable "name" reuse.
Call the global variable with the name of the interface "ifname". Do not pass it around, just use it globally. Do not use "ifname" for anything else. OK deraadt@
Diffstat (limited to 'sbin/ifconfig/sff.c')
-rw-r--r--sbin/ifconfig/sff.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/sbin/ifconfig/sff.c b/sbin/ifconfig/sff.c
index 35859d15280..a800a1f55d0 100644
--- a/sbin/ifconfig/sff.c
+++ b/sbin/ifconfig/sff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sff.c,v 1.22 2019/10/17 18:37:38 bluhm Exp $ */
+/* $OpenBSD: sff.c,v 1.23 2019/10/24 18:54:10 bluhm Exp $ */
/*
* Copyright (c) 2019 David Gwynne <dlg@openbsd.org>
@@ -346,9 +346,9 @@ static const struct sff_media_map upper_media_map = {
};
static void hexdump(const void *, size_t);
-static int if_sff8472(const char *, int, const struct if_sffpage *);
-static int if_sff8636(const char *, int, const struct if_sffpage *);
-static int if_inf8077(const char *, int, const struct if_sffpage *);
+static int if_sff8472(int, const struct if_sffpage *);
+static int if_sff8636(int, const struct if_sffpage *);
+static int if_inf8077(int, const struct if_sffpage *);
static const char *
sff_id_name(uint8_t id)
@@ -385,8 +385,7 @@ sff_con_name(uint8_t id)
}
static void
-if_sffpage_init(struct if_sffpage *sff, const char *ifname,
- uint8_t addr, uint8_t page)
+if_sffpage_init(struct if_sffpage *sff, uint8_t addr, uint8_t page)
{
memset(sff, 0, sizeof(*sff));
@@ -399,7 +398,7 @@ if_sffpage_init(struct if_sffpage *sff, const char *ifname,
}
static void
-if_sffpage_dump(const char *ifname, const struct if_sffpage *sff)
+if_sffpage_dump(const struct if_sffpage *sff)
{
printf("%s: addr %02x", ifname, sff->sff_addr);
if (sff->sff_addr == IFSFF_ADDR_EEPROM)
@@ -409,17 +408,17 @@ if_sffpage_dump(const char *ifname, const struct if_sffpage *sff)
}
int
-if_sff_info(const char *ifname, int dump)
+if_sff_info(int dump)
{
struct if_sffpage pg0;
int error = 0;
uint8_t id, ext_id;
- if_sffpage_init(&pg0, ifname, IFSFF_ADDR_EEPROM, 0);
+ if_sffpage_init(&pg0, IFSFF_ADDR_EEPROM, 0);
if (ioctl(sock, SIOCGIFSFFPAGE, (caddr_t)&pg0) == -1) {
if (errno == ENXIO) {
/* try 1 for XFP cos myx which can't switch pages... */
- if_sffpage_init(&pg0, ifname, IFSFF_ADDR_EEPROM, 1);
+ if_sffpage_init(&pg0, IFSFF_ADDR_EEPROM, 1);
if (ioctl(sock, SIOCGIFSFFPAGE, (caddr_t)&pg0) == -1)
return (-1);
} else
@@ -427,7 +426,7 @@ if_sff_info(const char *ifname, int dump)
}
if (dump)
- if_sffpage_dump(ifname, &pg0);
+ if_sffpage_dump(&pg0);
id = pg0.sff_data[0]; /* SFF8472_ID */
@@ -441,22 +440,22 @@ if_sff_info(const char *ifname, int dump)
}
/* FALLTHROUGH */
case SFF8024_ID_GBIC:
- error = if_sff8472(ifname, dump, &pg0);
+ error = if_sff8472(dump, &pg0);
break;
case SFF8024_ID_XFP:
if (pg0.sff_page != 1) {
- if_sffpage_init(&pg0, ifname, IFSFF_ADDR_EEPROM, 1);
+ if_sffpage_init(&pg0, IFSFF_ADDR_EEPROM, 1);
if (ioctl(sock, SIOCGIFSFFPAGE, (caddr_t)&pg0) == -1)
return (-1);
if (dump)
- if_sffpage_dump(ifname, &pg0);
+ if_sffpage_dump(&pg0);
}
- error = if_inf8077(ifname, dump, &pg0);
+ error = if_inf8077(dump, &pg0);
break;
case SFF8024_ID_QSFP:
case SFF8024_ID_QSFP_PLUS:
case SFF8024_ID_QSFP28:
- error = if_sff8636(ifname, dump, &pg0);
+ error = if_sff8636(dump, &pg0);
break;
default:
printf("\n");
@@ -613,7 +612,7 @@ if_sff_printmedia(const struct if_sffpage *pg, const struct sff_media_map *m)
}
static int
-if_sff8472(const char *ifname, int dump, const struct if_sffpage *pg0)
+if_sff8472(int dump, const struct if_sffpage *pg0)
{
struct if_sffpage ddm;
uint8_t ddm_types;
@@ -637,12 +636,12 @@ if_sff8472(const char *ifname, int dump, const struct if_sffpage *pg0)
!ISSET(ddm_types, SFF8472_DDM_TYPE_IMPL))
return (0);
- if_sffpage_init(&ddm, ifname, IFSFF_ADDR_DDM, 0);
+ if_sffpage_init(&ddm, IFSFF_ADDR_DDM, 0);
if (ioctl(sock, SIOCGIFSFFPAGE, (caddr_t)&ddm) == -1)
return (-1);
if (dump)
- if_sffpage_dump(ifname, &ddm);
+ if_sffpage_dump(&ddm);
if (ISSET(ddm_types, SFF8472_DDM_TYPE_CAL_EXT)) {
printf("\tcalibration: external "
@@ -716,7 +715,7 @@ if_upper_strings(const struct if_sffpage *pg)
}
static int
-if_inf8077(const char *ifname, int dump, const struct if_sffpage *pg1)
+if_inf8077(int dump, const struct if_sffpage *pg1)
{
if_upper_strings(pg1);
@@ -724,14 +723,13 @@ if_inf8077(const char *ifname, int dump, const struct if_sffpage *pg1)
}
static int
-if_sff8636_thresh(const char *ifname, int dump,
- const struct if_sffpage *pg0)
+if_sff8636_thresh(int dump, const struct if_sffpage *pg0)
{
struct if_sffpage pg3;
unsigned int i;
struct sff_thresholds temp, vcc, tx, rx, bias;
- if_sffpage_init(&pg3, ifname, IFSFF_ADDR_EEPROM, 3);
+ if_sffpage_init(&pg3, IFSFF_ADDR_EEPROM, 3);
if (ioctl(sock, SIOCGIFSFFPAGE, (caddr_t)&pg3) == -1) {
if (dump)
warn("%s SIOCGIFSFFPAGE page 3", ifname);
@@ -739,7 +737,7 @@ if_sff8636_thresh(const char *ifname, int dump,
}
if (dump)
- if_sffpage_dump(ifname, &pg3);
+ if_sffpage_dump(&pg3);
if (pg3.sff_data[0x7f] != 3) { /* just in case... */
if (dump) {
@@ -819,7 +817,7 @@ if_sff8636_thresh(const char *ifname, int dump,
}
static int
-if_sff8636(const char *ifname, int dump, const struct if_sffpage *pg0)
+if_sff8636(int dump, const struct if_sffpage *pg0)
{
int16_t temp;
uint8_t maxcasetemp;
@@ -846,7 +844,7 @@ if_sff8636(const char *ifname, int dump, const struct if_sffpage *pg0)
}
flat = pg0->sff_data[SFF8436_STATUS2] & SFF8436_STATUS2_FLAT_MEM;
- if (!flat && if_sff8636_thresh(ifname, dump, pg0) == 0) {
+ if (!flat && if_sff8636_thresh(dump, pg0) == 0) {
if (!dump)
return (0);
}