X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fvlandev.c;h=d2a319118a09de14197283341a48c85b8ffa1168;hb=HEAD;hp=282d28ca32ec97dbc89c2fd5f14e308652764d2b;hpb=259e0b1ad1bfea762a76f0098deb8f8d8db1dfa3;p=cascardo%2Fovs.git diff --git a/lib/vlandev.c b/lib/vlandev.c index 282d28ca3..d2a319118 100644 --- a/lib/vlandev.c +++ b/lib/vlandev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013 Nicira, Inc. + * Copyright (c) 2011, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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); @@ -38,7 +38,7 @@ struct vlandev_class { int (*vd_del)(const char *vlan_dev); }; -#ifdef LINUX_DATAPATH +#ifdef __linux__ static const struct vlandev_class vlandev_linux_class; #endif static const struct vlandev_class vlandev_stub_class; @@ -61,7 +61,7 @@ static const struct vlandev_class * vlandev_get_class(void) { if (!vd_class) { -#ifdef LINUX_DATAPATH +#if __linux__ vd_class = &vlandev_linux_class; #else vd_class = &vlandev_stub_class; @@ -161,8 +161,8 @@ vlandev_get_name(const char *real_dev_name, int vid) /* The Linux vlandev implementation. */ -#ifdef LINUX_DATAPATH -#include "rtnetlink-link.h" +#ifdef __linux__ +#include "rtnetlink.h" #include #include #include "netdev-linux.h" @@ -171,7 +171,7 @@ static struct nln_notifier *vlan_cache_notifier; static bool cache_valid; static void -vlan_cache_cb(const struct rtnetlink_link_change *change OVS_UNUSED, +vlan_cache_cb(const struct rtnetlink_change *change OVS_UNUSED, void *aux OVS_UNUSED) { cache_valid = false; @@ -185,8 +185,8 @@ vlandev_linux_refresh(void) FILE *stream; if (!vlan_cache_notifier) { - vlan_cache_notifier = rtnetlink_link_notifier_create(vlan_cache_cb, - NULL); + vlan_cache_notifier = rtnetlink_notifier_create(vlan_cache_cb, + NULL); if (!vlan_cache_notifier) { return EINVAL; } @@ -221,8 +221,7 @@ vlandev_linux_refresh(void) char vlan_dev[16], real_dev[16]; int vid; - if (sscanf(line, "%15[^ |] | %d | %15s", - vlan_dev, &vid, real_dev) == 3) { + if (ovs_scan(line, "%15[^ |] | %d | %15s", vlan_dev, &vid, real_dev)) { vlandev_add__(vlan_dev, real_dev, vid); } } @@ -303,7 +302,7 @@ vlandev_stub_del(const char *vlan_dev OVS_UNUSED) return EOPNOTSUPP; } -static const struct vlandev_class vlandev_stub_class = { +static const struct vlandev_class OVS_UNUSED vlandev_stub_class = { NULL, /* vd_refresh */ vlandev_stub_add, vlandev_stub_del @@ -375,7 +374,7 @@ static int vlandev_del__(const char *vlan_dev) { struct shash_node *vd_node = shash_find(&vlan_devs, vlan_dev); - if (!vd_node) { + if (vd_node) { struct vlan_dev *vd = vd_node->data; struct vlan_real_dev *vrd = vd->real_dev;