示例#1
0
文件: vlog.c 项目: AlexanderChou/ovs
};

/* RFC 5424 defines specific values for each syslog level.  Normally LOG_* use
 * the same values.  Verify that in fact they're the same.  If we get assertion
 * failures here then we need to define a separate rfc5424_levels[] array. */
#define VLOG_LEVEL(NAME, SYSLOG_LEVEL, RFC5424) \
    BUILD_ASSERT_DECL(SYSLOG_LEVEL == RFC5424);
VLOG_LEVELS
#undef VLOG_LEVELS

/* Similarly, RFC 5424 defines the local0 facility with the value ordinarily
 * used for LOG_LOCAL0. */
BUILD_ASSERT_DECL(LOG_LOCAL0 == (16 << 3));

/* The log modules. */
struct ovs_list vlog_modules = OVS_LIST_INITIALIZER(&vlog_modules);

/* Protects the 'pattern' in all "struct destination"s, so that a race between
 * changing and reading the pattern does not cause an access to freed
 * memory. */
static struct ovs_rwlock pattern_rwlock = OVS_RWLOCK_INITIALIZER;

/* Information about each destination. */
struct destination {
    const char *name;           /* Name. */
    char *pattern OVS_GUARDED_BY(pattern_rwlock); /* Current pattern. */
    bool default_pattern;       /* Whether current pattern is the default. */
};
static struct destination destinations[VLF_N_DESTINATIONS] = {
#define VLOG_DESTINATION(NAME, PATTERN) {#NAME, PATTERN, true},
    VLOG_DESTINATIONS
示例#2
0
文件: rstp.c 项目: Altiscale/ovs
#include <sys/types.h>
#include "byte-order.h"
#include "connectivity.h"
#include "ofpbuf.h"
#include "ofproto/ofproto.h"
#include "packets.h"
#include "seq.h"
#include "unixctl.h"
#include "util.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(rstp);

struct ovs_mutex rstp_mutex = OVS_MUTEX_INITIALIZER;

static struct ovs_list all_rstps__ = OVS_LIST_INITIALIZER(&all_rstps__);
static struct ovs_list *const all_rstps OVS_GUARDED_BY(rstp_mutex) = &all_rstps__;

/* Internal use only. */
static void rstp_set_bridge_address__(struct rstp *, rstp_identifier)
    OVS_REQUIRES(rstp_mutex);
static void rstp_set_bridge_priority__(struct rstp *, int new_priority)
    OVS_REQUIRES(rstp_mutex);
static void rstp_set_bridge_ageing_time__(struct rstp *, int new_ageing_time)
    OVS_REQUIRES(rstp_mutex);
static void rstp_set_bridge_force_protocol_version__(struct rstp *,
                                                     enum rstp_force_protocol_version)
    OVS_REQUIRES(rstp_mutex);
static void rstp_set_bridge_hello_time__(struct rstp *)
    OVS_REQUIRES(rstp_mutex);
static void rstp_set_bridge_max_age__(struct rstp *, int new_max_age)
示例#3
0
文件: rtbsd.c 项目: openvswitch/ovs
#include "coverage.h"
#include "socket-util.h"
#include "openvswitch/poll-loop.h"
#include "openvswitch/vlog.h"

VLOG_DEFINE_THIS_MODULE(rtbsd);
COVERAGE_DEFINE(rtbsd_changed);

static struct ovs_mutex rtbsd_mutex = OVS_MUTEX_INITIALIZER;

/* PF_ROUTE socket. */
static int notify_sock = -1;

/* All registered notifiers. */
static struct ovs_list all_notifiers = OVS_LIST_INITIALIZER(&all_notifiers);

static void rtbsd_report_change(const struct if_msghdr *)
    OVS_REQUIRES(rtbsd_mutex);
static void rtbsd_report_notify_error(void) OVS_REQUIRES(rtbsd_mutex);

/* Registers 'cb' to be called with auxiliary data 'aux' with network device
 * change notifications.  The notifier is stored in 'notifier', which the
 * caller must not modify or free.
 *
 * Returns 0 if successful, otherwise a positive errno value. */
int
rtbsd_notifier_register(struct rtbsd_notifier *notifier,
                            rtbsd_notify_func *cb, void *aux)
    OVS_EXCLUDED(rtbsd_mutex)
{
#include "ops-port.h"
#include "ops-knet.h"
#include "ops-stats.h"
#include "platform-defines.h"
#include "netdev-bcmsdk.h"
#include "ops-routing.h"

VLOG_DEFINE_THIS_MODULE(netdev_bcmsdk);


/* Protects 'bcmsdk_list'. */
static struct ovs_mutex bcmsdk_list_mutex = OVS_MUTEX_INITIALIZER;

/* Contains all 'struct bcmsdk_dev's. */
static struct ovs_list bcmsdk_list OVS_GUARDED_BY(bcmsdk_list_mutex)
    = OVS_LIST_INITIALIZER(&bcmsdk_list);

struct netdev_bcmsdk {
    struct netdev up;

    /* In bcmsdk_list. */
    struct ovs_list list_node OVS_GUARDED_BY(bcmsdk_list_mutex);

    /* Protects all members below. */
    struct ovs_mutex mutex OVS_ACQ_AFTER(bcmsdk_list_mutex);

    uint8_t hwaddr[ETH_ADDR_LEN] OVS_GUARDED;
    int mtu OVS_GUARDED;
    struct netdev_stats stats OVS_GUARDED;
    enum netdev_flags flags OVS_GUARDED;
    long long int link_resets OVS_GUARDED;