From: Thomas Graf Date: Mon, 15 Dec 2014 13:10:38 +0000 (+0100) Subject: lib: Move vlog.h to X-Git-Tag: v2.4.0~784 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=e6211adce42c28453e0004c7a3e342a3d52bb97d lib: Move vlog.h to A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf Acked-by: Ben Pfaff --- diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 0b95a0f61..5e9b77ad6 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -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 diff --git a/include/openvswitch/vlog.h b/include/openvswitch/vlog.h new file mode 100644 index 000000000..3f71e4bd7 --- /dev/null +++ b/include/openvswitch/vlog.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OPENVSWITCH_VLOG_H +#define OPENVSWITCH_VLOG_H 1 + +/* Logging. + * + * + * Thread-safety + * ============= + * + * Fully thread safe. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Logging severity levels. + * + * ovs-appctl(8) defines each of the log levels. */ +#define VLOG_LEVELS \ + VLOG_LEVEL(OFF, LOG_ALERT, 1) \ + VLOG_LEVEL(EMER, LOG_ALERT, 1) \ + VLOG_LEVEL(ERR, LOG_ERR, 3) \ + VLOG_LEVEL(WARN, LOG_WARNING, 4) \ + VLOG_LEVEL(INFO, LOG_NOTICE, 5) \ + VLOG_LEVEL(DBG, LOG_DEBUG, 7) +enum vlog_level { +#define VLOG_LEVEL(NAME, SYSLOG_LEVEL, RFC5424_LEVEL) VLL_##NAME, + VLOG_LEVELS +#undef VLOG_LEVEL + VLL_N_LEVELS +}; + +const char *vlog_get_level_name(enum vlog_level); +enum vlog_level vlog_get_level_val(const char *name); + +/* Facilities that we can log to. */ +#define VLOG_FACILITIES \ + VLOG_FACILITY(SYSLOG, "ovs|%05N|%c%T|%p|%m") \ + VLOG_FACILITY(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \ + VLOG_FACILITY(FILE, "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m") +enum vlog_facility { +#define VLOG_FACILITY(NAME, PATTERN) VLF_##NAME, + VLOG_FACILITIES +#undef VLOG_FACILITY + VLF_N_FACILITIES, + VLF_ANY_FACILITY = -1 +}; + +const char *vlog_get_facility_name(enum vlog_facility); +enum vlog_facility vlog_get_facility_val(const char *name); + +/* A log module. */ +struct vlog_module { + struct ovs_list list; + const char *name; /* User-visible name. */ + int levels[VLF_N_FACILITIES]; /* Minimum log level for each facility. */ + int min_level; /* Minimum log level for any facility. */ + bool honor_rate_limits; /* Set false to ignore rate limits. */ +}; + +/* 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) { \ + vlog_insert_module(&VLM_##MODULE.list); \ + } \ + +const char *vlog_get_module_name(const struct vlog_module *); +struct vlog_module *vlog_module_from_name(const char *name); + +/* Rate-limiter for log messages. */ +struct vlog_rate_limit { + struct token_bucket token_bucket; + time_t first_dropped; /* Time first message was dropped. */ + time_t last_dropped; /* Time of most recent message drop. */ + unsigned int n_dropped; /* Number of messages dropped. */ + struct ovs_mutex mutex; /* Mutual exclusion for rate limit. */ +}; + +/* Number of tokens to emit a message. We add 'rate' tokens per millisecond, + * thus 60,000 tokens are required to emit one message per minute. */ +#define VLOG_MSG_TOKENS (60 * 1000) + +/* 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 */ \ + } + +/* Configuring how each module logs messages. */ +enum vlog_level vlog_get_level(const struct vlog_module *, enum vlog_facility); +void vlog_set_levels(struct vlog_module *, + enum vlog_facility, enum vlog_level); +char *vlog_set_levels_from_string(const char *) OVS_WARN_UNUSED_RESULT; +void vlog_set_levels_from_string_assert(const char *); +char *vlog_get_levels(void); +bool vlog_is_enabled(const struct vlog_module *, enum vlog_level); +bool vlog_should_drop(const struct vlog_module *, enum vlog_level, + struct vlog_rate_limit *); +void vlog_set_verbosity(const char *arg); + +/* Configuring log facilities. */ +void vlog_set_pattern(enum vlog_facility, const char *pattern); +int vlog_set_log_file(const char *file_name); +int vlog_reopen_log_file(void); + +/* Configure syslog target. */ +void vlog_set_syslog_target(const char *target); + +/* Initialization. */ +void vlog_init(void); +void vlog_enable_async(void); + +/* Functions for actual logging. */ +void vlog(const struct vlog_module *, enum vlog_level, const char *format, ...) + OVS_PRINTF_FORMAT (3, 4); +void vlog_valist(const struct vlog_module *, enum vlog_level, + const char *, va_list) + OVS_PRINTF_FORMAT (3, 0); + +OVS_NO_RETURN void vlog_fatal(const struct vlog_module *, const char *format, ...) + OVS_PRINTF_FORMAT (2, 3); +OVS_NO_RETURN void vlog_fatal_valist(const struct vlog_module *, + const char *format, va_list) + OVS_PRINTF_FORMAT (2, 0); + +OVS_NO_RETURN void vlog_abort(const struct vlog_module *, const char *format, ...) + OVS_PRINTF_FORMAT (2, 3); +OVS_NO_RETURN void vlog_abort_valist(const struct vlog_module *, + const char *format, va_list) + OVS_PRINTF_FORMAT (2, 0); + +void vlog_rate_limit(const struct vlog_module *, enum vlog_level, + struct vlog_rate_limit *, const char *, ...) + OVS_PRINTF_FORMAT (4, 5); + +/* Creates and initializes a global instance of a module named MODULE, and + * defines a static variable named THIS_MODULE that points to it, for use with + * the convenience macros below. */ +#define VLOG_DEFINE_THIS_MODULE(MODULE) \ + VLOG_DEFINE_MODULE(MODULE); \ + static struct vlog_module *const THIS_MODULE = &VLM_##MODULE + +/* Convenience macros. These assume that THIS_MODULE points to a "struct + * vlog_module" for the current module, as set up by e.g. the + * VLOG_DEFINE_MODULE macro above. + * + * Guaranteed to preserve errno. + */ +#define VLOG_FATAL(...) vlog_fatal(THIS_MODULE, __VA_ARGS__) +#define VLOG_ABORT(...) vlog_abort(THIS_MODULE, __VA_ARGS__) +#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__) +#define VLOG_ERR(...) VLOG(VLL_ERR, __VA_ARGS__) +#define VLOG_WARN(...) VLOG(VLL_WARN, __VA_ARGS__) +#define VLOG_INFO(...) VLOG(VLL_INFO, __VA_ARGS__) +#define VLOG_DBG(...) VLOG(VLL_DBG, __VA_ARGS__) + +/* More convenience macros, for testing whether a given level is enabled in + * THIS_MODULE. When constructing a log message is expensive, this enables it + * to be skipped. */ +#define VLOG_IS_ERR_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_ERR) +#define VLOG_IS_WARN_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_WARN) +#define VLOG_IS_INFO_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_INFO) +#define VLOG_IS_DBG_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_DBG) + +/* Convenience macros for rate-limiting. + * Guaranteed to preserve errno. + */ +#define VLOG_ERR_RL(RL, ...) VLOG_RL(RL, VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_RL(RL, ...) VLOG_RL(RL, VLL_WARN, __VA_ARGS__) +#define VLOG_INFO_RL(RL, ...) VLOG_RL(RL, VLL_INFO, __VA_ARGS__) +#define VLOG_DBG_RL(RL, ...) VLOG_RL(RL, VLL_DBG, __VA_ARGS__) + +/* Convenience macros to additionally store log message in buffer + * Caller is responsible for freeing *ERRP afterwards */ +#define VLOG_ERR_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_WARN, __VA_ARGS__) + +#define VLOG_DROP_ERR(RL) vlog_should_drop(THIS_MODULE, VLL_ERR, RL) +#define VLOG_DROP_WARN(RL) vlog_should_drop(THIS_MODULE, VLL_WARN, RL) +#define VLOG_DROP_INFO(RL) vlog_should_drop(THIS_MODULE, VLL_INFO, RL) +#define VLOG_DROP_DBG(RL) vlog_should_drop(THIS_MODULE, VLL_DBG, RL) + +/* Macros for logging at most once per execution. */ +#define VLOG_ERR_ONCE(...) VLOG_ONCE(VLL_ERR, __VA_ARGS__) +#define VLOG_WARN_ONCE(...) VLOG_ONCE(VLL_WARN, __VA_ARGS__) +#define VLOG_INFO_ONCE(...) VLOG_ONCE(VLL_INFO, __VA_ARGS__) +#define VLOG_DBG_ONCE(...) VLOG_ONCE(VLL_DBG, __VA_ARGS__) + +/* Command line processing. */ +#define VLOG_OPTION_ENUMS \ + OPT_LOG_FILE, \ + OPT_SYSLOG_TARGET + +#define VLOG_LONG_OPTIONS \ + {"verbose", optional_argument, NULL, 'v'}, \ + {"log-file", optional_argument, NULL, OPT_LOG_FILE}, \ + {"syslog-target", optional_argument, NULL, OPT_SYSLOG_TARGET} + +#define VLOG_OPTION_HANDLERS \ + case 'v': \ + vlog_set_verbosity(optarg); \ + break; \ + case OPT_LOG_FILE: \ + vlog_set_log_file(optarg); \ + break; \ + case OPT_SYSLOG_TARGET: \ + vlog_set_syslog_target(optarg); \ + break; + +void vlog_usage(void); + +/* Implementation details. */ +#define VLOG(LEVEL, ...) \ + do { \ + enum vlog_level level__ = LEVEL; \ + if (THIS_MODULE->min_level >= level__) { \ + vlog(THIS_MODULE, level__, __VA_ARGS__); \ + } \ + } while (0) +#define VLOG_RL(RL, LEVEL, ...) \ + do { \ + enum vlog_level level__ = LEVEL; \ + if (THIS_MODULE->min_level >= level__) { \ + vlog_rate_limit(THIS_MODULE, level__, RL, __VA_ARGS__); \ + } \ + } while (0) +#define VLOG_ONCE(LEVEL, ...) \ + do { \ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; \ + if (ovsthread_once_start(&once)) { \ + vlog(THIS_MODULE, LEVEL, __VA_ARGS__); \ + ovsthread_once_done(&once); \ + } \ + } while (0) +#define VLOG_ERRP(ERRP, LEVEL, ...) \ + do { \ + VLOG(LEVEL, __VA_ARGS__); \ + if (ERRP) { \ + *(ERRP) = xasprintf(__VA_ARGS__); \ + } \ + } while (0) + +#define VLOG_DEFINE_MODULE__(MODULE) \ + extern struct vlog_module VLM_##MODULE; \ + struct vlog_module VLM_##MODULE = \ + { \ + OVS_LIST_INITIALIZER(&VLM_##MODULE.list), \ + #MODULE, /* name */ \ + { VLL_INFO, VLL_INFO, VLL_INFO }, /* levels */ \ + VLL_INFO, /* min_level */ \ + true /* honor_rate_limits */ \ + }; + +#ifdef __cplusplus +} +#endif + +#endif /* vlog.h */ diff --git a/lib/automake.mk b/lib/automake.mk index ba5f80aa4..ef5b02041 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -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 \ diff --git a/lib/backtrace.c b/lib/backtrace.c index 9b7c52b9a..5cb2954f8 100644 --- a/lib/backtrace.c +++ b/lib/backtrace.c @@ -18,7 +18,7 @@ #include #include "backtrace.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(backtrace); diff --git a/lib/bfd.c b/lib/bfd.c index 7f6bf5b51..3db1d5745 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -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); diff --git a/lib/bundle.c b/lib/bundle.c index 700969b4f..e66ceed06 100644 --- a/lib/bundle.c +++ b/lib/bundle.c @@ -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); diff --git a/lib/cfm.c b/lib/cfm.c index bc8be7114..23c1c6f31 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -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); diff --git a/lib/classifier.c b/lib/classifier.c index 1985efea7..bbc5a4a2f 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -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); diff --git a/lib/command-line.c b/lib/command-line.c index eb0a83b54..2eccdc682 100644 --- a/lib/command-line.c +++ b/lib/command-line.c @@ -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); diff --git a/lib/coverage.c b/lib/coverage.c index fe97d69af..61219566e 100644 --- a/lib/coverage.c +++ b/lib/coverage.c @@ -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); diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c index 3d0822238..3b24fca83 100644 --- a/lib/daemon-unix.c +++ b/lib/daemon-unix.c @@ -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); diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c index 3d1907e51..cb205cacc 100644 --- a/lib/daemon-windows.c +++ b/lib/daemon-windows.c @@ -20,7 +20,7 @@ #include #include #include "poll-loop.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(daemon_windows); diff --git a/lib/daemon.c b/lib/daemon.c index 4c7c8e16a..4ac32b88c 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -19,7 +19,9 @@ #include #include #include -#include "vlog.h" +#include "util.h" +#include "ovs-thread.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(daemon); diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 319435102..a0e508ce1 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -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); diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 2492a6bf7..63bbddcf8 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -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 diff --git a/lib/dpif.c b/lib/dpif.c index 4db3e433f..a2696c690 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -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); diff --git a/lib/entropy.c b/lib/entropy.c index f9808553d..05cc64835 100644 --- a/lib/entropy.c +++ b/lib/entropy.c @@ -23,9 +23,9 @@ #ifdef _WIN32 #include #endif - +#include "util.h" #include "socket-util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(entropy); diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c index 199cf6bd5..62acea085 100644 --- a/lib/fatal-signal.c +++ b/lib/fatal-signal.c @@ -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" diff --git a/lib/getopt_long.c b/lib/getopt_long.c index 95c810492..0663762fb 100644 --- a/lib/getopt_long.c +++ b/lib/getopt_long.c @@ -33,7 +33,7 @@ #include #include #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(getopt_long); diff --git a/lib/getrusage-windows.c b/lib/getrusage-windows.c index 0282a17c6..915725e37 100644 --- a/lib/getrusage-windows.c +++ b/lib/getrusage-windows.c @@ -20,7 +20,7 @@ #include #include #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(getrusage_windows); diff --git a/lib/hmap.c b/lib/hmap.c index 542d8b5a8..938dbc211 100644 --- a/lib/hmap.c +++ b/lib/hmap.c @@ -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); diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index d571656eb..f15adcaa1 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -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); diff --git a/lib/lacp.c b/lib/lacp.c index cc1a58223..6f526522e 100644 --- a/lib/lacp.c +++ b/lib/lacp.c @@ -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); diff --git a/lib/learning-switch.c b/lib/learning-switch.c index af72ae10a..b948af7a6 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -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); diff --git a/lib/lockfile.c b/lib/lockfile.c index 1ef625128..26aee3324 100644 --- a/lib/lockfile.c +++ b/lib/lockfile.c @@ -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); diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c index d99f01c13..e84efc60f 100644 --- a/lib/mcast-snooping.c +++ b/lib/mcast-snooping.c @@ -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); diff --git a/lib/memory.c b/lib/memory.c index 6c97e190a..3e21eb561 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -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); diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 9aa71a3df..90dd27c24 100644 --- a/lib/meta-flow.c +++ b/lib/meta-flow.c @@ -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); diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c index 473c0f662..a10b529ca 100644 --- a/lib/netdev-bsd.c +++ b/lib/netdev-bsd.c @@ -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); diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 4e2d28118..0ede2001d 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -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); diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 01ee928e9..fcb0b7749 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -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); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 99425f77b..a1e49797c 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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); diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index e6b97fa44..91acabb4e 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -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" diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c index 465f0c5c9..c67aaebcd 100644 --- a/lib/netdev-windows.c +++ b/lib/netdev-windows.c @@ -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" diff --git a/lib/netdev.c b/lib/netdev.c index 4a9c0f516..2bda77f51 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -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); diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c index 713082db4..45c9188af 100644 --- a/lib/netlink-notifier.c +++ b/lib/netlink-notifier.c @@ -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); diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 2e02c43bf..e4f153f4d 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -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); diff --git a/lib/netlink.c b/lib/netlink.c index 24b21689c..b6f7d4538 100644 --- a/lib/netlink.c +++ b/lib/netlink.c @@ -26,7 +26,7 @@ #include "ofpbuf.h" #include "timeval.h" #include "unaligned.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(netlink); diff --git a/lib/nx-match.c b/lib/nx-match.c index 72fa29bb6..2ad3cf2a4 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -33,7 +33,7 @@ #include "shash.h" #include "unaligned.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(nx_match); diff --git a/lib/odp-util.c b/lib/odp-util.c index a89d5f8bd..b8fda49b4 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -37,7 +37,7 @@ #include "timeval.h" #include "unaligned.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(odp_util); diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 1b7625d95..4680d816c 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -30,7 +30,7 @@ #include "ofpbuf.h" #include "unaligned.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofp_actions); diff --git a/lib/ofp-errors.c b/lib/ofp-errors.c index c803494f0..ce85f6758 100644 --- a/lib/ofp-errors.c +++ b/lib/ofp-errors.c @@ -23,7 +23,7 @@ #include "ofp-util.h" #include "ofpbuf.h" #include "openflow/openflow.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofp_errors); diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index 4dfc65764..364ce7616 100644 --- a/lib/ofp-msgs.c +++ b/lib/ofp-msgs.c @@ -24,7 +24,7 @@ #include "openflow/nicira-ext.h" #include "openflow/openflow.h" #include "ovs-thread.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofp_msgs); diff --git a/lib/ofp-util.c b/lib/ofp-util.c index b32234a97..986659ee7 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -42,7 +42,7 @@ #include "random.h" #include "unaligned.h" #include "type-props.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "bitmap.h" VLOG_DEFINE_THIS_MODULE(ofp_util); diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c index 07cbc7b2d..dabdd187f 100644 --- a/lib/ovs-numa.c +++ b/lib/ovs-numa.c @@ -32,7 +32,7 @@ #include "hmap.h" #include "list.h" #include "ovs-thread.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovs_numa); diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c index 1cf69aebb..5276981c8 100644 --- a/lib/ovs-rcu.c +++ b/lib/ovs-rcu.c @@ -22,7 +22,7 @@ #include "poll-loop.h" #include "seq.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovs_rcu); diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 3dd0ed6eb..7d38c8001 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -25,6 +25,7 @@ #include #include "compiler.h" #include "hash.h" +#include "list.h" #include "netdev-dpdk.h" #include "ovs-rcu.h" #include "poll-loop.h" @@ -38,7 +39,7 @@ * cut-and-paste. Since "sparse" is just a checker, not a compiler, it * doesn't matter that we don't define them. */ #else -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovs_thread); diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c index eb9f1eee4..8be4d1613 100644 --- a/lib/ovsdb-error.c +++ b/lib/ovsdb-error.c @@ -23,7 +23,7 @@ #include "dynamic-string.h" #include "json.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_error); diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index e1857b6d3..9c25dbcbc 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -34,7 +34,7 @@ #include "poll-loop.h" #include "shash.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_idl); diff --git a/lib/pcap-file.c b/lib/pcap-file.c index 191e690e6..58c60b1cc 100644 --- a/lib/pcap-file.c +++ b/lib/pcap-file.c @@ -29,7 +29,7 @@ #include "packets.h" #include "timeval.h" #include "unaligned.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(pcap); diff --git a/lib/poll-loop.c b/lib/poll-loop.c index 8747c61a1..3c4b55c88 100644 --- a/lib/poll-loop.c +++ b/lib/poll-loop.c @@ -29,7 +29,7 @@ #include "seq.h" #include "socket-util.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "hmap.h" #include "hash.h" diff --git a/lib/process.c b/lib/process.c index f6b665e81..e89f9cacc 100644 --- a/lib/process.c +++ b/lib/process.c @@ -34,7 +34,7 @@ #include "signals.h" #include "socket-util.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(process); diff --git a/lib/rconn.c b/lib/rconn.c index 9d8c46f3e..8e07b8e2b 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -30,7 +30,7 @@ #include "timeval.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(rconn); diff --git a/lib/reconnect.c b/lib/reconnect.c index 5296c5cbe..bab821ebb 100644 --- a/lib/reconnect.c +++ b/lib/reconnect.c @@ -20,7 +20,7 @@ #include #include "poll-loop.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(reconnect); diff --git a/lib/route-table.c b/lib/route-table.c index 2c3f64cf1..1459b7d54 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -31,7 +31,7 @@ #include "ofpbuf.h" #include "ovs-router.h" #include "rtnetlink-link.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(route_table); diff --git a/lib/rstp-state-machines.c b/lib/rstp-state-machines.c index df357a736..320201897 100644 --- a/lib/rstp-state-machines.c +++ b/lib/rstp-state-machines.c @@ -42,7 +42,7 @@ #include "seq.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(rstp_sm); diff --git a/lib/rstp.c b/lib/rstp.c index 8a7891a60..3b314b4c5 100644 --- a/lib/rstp.c +++ b/lib/rstp.c @@ -44,7 +44,7 @@ #include "seq.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(rstp); diff --git a/lib/rtbsd.c b/lib/rtbsd.c index d33f64bd6..c3dbdcab4 100644 --- a/lib/rtbsd.c +++ b/lib/rtbsd.c @@ -26,7 +26,7 @@ #include "coverage.h" #include "socket-util.h" #include "poll-loop.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "rtbsd.h" VLOG_DEFINE_THIS_MODULE(rtbsd); diff --git a/lib/signals.c b/lib/signals.c index 85e5c7949..3af618713 100644 --- a/lib/signals.c +++ b/lib/signals.c @@ -25,7 +25,7 @@ #include "socket-util.h" #include "type-props.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(signals); diff --git a/lib/socket-util-unix.c b/lib/socket-util-unix.c index c56654e03..afab1958d 100644 --- a/lib/socket-util-unix.c +++ b/lib/socket-util-unix.c @@ -28,7 +28,7 @@ #include "fatal-signal.h" #include "random.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(socket_util_unix); diff --git a/lib/socket-util.c b/lib/socket-util.c index 755ce4e4e..8949da77d 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -37,7 +37,7 @@ #include "packets.h" #include "poll-loop.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #ifdef __linux__ #include #endif diff --git a/lib/stp.c b/lib/stp.c index 9e02acc7b..1e88cba89 100644 --- a/lib/stp.c +++ b/lib/stp.c @@ -28,11 +28,12 @@ #include "byte-order.h" #include "connectivity.h" #include "ofpbuf.h" +#include "ovs-atomic.h" #include "packets.h" #include "seq.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stp); diff --git a/lib/stream-fd.c b/lib/stream-fd.c index 1b8070190..a6a10d476 100644 --- a/lib/stream-fd.c +++ b/lib/stream-fd.c @@ -29,7 +29,7 @@ #include "util.h" #include "stream-provider.h" #include "stream.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stream_fd); diff --git a/lib/stream-nossl.c b/lib/stream-nossl.c index 9dda9871c..26fcc978e 100644 --- a/lib/stream-nossl.c +++ b/lib/stream-nossl.c @@ -16,7 +16,7 @@ #include #include "stream-ssl.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stream_nossl); diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index 353f1718c..47c53125b 100644 --- a/lib/stream-ssl.c +++ b/lib/stream-ssl.c @@ -45,7 +45,7 @@ #include "stream-provider.h" #include "stream.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #ifdef _WIN32 /* Ref: https://www.openssl.org/support/faq.html#PROG2 diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c index e58c5adf7..3e19dbbb7 100644 --- a/lib/stream-tcp.c +++ b/lib/stream-tcp.c @@ -31,7 +31,7 @@ #include "util.h" #include "stream-provider.h" #include "stream-fd.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stream_tcp); diff --git a/lib/stream-unix.c b/lib/stream-unix.c index 29077c6a2..daade3f3b 100644 --- a/lib/stream-unix.c +++ b/lib/stream-unix.c @@ -33,7 +33,7 @@ #include "util.h" #include "stream-provider.h" #include "stream-fd.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stream_unix); diff --git a/lib/stream.c b/lib/stream.c index 4e512da2a..ca469fb5f 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -37,7 +37,7 @@ #include "random.h" #include "socket-util.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(stream); diff --git a/lib/svec.c b/lib/svec.c index d083ebb86..7fe8bebdf 100644 --- a/lib/svec.c +++ b/lib/svec.c @@ -21,7 +21,7 @@ #include #include "dynamic-string.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(svec); diff --git a/lib/timeval.c b/lib/timeval.c index 99f9b949c..6173affec 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -37,7 +37,7 @@ #include "seq.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(timeval); diff --git a/lib/tnl-arp-cache.c b/lib/tnl-arp-cache.c index 76195ec7c..59ec0bc37 100644 --- a/lib/tnl-arp-cache.c +++ b/lib/tnl-arp-cache.c @@ -36,7 +36,7 @@ #include "unaligned.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" /* In seconds */ diff --git a/lib/unixctl.c b/lib/unixctl.c index 9fb2e85b6..b47f35ad0 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -29,7 +29,7 @@ #include "stream.h" #include "stream-provider.h" #include "svec.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(unixctl); diff --git a/lib/util.c b/lib/util.c index 453ade6dc..6b51fa810 100644 --- a/lib/util.c +++ b/lib/util.c @@ -33,7 +33,7 @@ #include "ovs-rcu.h" #include "ovs-thread.h" #include "socket-util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #ifdef HAVE_PTHREAD_SET_NAME_NP #include #endif diff --git a/lib/vconn-stream.c b/lib/vconn-stream.c index 9347b5ea0..32c25cdbb 100644 --- a/lib/vconn-stream.c +++ b/lib/vconn-stream.c @@ -30,7 +30,7 @@ #include "util.h" #include "vconn-provider.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vconn_stream); diff --git a/lib/vconn.c b/lib/vconn.c index 97e8dd262..2ffbd8d7a 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -37,7 +37,7 @@ #include "poll-loop.h" #include "random.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "socket-util.h" VLOG_DEFINE_THIS_MODULE(vconn); diff --git a/lib/vlandev.c b/lib/vlandev.c index d2f5a37e1..99c99de70 100644 --- a/lib/vlandev.c +++ b/lib/vlandev.c @@ -27,7 +27,7 @@ #include "hash.h" #include "shash.h" #include "socket-util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vlandev); diff --git a/lib/vlog.c b/lib/vlog.c index 60ce3b420..dbf46c5ab 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -15,7 +15,7 @@ */ #include -#include "vlog.h" +#include "openvswitch/vlog.h" #include #include #include @@ -170,6 +170,11 @@ vlog_get_facility_val(const char *name) return i; } +void vlog_insert_module(struct ovs_list *vlog) +{ + list_insert(&vlog_modules, vlog); +} + /* Returns the name for logging module 'module'. */ const char * vlog_get_module_name(const struct vlog_module *module) diff --git a/lib/vlog.h b/lib/vlog.h deleted file mode 100644 index a8f7b0152..000000000 --- a/lib/vlog.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VLOG_H -#define VLOG_H 1 - -/* Logging. - * - * - * Thread-safety - * ============= - * - * Fully thread safe. - */ - -#include -#include -#include -#include -#include "compiler.h" -#include "ovs-thread.h" -#include "sat-math.h" -#include "openvswitch/token-bucket.h" -#include "util.h" -#include "list.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Logging severity levels. - * - * ovs-appctl(8) defines each of the log levels. */ -#define VLOG_LEVELS \ - VLOG_LEVEL(OFF, LOG_ALERT, 1) \ - VLOG_LEVEL(EMER, LOG_ALERT, 1) \ - VLOG_LEVEL(ERR, LOG_ERR, 3) \ - VLOG_LEVEL(WARN, LOG_WARNING, 4) \ - VLOG_LEVEL(INFO, LOG_NOTICE, 5) \ - VLOG_LEVEL(DBG, LOG_DEBUG, 7) -enum vlog_level { -#define VLOG_LEVEL(NAME, SYSLOG_LEVEL, RFC5424_LEVEL) VLL_##NAME, - VLOG_LEVELS -#undef VLOG_LEVEL - VLL_N_LEVELS -}; - -const char *vlog_get_level_name(enum vlog_level); -enum vlog_level vlog_get_level_val(const char *name); - -/* Facilities that we can log to. */ -#define VLOG_FACILITIES \ - VLOG_FACILITY(SYSLOG, "ovs|%05N|%c%T|%p|%m") \ - VLOG_FACILITY(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m") \ - VLOG_FACILITY(FILE, "%D{%Y-%m-%dT%H:%M:%S.###Z}|%05N|%c%T|%p|%m") -enum vlog_facility { -#define VLOG_FACILITY(NAME, PATTERN) VLF_##NAME, - VLOG_FACILITIES -#undef VLOG_FACILITY - VLF_N_FACILITIES, - VLF_ANY_FACILITY = -1 -}; - -const char *vlog_get_facility_name(enum vlog_facility); -enum vlog_facility vlog_get_facility_val(const char *name); - -/* A log module. */ -struct vlog_module { - struct ovs_list list; - const char *name; /* User-visible name. */ - int levels[VLF_N_FACILITIES]; /* Minimum log level for each facility. */ - int min_level; /* Minimum log level for any facility. */ - bool honor_rate_limits; /* Set false to ignore rate limits. */ -}; - -/* Global list of all logging modules */ -extern struct ovs_list vlog_modules; - -/* 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); \ - } \ - -const char *vlog_get_module_name(const struct vlog_module *); -struct vlog_module *vlog_module_from_name(const char *name); - -/* Rate-limiter for log messages. */ -struct vlog_rate_limit { - struct token_bucket token_bucket; - time_t first_dropped; /* Time first message was dropped. */ - time_t last_dropped; /* Time of most recent message drop. */ - unsigned int n_dropped; /* Number of messages dropped. */ - struct ovs_mutex mutex; /* Mutual exclusion for rate limit. */ -}; - -/* Number of tokens to emit a message. We add 'rate' tokens per millisecond, - * thus 60,000 tokens are required to emit one message per minute. */ -#define VLOG_MSG_TOKENS (60 * 1000) - -/* 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 */ \ - } - -/* Configuring how each module logs messages. */ -enum vlog_level vlog_get_level(const struct vlog_module *, enum vlog_facility); -void vlog_set_levels(struct vlog_module *, - enum vlog_facility, enum vlog_level); -char *vlog_set_levels_from_string(const char *) OVS_WARN_UNUSED_RESULT; -void vlog_set_levels_from_string_assert(const char *); -char *vlog_get_levels(void); -bool vlog_is_enabled(const struct vlog_module *, enum vlog_level); -bool vlog_should_drop(const struct vlog_module *, enum vlog_level, - struct vlog_rate_limit *); -void vlog_set_verbosity(const char *arg); - -/* Configuring log facilities. */ -void vlog_set_pattern(enum vlog_facility, const char *pattern); -int vlog_set_log_file(const char *file_name); -int vlog_reopen_log_file(void); - -/* Configure syslog target. */ -void vlog_set_syslog_target(const char *target); - -/* Initialization. */ -void vlog_init(void); -void vlog_enable_async(void); - -/* Functions for actual logging. */ -void vlog(const struct vlog_module *, enum vlog_level, const char *format, ...) - OVS_PRINTF_FORMAT (3, 4); -void vlog_valist(const struct vlog_module *, enum vlog_level, - const char *, va_list) - OVS_PRINTF_FORMAT (3, 0); - -OVS_NO_RETURN void vlog_fatal(const struct vlog_module *, const char *format, ...) - OVS_PRINTF_FORMAT (2, 3); -OVS_NO_RETURN void vlog_fatal_valist(const struct vlog_module *, - const char *format, va_list) - OVS_PRINTF_FORMAT (2, 0); - -OVS_NO_RETURN void vlog_abort(const struct vlog_module *, const char *format, ...) - OVS_PRINTF_FORMAT (2, 3); -OVS_NO_RETURN void vlog_abort_valist(const struct vlog_module *, - const char *format, va_list) - OVS_PRINTF_FORMAT (2, 0); - -void vlog_rate_limit(const struct vlog_module *, enum vlog_level, - struct vlog_rate_limit *, const char *, ...) - OVS_PRINTF_FORMAT (4, 5); - -/* Creates and initializes a global instance of a module named MODULE, and - * defines a static variable named THIS_MODULE that points to it, for use with - * the convenience macros below. */ -#define VLOG_DEFINE_THIS_MODULE(MODULE) \ - VLOG_DEFINE_MODULE(MODULE); \ - static struct vlog_module *const THIS_MODULE = &VLM_##MODULE - -/* Convenience macros. These assume that THIS_MODULE points to a "struct - * vlog_module" for the current module, as set up by e.g. the - * VLOG_DEFINE_MODULE macro above. - * - * Guaranteed to preserve errno. - */ -#define VLOG_FATAL(...) vlog_fatal(THIS_MODULE, __VA_ARGS__) -#define VLOG_ABORT(...) vlog_abort(THIS_MODULE, __VA_ARGS__) -#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__) -#define VLOG_ERR(...) VLOG(VLL_ERR, __VA_ARGS__) -#define VLOG_WARN(...) VLOG(VLL_WARN, __VA_ARGS__) -#define VLOG_INFO(...) VLOG(VLL_INFO, __VA_ARGS__) -#define VLOG_DBG(...) VLOG(VLL_DBG, __VA_ARGS__) - -/* More convenience macros, for testing whether a given level is enabled in - * THIS_MODULE. When constructing a log message is expensive, this enables it - * to be skipped. */ -#define VLOG_IS_ERR_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_ERR) -#define VLOG_IS_WARN_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_WARN) -#define VLOG_IS_INFO_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_INFO) -#define VLOG_IS_DBG_ENABLED() vlog_is_enabled(THIS_MODULE, VLL_DBG) - -/* Convenience macros for rate-limiting. - * Guaranteed to preserve errno. - */ -#define VLOG_ERR_RL(RL, ...) VLOG_RL(RL, VLL_ERR, __VA_ARGS__) -#define VLOG_WARN_RL(RL, ...) VLOG_RL(RL, VLL_WARN, __VA_ARGS__) -#define VLOG_INFO_RL(RL, ...) VLOG_RL(RL, VLL_INFO, __VA_ARGS__) -#define VLOG_DBG_RL(RL, ...) VLOG_RL(RL, VLL_DBG, __VA_ARGS__) - -/* Convenience macros to additionally store log message in buffer - * Caller is responsible for freeing *ERRP afterwards */ -#define VLOG_ERR_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_ERR, __VA_ARGS__) -#define VLOG_WARN_BUF(ERRP, ...) VLOG_ERRP(ERRP, VLL_WARN, __VA_ARGS__) - -#define VLOG_DROP_ERR(RL) vlog_should_drop(THIS_MODULE, VLL_ERR, RL) -#define VLOG_DROP_WARN(RL) vlog_should_drop(THIS_MODULE, VLL_WARN, RL) -#define VLOG_DROP_INFO(RL) vlog_should_drop(THIS_MODULE, VLL_INFO, RL) -#define VLOG_DROP_DBG(RL) vlog_should_drop(THIS_MODULE, VLL_DBG, RL) - -/* Macros for logging at most once per execution. */ -#define VLOG_ERR_ONCE(...) VLOG_ONCE(VLL_ERR, __VA_ARGS__) -#define VLOG_WARN_ONCE(...) VLOG_ONCE(VLL_WARN, __VA_ARGS__) -#define VLOG_INFO_ONCE(...) VLOG_ONCE(VLL_INFO, __VA_ARGS__) -#define VLOG_DBG_ONCE(...) VLOG_ONCE(VLL_DBG, __VA_ARGS__) - -/* Command line processing. */ -#define VLOG_OPTION_ENUMS \ - OPT_LOG_FILE, \ - OPT_SYSLOG_TARGET - -#define VLOG_LONG_OPTIONS \ - {"verbose", optional_argument, NULL, 'v'}, \ - {"log-file", optional_argument, NULL, OPT_LOG_FILE}, \ - {"syslog-target", optional_argument, NULL, OPT_SYSLOG_TARGET} - -#define VLOG_OPTION_HANDLERS \ - case 'v': \ - vlog_set_verbosity(optarg); \ - break; \ - case OPT_LOG_FILE: \ - vlog_set_log_file(optarg); \ - break; \ - case OPT_SYSLOG_TARGET: \ - vlog_set_syslog_target(optarg); \ - break; - -void vlog_usage(void); - -/* Implementation details. */ -#define VLOG(LEVEL, ...) \ - do { \ - enum vlog_level level__ = LEVEL; \ - if (THIS_MODULE->min_level >= level__) { \ - vlog(THIS_MODULE, level__, __VA_ARGS__); \ - } \ - } while (0) -#define VLOG_RL(RL, LEVEL, ...) \ - do { \ - enum vlog_level level__ = LEVEL; \ - if (THIS_MODULE->min_level >= level__) { \ - vlog_rate_limit(THIS_MODULE, level__, RL, __VA_ARGS__); \ - } \ - } while (0) -#define VLOG_ONCE(LEVEL, ...) \ - do { \ - static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; \ - if (ovsthread_once_start(&once)) { \ - vlog(THIS_MODULE, LEVEL, __VA_ARGS__); \ - ovsthread_once_done(&once); \ - } \ - } while (0) -#define VLOG_ERRP(ERRP, LEVEL, ...) \ - do { \ - VLOG(LEVEL, __VA_ARGS__); \ - if (ERRP) { \ - *(ERRP) = xasprintf(__VA_ARGS__); \ - } \ - } while (0) - -#define VLOG_DEFINE_MODULE__(MODULE) \ - extern struct vlog_module VLM_##MODULE; \ - struct vlog_module VLM_##MODULE = \ - { \ - OVS_LIST_INITIALIZER(&VLM_##MODULE.list), \ - #MODULE, /* name */ \ - { VLL_INFO, VLL_INFO, VLL_INFO }, /* levels */ \ - VLL_INFO, /* min_level */ \ - true /* honor_rate_limits */ \ - }; - -#ifdef __cplusplus -} -#endif - - -#endif /* vlog.h */ diff --git a/ofproto/bond.c b/ofproto/bond.c index 72611ae47..c4b3a3aa1 100644 --- a/ofproto/bond.c +++ b/ofproto/bond.c @@ -45,7 +45,7 @@ #include "shash.h" #include "timeval.h" #include "unixctl.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(bond); diff --git a/ofproto/bundles.c b/ofproto/bundles.c index 001ad14c3..c33af52cc 100644 --- a/ofproto/bundles.c +++ b/ofproto/bundles.c @@ -35,7 +35,7 @@ #include "stream.h" #include "timeval.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "bundles.h" diff --git a/ofproto/collectors.c b/ofproto/collectors.c index 4501d2b21..770151c06 100644 --- a/ofproto/collectors.c +++ b/ofproto/collectors.c @@ -26,7 +26,7 @@ #include "socket-util.h" #include "sset.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(collectors); diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index cf79fd2e1..35aa98052 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -40,7 +40,7 @@ #include "stream.h" #include "timeval.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "bundles.h" diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index b29e5af2e..2aacc1311 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -33,7 +33,7 @@ #include "rconn.h" #include "timeval.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(fail_open); diff --git a/ofproto/in-band.c b/ofproto/in-band.c index e25a27a00..bde893a22 100644 --- a/ofproto/in-band.c +++ b/ofproto/in-band.c @@ -37,7 +37,7 @@ #include "packets.h" #include "poll-loop.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(in_band); diff --git a/ofproto/netflow.c b/ofproto/netflow.c index 5b1c8fe59..99bd6b8e4 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -33,7 +33,7 @@ #include "socket-util.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(netflow); diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c index 33e9f3f45..3ba6dce18 100644 --- a/ofproto/ofproto-dpif-ipfix.c +++ b/ofproto/ofproto-dpif-ipfix.c @@ -32,7 +32,7 @@ #include "util.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ipfix); diff --git a/ofproto/ofproto-dpif-mirror.c b/ofproto/ofproto-dpif-mirror.c index fcc775890..e0f3dcd49 100644 --- a/ofproto/ofproto-dpif-mirror.c +++ b/ofproto/ofproto-dpif-mirror.c @@ -22,7 +22,7 @@ #include "hmapx.h" #include "ofproto.h" #include "vlan-bitmap.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofproto_dpif_mirror); diff --git a/ofproto/ofproto-dpif-monitor.c b/ofproto/ofproto-dpif-monitor.c index abe679364..14de027b3 100644 --- a/ofproto/ofproto-dpif-monitor.c +++ b/ofproto/ofproto-dpif-monitor.c @@ -33,7 +33,7 @@ #include "seq.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofproto_dpif_monitor); diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c index 35667ca79..539a293da 100644 --- a/ofproto/ofproto-dpif-sflow.c +++ b/ofproto/ofproto-dpif-sflow.c @@ -37,7 +37,7 @@ #include "sflow_api.h" #include "socket-util.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "lib/odp-util.h" #include "ofproto-provider.h" #include "lacp.h" diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 75a0e6184..89de528b2 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -38,7 +38,7 @@ #include "poll-loop.h" #include "seq.h" #include "unixctl.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #define MAX_QUEUE_LENGTH 512 #define UPCALL_MAX_BATCH 64 diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index b357cfa21..c1327a6b3 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -56,7 +56,7 @@ #include "ovs-router.h" #include "tnl-ports.h" #include "tunnel.h" -#include "vlog.h" +#include "openvswitch/vlog.h" COVERAGE_DEFINE(xlate_actions); COVERAGE_DEFINE(xlate_actions_oversize); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 325c02211..2165bdac9 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -68,7 +68,7 @@ #include "unaligned.h" #include "unixctl.h" #include "vlan-bitmap.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ofproto_dpif); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index ab4918f20..75f0b54b2 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -57,7 +57,7 @@ #include "timeval.h" #include "unaligned.h" #include "unixctl.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "bundles.h" VLOG_DEFINE_THIS_MODULE(ofproto); diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c index 38ec34853..5ba8c5103 100644 --- a/ofproto/pktbuf.c +++ b/ofproto/pktbuf.c @@ -24,7 +24,7 @@ #include "timeval.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(pktbuf); diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c index 769f533ef..d079a246c 100644 --- a/ofproto/tunnel.c +++ b/ofproto/tunnel.c @@ -36,7 +36,7 @@ #include "tnl-arp-cache.h" #include "tnl-ports.h" #include "tunnel.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "unaligned.h" #include "ofproto-dpif.h" diff --git a/ovsdb/file.c b/ovsdb/file.c index 7c8ac6f29..8c3c31b61 100644 --- a/ovsdb/file.c +++ b/ovsdb/file.c @@ -35,7 +35,7 @@ #include "transaction.h" #include "uuid.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_file); diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index 989af3b3f..e40675828 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -37,7 +37,7 @@ #include "timeval.h" #include "transaction.h" #include "trigger.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_jsonrpc_server); diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 2d4c4dbb6..e3b08c71c 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -47,7 +47,7 @@ #include "timeval.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_client); diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index faa774127..d5277b11d 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -53,7 +53,7 @@ #include "trigger.h" #include "util.h" #include "unixctl.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(ovsdb_server); diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c index a33969ba2..171166518 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -39,7 +39,7 @@ #include "table.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" /* -m, --more: Verbosity level for "show-log" command output. */ static int show_log_verbosity; diff --git a/tests/test-flows.c b/tests/test-flows.c index 63340c7ae..19e83151b 100644 --- a/tests/test-flows.c +++ b/tests/test-flows.c @@ -30,7 +30,7 @@ #include "pcap-file.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static void test_flows_main(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) diff --git a/tests/test-jsonrpc.c b/tests/test-jsonrpc.c index fe7d8691a..2aad5c543 100644 --- a/tests/test-jsonrpc.c +++ b/tests/test-jsonrpc.c @@ -31,7 +31,7 @@ #include "stream.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" OVS_NO_RETURN static void usage(void); static void parse_options(int argc, char *argv[]); diff --git a/tests/test-lockfile.c b/tests/test-lockfile.c index 71ccbc6ab..d0c8dc480 100644 --- a/tests/test-lockfile.c +++ b/tests/test-lockfile.c @@ -26,7 +26,7 @@ #include "process.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" struct test { const char *name; diff --git a/tests/test-netflow.c b/tests/test-netflow.c index b1b7717a0..b918d1550 100644 --- a/tests/test-netflow.c +++ b/tests/test-netflow.c @@ -32,7 +32,7 @@ #include "socket-util.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" OVS_NO_RETURN static void usage(void); static void parse_options(int argc, char *argv[]); diff --git a/tests/test-odp.c b/tests/test-odp.c index b38c2ebea..48ad56aca 100644 --- a/tests/test-odp.c +++ b/tests/test-odp.c @@ -25,7 +25,7 @@ #include "ofpbuf.h" #include "ovstest.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static int parse_keys(bool wc_keys) diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index b113b9d61..99f41c1b5 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -49,7 +49,7 @@ #include "tests/idltest.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" OVS_NO_RETURN static void usage(void); static void parse_options(int argc, char *argv[]); diff --git a/tests/test-reconnect.c b/tests/test-reconnect.c index 61f95a5d3..6e165a287 100644 --- a/tests/test-reconnect.c +++ b/tests/test-reconnect.c @@ -26,7 +26,7 @@ #include "ovstest.h" #include "svec.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static struct reconnect *reconnect; static int now; diff --git a/tests/test-rstp.c b/tests/test-rstp.c index c5e7a562b..005423bf8 100644 --- a/tests/test-rstp.c +++ b/tests/test-rstp.c @@ -10,7 +10,7 @@ #include "ofpbuf.h" #include "ovstest.h" #include "packets.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #define MAX_PORTS 10 diff --git a/tests/test-sflow.c b/tests/test-sflow.c index 0bd5570f3..959cd6c53 100644 --- a/tests/test-sflow.c +++ b/tests/test-sflow.c @@ -35,7 +35,7 @@ #include "socket-util.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" OVS_NO_RETURN static void usage(void); static void parse_options(int argc, char *argv[]); diff --git a/tests/test-stp.c b/tests/test-stp.c index 88a138dc7..6250c547d 100644 --- a/tests/test-stp.c +++ b/tests/test-stp.c @@ -26,7 +26,7 @@ #include "ofpbuf.h" #include "ovstest.h" #include "packets.h" -#include "vlog.h" +#include "openvswitch/vlog.h" struct bpdu { int port_no; diff --git a/tests/test-util.c b/tests/test-util.c index 74bc5c43c..2c985e71c 100644 --- a/tests/test-util.c +++ b/tests/test-util.c @@ -27,7 +27,7 @@ #include "command-line.h" #include "ovstest.h" #include "random.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static void check_log_2_floor(uint32_t x, int n) diff --git a/tests/test-vconn.c b/tests/test-vconn.c index c7869531a..b5ba1726a 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -36,7 +36,7 @@ #include "stream-ssl.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" struct fake_pvconn { const char *type; diff --git a/utilities/nlmon.c b/utilities/nlmon.c index 99b060c97..dc5d8c491 100644 --- a/utilities/nlmon.c +++ b/utilities/nlmon.c @@ -29,7 +29,7 @@ #include "poll-loop.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static const struct nl_policy rtnlgrp_link_policy[] = { [IFLA_IFNAME] = { .type = NL_A_STRING, .optional = false }, diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index 943efc3b1..5c39a8f28 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -31,7 +31,7 @@ #include "timeval.h" #include "unixctl.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static void usage(void); static const char *parse_command_line(int argc, char *argv[]); diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index 010d68648..a0927461b 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -31,7 +31,7 @@ #include "socket-util.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #define DEFAULT_PORT 6630 diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index ef4550b0f..404a428c0 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -40,7 +40,7 @@ #include "packets.h" #include "timeval.h" #include "util.h" -#include "vlog.h" +#include "openvswitch/vlog.h" static struct dpctl_params dpctl_p; diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 5e6afaeab..1e349ea09 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -60,7 +60,7 @@ #include "unixctl.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "meta-flow.h" #include "sort.h" diff --git a/utilities/ovs-testcontroller.c b/utilities/ovs-testcontroller.c index 5a5923b94..2c75b41c7 100644 --- a/utilities/ovs-testcontroller.c +++ b/utilities/ovs-testcontroller.c @@ -41,7 +41,7 @@ #include "unixctl.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "socket-util.h" #include "ofp-util.h" diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 2c272edca..41d8f9b1b 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -48,7 +48,7 @@ #include "timeval.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vsctl); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 228ee91e9..4d8473272 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -60,7 +60,7 @@ #include "vlandev.h" #include "lib/vswitch-idl.h" #include "xenserver.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "sflow_api.h" #include "vlan-bitmap.h" #include "packets.h" diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 392e2c79a..9e406c42b 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -46,7 +46,7 @@ #include "unixctl.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" #include "lib/vswitch-idl.h" #include "lib/netdev-dpdk.h" diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c index 42ac01a2b..b8a885536 100644 --- a/vswitchd/system-stats.c +++ b/vswitchd/system-stats.c @@ -42,7 +42,7 @@ #include "shash.h" #include "smap.h" #include "timeval.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(system_stats); diff --git a/vswitchd/xenserver.c b/vswitchd/xenserver.c index bc57f0ead..a1a6231f8 100644 --- a/vswitchd/xenserver.c +++ b/vswitchd/xenserver.c @@ -23,7 +23,8 @@ #include #include "dynamic-string.h" #include "process.h" -#include "vlog.h" +#include "util.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(xenserver); diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index afc7f3895..14de5b54f 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -48,7 +48,7 @@ #include "timeval.h" #include "util.h" #include "vconn.h" -#include "vlog.h" +#include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(vtep_ctl);