X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev-provider.h;h=1eb1b1e4cacced4d2b4180bbd90967196cdcba0d;hb=76f105d9be03588c2d5ec0b94ff769a1d269f2e4;hp=a6c0fd894c88526eda7f7978bfd2e2d498751f99;hpb=0f4f4a610a24098a98de64bccaeb29ba5621e01d;p=openvswitch diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index a6c0fd89..1eb1b1e4 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -25,6 +25,10 @@ #include "list.h" #include "shash.h" +#ifdef __cplusplus +extern "C" { +#endif + struct arg { char *key; char *value; @@ -36,7 +40,8 @@ struct arg { * 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. */ struct arg *args; /* Argument list from last config. */ @@ -53,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. @@ -75,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. @@ -107,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 @@ -358,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 */