HomeFreeBSD

ifnet/API: Change if_set*bit accessors to clear first

Description

ifnet/API: Change if_set*bit accessors to clear first

Summary:
A common pattern has been to:

if (foo)

		caps = IFCAP_FOO;

ifp->if_capenable &= ~IFCAP_FOO;
ifp->if_capenable |= caps;

which in the new order of things would be:

if (foo)

		caps = IF_FOO;

if_setcapenablebits(ifp, 0, IFCAP_FOO);
if_setcapenablebits(ifp, caps, 0);

This change streamlines this into:

if (foo)

		caps = IF_FOO;

if_setcapenablebits(ifp, caps, IFCAP_FOO);

Reviewed by: melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37993

Details

Provenance
jhibbitsAuthored on Jan 9 2023, 7:24 PM
Reviewer
melifaro
Differential Revision
D37993: ifnet/API: Change if_set*bit accessors to clear first
Parents
rG3b073d2ee50c: tools/build: Always bootstrap (sys/)bitstring.h
Branches
Unknown
Tags
Unknown