@@ -572,7 +572,7 @@ lock_pidfile(FILE *file, int command)
}
static pid_t
-read_pidfile__(const char *pidfile, bool delete_if_stale)
+read_pidfile__(const char *pidfile_, bool delete_if_stale)
{
struct stat s, s2;
struct flock lck;
@@ -581,7 +581,7 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
int error;
if ((pidfile_ino || pidfile_dev)
- && !stat(pidfile, &s)
+ && !stat(pidfile_, &s)
&& s.st_ino == pidfile_ino && s.st_dev == pidfile_dev) {
/* It's our own pidfile. We can't afford to open it, because closing
* *any* fd for a file that a process has locked also releases all the
@@ -591,19 +591,19 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
return getpid();
}
- file = fopen(pidfile, "r+");
+ file = fopen(pidfile_, "r+");
if (!file) {
if (errno == ENOENT && delete_if_stale) {
return 0;
}
error = errno;
- VLOG_WARN("%s: open: %s", pidfile, ovs_strerror(error));
+ VLOG_WARN("%s: open: %s", pidfile_, ovs_strerror(error));
goto error;
}
error = lock_pidfile__(file, F_GETLK, &lck);
if (error) {
- VLOG_WARN("%s: fcntl: %s", pidfile, ovs_strerror(error));
+ VLOG_WARN("%s: fcntl: %s", pidfile_, ovs_strerror(error));
goto error;
}
if (lck.l_type == F_UNLCK) {
@@ -616,7 +616,7 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
* pidfile locked, and only that process has the right to unlink it. */
if (!delete_if_stale) {
error = ESRCH;
- VLOG_DBG("%s: pid file is stale", pidfile);
+ VLOG_DBG("%s: pid file is stale", pidfile_);
goto error;
}
@@ -624,28 +624,28 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
error = lock_pidfile(file, F_SETLK);
if (error) {
/* We lost a race with someone else doing the same thing. */
- VLOG_WARN("%s: lost race to lock pidfile", pidfile);
+ VLOG_WARN("%s: lost race to lock pidfile", pidfile_);
goto error;
}
- /* Is the file we have locked still named 'pidfile'? */
- if (stat(pidfile, &s) || fstat(fileno(file), &s2)
+ /* Is the file we have locked still named 'pidfile_'? */
+ if (stat(pidfile_, &s) || fstat(fileno(file), &s2)
|| s.st_ino != s2.st_ino || s.st_dev != s2.st_dev) {
/* No. We lost a race with someone else who got the lock before
* us, deleted the pidfile, and closed it (releasing the lock). */
error = EALREADY;
- VLOG_WARN("%s: lost race to delete pidfile", pidfile);
+ VLOG_WARN("%s: lost race to delete pidfile", pidfile_);
goto error;
}
/* We won the right to delete the stale pidfile. */
- if (unlink(pidfile)) {
+ if (unlink(pidfile_)) {
error = errno;
VLOG_WARN("%s: failed to delete stale pidfile (%s)",
- pidfile, ovs_strerror(error));
+ pidfile_, ovs_strerror(error));
goto error;
}
- VLOG_DBG("%s: deleted stale pidfile", pidfile);
+ VLOG_DBG("%s: deleted stale pidfile", pidfile_);
fclose(file);
return 0;
}
@@ -653,10 +653,10 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
if (!fgets(line, sizeof line, file)) {
if (ferror(file)) {
error = errno;
- VLOG_WARN("%s: read: %s", pidfile, ovs_strerror(error));
+ VLOG_WARN("%s: read: %s", pidfile_, ovs_strerror(error));
} else {
error = ESRCH;
- VLOG_WARN("%s: read: unexpected end of file", pidfile);
+ VLOG_WARN("%s: read: unexpected end of file", pidfile_);
}
goto error;
}
@@ -667,7 +667,7 @@ read_pidfile__(const char *pidfile, bool delete_if_stale)
* preparing to delete it. */
error = ESRCH;
VLOG_WARN("%s: stale pidfile for pid %s being deleted by pid %ld",
- pidfile, line, (long int) lck.l_pid);
+ pidfile_, line, (long int) lck.l_pid);
goto error;
}
@@ -681,12 +681,12 @@ error:
return -error;
}
-/* Opens and reads a PID from 'pidfile'. Returns the positive PID if
+/* Opens and reads a PID from 'pidfile_'. Returns the positive PID if
* successful, otherwise a negative errno value. */
pid_t
-read_pidfile(const char *pidfile)
+read_pidfile(const char *pidfile_)
{
- return read_pidfile__(pidfile, false);
+ return read_pidfile__(pidfile_, false);
}
/* Checks whether a process with the given 'pidfile' is already running and,
@@ -730,22 +730,22 @@ gid_matches(gid_t expected, gid_t value)
}
static bool
-gid_verify(gid_t gid)
+gid_verify(gid_t gid_)
{
gid_t r, e;
r = getgid();
e = getegid();
- return (gid_matches(gid, r) &&
- gid_matches(gid, e));
+ return (gid_matches(gid_, r) &&
+ gid_matches(gid_, e));
}
static void
-daemon_switch_group(gid_t gid)
+daemon_switch_group(gid_t gid_)
{
- if ((setgid(gid) == -1) || !gid_verify(gid)) {
+ if ((setgid(gid_) == -1) || !gid_verify(gid_)) {
VLOG_FATAL("%s: fail to switch group to gid as %d, aborting",
- pidfile, gid);
+ pidfile, gid_);
}
}
@@ -756,22 +756,22 @@ uid_matches(uid_t expected, uid_t value)
}
static bool
-uid_verify(const uid_t uid)
+uid_verify(const uid_t uid_)
{
uid_t r, e;
r = getuid();
e = geteuid();
- return (uid_matches(uid, r) &&
- uid_matches(uid, e));
+ return (uid_matches(uid_, r) &&
+ uid_matches(uid_, e));
}
static void
-daemon_switch_user(const uid_t uid, const char *user)
+daemon_switch_user(const uid_t uid_, const char *user_)
{
- if ((setuid(uid) == -1) || !uid_verify(uid)) {
+ if ((setuid(uid_) == -1) || !uid_verify(uid_)) {
VLOG_FATAL("%s: fail to switch user to %s, aborting",
- pidfile, user);
+ pidfile, user_);
}
}
@@ -155,7 +155,7 @@ static int
route_table_reset(void)
{
struct nl_dump dump;
- struct rtgenmsg *rtmsg;
+ struct rtgenmsg *rtgenmsg;
uint64_t reply_stub[NL_DUMP_BUFSIZE / 8];
struct ofpbuf request, reply, buf;
@@ -166,10 +166,11 @@ route_table_reset(void)
ofpbuf_init(&request, 0);
- nl_msg_put_nlmsghdr(&request, sizeof *rtmsg, RTM_GETROUTE, NLM_F_REQUEST);
+ nl_msg_put_nlmsghdr(&request, sizeof *rtgenmsg, RTM_GETROUTE,
+ NLM_F_REQUEST);
- rtmsg = ofpbuf_put_zeros(&request, sizeof *rtmsg);
- rtmsg->rtgen_family = AF_UNSPEC;
+ rtgenmsg = ofpbuf_put_zeros(&request, sizeof *rtgenmsg);
+ rtgenmsg->rtgen_family = AF_UNSPEC;
nl_dump_start(&dump, NETLINK_ROUTE, &request);
ofpbuf_uninit(&request);
@@ -534,18 +534,15 @@ udpif_stop_threads(struct udpif *udpif)
/* Starts the handler and revalidator threads, must be enclosed in
* ovsrcu quiescent state. */
static void
-udpif_start_threads(struct udpif *udpif, size_t n_handlers,
- size_t n_revalidators)
+udpif_start_threads(struct udpif *udpif, size_t n_handlers_,
+ size_t n_revalidators_)
{
- if (udpif && n_handlers && n_revalidators) {
- size_t i;
- bool enable_ufid;
-
- udpif->n_handlers = n_handlers;
- udpif->n_revalidators = n_revalidators;
+ if (udpif && n_handlers_ && n_revalidators_) {
+ udpif->n_handlers = n_handlers_;
+ udpif->n_revalidators = n_revalidators_;
udpif->handlers = xzalloc(udpif->n_handlers * sizeof *udpif->handlers);
- for (i = 0; i < udpif->n_handlers; i++) {
+ for (size_t i = 0; i < udpif->n_handlers; i++) {
struct handler *handler = &udpif->handlers[i];
handler->udpif = udpif;
@@ -554,8 +551,7 @@ udpif_start_threads(struct udpif *udpif, size_t n_handlers,
"handler", udpif_upcall_handler, handler);
}
- enable_ufid = udpif->backer->rt_support.ufid;
- atomic_init(&udpif->enable_ufid, enable_ufid);
+ atomic_init(&udpif->enable_ufid, udpif->backer->rt_support.ufid);
dpif_enable_upcall(udpif->dpif);
ovs_barrier_init(&udpif->reval_barrier, udpif->n_revalidators);
@@ -564,7 +560,7 @@ udpif_start_threads(struct udpif *udpif, size_t n_handlers,
udpif->pause = false;
udpif->revalidators = xzalloc(udpif->n_revalidators
* sizeof *udpif->revalidators);
- for (i = 0; i < udpif->n_revalidators; i++) {
+ for (size_t i = 0; i < udpif->n_revalidators; i++) {
struct revalidator *revalidator = &udpif->revalidators[i];
revalidator->udpif = udpif;
@@ -598,33 +594,33 @@ udpif_resume_revalidators(struct udpif *udpif)
}
/* Tells 'udpif' how many threads it should use to handle upcalls.
- * 'n_handlers' and 'n_revalidators' can never be zero. 'udpif''s
+ * 'n_handlers_' and 'n_revalidators_' can never be zero. 'udpif''s
* datapath handle must have packet reception enabled before starting
* threads. */
void
-udpif_set_threads(struct udpif *udpif, size_t n_handlers,
- size_t n_revalidators)
+udpif_set_threads(struct udpif *udpif, size_t n_handlers_,
+ size_t n_revalidators_)
{
ovs_assert(udpif);
- ovs_assert(n_handlers && n_revalidators);
+ ovs_assert(n_handlers_ && n_revalidators_);
ovsrcu_quiesce_start();
- if (udpif->n_handlers != n_handlers
- || udpif->n_revalidators != n_revalidators) {
+ if (udpif->n_handlers != n_handlers_
+ || udpif->n_revalidators != n_revalidators_) {
udpif_stop_threads(udpif);
}
if (!udpif->handlers && !udpif->revalidators) {
int error;
- error = dpif_handlers_set(udpif->dpif, n_handlers);
+ error = dpif_handlers_set(udpif->dpif, n_handlers_);
if (error) {
VLOG_ERR("failed to configure handlers in dpif %s: %s",
dpif_name(udpif->dpif), ovs_strerror(error));
return;
}
- udpif_start_threads(udpif, n_handlers, n_revalidators);
+ udpif_start_threads(udpif, n_handlers_, n_revalidators_);
}
ovsrcu_quiesce_end();
}
@@ -639,12 +635,12 @@ udpif_synchronize(struct udpif *udpif)
/* This is stronger than necessary. It would be sufficient to ensure
* (somehow) that each handler and revalidator thread had passed through
* its main loop once. */
- size_t n_handlers = udpif->n_handlers;
- size_t n_revalidators = udpif->n_revalidators;
+ size_t n_handlers_ = udpif->n_handlers;
+ size_t n_revalidators_ = udpif->n_revalidators;
ovsrcu_quiesce_start();
udpif_stop_threads(udpif);
- udpif_start_threads(udpif, n_handlers, n_revalidators);
+ udpif_start_threads(udpif, n_handlers_, n_revalidators_);
ovsrcu_quiesce_end();
}
@@ -682,16 +678,14 @@ udpif_get_memory_usage(struct udpif *udpif, struct simap *usage)
void
udpif_flush(struct udpif *udpif)
{
- size_t n_handlers, n_revalidators;
-
- n_handlers = udpif->n_handlers;
- n_revalidators = udpif->n_revalidators;
+ size_t n_handlers_ = udpif->n_handlers;
+ size_t n_revalidators_ = udpif->n_revalidators;
ovsrcu_quiesce_start();
udpif_stop_threads(udpif);
dpif_flow_flush(udpif->dpif);
- udpif_start_threads(udpif, n_handlers, n_revalidators);
+ udpif_start_threads(udpif, n_handlers_, n_revalidators_);
ovsrcu_quiesce_end();
}
@@ -5239,8 +5239,6 @@ dpif_set_support(struct dpif_backer_support *rt_support,
#undef ODP_SUPPORT_FIELD
if (!name) {
- struct shash_node *node;
-
SHASH_FOR_EACH (node, &all_fields) {
display_support_field(node->name, node->data, ds);
}
@@ -587,9 +587,9 @@ static ovs_be32
queue_msg(struct ofpbuf *msg)
{
const struct ofp_header *oh = msg->data;
- ovs_be32 xid = oh->xid;
+ ovs_be32 xid_ = oh->xid;
rconn_send(swconn, msg, tx_counter);
- return xid;
+ return xid_;
}
static void
@@ -1038,7 +1038,7 @@ ofctrl_put(struct hmap *flow_table, struct shash *pending_ct_zones,
/* Add a barrier to the list of messages. */
struct ofpbuf *barrier = ofputil_encode_barrier_request(OFP13_VERSION);
const struct ofp_header *oh = barrier->data;
- ovs_be32 xid = oh->xid;
+ ovs_be32 xid_ = oh->xid;
ovs_list_push_back(&msgs, &barrier->list_node);
/* Queue the messages. */
@@ -1051,7 +1051,7 @@ ofctrl_put(struct hmap *flow_table, struct shash *pending_ct_zones,
SHASH_FOR_EACH(iter, pending_ct_zones) {
struct ct_zone_pending_entry *ctzpe = iter->data;
if (ctzpe->state == CT_ZONE_OF_SENT && !ctzpe->of_xid) {
- ctzpe->of_xid = xid;
+ ctzpe->of_xid = xid_;
}
}
@@ -1076,7 +1076,7 @@ ofctrl_put(struct hmap *flow_table, struct shash *pending_ct_zones,
* so that we don't send a notification that we're up-to-date
* until we're really caught up. */
VLOG_DBG("advanced xid target for nb_cfg=%"PRId64, nb_cfg);
- fup->xid = xid;
+ fup->xid = xid_;
goto done;
} else {
break;
@@ -1086,7 +1086,7 @@ ofctrl_put(struct hmap *flow_table, struct shash *pending_ct_zones,
/* Add a flow update. */
fup = xmalloc(sizeof *fup);
ovs_list_push_back(&flow_updates, &fup->list_node);
- fup->xid = xid;
+ fup->xid = xid_;
fup->nb_cfg = nb_cfg;
done:;
} else if (!ovs_list_is_empty(&flow_updates)) {
@@ -119,9 +119,9 @@ queue_msg(struct ofpbuf *msg)
return xid;
}
-/* Sets up 'swconn', a newly (re)connected connection to a switch. */
+/* Sets up global 'swconn', a newly (re)connected connection to a switch. */
static void
-pinctrl_setup(struct rconn *swconn)
+pinctrl_setup(void)
{
/* Fetch the switch configuration. The response later will allow us to
* change the miss_send_len to UINT16_MAX, so that we can enable
@@ -135,10 +135,10 @@ pinctrl_setup(struct rconn *swconn)
}
static void
-set_switch_config(struct rconn *swconn,
+set_switch_config(struct rconn *swconn_,
const struct ofputil_switch_config *config)
{
- enum ofp_version version = rconn_get_version(swconn);
+ enum ofp_version version = rconn_get_version(swconn_);
struct ofpbuf *request = ofputil_encode_set_config(config, version);
queue_msg(request);
}
@@ -1078,7 +1078,7 @@ pinctrl_run(struct controller_ctx *ctx,
}
if (conn_seq_no != rconn_get_connection_seqno(swconn)) {
- pinctrl_setup(swconn);
+ pinctrl_setup();
conn_seq_no = rconn_get_connection_seqno(swconn);
flush_put_mac_bindings();
}
@@ -440,10 +440,10 @@ struct macam_node {
};
static void
-cleanup_macam(struct hmap *macam)
+cleanup_macam(struct hmap *macam_)
{
struct macam_node *node;
- HMAP_FOR_EACH_POP (node, hmap_node, macam) {
+ HMAP_FOR_EACH_POP (node, hmap_node, macam_) {
free(node);
}
}
@@ -4463,9 +4463,9 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od,
while (ip_str && ip_str[0]) {
char *ip_address = NULL;
uint16_t port = 0;
- int addr_family;
+ int addr_family_;
ip_address_and_port_from_lb_key(ip_str, &ip_address, &port,
- &addr_family);
+ &addr_family_);
if (!ip_address) {
break;
}
@@ -1495,11 +1495,11 @@ benchmark(bool use_wc)
static uint32_t
random_value(void)
{
- static const uint32_t values[] =
+ static const uint32_t values_[] =
{ 0xffffffff, 0xaaaaaaaa, 0x55555555, 0x80000000,
0x00000001, 0xface0000, 0x00d00d1e, 0xdeadbeef };
- return values[random_range(ARRAY_SIZE(values))];
+ return values_[random_range(ARRAY_SIZE(values_))];
}
static bool
@@ -150,7 +150,7 @@ test_benchmark(struct ovs_cmdl_context *ctx)
}
static void
-pcap_batch_execute_conntrack(struct conntrack *ct,
+pcap_batch_execute_conntrack(struct conntrack *ct_,
struct dp_packet_batch *pkt_batch)
{
struct dp_packet_batch new_batch;
@@ -173,7 +173,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct,
}
if (flow.dl_type != dl_type) {
- conntrack_execute(ct, &new_batch, dl_type, false, true, 0,
+ conntrack_execute(ct_, &new_batch, dl_type, false, true, 0,
NULL, NULL, 0, 0, NULL, NULL, now);
dp_packet_batch_init(&new_batch);
}
@@ -181,7 +181,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct,
}
if (!dp_packet_batch_is_empty(&new_batch)) {
- conntrack_execute(ct, &new_batch, dl_type, false, true, 0, NULL, NULL,
+ conntrack_execute(ct_, &new_batch, dl_type, false, true, 0, NULL, NULL,
0, 0, NULL, NULL, now);
}
@@ -190,7 +190,7 @@ pcap_batch_execute_conntrack(struct conntrack *ct,
static void
test_pcap(struct ovs_cmdl_context *ctx)
{
- size_t total_count, batch_size;
+ size_t total_count, batch_size_;
FILE *pcap;
int err = 0;
@@ -199,10 +199,10 @@ test_pcap(struct ovs_cmdl_context *ctx)
return;
}
- batch_size = 1;
+ batch_size_ = 1;
if (ctx->argc > 2) {
- batch_size = strtoul(ctx->argv[2], NULL, 0);
- if (batch_size == 0 || batch_size > NETDEV_MAX_BURST) {
+ batch_size_ = strtoul(ctx->argv[2], NULL, 0);
+ if (batch_size_ == 0 || batch_size_ > NETDEV_MAX_BURST) {
ovs_fatal(0,
"batch_size must be between 1 and NETDEV_MAX_BURST(%u)",
NETDEV_MAX_BURST);
@@ -219,7 +219,7 @@ test_pcap(struct ovs_cmdl_context *ctx)
struct dp_packet_batch *batch = &pkt_batch_;
dp_packet_batch_init(batch);
- for (int i = 0; i < batch_size; i++) {
+ for (int i = 0; i < batch_size_; i++) {
err = ovs_pcap_read(pcap, &packet, NULL);
if (err) {
break;
@@ -653,17 +653,17 @@ dump_transaction(struct vconn *vconn, struct ofpbuf *request)
"OpenFlow packet receive failed");
recv_xid = ((struct ofp_header *) reply->data)->xid;
if (send_xid == recv_xid) {
- enum ofpraw raw;
+ enum ofpraw ofpraw;
ofp_print(stdout, reply->data, reply->size,
ports_to_show(vconn_get_name(vconn)),
tables_to_show(vconn_get_name(vconn)),
verbosity + 1);
- ofpraw_decode(&raw, reply->data);
- if (ofptype_from_ofpraw(raw) == OFPTYPE_ERROR) {
+ ofpraw_decode(&ofpraw, reply->data);
+ if (ofptype_from_ofpraw(ofpraw) == OFPTYPE_ERROR) {
done = true;
- } else if (raw == reply_raw) {
+ } else if (ofpraw == reply_raw) {
done = !ofpmp_more(reply->data);
} else {
ovs_fatal(0, "received bad reply: %s",
@@ -693,13 +693,13 @@ dump_transaction(struct vconn *vconn, struct ofpbuf *request)
}
static void
-dump_trivial_transaction(const char *vconn_name, enum ofpraw raw)
+dump_trivial_transaction(const char *vconn_name, enum ofpraw ofpraw)
{
struct ofpbuf *request;
struct vconn *vconn;
open_vconn(vconn_name, &vconn);
- request = ofpraw_alloc(raw, vconn_get_version(vconn), 0);
+ request = ofpraw_alloc(ofpraw, vconn_get_version(vconn), 0);
dump_transaction(vconn, request);
vconn_close(vconn);
}
@@ -1223,10 +1223,10 @@ table_iterator_init(struct table_iterator *ti, struct vconn *vconn)
? TI_STATS : TI_FEATURES);
ti->more = true;
- enum ofpraw raw = (ti->variant == TI_STATS
- ? OFPRAW_OFPST_TABLE_REQUEST
- : OFPRAW_OFPST13_TABLE_FEATURES_REQUEST);
- struct ofpbuf *rq = ofpraw_alloc(raw, vconn_get_version(vconn), 0);
+ enum ofpraw ofpraw = (ti->variant == TI_STATS
+ ? OFPRAW_OFPST_TABLE_REQUEST
+ : OFPRAW_OFPST13_TABLE_FEATURES_REQUEST);
+ struct ofpbuf *rq = ofpraw_alloc(ofpraw, vconn_get_version(vconn), 0);
ti->send_xid = ((struct ofp_header *) rq->data)->xid;
send_openflow_buffer(ti->vconn, rq);
}
@@ -4645,7 +4645,7 @@ ofctl_encode_error_reply(struct ovs_cmdl_context *ctx)
static void
ofctl_ofp_print(struct ovs_cmdl_context *ctx)
{
- int verbosity = ctx->argc > 2 ? atoi(ctx->argv[2]) : 2;
+ int verbosity_ = ctx->argc > 2 ? atoi(ctx->argv[2]) : 2;
struct ofpbuf packet;
ofpbuf_init(&packet, 0);
@@ -4674,7 +4674,7 @@ ofctl_ofp_print(struct ovs_cmdl_context *ctx)
ovs_fatal(0, "trailing garbage following hex bytes");
}
free(buffer);
- ofp_print(stdout, packet.data, packet.size, NULL, NULL, verbosity);
+ ofp_print(stdout, packet.data, packet.size, NULL, NULL, verbosity_);
ofpbuf_uninit(&packet);
}
Rename the remaining variables that were shadowing another definition. Signed-off-by: Justin Pettit <jpettit@ovn.org> --- lib/daemon-unix.c | 62 +++++++++++++++++++++---------------------- lib/route-table.c | 9 ++++--- ofproto/ofproto-dpif-upcall.c | 50 +++++++++++++++------------------- ofproto/ofproto-dpif.c | 2 -- ovn/controller/ofctrl.c | 12 ++++----- ovn/controller/pinctrl.c | 10 +++---- ovn/northd/ovn-northd.c | 8 +++--- tests/test-classifier.c | 4 +-- tests/test-conntrack.c | 16 +++++------ utilities/ovs-ofctl.c | 24 ++++++++--------- 10 files changed, 95 insertions(+), 102 deletions(-)