I suspect that this makes it easier to make sure that a netdev stays open
as long as needed in some cases where a module needs access to a netdev
opened by some higher-level module.
CC: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
return 0;
}
+/* Returns a reference to 'netdev_' for the caller to own. */
+struct netdev *
+netdev_ref(const struct netdev *netdev_)
+{
+ struct netdev *netdev = CONST_CAST(struct netdev *, netdev_);
+
+ ovs_assert(netdev->ref_cnt > 0);
+ netdev->ref_cnt++;
+ return netdev;
+}
+
/* Reconfigures the device 'netdev' with 'args'. 'args' may be empty
* or NULL if none are needed. */
int
/* Open and close. */
int netdev_open(const char *name, const char *type, struct netdev **);
+struct netdev *netdev_ref(const struct netdev *);
void netdev_close(struct netdev *);
void netdev_parse_name(const char *netdev_name, char **name, char **type);