Patchwork [Open-FCoE,1/4] fcoe-utils: Resolve unused parameter warnings

login
register
mail settings
Submitter Mark Rustad
Date May 17, 2013, 8:56 p.m.
Message ID <20130517205612.15739.96856.stgit@host1-mdrustad.localdomain>
Download mbox | patch
Permalink /patch/52/
State Accepted
Headers show

Comments

Mark Rustad - May 17, 2013, 8:56 p.m.
Adding -Wextra reveals unused parameter warnings. Resolve
them.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
---
 fcoeadm_display.c    |   22 +++++--------------
 fcoemon.c            |   59 +++++++++++++++++++++++---------------------------
 fcping.c             |    3 +--
 fipvlan.c            |    5 +++-
 include/fcoe_utils.h |    2 ++
 lib/fcoe_utils.c     |    5 ++--
 libopenfcoe.c        |    8 +++----
 7 files changed, 45 insertions(+), 59 deletions(-)

Patch

diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index e1cbd48..215c19e 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -190,8 +190,7 @@  static void show_hba_info(HBA_ADAPTERATTRIBUTES *hba_info)
 	printf("\n");
 }
 
-static void show_port_info(HBA_ADAPTERATTRIBUTES *hba_info,
-			   HBA_PORTATTRIBUTES *lp_info)
+static void show_port_info(HBA_PORTATTRIBUTES *lp_info)
 {
 	char buf[256];
 	int len = sizeof(buf);
@@ -235,7 +234,6 @@  static void show_port_info(HBA_ADAPTERATTRIBUTES *hba_info,
 }
 
 static void show_target_info(const char *symbolic_name,
-			     HBA_ADAPTERATTRIBUTES *hba_info,
 			     HBA_PORTATTRIBUTES *rp_info)
 {
 	char buf[256];
@@ -666,8 +664,7 @@  show_short_lun_info(HBA_FCP_SCSI_ENTRY *ep, char *inqbuf,
 }
 
 static void
-show_full_lun_info(HBA_HANDLE hba_handle,
-		   HBA_ADAPTERATTRIBUTES *hba_info,
+show_full_lun_info(UNUSED HBA_HANDLE hba_handle,
 		   HBA_PORTATTRIBUTES *lp_info,
 		   HBA_PORTATTRIBUTES *rp_info,
 		   HBA_FCP_SCSI_ENTRY *ep,
@@ -854,10 +851,8 @@  get_device_map(HBA_HANDLE hba_handle, HBA_PORTATTRIBUTES *lp_info,
 
 static void
 scan_device_map(HBA_HANDLE hba_handle,
-		HBA_ADAPTERATTRIBUTES *hba_info,
 		HBA_PORTATTRIBUTES *lp_info,
 		HBA_PORTATTRIBUTES *rp_info,
-		const char *ifname,
 		enum disp_style style)
 {
 	HBA_STATUS status;
@@ -947,7 +942,7 @@  scan_device_map(HBA_HANDLE hba_handle,
 			show_short_lun_info(ep, inqbuf, blksize, lba);
 			break;
 		case DISP_LUN:
-			show_full_lun_info(hba_handle, hba_info, lp_info,
+			show_full_lun_info(hba_handle, lp_info,
 					   rp_info, ep, inqbuf, blksize, lba);
 			break;
 		}
@@ -1296,8 +1291,7 @@  enum fcoe_status display_adapter_info(const char *ifname)
 			if (!strncmp(hba_attrs->SerialNumber,
 				     shba_attrs->SerialNumber,
 				     strlen(hba_attrs->SerialNumber))) {
-				show_port_info(shba_attrs,
-					       sport_attrs);
+				show_port_info(sport_attrs);
 				hba_table_list->hba_table[j].displayed = 1;
 			}
 		}
@@ -1320,7 +1314,6 @@  enum fcoe_status display_target_info(const char *ifname,
 	enum fcoe_status rc = SUCCESS;
 	HBA_HANDLE hba_handle;
 	HBA_PORTATTRIBUTES *port_attrs;
-	HBA_ADAPTERATTRIBUTES *hba_attrs;
 
 	if (fcoeadm_loadhba())
 		return EHBAAPIERR;
@@ -1346,7 +1339,6 @@  enum fcoe_status display_target_info(const char *ifname,
 
 		hba_handle = hba_table_list->hba_table[i].hba_handle;
 		port_attrs = &hba_table_list->hba_table[i].port_attrs;
-		hba_attrs = &hba_table_list->hba_table[i].hba_attrs;
 
 		if (ifname && check_symbolic_name_for_interface(
 			    port_attrs->PortSymbolicName,
@@ -1386,7 +1378,6 @@  enum fcoe_status display_target_info(const char *ifname,
 
 			show_target_info(
 				port_attrs->PortSymbolicName,
-				hba_attrs,
 				&rport_attrs);
 
 			if (port_attrs->PortState != HBA_PORTSTATE_ONLINE)
@@ -1397,9 +1388,8 @@  enum fcoe_status display_target_info(const char *ifname,
 			 * under the target.
 			 */
 			scan_device_map(hba_handle,
-					hba_attrs,
 					port_attrs,
-					&rport_attrs, ifname, style);
+					&rport_attrs, style);
 		}
 	}
 
@@ -1412,7 +1402,7 @@  out:
 
 static struct sa_table fcoe_ctlr_table;
 
-void print_fcoe_fcf_device(void *ep, void *arg)
+void print_fcoe_fcf_device(void *ep, UNUSED void *arg)
 {
 	struct fcoe_fcf_device *fcf = (struct fcoe_fcf_device *)ep;
 	char temp[MAX_STR_LEN];
diff --git a/fcoemon.c b/fcoemon.c
index 5460214..eeb2903 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -169,7 +169,7 @@  static void fcm_dcbd_rx(void *);
 static void fcm_dcbd_event(char *, size_t);
 static void fcm_dcbd_cmd_resp(char *, cmd_status);
 static void fcm_netif_advance(struct fcm_netif *);
-static void fcm_fcoe_action(struct fcm_netif *, struct fcoe_port *);
+static void fcm_fcoe_action(struct fcoe_port *);
 static void fcp_set_next_action(struct fcoe_port *, enum fcp_action);
 static enum fcoe_status fcm_fcoe_if_action(char *, char *);
 
@@ -178,15 +178,15 @@  static enum fcoe_status fcm_fcoe_if_action(char *, char *);
  * "control" interfaces.
  */
 struct libfcoe_interface_template {
-	enum fcoe_status (*create)(struct fcm_netif *, struct fcoe_port *);
-	enum fcoe_status (*destroy)(struct fcm_netif *, struct fcoe_port *);
-	enum fcoe_status (*enable)(struct fcm_netif *, struct fcoe_port *);
-	enum fcoe_status (*disable)(struct fcm_netif *, struct fcoe_port *);
+	enum fcoe_status (*create)(struct fcoe_port *);
+	enum fcoe_status (*destroy)(struct fcoe_port *);
+	enum fcoe_status (*enable)(struct fcoe_port *);
+	enum fcoe_status (*disable)(struct fcoe_port *);
 };
 
 static const struct libfcoe_interface_template *libfcoe_control;
 
-static enum fcoe_status fcm_module_create(struct fcm_netif *ff, struct fcoe_port *p)
+static enum fcoe_status fcm_module_create(struct fcoe_port *p)
 {
 	enum fcoe_status rc;
 
@@ -216,17 +216,17 @@  static enum fcoe_status fcm_module_create(struct fcm_netif *ff, struct fcoe_port
 	return SUCCESS;
 }
 
-static enum fcoe_status fcm_module_destroy(struct fcm_netif *ff, struct fcoe_port *p)
+static enum fcoe_status fcm_module_destroy(struct fcoe_port *p)
 {
 	return fcm_fcoe_if_action(FCOE_DESTROY, p->ifname);
 }
 
-static enum fcoe_status fcm_module_enable(struct fcm_netif *ff, struct fcoe_port *p)
+static enum fcoe_status fcm_module_enable(struct fcoe_port *p)
 {
 	return fcm_fcoe_if_action(FCOE_ENABLE, p->ifname);
 }
 
-static enum fcoe_status fcm_module_disable(struct fcm_netif *ff, struct fcoe_port *p)
+static enum fcoe_status fcm_module_disable(struct fcoe_port *p)
 {
 	return fcm_fcoe_if_action(FCOE_DISABLE, p->ifname);
 }
@@ -238,13 +238,12 @@  static struct libfcoe_interface_template libfcoe_module_tmpl = {
 	.disable = fcm_module_disable,
 };
 
-static enum fcoe_status fcm_bus_enable(struct fcm_netif *ff,
-				       struct fcoe_port *p)
+static enum fcoe_status fcm_bus_enable(struct fcoe_port *p)
 {
 	return fcm_write_str_to_ctlr_attr(p->ctlr, FCOE_CTLR_ATTR_ENABLED, "1");
 }
 
-static int fcm_bus_configure(struct fcm_netif *ff, struct fcoe_port *p)
+static int fcm_bus_configure(struct fcoe_port *p)
 {
 	int rc;
 
@@ -255,8 +254,7 @@  static int fcm_bus_configure(struct fcm_netif *ff, struct fcoe_port *p)
 	return rc;
 }
 
-static enum fcoe_status fcm_bus_create(struct fcm_netif *ff,
-				       struct fcoe_port *p)
+static enum fcoe_status fcm_bus_create(struct fcoe_port *p)
 {
 	enum fcoe_status rc;
 
@@ -284,21 +282,19 @@  static enum fcoe_status fcm_bus_create(struct fcm_netif *ff,
 		return ENOSYSFS;
 	}
 
-	rc = fcm_bus_configure(ff, p);
+	rc = fcm_bus_configure(p);
 	if (!rc)
-		rc = fcm_bus_enable(ff, p);
+		rc = fcm_bus_enable(p);
 
 	return rc;
 }
 
-static enum fcoe_status fcm_bus_destroy(struct fcm_netif *ff,
-					struct fcoe_port *p)
+static enum fcoe_status fcm_bus_destroy(struct fcoe_port *p)
 {
 	return fcm_write_str_to_sysfs_file(FCOE_BUS_DESTROY, p->ifname);
 }
 
-static enum fcoe_status fcm_bus_disable(struct fcm_netif *ff,
-					struct fcoe_port *p)
+static enum fcoe_status fcm_bus_disable(struct fcoe_port *p)
 {
 	return fcm_write_str_to_ctlr_attr(p->ctlr, FCOE_CTLR_ATTR_ENABLED, "0");
 }
@@ -816,7 +812,7 @@  static void fcm_fc_event_log(struct fc_nl_event *fe)
 
 }
 
-static void fcm_fc_event_recv(void *arg)
+static void fcm_fc_event_recv(UNUSED void *arg)
 {
 	struct nlmsghdr *hp;
 	struct fc_nl_event *fc_event;
@@ -1413,8 +1409,7 @@  static void fcm_dcbd_state_set(struct fcm_netif *ff,
 	ff->response_pending = 0;
 }
 
-static int fip_recv_vlan_req(struct fiphdr *fh, struct sockaddr_ll *ssa,
-			     struct fcoe_port *sp)
+static int fip_recv_vlan_req(struct sockaddr_ll *ssa, struct fcoe_port *sp)
 {
 	struct fip_tlv_vlan *vlan_tlvs = NULL;
 	int vlan_count = 0;
@@ -1473,7 +1468,7 @@  static int fip_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa,
 	switch (fh->fip_subcode) {
 	case FIP_VLAN_REQ:
 		FCM_LOG_DBG("received VLAN req, subcode=%d\n", fh->fip_subcode);
-		rc = fip_recv_vlan_req(fh, sa, p);
+		rc = fip_recv_vlan_req(sa, p);
 		break;
 	default:
 		FCM_LOG_DBG("ignored FIP VLAN packet with subcode %d\n",
@@ -1841,7 +1836,7 @@  static void fcm_process_ieee_msg(struct nlmsghdr *nlh)
 		ieee_state_set(ff, IEEE_DONE);
 }
 
-static void fcm_link_recv(void *arg)
+static void fcm_link_recv(UNUSED void *arg)
 {
 	int rc;
 	char *buf;
@@ -2104,7 +2099,7 @@  static int fcm_dcbd_connect(void)
 	return 1;
 }
 
-static void fcm_dcbd_timeout(void *arg)
+static void fcm_dcbd_timeout(UNUSED void *arg)
 {
 	if (fcm_clif->cl_ping_pending > 0) {
 		fcm_dcbd_request("D");	/* DETACH_CMD */
@@ -2947,7 +2942,7 @@  int fcm_start_vlan_disc(struct fcoe_port *p)
  *         action = 2      Create the FCoE interface
  *         action = 3      Reset the interface
  */
-static void fcm_fcoe_action(struct fcm_netif *ff, struct fcoe_port *p)
+static void fcm_fcoe_action(struct fcoe_port *p)
 {
 	struct fcoe_port *vp;
 	char path[MAX_PATH_LEN];
@@ -2956,7 +2951,7 @@  static void fcm_fcoe_action(struct fcm_netif *ff, struct fcoe_port *p)
 	switch (p->action) {
 	case FCP_CREATE_IF:
 		FCM_LOG_DBG("OP: CREATE %s\n", p->ifname);
-		rc = libfcoe_control->create(ff, p);
+		rc = libfcoe_control->create(p);
 		if (rc) {
 			FCM_LOG_DBG("Failed to create FCoE interface "
 				    "for %s, rc is %d\n", p->ifname, rc);
@@ -2982,12 +2977,12 @@  static void fcm_fcoe_action(struct fcm_netif *ff, struct fcoe_port *p)
 			rc = SUCCESS;
 			break;
 		}
-		rc = libfcoe_control->destroy(ff, p);
+		rc = libfcoe_control->destroy(p);
 		p->fchost[0] = '\0';
 		break;
 	case FCP_ENABLE_IF:
 		FCM_LOG_DBG("OP: ENABLE %s\n", p->ifname);
-		rc = libfcoe_control->enable(ff, p);
+		rc = libfcoe_control->enable(p);
 		break;
 	case FCP_DISABLE_IF:
 		FCM_LOG_DBG("OP: DISABLE %s\n", p->ifname);
@@ -3003,7 +2998,7 @@  static void fcm_fcoe_action(struct fcm_netif *ff, struct fcoe_port *p)
 			}
 			break;
 		}
-		rc = libfcoe_control->disable(ff, p);
+		rc = libfcoe_control->disable(p);
 		break;
 	case FCP_RESET_IF:
 		FCM_LOG_DBG("OP: RESET %s\n", p->ifname);
@@ -3194,7 +3189,7 @@  static void fcm_handle_changes()
 			goto next_port;
 		}
 
-		fcm_fcoe_action(ff, p);
+		fcm_fcoe_action(p);
 
 		fcp_set_next_action(p, FCP_WAIT);
 next_port:
diff --git a/fcping.c b/fcping.c
index 0b93012..dcdb081 100644
--- a/fcping.c
+++ b/fcping.c
@@ -993,8 +993,7 @@  static int fp_send_ping(void)
 	return rc;
 }
 
-static void
-fp_signal_handler(int sig)
+static void fp_signal_handler(UNUSED int sig)
 {
 	/*
 	 * Allow graceful termination of the
diff --git a/fipvlan.c b/fipvlan.c
index ecce311..10db38e 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -319,7 +319,8 @@  static int fip_recv_vlan_note(struct fiphdr *fh, int ifindex, bool vn2vn)
 	return 0;
 }
 
-int fip_vlan_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg)
+int fip_vlan_handler(struct fiphdr *fh, struct sockaddr_ll *sa,
+		     UNUSED void *arg)
 {
 	/* We only care about VLAN Notifications */
 	if (ntohs(fh->fip_proto) != FIP_PROTO_VLAN) {
@@ -526,7 +527,7 @@  void parse_cmdline(int argc, char **argv)
 	config.namec = argc - optind;
 }
 
-int rtnl_listener_handler(struct nlmsghdr *nh, void *arg)
+int rtnl_listener_handler(struct nlmsghdr *nh, UNUSED void *arg)
 {
 	switch (nh->nlmsg_type) {
 	case RTM_NEWLINK:
diff --git a/include/fcoe_utils.h b/include/fcoe_utils.h
index 5fb875d..29b8ef0 100644
--- a/include/fcoe_utils.h
+++ b/include/fcoe_utils.h
@@ -32,6 +32,8 @@ 
 #include <dirent.h>
 #include <errno.h>
 
+#define UNUSED __attribute__((__unused__))
+
 #define MAX_STR_LEN 512
 #define MAX_PATH_LEN MAX_STR_LEN
 
diff --git a/lib/fcoe_utils.c b/lib/fcoe_utils.c
index 792ca49..54b979b 100644
--- a/lib/fcoe_utils.c
+++ b/lib/fcoe_utils.c
@@ -218,7 +218,7 @@  static int fchost_filter(const struct dirent *dent)
 	return !strncmp(dent->d_name, "host", 4);
 }
 
-static int fcoe_check_ctlr(const char *fchost, const char *dname, int len)
+static int fcoe_check_ctlr(const char *fchost, const char *dname)
 {
 	int n, status;
 	struct dirent **namelist;
@@ -259,8 +259,7 @@  enum fcoe_status fcoe_find_ctlr(const char *fchost, char *ctlr, int len)
 		if (rc) {
 			/* check ctlr against known host */
 			if (!fcoe_check_ctlr(fchost,
-					     namelist[n]->d_name,
-					     len)) {
+					     namelist[n]->d_name)) {
 
 				dname_len = strnlen(namelist[n]->d_name, len);
 
diff --git a/libopenfcoe.c b/libopenfcoe.c
index 9c4cfd9..94a37e3 100644
--- a/libopenfcoe.c
+++ b/libopenfcoe.c
@@ -92,7 +92,7 @@  fail:
 	return -ENOENT;
 }
 
-static void read_fcoe_fcf_device(void *ep, void *arg)
+static void read_fcoe_fcf_device(void *ep, UNUSED void *arg)
 {
 	struct fcoe_fcf_device *fcf = (struct fcoe_fcf_device *)ep;
 	char buf[MAX_STR_LEN];
@@ -114,7 +114,7 @@  static void read_fcoe_fcf_device(void *ep, void *arg)
 	sa_sys_read_u32(fcf->path, "vlan_id", &fcf->vlan_id);
 }
 
-void read_fcoe_fcf(void *ep, void *arg)
+void read_fcoe_fcf(void *ep, UNUSED void *arg)
 {
 	struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)ep;
 
@@ -125,7 +125,7 @@  void read_fcoe_fcf(void *ep, void *arg)
 	sa_table_iterate(&ctlr->fcfs, read_fcoe_fcf_device, NULL);
 }
 
-void free_fcoe_fcf_device(void *ep, void *arg)
+void free_fcoe_fcf_device(void *ep, UNUSED void *arg)
 {
 	struct fcoe_fcf_device *fcf = (struct fcoe_fcf_device *)ep;
 
@@ -234,7 +234,7 @@  void read_fcoe_ctlr(struct sa_table *ctlrs)
 	sa_table_iterate(ctlrs, read_fcoe_fcf, NULL);
 }
 
-void free_fcoe_ctlr_device(void *ep, void *arg)
+void free_fcoe_ctlr_device(void *ep, UNUSED void *arg)
 {
 	struct fcoe_ctlr_device *ctlr = (struct fcoe_ctlr_device *)ep;