-/* Undoes the results of initialization.
- *
- * Normally this function only needs to be called from netdev_close().
- * However, it may be called by providers due to an error on opening
- * that occurs after initialization. It this case netdev_close() would
- * never be called. */
-void
-netdev_uninit(struct netdev *netdev, bool close)
-{
- /* Restore flags that we changed, if any. */
- int error = restore_flags(netdev);
- list_remove(&netdev->node);
- if (error) {
- VLOG_WARN("failed to restore network device flags on %s: %s",
- netdev_get_name(netdev), strerror(error));
- }
-
- if (close) {
- netdev_get_dev(netdev)->netdev_class->close(netdev);
- }
-}
-
-
-/* Returns the class type of 'netdev'.
- *
- * The caller must not free the returned value. */
-const char *
-netdev_get_type(const struct netdev *netdev)
-{
- return netdev_get_dev(netdev)->netdev_class->type;
-}
-
-struct netdev_dev *
-netdev_get_dev(const struct netdev *netdev)
-{
- return netdev->netdev_dev;
-}
-\f
-/* Restore the network device flags on 'netdev' to those that were active
- * before we changed them. Returns 0 if successful, otherwise a positive
- * errno value.
- *
- * To avoid reentry, the caller must ensure that fatal signals are blocked. */
-static int
-restore_flags(struct netdev *netdev)
-{
- if (netdev->changed_flags) {
- enum netdev_flags restore = netdev->save_flags & netdev->changed_flags;
- enum netdev_flags old_flags;
- return netdev_get_dev(netdev)->netdev_class->update_flags(netdev,
- netdev->changed_flags & ~restore,
- restore, &old_flags);