[ovs-dev] [PATCH 14/16] netdev: Allow get_ifindex and get_features to be null.

Ben Pfaff blp at nicira.com
Wed Apr 14 18:17:59 UTC 2010


On Tue, Apr 13, 2010 at 10:41:16AM -0400, Jesse Gross wrote:
> Allow netdev providers to set get_ifindex and get_features it
> null if they would always return EOPNOTSUPP.  This is particuarly
> useful for virtual devices.

Looks fine, but the formatting here looks extra awkward to me:

> @@ -661,8 +675,9 @@ netdev_get_features(struct netdev *netdev,
>          peer = &dummy[3];
>      }
>  
> -    error = netdev_get_dev(netdev)->netdev_class->get_features(netdev, current,
> -            advertised, supported, peer);
> +    get_features = netdev_get_dev(netdev)->netdev_class->get_features;
> +    error = get_features ?get_features(netdev, current, advertised, supported,
> +                                       peer) : EOPNOTSUPP;

The style I've been following when a ?: does not fit comfortably on one
line looks like this:

    error = (get_features
             ? get_features(netdev, current, advertised, supported, peer)
             : EOPNOTSUPP);





More information about the dev mailing list