X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev-provider.h;h=1eb1b1e4cacced4d2b4180bbd90967196cdcba0d;hb=3cfafd474026fd751765300fa462da2358379297;hp=b009c8dc7ae17c8f97244a7a01d9f372cc65e92c;hpb=46415c9085ef6b7386943b1714754150487b6cff;p=openvswitch diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index b009c8dc..1eb1b1e4 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -25,16 +25,27 @@ #include "list.h" #include "shash.h" +#ifdef __cplusplus +extern "C" { +#endif + +struct arg { + char *key; + char *value; +}; + /* A network device (e.g. an Ethernet device). * * This structure should be treated as opaque by network device * implementations. */ struct netdev_dev { char *name; /* Name of network device. */ - const struct netdev_class *class; /* Functions to control this device. */ + const struct netdev_class *netdev_class; /* Functions to control + this device. */ int ref_cnt; /* Times this devices was opened. */ struct shash_node *node; /* Pointer to element in global map. */ - uint32_t args_hash; /* Hash of arguments for the device. */ + struct arg *args; /* Argument list from last config. */ + int n_args; /* Number of arguments in 'args'. */ }; void netdev_dev_init(struct netdev_dev *, const char *name, @@ -47,9 +58,9 @@ void netdev_dev_get_devices(const struct netdev_class *, struct shash *device_list); static inline void netdev_dev_assert_class(const struct netdev_dev *netdev_dev, - const struct netdev_class *class) + const struct netdev_class *class_) { - assert(netdev_dev->class == class); + assert(netdev_dev->netdev_class == class_); } /* A instance of an open network device. @@ -69,9 +80,9 @@ void netdev_uninit(struct netdev *, bool close); struct netdev_dev *netdev_get_dev(const struct netdev *); static inline void netdev_assert_class(const struct netdev *netdev, - const struct netdev_class *class) + const struct netdev_class *netdev_class) { - netdev_dev_assert_class(netdev_get_dev(netdev), class); + netdev_dev_assert_class(netdev_get_dev(netdev), netdev_class); } /* A network device notifier. @@ -101,12 +112,12 @@ struct netdev_class { * the system. */ const char *type; - /* Called only once, at program startup. Returning an error from this - * function will prevent any network device in this class from being - * opened. + /* Called when the netdev provider is registered, typically at program + * startup. Returning an error from this function will prevent any network + * device in this class from being opened. * * This function may be set to null if a network device class needs no - * initialization at program startup. */ + * initialization at registration time. */ int (*init)(void); /* Performs periodic work needed by netdevs of this class. May be null if @@ -352,4 +363,8 @@ extern const struct netdev_class netdev_linux_class; extern const struct netdev_class netdev_tap_class; extern const struct netdev_class netdev_gre_class; +#ifdef __cplusplus +} +#endif + #endif /* netdev.h */