[ovs-dev] [OfconnLogging 1/5] rconn: Drop 'name' arg to rconn_new_from_vconn(), rconn_connect_unreliably().
Ben Pfaff
blp at nicira.com
Fri Jun 4 20:50:13 UTC 2010
The 'name' argument to these functions is actively unhelpful, because none
of the callers provided a better name than the one provided by
vconn_get_name(). So drop it.
---
lib/rconn.c | 9 ++++-----
lib/rconn.h | 5 ++---
ofproto/ofproto.c | 3 +--
utilities/ovs-controller.c | 10 +++++-----
4 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/lib/rconn.c b/lib/rconn.c
index 71198ea..a26b037 100644
--- a/lib/rconn.c
+++ b/lib/rconn.c
@@ -156,10 +156,10 @@ rconn_new(const char *name, int inactivity_probe_interval, int max_backoff)
/* Creates a new rconn, connects it (unreliably) to 'vconn', and returns it. */
struct rconn *
-rconn_new_from_vconn(const char *name, struct vconn *vconn)
+rconn_new_from_vconn(struct vconn *vconn)
{
struct rconn *rc = rconn_create(60, 0);
- rconn_connect_unreliably(rc, name, vconn);
+ rconn_connect_unreliably(rc, vconn);
return rc;
}
@@ -257,12 +257,11 @@ rconn_connect(struct rconn *rc, const char *name)
}
void
-rconn_connect_unreliably(struct rconn *rc,
- const char *name, struct vconn *vconn)
+rconn_connect_unreliably(struct rconn *rc, struct vconn *vconn)
{
assert(vconn != NULL);
rconn_disconnect(rc);
- set_vconn_name(rc, name);
+ set_vconn_name(rc, vconn_get_name(vconn));
rc->reliable = false;
rc->vconn = vconn;
rc->last_connected = time_now();
diff --git a/lib/rconn.h b/lib/rconn.h
index 765e88c..aa9d76c 100644
--- a/lib/rconn.h
+++ b/lib/rconn.h
@@ -39,7 +39,7 @@ struct rconn_packet_counter;
struct rconn *rconn_new(const char *name,
int inactivity_probe_interval, int max_backoff);
-struct rconn *rconn_new_from_vconn(const char *name, struct vconn *);
+struct rconn *rconn_new_from_vconn(struct vconn *);
struct rconn *rconn_create(int inactivity_probe_interval, int max_backoff);
void rconn_set_max_backoff(struct rconn *, int max_backoff);
@@ -48,8 +48,7 @@ void rconn_set_probe_interval(struct rconn *, int inactivity_probe_interval);
int rconn_get_probe_interval(const struct rconn *);
int rconn_connect(struct rconn *, const char *name);
-void rconn_connect_unreliably(struct rconn *,
- const char *name, struct vconn *vconn);
+void rconn_connect_unreliably(struct rconn *, struct vconn *vconn);
void rconn_reconnect(struct rconn *);
void rconn_disconnect(struct rconn *);
void rconn_destroy(struct rconn *);
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 0fd2fdf..adb836b 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1078,8 +1078,7 @@ ofproto_run1(struct ofproto *p)
retval = pvconn_accept(p->listeners[i], OFP_VERSION, &vconn);
if (!retval) {
- ofconn_create(p, rconn_new_from_vconn("passive", vconn),
- OFCONN_TRANSIENT);
+ ofconn_create(p, rconn_new_from_vconn(vconn), OFCONN_TRANSIENT);
} else if (retval != EAGAIN) {
VLOG_WARN_RL(&rl, "accept failed (%s)", strerror(retval));
}
diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c
index 30acc8b..19eec15 100644
--- a/utilities/ovs-controller.c
+++ b/utilities/ovs-controller.c
@@ -71,7 +71,7 @@ static bool mute = false;
static char *unixctl_path = NULL;
static int do_switching(struct switch_ *);
-static void new_switch(struct switch_ *, struct vconn *, const char *name);
+static void new_switch(struct switch_ *, struct vconn *);
static void parse_options(int argc, char *argv[]);
static void usage(void) NO_RETURN;
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
if (n_switches >= MAX_SWITCHES) {
ovs_fatal(0, "max %d switch connections", n_switches);
}
- new_switch(&switches[n_switches++], vconn, name);
+ new_switch(&switches[n_switches++], vconn);
continue;
} else if (retval == EAFNOSUPPORT) {
struct pvconn *pvconn;
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
retval = pvconn_accept(listeners[i], OFP_VERSION, &new_vconn);
if (!retval || retval == EAGAIN) {
if (!retval) {
- new_switch(&switches[n_switches++], new_vconn, "tcp");
+ new_switch(&switches[n_switches++], new_vconn);
}
i++;
} else {
@@ -208,9 +208,9 @@ main(int argc, char *argv[])
}
static void
-new_switch(struct switch_ *sw, struct vconn *vconn, const char *name)
+new_switch(struct switch_ *sw, struct vconn *vconn)
{
- sw->rconn = rconn_new_from_vconn(name, vconn);
+ sw->rconn = rconn_new_from_vconn(vconn);
sw->lswitch = lswitch_create(sw->rconn, learn_macs, exact_flows,
set_up_flows ? max_idle : -1,
action_normal);
--
1.7.1
More information about the dev
mailing list