From: Giuseppe Lettieri Date: Thu, 24 Jan 2013 13:52:38 +0000 (+0100) Subject: proper type for internal port of planetlab dpif X-Git-Tag: sliver-openvswitch-1.9.90-3~6 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0f5293d8a5cadcc2111e38fd79f3d39f5c83cebc;p=sliver-openvswitch.git proper type for internal port of planetlab dpif do_add_port() directly calls dpif_netdev_port_open_type(), so we cannot rely on virtual method dispatch to have our dpif_planetlab_port_open_type() called. --- diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 6e7a5cca0..13f57157c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -184,16 +184,9 @@ static const char * dpif_netdev_port_open_type(const struct dpif_class *class, const char *type) { return strcmp(type, "internal") ? type - : class != &dpif_netdev_class ? "dummy" - : "tap"; -} - -static const char * -dpif_planetlab_port_open_type(const struct dpif_class *class, const char *type) -{ - return strcmp(type, "internal") ? type - : class != &dpif_planetlab_class ? "dummy" - : "pltap"; + : class == &dpif_netdev_class ? "tap" + : class == &dpif_planetlab_class ? "pltap" + : "dummy"; } static struct dpif * @@ -1294,9 +1287,9 @@ dp_netdev_execute_actions(struct dp_netdev *dp, } } -#define DPIF_NETDEV_CLASS_FUNCTIONS(PORT_OPEN_TYPE) \ +#define DPIF_NETDEV_CLASS_FUNCTIONS \ dpif_netdev_enumerate, \ - PORT_OPEN_TYPE, \ + dpif_netdev_port_open_type, \ dpif_netdev_open, \ dpif_netdev_close, \ dpif_netdev_destroy, \ @@ -1331,12 +1324,12 @@ dp_netdev_execute_actions(struct dp_netdev *dp, const struct dpif_class dpif_netdev_class = { "netdev", - DPIF_NETDEV_CLASS_FUNCTIONS(dpif_netdev_port_open_type) + DPIF_NETDEV_CLASS_FUNCTIONS }; const struct dpif_class dpif_planetlab_class = { "planetlab", - DPIF_NETDEV_CLASS_FUNCTIONS(dpif_planetlab_port_open_type) + DPIF_NETDEV_CLASS_FUNCTIONS }; static void