vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.
authorBen Pfaff <blp@nicira.com>
Fri, 16 Jul 2010 18:02:49 +0000 (11:02 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 21 Jul 2010 22:47:09 +0000 (15:47 -0700)
Adding a macro to define the vlog module in use adds a level of
indirection, which makes it easier to change how the vlog module must be
defined.  A followup commit needs to do that, so getting these widespread
changes out of the way first should make that commit easier to review.

78 files changed:
extras/ezio/ezio-term.c
extras/ezio/ovs-switchui.c
extras/ezio/terminal.c
extras/ezio/tty.c
extras/ezio/vt-dummy.c
extras/ezio/vt-linux.c
lib/automake.mk
lib/backtrace.c
lib/coverage.c
lib/daemon.c
lib/dhcp-client.c
lib/dhcp.c
lib/dpif-linux.c
lib/dpif-netdev.c
lib/dpif.c
lib/fatal-signal.c
lib/flow.c
lib/jsonrpc.c
lib/leak-checker.c
lib/learning-switch.c
lib/lockfile.c
lib/mac-learning.c
lib/netdev-gre.c
lib/netdev-linux.c
lib/netdev-patch.c
lib/netdev-vport.c
lib/netdev.c
lib/netlink.c
lib/ofp-util.c
lib/ovsdb-error.c
lib/ovsdb-idl.c
lib/pcap.c
lib/poll-loop.c
lib/process.c
lib/rconn.c
lib/reconnect.c
lib/rtnetlink.c
lib/socket-util.c
lib/stp.c
lib/stream-fd.c
lib/stream-ssl.c
lib/stream-tcp.c
lib/stream-unix.c
lib/stream.c
lib/svec.c
lib/timeval.c
lib/unixctl.c
lib/util.c
lib/vconn-stream.c
lib/vconn.c
lib/vlog.c
lib/vlog.h
ofproto/collectors.c
ofproto/discovery.c
ofproto/fail-open.c
ofproto/in-band.c
ofproto/netflow.c
ofproto/ofproto-sflow.c
ofproto/ofproto.c
ofproto/pktbuf.c
ofproto/status.c
ovsdb/file.c
ovsdb/jsonrpc-server.c
ovsdb/log.c
ovsdb/ovsdb-client.c
ovsdb/ovsdb-server.c
ovsdb/ovsdb-tool.c
utilities/ovs-controller.c
utilities/ovs-discover.c
utilities/ovs-dpctl.c
utilities/ovs-ofctl.c
utilities/ovs-openflowd.c
utilities/ovs-vsctl.c
vswitchd/bridge.c
vswitchd/ovs-brcompatd.c
vswitchd/ovs-vswitchd.c
vswitchd/proc-net-compat.c
vswitchd/xenserver.c

index f7645528905294d7075a0c7fc057241c63d08ea9..b41a7c0258306e6fb83520bb291f9dc9b60f787b 100644 (file)
 #include "terminal.h"
 #include "timeval.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_ezio_term
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(ezio_term)
+
 /* EZIO button status. */
 enum btn_status {
     BTN_UP    = 1 << 0,
index b1ba8d2496b4781619e3da75c7b1054cbf7155eb..092eb1e5d327243bf4c7b43f656d69a1bfca21b6 100644 (file)
 #include "timeval.h"
 #include "util.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#define THIS_MODULE VLM_switchui
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(switchui)
 
 static void parse_options(int argc, char *argv[]);
 static void usage(void);
index 090e80e44be0126625c98c90651509fcf9da7fc1..3e499ab016ba93e9d741b4b6bc3f85fb5afeae2f 100644 (file)
 #include "ezio.h"
 #include "poll-loop.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_terminal
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(terminal)
+
 /* UTF-8 decoding. */
 static struct utf8_reader *utf8_reader_create(void);
 static void utf8_reader_destroy(struct utf8_reader *);
index 432882852b4b2064f8729d50be9f1b1c8088fd52..a4bb14ce2179eeb29e47dd694d0a6ded1bbe0549 100644 (file)
 #include "fatal-signal.h"
 #include "socket-util.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_tty
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(tty)
+
 /* Get major() and minor() macros. */
 #if MAJOR_IN_MKDEV
 #  include <sys/mkdev.h>
index c1de6c804783ce956681d8b327cb3c6d006f6426..18da821d76778bd8cab6afda6656a4e5ce505338 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009 Nicira Networks, Inc.
+/* Copyright (c) 2008, 2009, 2010 Nicira Networks, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <config.h>
 #include "extras/ezio/vt.h"
 #include <errno.h>
-
-#define THIS_MODULE VLM_vt
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(vt)
+
 int
 vt_open(int open_flags)
 {
index 92f7ebb61f06cc25a5f185c1f500cd7b785ed1bd..b281c8972b68fde8ca49caea0e92f1a410e233a3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009 Nicira Networks, Inc.
+/* Copyright (c) 2008, 2009, 2010 Nicira Networks, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include "util.h"
-
-#define THIS_MODULE VLM_vt
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(vt)
+
 static bool get_console_fd(int *fd);
 
 int
index 71e4d61fb25d3aea514e5f1c294a15c4775f1b25..046e9ab6e56115e853ce098b6bfc011da1874974 100644 (file)
@@ -274,8 +274,8 @@ check-for-unused-vlog-modules:
                     lib/vlog-modules.def |                                   \
                      LC_ALL=C sort -u |                                              \
                      xargs echo`;                                            \
-         used_vlog=`git grep VLM_ |                                          \
-                    sed -n 's/.*VLM_\([a-z_0-9]\{1,\}\).*/\1/p' |            \
+         used_vlog=`git grep VLOG_DEFINE_THIS_MODULE |                       \
+                    sed -n 's/.*VLOG_DEFINE_THIS_MODULE(\([a-z_0-9]\{1,\}\)).*/\1/p' |       \
                     LC_ALL=C sort -u |                                       \
                      xargs echo`;                                            \
          rc=0;                                                               \
index 80cae54a6a15310643631fae55718bbb623a2424..131bdf4fc87881d3440964745579ef842f6c71d9 100644 (file)
 #include <stdbool.h>
 #include <stdio.h>
 #include "compiler.h"
-
-#define THIS_MODULE VLM_backtrace
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(backtrace)
+
 static uintptr_t OVS_UNUSED
 get_max_stack(void)
 {
index 5c99c18ade24b4f77630bb60618abf6ad4ad0d6f..6e65810e8ad482910c95c010c5a8aedcbd9f5704 100644 (file)
 #include "hash.h"
 #include "unixctl.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_coverage
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(coverage)
+
 static unsigned int epoch;
 
 static void
index 59628f23335d85368b29527b495cc761253ae44b..6cb553acf257fbec132819060e86b8f852620639 100644 (file)
 #include "socket-util.h"
 #include "timeval.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_daemon
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(daemon)
+
 /* Should we run in the background? */
 static bool detach;
 
index 7168361f00e3c0757a38c61541b8b1a982dc8c60..961994a2e412966e93e3cacb30eb845ff3f3983e 100644 (file)
 #include "poll-loop.h"
 #include "sat-math.h"
 #include "timeval.h"
-
-#define THIS_MODULE VLM_dhcp_client
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(dhcp_client)
+
 #define DHCLIENT_STATES                         \
     DHCLIENT_STATE(INIT, 1 << 0)                \
     DHCLIENT_STATE(INIT_REBOOT, 1 << 1)         \
index e16176ba1bf32ee83059e6a6aa9e85df833e5aab..e6d5735e80c251432d49d0de831a79dabb3b2a89 100644 (file)
 #include <stdlib.h>
 #include "dynamic-string.h"
 #include "ofpbuf.h"
-
-#define THIS_MODULE VLM_dhcp
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(dhcp)
+
 /* Information about a DHCP argument type. */
 struct arg_type {
     const char *name;           /* Name. */
index 432d5ed1a4fe59f3d696854d80b719df1509c09f..52d73c6bb76d404dd32dd70bfbd6775a20e242bd 100644 (file)
@@ -41,9 +41,9 @@
 #include "shash.h"
 #include "svec.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_dpif_linux
+
+VLOG_DEFINE_THIS_MODULE(dpif_linux)
 
 /* Datapath interface for the openvswitch Linux kernel module. */
 struct dpif_linux {
index fc117d20623d6ab6869ac7fc5c754f48fbe0e6ed..15ff0d551289380b36888528354413bfdb088b8b 100644 (file)
@@ -45,9 +45,9 @@
 #include "queue.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_dpif_netdev
+
+VLOG_DEFINE_THIS_MODULE(dpif_netdev)
 
 /* Configuration parameters. */
 enum { N_QUEUES = 2 };          /* Number of queues for dpif_recv(). */
index ef28ea9fa18974e7aad02073544d0dcbf3384fae..40741a45eb8d354b5cb20cf4e63ad033b3a5a7ab 100644 (file)
@@ -37,9 +37,9 @@
 #include "svec.h"
 #include "util.h"
 #include "valgrind.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_dpif
+
+VLOG_DEFINE_THIS_MODULE(dpif)
 
 static const struct dpif_class *base_dpif_classes[] = {
 #ifdef HAVE_NETLINK
index 0f3603689541150495683fe34a2b096aec456bf8..d9442a3eff7eb2ee1a05985b0e0863c9a3389457 100644 (file)
 #include "shash.h"
 #include "socket-util.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_fatal_signal
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(fatal_signal)
+
 /* Signals to catch. */
 static const int fatal_signals[] = { SIGTERM, SIGINT, SIGHUP, SIGALRM };
 
index 7ae90d2b56f8c7210238aeaf4cbc33ca11f800fa..490c46bc1770a6960771b877a928557df3591629 100644 (file)
 #include "openvswitch/datapath-protocol.h"
 #include "packets.h"
 #include "unaligned.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_flow
+VLOG_DEFINE_THIS_MODULE(flow)
 
 static struct arp_eth_header *
 pull_arp(struct ofpbuf *packet)
index 32d34b4f1a60fb2cab5ee33c453c927c9c76374d..5d394c68050e2afa5d8d1f31acc786b1ac2f4f38 100644 (file)
@@ -32,9 +32,9 @@
 #include "reconnect.h"
 #include "stream.h"
 #include "timeval.h"
-
-#define THIS_MODULE VLM_jsonrpc
 #include "vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(jsonrpc)
 \f
 struct jsonrpc {
     struct stream *stream;
index 4ab55e59493f2303b279bfa45a3eaed57a1d5ad6..28beb0b3cdebc4caadc00e71a2b13c9a8b80cd68 100644 (file)
 #include "leak-checker.h"
 #include <inttypes.h>
 #include "backtrace.h"
-
-#define THIS_MODULE VLM_leak_checker
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(leak_checker)
+
 #ifndef HAVE_MALLOC_HOOKS
 void
 leak_checker_start(const char *file_name OVS_UNUSED)
index 97c424a6be865491940e62c2918a95d3f4cfc23c..d2da25237a4956b47f4a4ad18e5e6dbf061c1dbc 100644 (file)
 #include "stp.h"
 #include "timeval.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#define THIS_MODULE VLM_learning_switch
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(learning_switch)
 
 enum port_state {
     P_DISABLED = 1 << 0,
index 100440e93614ca92db6255d25f8c09756b474532..84bfb3c04061bfa52c8b37aaac944de6e8ee9e42 100644 (file)
 #include "hmap.h"
 #include "timeval.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_lockfile
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(lockfile)
+
 struct lockfile {
     struct hmap_node hmap_node;
     char *name;
index 5d64f543748bfa52aa5c34902746d291b9c6da43..c8582f3123c98d577596d9dcc47a4e54635e648b 100644 (file)
 #include "tag.h"
 #include "timeval.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_mac_learning
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(mac_learning)
+
 /* Returns the number of seconds since 'e' was last learned. */
 int
 mac_entry_age(const struct mac_entry *e)
index 25e0a646780da5a2c7cbcdd4f50664d811c17e1e..aecc77edf6da11b5deabbe1b0009006fed9b95df 100644 (file)
 #include "openvswitch/gre.h"
 #include "packets.h"
 #include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_gre
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(netdev_gre)
+
 struct netdev_dev_gre {
     struct netdev_dev netdev_dev;
 };
index 09a461296c550d6d2310ee6df61250b68251330b..a20a1c4d1bbdf34e9edba96800f14620b699b471 100644 (file)
@@ -61,9 +61,9 @@
 #include "socket-util.h"
 #include "shash.h"
 #include "svec.h"
-
-#define THIS_MODULE VLM_netdev_linux
 #include "vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(netdev_linux)
 \f
 /* These were introduced in Linux 2.6.14, so they might be missing if we have
  * old headers. */
index 1340eb7194dfcbe7c8c919882a8552c7b470c163..7e8b1990e3ca66cf4281a6f251341e67de60dbb5 100644 (file)
 #include "openvswitch/datapath-protocol.h"
 #include "packets.h"
 #include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_patch
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(netdev_patch)
+
 struct netdev_dev_patch {
     struct netdev_dev netdev_dev;
 };
index 58858f90fe23bc2f03e05d6e5c6c35e50f043181..96834115e39f1f6941e2965a814c1bdec3cc5b6d 100644 (file)
 #include "openvswitch/datapath-protocol.h"
 #include "shash.h"
 #include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_vport
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(netdev_vport)
+
 struct netdev_vport_notifier {
     struct netdev_notifier notifier;
     struct list list_node;
index 38f4dd58561ad5a2abd9e78d8c22294eccbc4ad1..7d834ad0909282b76b6a21d49edb3e4c1b5f9edc 100644 (file)
 #include "poll-loop.h"
 #include "shash.h"
 #include "svec.h"
-
-#define THIS_MODULE VLM_netdev
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(netdev)
+
 static const struct netdev_class *base_netdev_classes[] = {
 #ifdef HAVE_NETLINK
     &netdev_linux_class,
index d59f65e04371c52d53eb4d42dbe844e2b98c931b..2f7bc0a1c04e7bc44e5033d75bb1c1a76a4daf06 100644 (file)
@@ -31,9 +31,9 @@
 #include "poll-loop.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_netlink
+
+VLOG_DEFINE_THIS_MODULE(netlink)
 
 /* Linux header file confusion causes this to be undefined. */
 #ifndef SOL_NETLINK
index cedeb6702b8a911b964ebc6f485d2c6887c72be5..fd54a03ed49ee4288b9fa86afd2d567e6a4dfc8b 100644 (file)
 #include "ofpbuf.h"
 #include "packets.h"
 #include "random.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#define THIS_MODULE VLM_ofp_util
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(ofp_util)
 
 /* Rate limit for OpenFlow message parse errors.  These always indicate a bug
  * in the peer and so there's not much point in showing a lot of them. */
index c57175abb0c78c6b6ac0cca23009b318f210720d..5eb4ec7bdd8961041c4a7b17875d96c2dfd5c4c7 100644 (file)
@@ -25,8 +25,7 @@
 #include "util.h"
 #include "vlog.h"
 
-#define THIS_MODULE VLM_ovsdb_error
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(ovsdb_error)
 
 struct ovsdb_error {
     const char *tag;            /* String for "error" member. */
index f32fe0e6be886d14b6e915769ff178d833652a6d..2a4378124b19be994559676d0bfdaab7121dcd8d 100644 (file)
 #include "poll-loop.h"
 #include "shash.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_idl
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(ovsdb_idl)
+
 /* An arc from one idl_row to another.  When row A contains a UUID that
  * references row B, this is represented by an arc from A (the source) to B
  * (the destination).
index 028dd0cb7b36b3749611de862e6389d076ad0fa4..cc15411d498ac3cef3a06e832aa5b947df7d75a6 100644 (file)
 #include <string.h>
 #include "compiler.h"
 #include "ofpbuf.h"
-
-#define THIS_MODULE VLM_pcap
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(pcap)
+
 struct pcap_hdr {
     uint32_t magic_number;   /* magic number */
     uint16_t version_major;  /* major version number */
index 91034b04e907fd2456c5658d65e8fb1368887198..70360b9b53aa23f6e9abff4c9c30fa84f55ddb8f 100644 (file)
 #include "fatal-signal.h"
 #include "list.h"
 #include "timeval.h"
-
-#define THIS_MODULE VLM_poll_loop
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(poll_loop)
+
 /* An event that will wake the following call to poll_block(). */
 struct poll_waiter {
     /* Set when the waiter is created. */
index af867ef4e01f5f349c650487089c5327aa3f4149..a201a88f8bb8c945306800a3410f52a640402eac 100644 (file)
 #include "poll-loop.h"
 #include "socket-util.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_process
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(process)
+
 struct process {
     struct list node;
     char *name;
index 36828f3abda1703fcf64cd006c1a8c71181abfb2..d254356d648e428b5bdee948d51be42c48caab7e 100644 (file)
 #include "timeval.h"
 #include "util.h"
 #include "vconn.h"
-
-#define THIS_MODULE VLM_rconn
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(rconn)
+
 #define STATES                                  \
     STATE(VOID, 1 << 0)                         \
     STATE(BACKOFF, 1 << 1)                      \
index 372c2ebdceae167e509082c9324092dfc4be1a16..169f3173c195a304457f62cada799a90dd3b6170 100644 (file)
 #include <stdlib.h>
 
 #include "poll-loop.h"
-
-#define THIS_MODULE VLM_reconnect
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(reconnect)
+
 #define STATES                                  \
     STATE(VOID, 1 << 0)                         \
     STATE(BACKOFF, 1 << 1)                      \
index 1d302ea635513d62285e9e6ef90b22ea049e7b7c..f5a6df8a1e5b6f05ba0148210d90395af21deca5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "coverage.h"
 #include "netlink.h"
 #include "ofpbuf.h"
-
-#define THIS_MODULE VLM_rtnetlink
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(rtnetlink)
+
 /* rtnetlink socket. */
 static struct nl_sock *notify_sock;
 
index bf563edaea62d70d6781ecdda83847217310e44b..16a321c201804343bd285b56d41232422fefafe7 100644 (file)
@@ -32,9 +32,9 @@
 #include <unistd.h>
 #include "fatal-signal.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_socket_util
+
+VLOG_DEFINE_THIS_MODULE(socket_util)
 
 /* Sets 'fd' to non-blocking mode.  Returns 0 if successful, otherwise a
  * positive errno value. */
index 38885c07f666e472ce4691988863e7df7879e991..c5c8b3ba8a11238621b13f33b5ca4004cde373a0 100644 (file)
--- a/lib/stp.c
+++ b/lib/stp.c
@@ -17,6 +17,8 @@
 /* Based on sample implementation in 802.1D-1998.  Above copyright and license
  * applies to all modifications. */
 
+#include <config.h>
+
 #include "stp.h"
 #include <sys/types.h>
 #include <netinet/in.h>
 #include "ofpbuf.h"
 #include "packets.h"
 #include "util.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_stp
+VLOG_DEFINE_THIS_MODULE(stp)
 
 /* Ethernet address used as the destination for STP frames. */
 const uint8_t stp_eth_addr[ETH_ADDR_LEN]
index cc897b3d9f56186e31da32212eac3c85a9aa8fdd..9410009c45221fd6a3336f0669552cf748610076 100644 (file)
@@ -31,9 +31,9 @@
 #include "util.h"
 #include "stream-provider.h"
 #include "stream.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_stream_fd
+
+VLOG_DEFINE_THIS_MODULE(stream_fd)
 
 /* Active file descriptor stream. */
 
index 1944cb9ed302dae7460764ddbd8cbb9c21ed8182..851e7a76fa3d07c0d912aeecf4bcab34dea2a045 100644 (file)
@@ -41,9 +41,9 @@
 #include "stream-provider.h"
 #include "stream.h"
 #include "timeval.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_stream_ssl
+
+VLOG_DEFINE_THIS_MODULE(stream_ssl)
 
 /* Active SSL. */
 
index 2f7e798a615502fb2467098ac5434246f23bb839..d00477732932e40eb58473b93270ebf2a2d93fdb 100644 (file)
@@ -30,9 +30,9 @@
 #include "util.h"
 #include "stream-provider.h"
 #include "stream-fd.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_stream_tcp
+
+VLOG_DEFINE_THIS_MODULE(stream_tcp)
 
 /* Active TCP. */
 
index 930f548680c0cb00079e4d8925727c998e9cc730..20aa5b482876c373f7a7386be4f810ee7e683ce8 100644 (file)
@@ -33,9 +33,9 @@
 #include "util.h"
 #include "stream-provider.h"
 #include "stream-fd.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_stream_unix
+
+VLOG_DEFINE_THIS_MODULE(stream_unix)
 
 /* Active UNIX socket. */
 
index acbefc2785a020439aeed89668bb3a6f6188c731..4d894e7ede743e1640854a83d14589aae97a9eeb 100644 (file)
 #include "poll-loop.h"
 #include "random.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_stream
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(stream)
+
 /* State of an active stream.*/
 enum stream_state {
     SCS_CONNECTING,             /* Underlying stream is not connected. */
index bc3df23d511cb690f2b1d363b4fa859f3cb74b4c..79c835551d5c67e15360d0d885a8609a2b687db7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <string.h>
 #include "dynamic-string.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_svec
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(svec)
+
 void
 svec_init(struct svec *svec)
 {
index e83f5737e9bbf487399c30d13df1eab2b8491fbc..b95d1f42551e7c3e353aac9f5a6d3b89c7635834 100644 (file)
@@ -27,9 +27,9 @@
 #include "coverage.h"
 #include "fatal-signal.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_timeval
+
+VLOG_DEFINE_THIS_MODULE(timeval)
 
 /* The clock to use for measuring time intervals.  This is CLOCK_MONOTONIC by
  * preference, but on systems that don't have a monotonic clock we fall back
index 70785682731fcbdd30401cad9913ec0a2c79eea2..ac756a834bc456c5169868c9ccd76d9b579df6ee 100644 (file)
 #include "socket-util.h"
 #include "svec.h"
 #include "util.h"
+#include "vlog.h"
 
 #ifndef SCM_CREDENTIALS
 #include <time.h>
 #endif
 
-#define THIS_MODULE VLM_unixctl
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(unixctl)
 \f
 struct unixctl_command {
     unixctl_cb_func *cb;
index 19f13dddc1f3f902b9964354e49381cd2221b8ef..9fc99f07d37b55495eb5389adc7e2dfd81beb820 100644 (file)
 #include <string.h>
 #include <unistd.h>
 #include "coverage.h"
-
-#define THIS_MODULE VLM_util
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(util)
+
 const char *program_name;
 
 void
index df728d5ccde9870c792981f6d198f4b3b0872114..e6c2946d4d6d9232b8a1a654c7a47c9cdbc08852 100644 (file)
@@ -32,9 +32,9 @@
 #include "util.h"
 #include "vconn-provider.h"
 #include "vconn.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_vconn_stream
+
+VLOG_DEFINE_THIS_MODULE(vconn_stream)
 
 /* Active stream socket vconn. */
 
index b558f8069fd085f3c58eb3e6aca926d2b9b15984..99b6e7b0de0116e304a676e8bbb5e60360590bcb 100644 (file)
 #include "poll-loop.h"
 #include "random.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_vconn
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(vconn)
+
 /* State of an active vconn.*/
 enum vconn_state {
     /* This is the ordinary progression of states. */
index a77a6e5546d83730c077f0a3189e47d732120580..38871295020fd919b2515ce24dfb9360ee810845 100644 (file)
@@ -33,7 +33,7 @@
 #include "unixctl.h"
 #include "util.h"
 
-#define THIS_MODULE VLM_vlog
+VLOG_DEFINE_THIS_MODULE(vlog)
 
 /* Name for each logging level. */
 static const char *level_names[VLL_N_LEVELS] = {
index f50b76a16485e8e3e90f97d6f4a99e33e6be93ed..53e8f39ac2d10b478c9eb209f0ec9b2f57c8df38 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -129,10 +129,12 @@ void vlog_rate_limit(enum vlog_module, enum vlog_level,
                      struct vlog_rate_limit *, const char *, ...)
     __attribute__((format(printf, 4, 5)));
 
-/* Convenience macros.  To use these, define THIS_MODULE as a macro that
- * expands to the module used by the current source file, e.g.
- *      #include "vlog.h"
- *      #define THIS_MODULE VLM_netlink
+/* Defines THIS_MODULE as MODULE, for use with the convenience macros below. */
+#define VLOG_DEFINE_THIS_MODULE(MODULE) enum { THIS_MODULE = VLM_##MODULE };
+
+/* Convenience macros.  These assume that THIS_MODULE is defined as the current
+ * module, as set up by e.g. the VLOG_DEFINE_MODULE macro above.
+ *
  * Guaranteed to preserve errno.
  */
 #define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__)
index 0b84c3ece300a44fd62d9e4f6f4e255e99a111a8..69eed5d7d85a50fb118e3e1eac05fab3bc32e695 100644 (file)
 #include "socket-util.h"
 #include "svec.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_collectors
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(collectors)
+
 struct collectors {
     int *fds;                     /* Sockets. */
     size_t n_fds;                 /* Number of sockets. */
index 84f092e69b4da1ed1212618a3c8af9a731a954c8..008ad62ca9c3ae6770ae44427d2d4fea05f12e82 100644 (file)
 #include "packets.h"
 #include "status.h"
 #include "stream-ssl.h"
-
-#define THIS_MODULE VLM_discovery
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(discovery)
+
 struct discovery {
     char *dpif_name;
     char *re;
index a86ee391b12dbfc8d56c8cdb55b1fb27965de50e..04be5ce6a357caf31f7ef88176b60fe7c2ae9b80 100644 (file)
 #include "status.h"
 #include "timeval.h"
 #include "vconn.h"
-
-#define THIS_MODULE VLM_fail_open
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(fail_open)
+
 /*
  * Fail-open mode.
  *
index 884cf1d26fb70e411803dc3b124c777e292d9325..44bcd720a99bbe905361c0323bcde7ed280d4e23 100644 (file)
 #include "poll-loop.h"
 #include "status.h"
 #include "timeval.h"
-
-#define THIS_MODULE VLM_in_band
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(in_band)
+
 /* In-band control allows a single network to be used for OpenFlow
  * traffic and other data traffic.  Refer to ovs-vswitchd.conf(5) and 
  * secchan(8) for a description of configuring in-band control.
index 67932f0f75d29454bf2c4ff726123b44f8a3d584..dd14a8b0d121446673915f51914f185c05e738fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include "svec.h"
 #include "timeval.h"
 #include "util.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#define THIS_MODULE VLM_netflow
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(netflow)
 
 #define NETFLOW_V5_VERSION 5
 
index cc6a6935a0538d5695c7d323215064bded243a98..c74c7360ef5e4db6b738421655cd693880ad943f 100644 (file)
 #include "sflow_api.h"
 #include "socket-util.h"
 #include "timeval.h"
-
-#define THIS_MODULE VLM_sflow
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(sflow)
+
 struct ofproto_sflow_port {
     struct netdev *netdev;      /* Underlying network device, for stats. */
     SFLDataSource_instance dsi; /* sFlow library's notion of port number. */
index cf491395c2d1d2eccb4078bcb7b73b19b8463648..66b957e1091a4a001031a6443f970f300e04ca38 100644 (file)
 #include "timeval.h"
 #include "unixctl.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#define THIS_MODULE VLM_ofproto
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(ofproto)
 
 #include "sflow_api.h"
 
index b04eb5955b59dbf55f30632a112d3a1ca9753873..49e5c4d63f307b5ef1814b6f2e6bd7e7b82ec6c8 100644 (file)
 #include "timeval.h"
 #include "util.h"
 #include "vconn.h"
-
-#define THIS_MODULE VLM_pktbuf
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(pktbuf)
+
 /* Buffers are identified by a 32-bit opaque ID.  We divide the ID
  * into a buffer number (low bits) and a cookie (high bits).  The buffer number
  * is an index into an array of buffers.  The cookie distinguishes between
index 27dc86cc87efcaa7006d8a87da0eb839cb4c6898..a8f522d61097b558866755fce81acd81cd823740 100644 (file)
 #include "svec.h"
 #include "timeval.h"
 #include "vconn.h"
-
-#define THIS_MODULE VLM_status
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(status)
+
 struct status_category {
     struct list node;
     char *name;
index f0913e9d3bf388d4878a91ddc3bf0125523d9018..846f55668e5f61bb7dad7ebeb1663cb1ceb7a227 100644 (file)
 #include "transaction.h"
 #include "uuid.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_file
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(ovsdb_file)
+
 /* Minimum number of milliseconds between database compactions. */
 #define COMPACT_MIN_MSEC        (10 * 60 * 1000) /* 10 minutes. */
 
index bc717e469a72153b615dce7f0e851d0439b68f2f..71a44899e06316d79d8a5c0426fc4af1e70da4d5 100644 (file)
 #include "timeval.h"
 #include "transaction.h"
 #include "trigger.h"
-
-#define THIS_MODULE VLM_ovsdb_jsonrpc_server
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(ovsdb_jsonrpc_server)
+
 struct ovsdb_jsonrpc_remote;
 struct ovsdb_jsonrpc_session;
 
index 09b9f1f7adc809c2eb6dcb1fcac13bed428f7568..b532f7c0a6cd7bf5406a252ac2aa962b947d6d1e 100644 (file)
 #include "socket-util.h"
 #include "transaction.h"
 #include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_log
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(ovsdb_log)
+
 enum ovsdb_log_mode {
     OVSDB_LOG_READ,
     OVSDB_LOG_WRITE
index 8a48e8b5d0a59fe6a133f1ce6de3f3a30d92df7e..b8a2fa4fd2220b4693dace25bf1a786d0c98d7fd 100644 (file)
@@ -41,9 +41,9 @@
 #include "table.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_ovsdb_client
+
+VLOG_DEFINE_THIS_MODULE(ovsdb_client)
 
 /* --format: Output formatting. */
 static enum {
index ecc620df40f6514d3f2bcd00ab2ee1ed65921304..4ca9c2d1ff435f1c724d46803a49f2464aa3f371 100644 (file)
@@ -45,9 +45,9 @@
 #include "trigger.h"
 #include "util.h"
 #include "unixctl.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_ovsdb_server
+
+VLOG_DEFINE_THIS_MODULE(ovsdb_server)
 
 #if HAVE_OPENSSL
 /* SSL configuration. */
index b485e8bc84e6ed2e5c3f1d9303d45374723f12d2..0da2085904c5a4afc189af6ff2944f04795062dc 100644 (file)
@@ -34,9 +34,9 @@
 #include "table.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_ovsdb_tool
+
+VLOG_DEFINE_THIS_MODULE(ovsdb_tool)
 
 /* -m, --more: Verbosity level for "show-log" command output. */
 static int show_log_verbosity;
index f190edc6371c530acc1b18bcfeb434942fee2a6a..92b84ae12838b8d9f45c420f654d9b1e50333614 100644 (file)
@@ -36,9 +36,9 @@
 #include "unixctl.h"
 #include "util.h"
 #include "vconn.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_controller
+
+VLOG_DEFINE_THIS_MODULE(controller)
 
 #define MAX_SWITCHES 16
 #define MAX_LISTENERS 16
index f5da6420519aa43f74d5b09263b67f959fdf1990..7cd1edf103fe801c30127546f6a8998f8013f7c0 100644 (file)
@@ -33,9 +33,9 @@
 #include "timeval.h"
 #include "unixctl.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_ovs_discover
+
+VLOG_DEFINE_THIS_MODULE(ovs_discover)
 
 struct iface {
     const char *name;
index 077ae74175bc901883fe8cb5f7a865b7113f6f30..fe44f27e26f0f5912b382c04e43b1cb0c88c9cdf 100644 (file)
@@ -40,9 +40,9 @@
 #include "svec.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_dpctl
+
+VLOG_DEFINE_THIS_MODULE(dpctl)
 
 static const struct command all_commands[];
 
index 31b58a6ad8456a5be464fb38e2a290b3c1254d31..54183e58dc242cc3a1ff11930ed96ee1710345dd 100644 (file)
 #include "timeval.h"
 #include "util.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "xtoxll.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_ofctl
+VLOG_DEFINE_THIS_MODULE(ofctl)
 
 #define DEFAULT_IDLE_TIMEOUT 60
 
index 1aa3ef5485e527e69de010b622353f6445f6ff4a..bb77d589658de070a0bf25b6be1e0a02e2ce75e5 100644 (file)
@@ -44,9 +44,9 @@
 #include "unixctl.h"
 #include "util.h"
 #include "vconn.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_openflowd
+
+VLOG_DEFINE_THIS_MODULE(openflowd)
 
 /* Settings that may be configured by the user. */
 struct ofsettings {
index 17ebdb41808fdc6deed6f97b9377df5e645c8097..c18de47ae6c10edbac5bb262e8c33d22d98f7208 100644 (file)
@@ -41,9 +41,9 @@
 #include "vswitchd/vswitch-idl.h"
 #include "timeval.h"
 #include "util.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_vsctl
+
+VLOG_DEFINE_THIS_MODULE(vsctl)
 
 /* vsctl_fatal() also logs the error, so it is preferred in this file. */
 #define ovs_fatal please_use_vsctl_fatal_instead_of_ovs_fatal
index e4d9cb7bcfcd76e605aff105361dfc918554473a..be0e875813ba5480e787faea9e23f82829eca5d2 100644 (file)
 #include "vconn.h"
 #include "vswitchd/vswitch-idl.h"
 #include "xenserver.h"
+#include "vlog.h"
 #include "xtoxll.h"
 #include "sflow_api.h"
 
-#define THIS_MODULE VLM_bridge
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(bridge)
 
 struct dst {
     uint16_t vlan;
index 6e620e1d61046d418429aefb4dfc74e2ede1e589..5e59373e0659de633e0fee52bdd9fffc2bff07ef 100644 (file)
 #include "timeval.h"
 #include "unixctl.h"
 #include "util.h"
+#include "vlog.h"
 #include "vswitchd/vswitch-idl.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_brcompatd
+VLOG_DEFINE_THIS_MODULE(brcompatd)
 
 
 /* xxx Just hangs if datapath is rmmod/insmod.  Learn to reconnect? */
index a027b8cfe83d339f6cb7ea23b0c1a826136185cf..541cdcbc8b70af9e4e32b5fe3d89269b8ef3fc08 100644 (file)
 #include "unixctl.h"
 #include "util.h"
 #include "vconn.h"
+#include "vlog.h"
 #include "vswitchd/vswitch-idl.h"
 
-#include "vlog.h"
-#define THIS_MODULE VLM_vswitchd
+VLOG_DEFINE_THIS_MODULE(vswitchd)
 
 static unixctl_cb_func ovs_vswitchd_exit;
 
index 106a7c3f55e78b8840c919fd927236b0da051f70..6a8f8756e2f8b12716c7c3520ea6afae08152768 100644 (file)
 #include "hmap.h"
 #include "shash.h"
 #include "svec.h"
-
-#define THIS_MODULE VLM_proc_net_compat
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(proc_net_compat)
+
 /* Netlink socket to bridge compatibility kernel module. */
 static struct nl_sock *brc_sock;
 
index 03c4955529fcc1197401f33e2533411ce2d40203..976d7162cfdba673b101541db636859333b046b2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@
 #include <unistd.h>
 #include "dynamic-string.h"
 #include "process.h"
-
 #include "vlog.h"
-#define THIS_MODULE VLM_xenserver
+
+VLOG_DEFINE_THIS_MODULE(xenserver)
 
 static char *
 read_host_uuid(void)