summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-02-03 13:15:48 -0800
committerBen Pfaff <blp@ovn.org>2016-02-03 15:20:11 -0800
commit45863ce567c8edf53b5e41e359295f694bb9d3b4 (patch)
treecf4d1bca777ae80bcaa0c5f78a32febcc992f4c0
parenteba7755248f3c042238cf319676dead0dcc785c6 (diff)
downloadopenvswitch-45863ce567c8edf53b5e41e359295f694bb9d3b4.tar.gz
vlog: Stop using explicit references to external log modules.
It's always risky to write "extern" declarations outside a header file, since there's no way to ensure the type of what's being referenced is correct. In these cases, we can easily avoid the extern reference, so do so. There is a little tradeoff here, in that referring to the log modules through strings means that we catch an incorrect module name at runtime instead of at link time, but I think that the risk here is minimal because the mistake will be found by every test in "make check" that runs any of the utilities, since they make these calls as one of their first tasks during initialization. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
-rw-r--r--ovn/utilities/ovn-nbctl.c3
-rw-r--r--ovn/utilities/ovn-sbctl.c3
-rw-r--r--tests/test-reconnect.c3
-rw-r--r--utilities/ovs-vsctl.c3
-rw-r--r--vtep/vtep-ctl.c3
5 files changed, 5 insertions, 10 deletions
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 8c3b3c87d..324a0a40e 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -73,7 +73,6 @@ static void do_nbctl(const char *args, struct ctl_command *, size_t n,
int
main(int argc, char *argv[])
{
- extern struct vlog_module VLM_reconnect;
struct ovsdb_idl *idl;
struct ctl_command *commands;
struct shash local_options;
@@ -84,7 +83,7 @@ main(int argc, char *argv[])
set_program_name(argv[0]);
fatal_ignore_sigpipe();
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
- vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
+ vlog_set_levels_from_string_assert("reconnect:warn");
nbrec_init();
nbctl_cmd_init();
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index cf3c559ea..b428a3524 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -86,7 +86,6 @@ static void do_sbctl(const char *args, struct ctl_command *, size_t n,
int
main(int argc, char *argv[])
{
- extern struct vlog_module VLM_reconnect;
struct ovsdb_idl *idl;
struct ctl_command *commands;
struct shash local_options;
@@ -97,7 +96,7 @@ main(int argc, char *argv[])
set_program_name(argv[0]);
fatal_ignore_sigpipe();
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
- vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
+ vlog_set_levels_from_string_assert("reconnect:warn");
sbrec_init();
sbctl_cmd_init();
diff --git a/tests/test-reconnect.c b/tests/test-reconnect.c
index a55c57c3f..b70a7d550 100644
--- a/tests/test-reconnect.c
+++ b/tests/test-reconnect.c
@@ -39,13 +39,12 @@ static const struct ovs_cmdl_command *get_all_commands(void);
static void
test_reconnect_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
- extern struct vlog_module VLM_reconnect;
struct reconnect_stats prev;
unsigned int old_max_tries;
int old_time;
char line[128];
- vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_OFF);
+ vlog_set_levels_from_string_assert("reconnect:off");
now = 1000;
reconnect = reconnect_create(now);
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index c5a28e016..00ac45894 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -130,7 +130,6 @@ static size_t allocated_neoteric_ifaces;
int
main(int argc, char *argv[])
{
- extern struct vlog_module VLM_reconnect;
struct ovsdb_idl *idl;
struct ctl_command *commands;
struct shash local_options;
@@ -141,7 +140,7 @@ main(int argc, char *argv[])
set_program_name(argv[0]);
fatal_ignore_sigpipe();
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
- vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
+ vlog_set_levels_from_string_assert("reconnect:warn");
ovsrec_init();
vsctl_cmd_init();
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 2e805816b..2f13dc6c1 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -94,7 +94,6 @@ static struct vtep_ctl_lrouter *find_lrouter(struct vtep_ctl_context *,
int
main(int argc, char *argv[])
{
- extern struct vlog_module VLM_reconnect;
struct ovsdb_idl *idl;
struct ctl_command *commands;
struct shash local_options;
@@ -105,7 +104,7 @@ main(int argc, char *argv[])
set_program_name(argv[0]);
fatal_ignore_sigpipe();
vlog_set_levels(NULL, VLF_CONSOLE, VLL_WARN);
- vlog_set_levels(&VLM_reconnect, VLF_ANY_DESTINATION, VLL_WARN);
+ vlog_set_levels_from_string_assert("reconnect:warn");
vteprec_init();
vtep_ctl_cmd_init();