Skip to content

Commit

Permalink
lldpad: Fix unused parameter warnings
Browse files Browse the repository at this point in the history
Resolve unused parameter warnings revealed by -Wextra.

V2: Update for latest repo.
V3: Resolve conflict with recent changes.

Signed-off-by: Mark Rustad <[email protected]>
Tested-by: Ross Brattain <[email protected]>
Signed-off-by: John Fastabend <[email protected]>
  • Loading branch information
mdrustad authored and John Fastabend committed Feb 2, 2012
1 parent 047639d commit 1015c49
Show file tree
Hide file tree
Showing 37 changed files with 276 additions and 259 deletions.
9 changes: 4 additions & 5 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void destroy_cfg(void)
config_destroy(&lldpad_cfg);
}

void scan_port(void *eloop_data, void *user_ctx)
void scan_port(UNUSED void *eloop_data, UNUSED void *user_ctx)
{
struct port *port;
struct if_nameindex *nameidx, *p;
Expand Down Expand Up @@ -695,7 +695,7 @@ int set_config_tlvfield(const char *ifname, int agenttype, u32 tlvid,
}

int set_config_tlvfield_str(const char *ifname, int agenttype, u32 tlvid,
const char *field, const char *str, size_t size)
const char *field, const char *str)
{
if (!str)
return EINVAL;
Expand Down Expand Up @@ -734,10 +734,9 @@ int set_config_tlvinfo_bin(const char *ifname, int agenttype, u32 tlvid,
}

int set_config_tlvinfo_str(const char *ifname, int agenttype, u32 tlvid,
char *value, size_t size)
char *value)
{
return set_config_tlvfield_str(ifname, agenttype, tlvid, "info",
value, size);
return set_config_tlvfield_str(ifname, agenttype, tlvid, "info", value);
}

int set_config_tlvfield_int(const char *ifname, int agenttype, u32 tlvid,
Expand Down
26 changes: 13 additions & 13 deletions ctrl_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,19 @@ int clif_iface_module(struct clif_data *clifd,
}


int clif_iface_cmd_unknown(struct clif_data *clifd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen,
char *rbuf, int rlen)
int clif_iface_cmd_unknown(UNUSED struct clif_data *clifd,
UNUSED struct sockaddr_un *from,
UNUSED socklen_t fromlen,
UNUSED char *ibuf, UNUSED int ilen,
UNUSED char *rbuf, UNUSED int rlen)
{
return cmd_invalid;
}

int clif_iface_ping(struct clif_data *clifd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen,
int clif_iface_ping(UNUSED struct clif_data *clifd,
UNUSED struct sockaddr_un *from,
UNUSED socklen_t fromlen,
UNUSED char *ibuf, UNUSED int ilen,
char *rbuf, int rlen)
{
snprintf(rbuf, rlen, "%cPONG", PING_CMD);
Expand All @@ -148,7 +148,7 @@ int clif_iface_ping(struct clif_data *clifd,
int clif_iface_attach(struct clif_data *clifd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen,
char *ibuf, UNUSED int ilen,
char *rbuf, int rlen)
{
struct ctrl_dst *dst;
Expand Down Expand Up @@ -258,7 +258,7 @@ static int detach_clif_monitor(struct clif_data *clifd,
int clif_iface_detach(struct clif_data *clifd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen,
UNUSED char *ibuf, UNUSED int ilen,
char *rbuf, int rlen)
{
snprintf(rbuf, rlen, "%c", DETACH_CMD);
Expand All @@ -268,7 +268,7 @@ int clif_iface_detach(struct clif_data *clifd,
int clif_iface_level(struct clif_data *clifd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen,
char *ibuf, UNUSED int ilen,
char *rbuf, int rlen)
{
struct ctrl_dst *dst;
Expand Down Expand Up @@ -332,7 +332,7 @@ static void process_clif_cmd( struct clif_data *cd,


static void ctrl_iface_receive(int sock, void *eloop_ctx,
void *sock_ctx)
UNUSED void *sock_ctx)
{
struct clif_data *clifd = eloop_ctx;
char buf[MAX_CLIF_MSGBUF];
Expand Down
2 changes: 1 addition & 1 deletion dcb_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ void mark_pfc_sent(char *device_name)
it->second->protocol.tlv_sent = true;
}

void mark_app_sent(char *device_name, u32 subtype)
void mark_app_sent(char *device_name)
{
app_it it;
int i;
Expand Down
28 changes: 16 additions & 12 deletions dcbtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#include "dcbtool.h"
#include "version.h"

#define UNUSED __attribute__((__unused__))

static int show_raw;

static const char *cli_version =
Expand Down Expand Up @@ -265,7 +267,7 @@ static void cli_close_connection(void)
}


static void cli_msg_cb(char *msg, size_t len)
static void cli_msg_cb(char *msg, UNUSED size_t len)
{
parse_print_message(msg, SHOW_OUTPUT | show_raw);
}
Expand Down Expand Up @@ -313,27 +315,31 @@ inline int clif_command(struct clif *clif, char *cmd, int raw)
return _clif_command(clif, cmd, SHOW_OUTPUT | raw);
}


static int cli_cmd_ping(struct clif *clif, int argc, char *argv[], int raw)
static int cli_cmd_ping(struct clif *clif, UNUSED int argc, UNUSED char *argv[],
int raw)
{
return clif_command(clif, "P", raw);
}

static int cli_cmd_help(struct clif *clif, int argc, char *argv[], int raw)
static int
cli_cmd_help(UNUSED struct clif *clif, UNUSED int argc, UNUSED char *argv[],
UNUSED int raw)
{
printf("%s", commands_help);
return 0;
}


static int cli_cmd_license(struct clif *clif, int argc, char *argv[], int raw)
static int
cli_cmd_license(UNUSED struct clif *clif, UNUSED int argc, UNUSED char *argv[],
UNUSED int raw)
{
printf("%s\n\n%s\n", cli_version, cli_full_license);
return 0;
}


static int cli_cmd_quit(struct clif *clif, int argc, char *argv[], int raw)
static int
cli_cmd_quit(UNUSED struct clif *clif, UNUSED int argc, UNUSED char *argv[],
UNUSED int raw)
{
cli_quit = 1;
return 0;
Expand Down Expand Up @@ -455,15 +461,13 @@ static void cli_interactive(int raw)
} while (!cli_quit);
}


static void cli_terminate(int sig)
static void cli_terminate(UNUSED int sig)
{
cli_close_connection();
exit(0);
}


static void cli_alarm(int sig)
static void cli_alarm(UNUSED int sig)
{
if (clif_conn && _clif_command(clif_conn, "P", SHOW_NO_OUTPUT)) {
printf("Connection to lldpad lost - trying to reconnect\n");
Expand Down
4 changes: 2 additions & 2 deletions ecp/ecp.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* to not having to call the ecp code from the vdp state machine. Instead, we
* return to the event loop, giving other code a chance to do work.
*/
void ecp_localchange_handler(void *eloop_data, void *user_ctx)
void ecp_localchange_handler(UNUSED void *eloop_data, void *user_ctx)
{
struct vdp_data *vd;

Expand Down Expand Up @@ -104,7 +104,7 @@ static int ecp_stop_localchange_timer(struct vdp_data *vd)
*
* called when the ECP timer has expired. Calls the ECP station state machine.
*/
void ecp_ack_timeout_handler(void *eloop_data, void *user_ctx)
void ecp_ack_timeout_handler(UNUSED void *eloop_data, void *user_ctx)
{
struct vdp_data *vd;

Expand Down
5 changes: 3 additions & 2 deletions ecp/ecp_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ void ecp_rx_send_ack_frame(struct vdp_data *vd)
* statistics about ecp frames. Checks if it is a request or an ack frame and branches
* to ecp rx or ecp tx state machine.
*/
void ecp_rx_ReceiveFrame(void *ctx, int ifindex, const u8 *buf, size_t len)
void
ecp_rx_ReceiveFrame(void *ctx, UNUSED int ifindex, const u8 *buf, size_t len)
{
struct vdp_data *vd;
struct port *port;
Expand Down Expand Up @@ -449,7 +450,7 @@ void ecp_rx_ProcessFrame(struct vdp_data *vd)

if (tlv->type == TYPE_127) { /* private TLV */
/* give VSI TLV to VDP */
if (!vdp_indicate(vd, tlv, ecp_hdr->mode))
if (!vdp_indicate(vd, tlv))
tlv_stored = true;
else {
/* TODO: put it in a list and try again later until
Expand Down
4 changes: 3 additions & 1 deletion eloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <unistd.h>
#include "eloop.h"

#define UNUSED __attribute__((__unused__))

typedef long os_time_t;

/**
Expand Down Expand Up @@ -516,7 +518,7 @@ void eloop_run(void)
}


void eloop_terminate(int sig, void *eloop_ctx, void *signal_ctx)
void eloop_terminate(int sig, UNUSED void *eloop_ctx, UNUSED void *signal_ctx)
{
printf("Signal %d received - terminating\n", sig);
eloop.terminate = 1;
Expand Down
7 changes: 5 additions & 2 deletions event_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,9 @@ struct nl_msg *event_if_simpleResponse(uint32_t pid, uint32_t seq, int err)
return NULL;
}

static void event_iface_receive_user_space(int sock, void *eloop_ctx, void *sock_ctx)
static void
event_iface_receive_user_space(int sock,
UNUSED void *eloop_ctx, UNUSED void *sock_ctx)
{
struct nlmsghdr *nlh, *nlh2;
struct nl_msg *nl_msg;
Expand Down Expand Up @@ -882,7 +884,8 @@ static void event_iface_receive_user_space(int sock, void *eloop_ctx, void *sock
return;
}

static void event_iface_receive(int sock, void *eloop_ctx, void *sock_ctx)
static void
event_iface_receive(int sock, UNUSED void *eloop_ctx, UNUSED void *sock_ctx)
{
struct nlmsghdr *nlh;
struct sockaddr_nl dest_addr;
Expand Down
4 changes: 2 additions & 2 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ int set_config_tlvfield(const char *ifname, int agenttype, u32 tlvid, const char
int set_config_tlvfield_int(const char *ifname, int agenttype, u32 tlvid, const char *field, int *value);
int set_config_tlvfield_bool(const char *ifname, int agenttype, u32 tlvid, const char *field, int *value);
int set_config_tlvfield_bin(const char *ifname, int agenttype, u32 tlvid, const char *field, void *value, size_t size);
int set_config_tlvfield_str(const char *ifname, int agenttype, u32 tlvid, const char *field, const char *value, size_t size);
int set_config_tlvfield_str(const char *ifname, int agenttype, u32 tlvid, const char *field, const char *value);
int set_config_tlvinfo_bin(const char *ifname, int agenttype, u32 tlvid, void *value, size_t size);
int set_config_tlvinfo_str(const char *ifname, int agenttype, u32 tlvid, char *value, size_t size);
int set_config_tlvinfo_str(const char *ifname, int agenttype, u32 tlvid, char *value);
int is_tlv_txdisabled(const char *ifname, int agenttype, u32 tlvid);
int is_tlv_txenabled(const char *ifname, int agenttype, u32 tlvid);
int tlv_enabletx(const char *ifname, int agenttype, u32 tlvid);
Expand Down
2 changes: 1 addition & 1 deletion include/dcb_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool add_pfc_defaults(void);
bool add_app_defaults(u32 subtype);
void mark_pg_sent(char *device_name);
void mark_pfc_sent(char *device_name);
void mark_app_sent(char *device_name, u32 subtype);
void mark_app_sent(char *device_name);
bool add_llink_defaults(u32 subtype);
void mark_llink_sent(char *device_name, u32 subtype);

Expand Down
2 changes: 2 additions & 0 deletions include/lldp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ typedef __u16 u16;
typedef __u32 u32;
typedef __u64 u64;

#define UNUSED __attribute__((__unused__))

#define MIN(x,y) \
({ \
typeof (x) __x = (x); \
Expand Down
2 changes: 1 addition & 1 deletion include/lldp_vdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int vdp_remove_profile(struct vsi_profile *);
void vdp_somethingChangedLocal(struct vsi_profile *, bool);

void vdp_ack_profiles(struct vdp_data *, int);
int vdp_indicate(struct vdp_data *, struct unpacked_tlv *, int);
int vdp_indicate(struct vdp_data *, struct unpacked_tlv *);
int vdp_vsis_pending(struct vdp_data *);
int vdp_vsis(char *);
const char *vdp_response2str(int);
Expand Down
2 changes: 1 addition & 1 deletion include/tlv_dcbx.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ bool unpack_dcbx2_tlvs(struct port *, struct lldp_agent *, struct unpacked_tlv
bool process_dcbx_ctrl_tlv(struct port *, struct lldp_agent *);
bool process_dcbx_pg_tlv(struct port *, struct lldp_agent *);
bool process_dcbx_pfc_tlv(struct port *, struct lldp_agent *);
bool process_dcbx_app_tlv(struct port *, struct lldp_agent *, int);
bool process_dcbx_app_tlv(struct port *, struct lldp_agent *);
bool process_dcbx_llink_tlv(struct port *, struct lldp_agent *);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion lldp/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ int lldp_add_agent(const char *ifname, enum agent_type type)
return 0;
}

static void timer(void *eloop_data, void *user_ctx)
static void timer(UNUSED void *eloop_data, UNUSED void *user_ctx)
{
struct lldp_module *n;
struct lldp_agent *agent;
Expand Down
6 changes: 3 additions & 3 deletions lldp/l2_packet_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
}


static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)
static void l2_packet_receive(int sock, void *eloop_ctx, UNUSED void *sock_ctx)
{
struct l2_packet_data *l2 = eloop_ctx;
u8 buf[2300];
Expand All @@ -154,7 +154,7 @@ static void l2_packet_receive(int sock, void *eloop_ctx, void *sock_ctx)


struct l2_packet_data * l2_packet_init(
const char *ifname, const u8 *own_addr, unsigned short protocol,
const char *ifname, UNUSED const u8 *own_addr, unsigned short protocol,
void (*rx_callback)(void *ctx, int ifindex,
const u8 *buf, size_t len),
void *rx_callback_ctx, int l2_hdr)
Expand Down Expand Up @@ -357,7 +357,7 @@ struct port *add_bond_port(const char *ifname)
}


void recv_on_bond(void *ctx, int ifindex, const u8 *buf, size_t len)
void recv_on_bond(UNUSED void *ctx, int ifindex, const u8 *buf, size_t len)
{
struct port *port;

Expand Down
8 changes: 1 addition & 7 deletions lldp/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void rxInitializeLLDP(struct port *port, struct lldp_agent *agent)
return;
}

void rxReceiveFrame(void *ctx, int ifindex, const u8 *buf, size_t len)
void rxReceiveFrame(void *ctx, UNUSED int ifindex, const u8 *buf, size_t len)
{
struct port * port;
struct lldp_agent *agent;
Expand Down Expand Up @@ -433,7 +433,6 @@ void run_rx_sm(struct port *port, struct lldp_agent *agent)
do {
switch(agent->rx.state) {
case LLDP_WAIT_PORT_OPERATIONAL:
process_wait_port_operational(port);
break;
case DELETE_AGED_INFO:
process_delete_aged_info(port, agent);
Expand Down Expand Up @@ -522,11 +521,6 @@ bool set_rx_state(struct port *port, struct lldp_agent *agent)
}
}

void process_wait_port_operational(struct port *port)
{
return;
}

void process_delete_aged_info(struct port *port, struct lldp_agent *agent)
{
mibDeleteObjects(port, agent);
Expand Down
1 change: 0 additions & 1 deletion lldp/states.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ void mibUpdateObjects(struct port *, struct lldp_agent *);
void run_rx_sm(struct port *, struct lldp_agent *);
bool set_rx_state(struct port *, struct lldp_agent *);
void rx_change_state(struct lldp_agent *, u8 );
void process_wait_port_operational(struct port *);
void process_delete_aged_info(struct port *, struct lldp_agent *);
void process_rx_lldp_initialize(struct port *, struct lldp_agent *);
void process_wait_for_frame(struct lldp_agent *);
Expand Down
Loading

0 comments on commit 1015c49

Please sign in to comment.