summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9200fb9)
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:
#include "terminal.h"
#include "timeval.h"
#include "util.h"
#include "terminal.h"
#include "timeval.h"
#include "util.h"
-
-#define THIS_MODULE VLM_ezio_term
+VLOG_DEFINE_THIS_MODULE(ezio_term)
+
/* EZIO button status. */
enum btn_status {
BTN_UP = 1 << 0,
/* EZIO button status. */
enum btn_status {
BTN_UP = 1 << 0,
#include "timeval.h"
#include "util.h"
#include "vconn.h"
#include "timeval.h"
#include "util.h"
#include "vconn.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);
static void parse_options(int argc, char *argv[]);
static void usage(void);
#include "ezio.h"
#include "poll-loop.h"
#include "util.h"
#include "ezio.h"
#include "poll-loop.h"
#include "util.h"
-
-#define THIS_MODULE VLM_terminal
+VLOG_DEFINE_THIS_MODULE(terminal)
+
/* UTF-8 decoding. */
static struct utf8_reader *utf8_reader_create(void);
static void utf8_reader_destroy(struct utf8_reader *);
/* UTF-8 decoding. */
static struct utf8_reader *utf8_reader_create(void);
static void utf8_reader_destroy(struct utf8_reader *);
#include "fatal-signal.h"
#include "socket-util.h"
#include "util.h"
#include "fatal-signal.h"
#include "socket-util.h"
#include "util.h"
-
-#define THIS_MODULE VLM_tty
+VLOG_DEFINE_THIS_MODULE(tty)
+
/* Get major() and minor() macros. */
#if MAJOR_IN_MKDEV
# include <sys/mkdev.h>
/* Get major() and minor() macros. */
#if MAJOR_IN_MKDEV
# include <sys/mkdev.h>
-/* 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.
*
* 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>
#include <config.h>
#include "extras/ezio/vt.h"
#include <errno.h>
-
-#define THIS_MODULE VLM_vt
+VLOG_DEFINE_THIS_MODULE(vt)
+
int
vt_open(int open_flags)
{
int
vt_open(int open_flags)
{
-/* 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.
*
* 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"
#include <sys/ioctl.h>
#include <unistd.h>
#include "util.h"
-
-#define THIS_MODULE VLM_vt
+VLOG_DEFINE_THIS_MODULE(vt)
+
static bool get_console_fd(int *fd);
int
static bool get_console_fd(int *fd);
int
lib/vlog-modules.def | \
LC_ALL=C sort -u | \
xargs echo`; \
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; \
LC_ALL=C sort -u | \
xargs echo`; \
rc=0; \
#include <stdbool.h>
#include <stdio.h>
#include "compiler.h"
#include <stdbool.h>
#include <stdio.h>
#include "compiler.h"
-
-#define THIS_MODULE VLM_backtrace
+VLOG_DEFINE_THIS_MODULE(backtrace)
+
static uintptr_t OVS_UNUSED
get_max_stack(void)
{
static uintptr_t OVS_UNUSED
get_max_stack(void)
{
#include "hash.h"
#include "unixctl.h"
#include "util.h"
#include "hash.h"
#include "unixctl.h"
#include "util.h"
-
-#define THIS_MODULE VLM_coverage
+VLOG_DEFINE_THIS_MODULE(coverage)
+
static unsigned int epoch;
static void
static unsigned int epoch;
static void
#include "socket-util.h"
#include "timeval.h"
#include "util.h"
#include "socket-util.h"
#include "timeval.h"
#include "util.h"
-
-#define THIS_MODULE VLM_daemon
+VLOG_DEFINE_THIS_MODULE(daemon)
+
/* Should we run in the background? */
static bool detach;
/* Should we run in the background? */
static bool detach;
#include "poll-loop.h"
#include "sat-math.h"
#include "timeval.h"
#include "poll-loop.h"
#include "sat-math.h"
#include "timeval.h"
-
-#define THIS_MODULE VLM_dhcp_client
+VLOG_DEFINE_THIS_MODULE(dhcp_client)
+
#define DHCLIENT_STATES \
DHCLIENT_STATE(INIT, 1 << 0) \
DHCLIENT_STATE(INIT_REBOOT, 1 << 1) \
#define DHCLIENT_STATES \
DHCLIENT_STATE(INIT, 1 << 0) \
DHCLIENT_STATE(INIT_REBOOT, 1 << 1) \
#include <stdlib.h>
#include "dynamic-string.h"
#include "ofpbuf.h"
#include <stdlib.h>
#include "dynamic-string.h"
#include "ofpbuf.h"
-
-#define THIS_MODULE VLM_dhcp
+VLOG_DEFINE_THIS_MODULE(dhcp)
+
/* Information about a DHCP argument type. */
struct arg_type {
const char *name; /* Name. */
/* Information about a DHCP argument type. */
struct arg_type {
const char *name; /* Name. */
#include "shash.h"
#include "svec.h"
#include "util.h"
#include "shash.h"
#include "svec.h"
#include "util.h"
-#define THIS_MODULE VLM_dpif_linux
+
+VLOG_DEFINE_THIS_MODULE(dpif_linux)
/* Datapath interface for the openvswitch Linux kernel module. */
struct dpif_linux {
/* Datapath interface for the openvswitch Linux kernel module. */
struct dpif_linux {
#include "queue.h"
#include "timeval.h"
#include "util.h"
#include "queue.h"
#include "timeval.h"
#include "util.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(). */
/* Configuration parameters. */
enum { N_QUEUES = 2 }; /* Number of queues for dpif_recv(). */
#include "svec.h"
#include "util.h"
#include "valgrind.h"
#include "svec.h"
#include "util.h"
#include "valgrind.h"
-#define THIS_MODULE VLM_dpif
+
+VLOG_DEFINE_THIS_MODULE(dpif)
static const struct dpif_class *base_dpif_classes[] = {
#ifdef HAVE_NETLINK
static const struct dpif_class *base_dpif_classes[] = {
#ifdef HAVE_NETLINK
#include "shash.h"
#include "socket-util.h"
#include "util.h"
#include "shash.h"
#include "socket-util.h"
#include "util.h"
-
-#define THIS_MODULE VLM_fatal_signal
+VLOG_DEFINE_THIS_MODULE(fatal_signal)
+
/* Signals to catch. */
static const int fatal_signals[] = { SIGTERM, SIGINT, SIGHUP, SIGALRM };
/* Signals to catch. */
static const int fatal_signals[] = { SIGTERM, SIGINT, SIGHUP, SIGALRM };
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
#include "unaligned.h"
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
#include "unaligned.h"
-#include "vlog.h"
-#define THIS_MODULE VLM_flow
+VLOG_DEFINE_THIS_MODULE(flow)
static struct arp_eth_header *
pull_arp(struct ofpbuf *packet)
static struct arp_eth_header *
pull_arp(struct ofpbuf *packet)
#include "reconnect.h"
#include "stream.h"
#include "timeval.h"
#include "reconnect.h"
#include "stream.h"
#include "timeval.h"
-
-#define THIS_MODULE VLM_jsonrpc
+
+VLOG_DEFINE_THIS_MODULE(jsonrpc)
\f
struct jsonrpc {
struct stream *stream;
\f
struct jsonrpc {
struct stream *stream;
#include "leak-checker.h"
#include <inttypes.h>
#include "backtrace.h"
#include "leak-checker.h"
#include <inttypes.h>
#include "backtrace.h"
-
-#define THIS_MODULE VLM_leak_checker
+VLOG_DEFINE_THIS_MODULE(leak_checker)
+
#ifndef HAVE_MALLOC_HOOKS
void
leak_checker_start(const char *file_name OVS_UNUSED)
#ifndef HAVE_MALLOC_HOOKS
void
leak_checker_start(const char *file_name OVS_UNUSED)
#include "stp.h"
#include "timeval.h"
#include "vconn.h"
#include "stp.h"
#include "timeval.h"
#include "vconn.h"
-#define THIS_MODULE VLM_learning_switch
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(learning_switch)
enum port_state {
P_DISABLED = 1 << 0,
enum port_state {
P_DISABLED = 1 << 0,
#include "hmap.h"
#include "timeval.h"
#include "util.h"
#include "hmap.h"
#include "timeval.h"
#include "util.h"
-
-#define THIS_MODULE VLM_lockfile
+VLOG_DEFINE_THIS_MODULE(lockfile)
+
struct lockfile {
struct hmap_node hmap_node;
char *name;
struct lockfile {
struct hmap_node hmap_node;
char *name;
#include "tag.h"
#include "timeval.h"
#include "util.h"
#include "tag.h"
#include "timeval.h"
#include "util.h"
-
-#define THIS_MODULE VLM_mac_learning
+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)
/* Returns the number of seconds since 'e' was last learned. */
int
mac_entry_age(const struct mac_entry *e)
#include "openvswitch/gre.h"
#include "packets.h"
#include "socket-util.h"
#include "openvswitch/gre.h"
#include "packets.h"
#include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_gre
+VLOG_DEFINE_THIS_MODULE(netdev_gre)
+
struct netdev_dev_gre {
struct netdev_dev netdev_dev;
};
struct netdev_dev_gre {
struct netdev_dev netdev_dev;
};
#include "socket-util.h"
#include "shash.h"
#include "svec.h"
#include "socket-util.h"
#include "shash.h"
#include "svec.h"
-
-#define THIS_MODULE VLM_netdev_linux
+
+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. */
\f
/* These were introduced in Linux 2.6.14, so they might be missing if we have
* old headers. */
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
#include "socket-util.h"
#include "openvswitch/datapath-protocol.h"
#include "packets.h"
#include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_patch
+VLOG_DEFINE_THIS_MODULE(netdev_patch)
+
struct netdev_dev_patch {
struct netdev_dev netdev_dev;
};
struct netdev_dev_patch {
struct netdev_dev netdev_dev;
};
#include "openvswitch/datapath-protocol.h"
#include "shash.h"
#include "socket-util.h"
#include "openvswitch/datapath-protocol.h"
#include "shash.h"
#include "socket-util.h"
-
-#define THIS_MODULE VLM_netdev_vport
+VLOG_DEFINE_THIS_MODULE(netdev_vport)
+
struct netdev_vport_notifier {
struct netdev_notifier notifier;
struct list list_node;
struct netdev_vport_notifier {
struct netdev_notifier notifier;
struct list list_node;
#include "poll-loop.h"
#include "shash.h"
#include "svec.h"
#include "poll-loop.h"
#include "shash.h"
#include "svec.h"
-
-#define THIS_MODULE VLM_netdev
+VLOG_DEFINE_THIS_MODULE(netdev)
+
static const struct netdev_class *base_netdev_classes[] = {
#ifdef HAVE_NETLINK
&netdev_linux_class,
static const struct netdev_class *base_netdev_classes[] = {
#ifdef HAVE_NETLINK
&netdev_linux_class,
#include "poll-loop.h"
#include "timeval.h"
#include "util.h"
#include "poll-loop.h"
#include "timeval.h"
#include "util.h"
-#define THIS_MODULE VLM_netlink
+
+VLOG_DEFINE_THIS_MODULE(netlink)
/* Linux header file confusion causes this to be undefined. */
#ifndef SOL_NETLINK
/* Linux header file confusion causes this to be undefined. */
#ifndef SOL_NETLINK
#include "ofpbuf.h"
#include "packets.h"
#include "random.h"
#include "ofpbuf.h"
#include "packets.h"
#include "random.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. */
/* 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. */
#include "util.h"
#include "vlog.h"
#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. */
struct ovsdb_error {
const char *tag; /* String for "error" member. */
#include "poll-loop.h"
#include "shash.h"
#include "util.h"
#include "poll-loop.h"
#include "shash.h"
#include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_idl
+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).
/* 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).
#include <string.h>
#include "compiler.h"
#include "ofpbuf.h"
#include <string.h>
#include "compiler.h"
#include "ofpbuf.h"
-
-#define THIS_MODULE VLM_pcap
+VLOG_DEFINE_THIS_MODULE(pcap)
+
struct pcap_hdr {
uint32_t magic_number; /* magic number */
uint16_t version_major; /* major version number */
struct pcap_hdr {
uint32_t magic_number; /* magic number */
uint16_t version_major; /* major version number */
#include "fatal-signal.h"
#include "list.h"
#include "timeval.h"
#include "fatal-signal.h"
#include "list.h"
#include "timeval.h"
-
-#define THIS_MODULE VLM_poll_loop
+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. */
/* An event that will wake the following call to poll_block(). */
struct poll_waiter {
/* Set when the waiter is created. */
#include "poll-loop.h"
#include "socket-util.h"
#include "util.h"
#include "poll-loop.h"
#include "socket-util.h"
#include "util.h"
-
-#define THIS_MODULE VLM_process
+VLOG_DEFINE_THIS_MODULE(process)
+
struct process {
struct list node;
char *name;
struct process {
struct list node;
char *name;
#include "timeval.h"
#include "util.h"
#include "vconn.h"
#include "timeval.h"
#include "util.h"
#include "vconn.h"
-
-#define THIS_MODULE VLM_rconn
+VLOG_DEFINE_THIS_MODULE(rconn)
+
#define STATES \
STATE(VOID, 1 << 0) \
STATE(BACKOFF, 1 << 1) \
#define STATES \
STATE(VOID, 1 << 0) \
STATE(BACKOFF, 1 << 1) \
#include <stdlib.h>
#include "poll-loop.h"
#include <stdlib.h>
#include "poll-loop.h"
-
-#define THIS_MODULE VLM_reconnect
+VLOG_DEFINE_THIS_MODULE(reconnect)
+
#define STATES \
STATE(VOID, 1 << 0) \
STATE(BACKOFF, 1 << 1) \
#define STATES \
STATE(VOID, 1 << 0) \
STATE(BACKOFF, 1 << 1) \
- * 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.
*
* 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"
#include "coverage.h"
#include "netlink.h"
#include "ofpbuf.h"
-
-#define THIS_MODULE VLM_rtnetlink
+VLOG_DEFINE_THIS_MODULE(rtnetlink)
+
/* rtnetlink socket. */
static struct nl_sock *notify_sock;
/* rtnetlink socket. */
static struct nl_sock *notify_sock;
#include <unistd.h>
#include "fatal-signal.h"
#include "util.h"
#include <unistd.h>
#include "fatal-signal.h"
#include "util.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. */
/* Sets 'fd' to non-blocking mode. Returns 0 if successful, otherwise a
* positive errno value. */
/* Based on sample implementation in 802.1D-1998. Above copyright and license
* applies to all modifications. */
/* Based on sample implementation in 802.1D-1998. Above copyright and license
* applies to all modifications. */
#include "stp.h"
#include <sys/types.h>
#include <netinet/in.h>
#include "stp.h"
#include <sys/types.h>
#include <netinet/in.h>
#include "ofpbuf.h"
#include "packets.h"
#include "util.h"
#include "ofpbuf.h"
#include "packets.h"
#include "util.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]
/* Ethernet address used as the destination for STP frames. */
const uint8_t stp_eth_addr[ETH_ADDR_LEN]
#include "util.h"
#include "stream-provider.h"
#include "stream.h"
#include "util.h"
#include "stream-provider.h"
#include "stream.h"
-#define THIS_MODULE VLM_stream_fd
+
+VLOG_DEFINE_THIS_MODULE(stream_fd)
/* Active file descriptor stream. */
/* Active file descriptor stream. */
#include "stream-provider.h"
#include "stream.h"
#include "timeval.h"
#include "stream-provider.h"
#include "stream.h"
#include "timeval.h"
-#define THIS_MODULE VLM_stream_ssl
+
+VLOG_DEFINE_THIS_MODULE(stream_ssl)
#include "util.h"
#include "stream-provider.h"
#include "stream-fd.h"
#include "util.h"
#include "stream-provider.h"
#include "stream-fd.h"
-#define THIS_MODULE VLM_stream_tcp
+
+VLOG_DEFINE_THIS_MODULE(stream_tcp)
#include "util.h"
#include "stream-provider.h"
#include "stream-fd.h"
#include "util.h"
#include "stream-provider.h"
#include "stream-fd.h"
-#define THIS_MODULE VLM_stream_unix
+
+VLOG_DEFINE_THIS_MODULE(stream_unix)
/* Active UNIX socket. */
/* Active UNIX socket. */
#include "poll-loop.h"
#include "random.h"
#include "util.h"
#include "poll-loop.h"
#include "random.h"
#include "util.h"
-
-#define THIS_MODULE VLM_stream
+VLOG_DEFINE_THIS_MODULE(stream)
+
/* State of an active stream.*/
enum stream_state {
SCS_CONNECTING, /* Underlying stream is not connected. */
/* State of an active stream.*/
enum stream_state {
SCS_CONNECTING, /* Underlying stream is not connected. */
- * 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.
*
* 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"
#include <string.h>
#include "dynamic-string.h"
#include "util.h"
-
-#define THIS_MODULE VLM_svec
+VLOG_DEFINE_THIS_MODULE(svec)
+
void
svec_init(struct svec *svec)
{
void
svec_init(struct svec *svec)
{
#include "coverage.h"
#include "fatal-signal.h"
#include "util.h"
#include "coverage.h"
#include "fatal-signal.h"
#include "util.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
/* 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
#include "socket-util.h"
#include "svec.h"
#include "util.h"
#include "socket-util.h"
#include "svec.h"
#include "util.h"
#ifndef SCM_CREDENTIALS
#include <time.h>
#endif
#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;
\f
struct unixctl_command {
unixctl_cb_func *cb;
#include <string.h>
#include <unistd.h>
#include "coverage.h"
#include <string.h>
#include <unistd.h>
#include "coverage.h"
-
-#define THIS_MODULE VLM_util
+VLOG_DEFINE_THIS_MODULE(util)
+
const char *program_name;
void
const char *program_name;
void
#include "util.h"
#include "vconn-provider.h"
#include "vconn.h"
#include "util.h"
#include "vconn-provider.h"
#include "vconn.h"
-#define THIS_MODULE VLM_vconn_stream
+
+VLOG_DEFINE_THIS_MODULE(vconn_stream)
/* Active stream socket vconn. */
/* Active stream socket vconn. */
#include "poll-loop.h"
#include "random.h"
#include "util.h"
#include "poll-loop.h"
#include "random.h"
#include "util.h"
-
-#define THIS_MODULE VLM_vconn
+VLOG_DEFINE_THIS_MODULE(vconn)
+
/* State of an active vconn.*/
enum vconn_state {
/* This is the ordinary progression of states. */
/* State of an active vconn.*/
enum vconn_state {
/* This is the ordinary progression of states. */
#include "unixctl.h"
#include "util.h"
#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] = {
/* Name for each logging level. */
static const char *level_names[VLL_N_LEVELS] = {
- * 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
struct vlog_rate_limit *, const char *, ...)
__attribute__((format(printf, 4, 5)));
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__)
* Guaranteed to preserve errno.
*/
#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__)
#include "socket-util.h"
#include "svec.h"
#include "util.h"
#include "socket-util.h"
#include "svec.h"
#include "util.h"
-
-#define THIS_MODULE VLM_collectors
+VLOG_DEFINE_THIS_MODULE(collectors)
+
struct collectors {
int *fds; /* Sockets. */
size_t n_fds; /* Number of sockets. */
struct collectors {
int *fds; /* Sockets. */
size_t n_fds; /* Number of sockets. */
#include "packets.h"
#include "status.h"
#include "stream-ssl.h"
#include "packets.h"
#include "status.h"
#include "stream-ssl.h"
-
-#define THIS_MODULE VLM_discovery
+VLOG_DEFINE_THIS_MODULE(discovery)
+
struct discovery {
char *dpif_name;
char *re;
struct discovery {
char *dpif_name;
char *re;
#include "status.h"
#include "timeval.h"
#include "vconn.h"
#include "status.h"
#include "timeval.h"
#include "vconn.h"
-
-#define THIS_MODULE VLM_fail_open
+VLOG_DEFINE_THIS_MODULE(fail_open)
+
#include "poll-loop.h"
#include "status.h"
#include "timeval.h"
#include "poll-loop.h"
#include "status.h"
#include "timeval.h"
-
-#define THIS_MODULE VLM_in_band
+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.
/* 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.
- * 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.
*
* 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 "svec.h"
#include "timeval.h"
#include "util.h"
-#define THIS_MODULE VLM_netflow
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(netflow)
#define NETFLOW_V5_VERSION 5
#define NETFLOW_V5_VERSION 5
#include "sflow_api.h"
#include "socket-util.h"
#include "timeval.h"
#include "sflow_api.h"
#include "socket-util.h"
#include "timeval.h"
-
-#define THIS_MODULE VLM_sflow
+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. */
struct ofproto_sflow_port {
struct netdev *netdev; /* Underlying network device, for stats. */
SFLDataSource_instance dsi; /* sFlow library's notion of port number. */
#include "timeval.h"
#include "unixctl.h"
#include "vconn.h"
#include "timeval.h"
#include "unixctl.h"
#include "vconn.h"
-#define THIS_MODULE VLM_ofproto
-#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(ofproto)
#include "timeval.h"
#include "util.h"
#include "vconn.h"
#include "timeval.h"
#include "util.h"
#include "vconn.h"
-
-#define THIS_MODULE VLM_pktbuf
+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
/* 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
#include "svec.h"
#include "timeval.h"
#include "vconn.h"
#include "svec.h"
#include "timeval.h"
#include "vconn.h"
-
-#define THIS_MODULE VLM_status
+VLOG_DEFINE_THIS_MODULE(status)
+
struct status_category {
struct list node;
char *name;
struct status_category {
struct list node;
char *name;
#include "transaction.h"
#include "uuid.h"
#include "util.h"
#include "transaction.h"
#include "uuid.h"
#include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_file
+VLOG_DEFINE_THIS_MODULE(ovsdb_file)
+
/* Minimum number of milliseconds between database compactions. */
#define COMPACT_MIN_MSEC (10 * 60 * 1000) /* 10 minutes. */
/* Minimum number of milliseconds between database compactions. */
#define COMPACT_MIN_MSEC (10 * 60 * 1000) /* 10 minutes. */
#include "timeval.h"
#include "transaction.h"
#include "trigger.h"
#include "timeval.h"
#include "transaction.h"
#include "trigger.h"
-
-#define THIS_MODULE VLM_ovsdb_jsonrpc_server
+VLOG_DEFINE_THIS_MODULE(ovsdb_jsonrpc_server)
+
struct ovsdb_jsonrpc_remote;
struct ovsdb_jsonrpc_session;
struct ovsdb_jsonrpc_remote;
struct ovsdb_jsonrpc_session;
#include "socket-util.h"
#include "transaction.h"
#include "util.h"
#include "socket-util.h"
#include "transaction.h"
#include "util.h"
-
-#define THIS_MODULE VLM_ovsdb_log
+VLOG_DEFINE_THIS_MODULE(ovsdb_log)
+
enum ovsdb_log_mode {
OVSDB_LOG_READ,
OVSDB_LOG_WRITE
enum ovsdb_log_mode {
OVSDB_LOG_READ,
OVSDB_LOG_WRITE
#include "table.h"
#include "timeval.h"
#include "util.h"
#include "table.h"
#include "timeval.h"
#include "util.h"
-#define THIS_MODULE VLM_ovsdb_client
+
+VLOG_DEFINE_THIS_MODULE(ovsdb_client)
/* --format: Output formatting. */
static enum {
/* --format: Output formatting. */
static enum {
#include "trigger.h"
#include "util.h"
#include "unixctl.h"
#include "trigger.h"
#include "util.h"
#include "unixctl.h"
-#define THIS_MODULE VLM_ovsdb_server
+
+VLOG_DEFINE_THIS_MODULE(ovsdb_server)
#if HAVE_OPENSSL
/* SSL configuration. */
#if HAVE_OPENSSL
/* SSL configuration. */
#include "table.h"
#include "timeval.h"
#include "util.h"
#include "table.h"
#include "timeval.h"
#include "util.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;
/* -m, --more: Verbosity level for "show-log" command output. */
static int show_log_verbosity;
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
-#define THIS_MODULE VLM_controller
+
+VLOG_DEFINE_THIS_MODULE(controller)
#define MAX_SWITCHES 16
#define MAX_LISTENERS 16
#define MAX_SWITCHES 16
#define MAX_LISTENERS 16
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
-#define THIS_MODULE VLM_ovs_discover
+
+VLOG_DEFINE_THIS_MODULE(ovs_discover)
struct iface {
const char *name;
struct iface {
const char *name;
#include "svec.h"
#include "timeval.h"
#include "util.h"
#include "svec.h"
#include "timeval.h"
#include "util.h"
-#define THIS_MODULE VLM_dpctl
+
+VLOG_DEFINE_THIS_MODULE(dpctl)
static const struct command all_commands[];
static const struct command all_commands[];
#include "timeval.h"
#include "util.h"
#include "vconn.h"
#include "timeval.h"
#include "util.h"
#include "vconn.h"
-#include "vlog.h"
-#define THIS_MODULE VLM_ofctl
+VLOG_DEFINE_THIS_MODULE(ofctl)
#define DEFAULT_IDLE_TIMEOUT 60
#define DEFAULT_IDLE_TIMEOUT 60
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
-#define THIS_MODULE VLM_openflowd
+
+VLOG_DEFINE_THIS_MODULE(openflowd)
/* Settings that may be configured by the user. */
struct ofsettings {
/* Settings that may be configured by the user. */
struct ofsettings {
#include "vswitchd/vswitch-idl.h"
#include "timeval.h"
#include "util.h"
#include "vswitchd/vswitch-idl.h"
#include "timeval.h"
#include "util.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
/* vsctl_fatal() also logs the error, so it is preferred in this file. */
#define ovs_fatal please_use_vsctl_fatal_instead_of_ovs_fatal
#include "vconn.h"
#include "vswitchd/vswitch-idl.h"
#include "xenserver.h"
#include "vconn.h"
#include "vswitchd/vswitch-idl.h"
#include "xenserver.h"
#include "xtoxll.h"
#include "sflow_api.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;
struct dst {
uint16_t vlan;
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
#include "vswitchd/vswitch-idl.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? */
/* xxx Just hangs if datapath is rmmod/insmod. Learn to reconnect? */
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
#include "unixctl.h"
#include "util.h"
#include "vconn.h"
#include "vswitchd/vswitch-idl.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;
static unixctl_cb_func ovs_vswitchd_exit;
#include "hmap.h"
#include "shash.h"
#include "svec.h"
#include "hmap.h"
#include "shash.h"
#include "svec.h"
-
-#define THIS_MODULE VLM_proc_net_compat
+VLOG_DEFINE_THIS_MODULE(proc_net_compat)
+
/* Netlink socket to bridge compatibility kernel module. */
static struct nl_sock *brc_sock;
/* Netlink socket to bridge compatibility kernel module. */
static struct nl_sock *brc_sock;
-/* 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <unistd.h>
#include "dynamic-string.h"
#include "process.h"
#include <unistd.h>
#include "dynamic-string.h"
#include "process.h"
-#define THIS_MODULE VLM_xenserver
+
+VLOG_DEFINE_THIS_MODULE(xenserver)
static char *
read_host_uuid(void)
static char *
read_host_uuid(void)