[ovs-dev] [netdev 13/27] netdev-linux: Remove pointless layers of indirection for tap devices.

Ben Pfaff blp at nicira.com
Thu Aug 8 05:16:51 UTC 2013


On Wed, Aug 07, 2013 at 03:20:57PM -0700, Andy Zhou wrote:
> Acked-by: Andy Zhou <azhou at nicira.com>

Thanks.

> > -    if (netdev_get_class(netdev_) == &netdev_tap_class) {
> > -        destroy_tap(netdev);
> > +    if (netdev_get_class(netdev_) == &netdev_tap_class
> > +        && netdev->tap_fd >= 0)
> >
> Should we make netdev->tap_fd >= 0 an assert?

It could be an assert, I guess.  This patch is trying to be just a code
cleanup without changing behavior.

> Could zero be a valid tap_fd value?

Theoretically yes.  Most people wouldn't bother to worry about that, but
coreutils does so I've always found it better to write >= 0 rather than
> 0 to test for an invalid fd value.



More information about the dev mailing list