-/* Returns true if 'args' is equivalent to the "args" field in
- * 'netdev_dev', otherwise false. */
-bool
-netdev_dev_args_equal(const struct netdev_dev *netdev_dev,
- const struct shash *args)
-{
- if (netdev_dev->netdev_class->config_equal) {
- return netdev_dev->netdev_class->config_equal(netdev_dev, args);
- } else {
- return smap_equal(&netdev_dev->args, args);
- }
-}
-
-/* Initializes 'netdev' as a instance of the netdev_dev.
- *
- * This function adds 'netdev' to a netdev-owned linked list, so it is very
- * important that 'netdev' only be freed after calling netdev_close(). */
-void
-netdev_init(struct netdev *netdev, struct netdev_dev *netdev_dev)
-{
- memset(netdev, 0, sizeof *netdev);
- netdev->netdev_dev = netdev_dev;
- list_push_back(&netdev_list, &netdev->node);
-}
-
-/* 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);