[ovs-dev] [PATCH 10/10] netdev: Rename get_drv_info() to get_status().

Jesse Gross jesse at nicira.com
Sat Dec 22 00:34:01 UTC 2012


On Wed, Dec 19, 2012 at 10:11 PM, Ethan Jackson <ethan at nicira.com> wrote:
> diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
> index 94f60af..7f481c5 100644
> --- a/lib/netdev-provider.h
> +++ b/lib/netdev-provider.h
> @@ -547,15 +547,15 @@ struct netdev_class {
>      /* Retrieves driver information of the device.
>       *
>       * Populates 'sh' with key-value pairs representing the status of the

I think 'sh' should now be 'smap'.

> -     * device.  Driver info is a set of key-value string pairs
> -     * representing netdev type specific information.  For more information see
> +     * device.  'smap'is a set of key-value string pairs representing netdev

You're missing a space between 'smap' and is.

> +     * type specific information.  For more information see
>       * ovs-vswitchd.conf.db(5).
>       *
>       * The caller is responsible for destroying 'smap' and its data.
>       *
>       * This function may be set to null if it would always return EOPNOTSUPP
>       * anyhow. */
> -    int (*get_drv_info)(const struct netdev *netdev, struct smap *smap);
> +    int (*get_status)(const struct netdev *netdev, struct smap *smap);

This updates netdev-vport.c but should we also change the name in
netdev-linux.c to match?

> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index a527f91..fc7f8c0 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
>  static int
> -netdev_vport_get_drv_info(const struct netdev *netdev, struct smap *smap)
> +tunnel_get_status(const struct netdev *netdev, struct smap *smap)
>  {
> -    const char *iface = netdev_vport_get_tnl_iface(netdev);
> +    struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
> +    struct netdev_dev_vport *ndv;
> +    static char iface[IFNAMSIZ];
> +    ovs_be32 route;
>
> -    if (iface) {
> +    ndv = netdev_dev_vport_cast(netdev_get_dev(netdev));
> +    if (tnl_port_config_from_nlattr(ndv->options->data,
> +                                    ndv->options->size, a)) {

This isn't a new problem but I'm not sure that this operation is safe
if you run this immediately after creating a port because options is
NULL.  We probably either need to fetch the options (which is what we
do for unparse) or handle NULL as an empty set better.



More information about the dev mailing list