-/* Initializes 'netdev' as a netdev device named 'name' of the specified
- * 'netdev_class'. This function is ordinarily called from a netdev provider's
- * 'create' function.
- *
- * This function adds 'netdev' to a netdev-owned shash, so it is very important
- * that 'netdev' only be freed after calling netdev_uninit(). */
-void
-netdev_init(struct netdev *netdev, const char *name,
- const struct netdev_class *netdev_class)
-{
- ovs_assert(!shash_find(&netdev_shash, name));
-
- memset(netdev, 0, sizeof *netdev);
- netdev->netdev_class = netdev_class;
- netdev->name = xstrdup(name);
- netdev->node = shash_add(&netdev_shash, name, netdev);
- list_init(&netdev->saved_flags_list);
-}
-
-/* Undoes the results of initialization.
- *
- * Normally this function does not need to be called as netdev_close has
- * the same effect when the refcount drops to zero.
- * However, it may be called by providers due to an error on creation
- * that occurs after initialization. It this case netdev_close() would
- * never be called. */
-void
-netdev_uninit(struct netdev *netdev, bool destroy)
-{
- char *name = netdev->name;
-
- ovs_assert(!netdev->ref_cnt);
- ovs_assert(list_is_empty(&netdev->saved_flags_list));
-
- shash_delete(&netdev_shash, netdev->node);
-
- if (destroy) {
- netdev->netdev_class->destroy(netdev);
- }
- free(name);
-}
-