Skip to content

Commit

Permalink
lib: Move vlog.h to <openvswitch/vlog.h>
Browse files Browse the repository at this point in the history
A new function vlog_insert_module() is introduced to avoid using
list_insert() from the vlog.h header.

Signed-off-by: Thomas Graf <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
Thomas Graf committed Dec 15, 2014
1 parent 55951e1 commit e6211ad
Show file tree
Hide file tree
Showing 123 changed files with 150 additions and 140 deletions.
3 changes: 2 additions & 1 deletion include/openvswitch/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ openvswitchinclude_HEADERS = \
include/openvswitch/token-bucket.h \
include/openvswitch/types.h \
include/openvswitch/util.h \
include/openvswitch/version.h
include/openvswitch/version.h \
include/openvswitch/vlog.h

34 changes: 17 additions & 17 deletions lib/vlog.h → include/openvswitch/vlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

#ifndef VLOG_H
#define VLOG_H 1
#ifndef OPENVSWITCH_VLOG_H
#define OPENVSWITCH_VLOG_H 1

/* Logging.
*
Expand All @@ -30,12 +30,11 @@
#include <stdarg.h>
#include <stdbool.h>
#include <time.h>
#include "compiler.h"
#include "ovs-thread.h"
#include "sat-math.h"
#include "openvswitch/token-bucket.h"
#include "util.h"
#include "list.h"
#include <openvswitch/compiler.h>
#include <openvswitch/list.h>
#include <openvswitch/thread.h>
#include <openvswitch/token-bucket.h>
#include <openvswitch/util.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -89,11 +88,13 @@ struct vlog_module {
/* Global list of all logging modules */
extern struct ovs_list vlog_modules;

void vlog_insert_module(struct ovs_list *);

/* Creates and initializes a global instance of a module named MODULE. */
#define VLOG_DEFINE_MODULE(MODULE) \
VLOG_DEFINE_MODULE__(MODULE) \
OVS_CONSTRUCTOR(init_##MODULE) { \
list_insert(&vlog_modules, &VLM_##MODULE.list); \
vlog_insert_module(&VLM_##MODULE.list); \
} \

const char *vlog_get_module_name(const struct vlog_module *);
Expand All @@ -114,13 +115,13 @@ struct vlog_rate_limit {

/* Initializer for a struct vlog_rate_limit, to set up a maximum rate of RATE
* messages per minute and a maximum burst size of BURST messages. */
#define VLOG_RATE_LIMIT_INIT(RATE, BURST) \
{ \
TOKEN_BUCKET_INIT(RATE, OVS_SAT_MUL(BURST, VLOG_MSG_TOKENS)),\
0, /* first_dropped */ \
0, /* last_dropped */ \
0, /* n_dropped */ \
OVS_MUTEX_INITIALIZER /* mutex */ \
#define VLOG_RATE_LIMIT_INIT(RATE, BURST) \
{ \
TOKEN_BUCKET_INIT(RATE, OVS_SAT_MUL(BURST, VLOG_MSG_TOKENS)), \
0, /* first_dropped */ \
0, /* last_dropped */ \
0, /* n_dropped */ \
OVS_MUTEX_INITIALIZER /* mutex */ \
}

/* Configuring how each module logs messages. */
Expand Down Expand Up @@ -292,5 +293,4 @@ void vlog_usage(void);
}
#endif


#endif /* vlog.h */
1 change: 0 additions & 1 deletion lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ lib_libopenvswitch_la_SOURCES = \
lib/vlandev.c \
lib/vlandev.h \
lib/vlog.c \
lib/vlog.h \
lib/vswitch-idl.c \
lib/vswitch-idl.h \
lib/vtep-idl.c \
Expand Down
2 changes: 1 addition & 1 deletion lib/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <inttypes.h>

#include "backtrace.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(backtrace);

Expand Down
2 changes: 1 addition & 1 deletion lib/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "unaligned.h"
#include "unixctl.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(bfd);

Expand Down
2 changes: 1 addition & 1 deletion lib/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "ofp-errors.h"
#include "ofp-util.h"
#include "openflow/nicira-ext.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(bundle);

Expand Down
2 changes: 1 addition & 1 deletion lib/cfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "timer.h"
#include "timeval.h"
#include "unixctl.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(cfm);

Expand Down
2 changes: 1 addition & 1 deletion lib/classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "ofp-util.h"
#include "packets.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(classifier);

Expand Down
2 changes: 1 addition & 1 deletion lib/command-line.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "dynamic-string.h"
#include "ovs-thread.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(command_line);

Expand Down
2 changes: 1 addition & 1 deletion lib/coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "timeval.h"
#include "unixctl.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(coverage);

Expand Down
2 changes: 1 addition & 1 deletion lib/daemon-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "socket-util.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(daemon_unix);

Expand Down
2 changes: 1 addition & 1 deletion lib/daemon-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "poll-loop.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(daemon_windows);

Expand Down
4 changes: 3 additions & 1 deletion lib/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include "vlog.h"
#include "util.h"
#include "ovs-thread.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(daemon);

Expand Down
2 changes: 1 addition & 1 deletion lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#include "tnl-arp-cache.h"
#include "unixctl.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(dpif_netdev);

Expand Down
2 changes: 1 addition & 1 deletion lib/dpif-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "timeval.h"
#include "unaligned.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(dpif_netlink);
#ifdef _WIN32
Expand Down
2 changes: 1 addition & 1 deletion lib/dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "tnl-ports.h"
#include "util.h"
#include "valgrind.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(dpif);

Expand Down
4 changes: 2 additions & 2 deletions lib/entropy.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#ifdef _WIN32
#include <Wincrypt.h>
#endif

#include "util.h"
#include "socket-util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(entropy);

Expand Down
2 changes: 1 addition & 1 deletion lib/fatal-signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "signals.h"
#include "socket-util.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

#include "type-props.h"

Expand Down
2 changes: 1 addition & 1 deletion lib/getopt_long.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(getopt_long);

Expand Down
2 changes: 1 addition & 1 deletion lib/getrusage-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sys/resource.h>
#include <time.h>
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(getrusage_windows);

Expand Down
2 changes: 1 addition & 1 deletion lib/hmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "coverage.h"
#include "random.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(hmap);

Expand Down
2 changes: 1 addition & 1 deletion lib/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "reconnect.h"
#include "stream.h"
#include "timeval.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(jsonrpc);

Expand Down
2 changes: 1 addition & 1 deletion lib/lacp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "timer.h"
#include "timeval.h"
#include "unixctl.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(lacp);

Expand Down
2 changes: 1 addition & 1 deletion lib/learning-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "simap.h"
#include "timeval.h"
#include "vconn.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(learning_switch);

Expand Down
2 changes: 1 addition & 1 deletion lib/lockfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ovs-thread.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(lockfile);

Expand Down
2 changes: 1 addition & 1 deletion lib/mcast-snooping.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "unaligned.h"
#include "util.h"
#include "vlan-bitmap.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

COVERAGE_DEFINE(mcast_snooping_learned);
COVERAGE_DEFINE(mcast_snooping_expired);
Expand Down
2 changes: 1 addition & 1 deletion lib/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "simap.h"
#include "timeval.h"
#include "unixctl.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(memory);

Expand Down
2 changes: 1 addition & 1 deletion lib/meta-flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "socket-util.h"
#include "unaligned.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(meta_flow);

Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#include "socket-util.h"
#include "svec.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netdev_bsd);

Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "unaligned.h"
#include "timeval.h"
#include "unixctl.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(dpdk);
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "timeval.h"
#include "unixctl.h"
#include "reconnect.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netdev_dummy);

Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#include "sset.h"
#include "timer.h"
#include "unaligned.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netdev_linux);

Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "route-table.h"
#include "shash.h"
#include "socket-util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"
#include "unaligned.h"
#include "unixctl.h"
#include "util.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "poll-loop.h"
#include "shash.h"
#include "svec.h"
#include "vlog.h"
#include "openvswitch/vlog.h"
#include "odp-netlink.h"
#include "netlink-socket.h"
#include "netlink.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "smap.h"
#include "sset.h"
#include "svec.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netdev);

Expand Down
2 changes: 1 addition & 1 deletion lib/netlink-notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "netlink.h"
#include "netlink-socket.h"
#include "ofpbuf.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netlink_notifier);

Expand Down
2 changes: 1 addition & 1 deletion lib/netlink-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "seq.h"
#include "socket-util.h"
#include "util.h"
#include "vlog.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(netlink_socket);

Expand Down
Loading

0 comments on commit e6211ad

Please sign in to comment.