[ovs-dev] [PATCH] netdev-vport: Remove useless struct netdev-vport.

Ethan Jackson ethan at nicira.com
Thu Jan 10 02:11:14 UTC 2013


Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 lib/netdev-vport.c |   25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index e0e9479..d6a17a9 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -59,10 +59,6 @@ struct netdev_dev_vport {
     uint8_t etheraddr[ETH_ADDR_LEN];
 };
 
-struct netdev_vport {
-    struct netdev netdev;
-};
-
 struct vport_class {
     enum ovs_vport_type type;
     struct netdev_class netdev_class;
@@ -108,14 +104,6 @@ netdev_vport_get_dev(const struct netdev *netdev)
     return netdev_dev_vport_cast(netdev_get_dev(netdev));
 }
 
-static struct netdev_vport *
-netdev_vport_cast(const struct netdev *netdev)
-{
-    struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
-    assert(is_vport_class(netdev_dev_get_class(netdev_dev)));
-    return CONTAINER_OF(netdev, struct netdev_vport, netdev);
-}
-
 /* If 'netdev' is a vport netdev, returns an ofpbuf that contains Netlink
  * options to include in OVS_VPORT_ATTR_OPTIONS for configuring that vport.
  * Otherwise returns NULL. */
@@ -227,21 +215,16 @@ netdev_vport_destroy(struct netdev_dev *netdev_dev_)
 }
 
 static int
-netdev_vport_open(struct netdev_dev *netdev_dev_, struct netdev **netdevp)
+netdev_vport_open(struct netdev_dev *netdev_dev, struct netdev **netdevp)
 {
-    struct netdev_vport *netdev;
-
-    netdev = xmalloc(sizeof *netdev);
-    netdev_init(&netdev->netdev, netdev_dev_);
-
-    *netdevp = &netdev->netdev;
+    *netdevp = xmalloc(sizeof **netdevp);
+    netdev_init(*netdevp, netdev_dev);
     return 0;
 }
 
 static void
-netdev_vport_close(struct netdev *netdev_)
+netdev_vport_close(struct netdev *netdev)
 {
-    struct netdev_vport *netdev = netdev_vport_cast(netdev_);
     free(netdev);
 }
 
-- 
1.7.9.5




More information about the dev mailing list