Page MenuHomeFreeBSD

vnet: make VNET_FOREACH() always be a loop
ClosedPublic

Authored by kp on Jul 6 2022, 8:21 PM.
Tags
None
Referenced Files
F154431513: D35739.id107863.diff
Tue, Apr 28, 12:32 PM
F154418126: D35739.id107877.diff
Tue, Apr 28, 10:28 AM
Unknown Object (File)
Mon, Apr 27, 11:44 AM
Unknown Object (File)
Mon, Apr 27, 2:37 AM
Unknown Object (File)
Sun, Apr 26, 3:32 PM
Unknown Object (File)
Sun, Apr 26, 1:26 PM
Unknown Object (File)
Sat, Apr 25, 9:42 AM
Unknown Object (File)
Thu, Apr 23, 4:14 AM

Details

Summary

VNET_FOREACH() is a LIST_FOREACH if VIMAGE is set, but empty if it's
not. This means that users of the macro couldn't use 'continue' or
'break' as one would expect of a loop.

Change VNET_FOREACH() to be a loop in all cases (although one that is
fixed to one iteration if VIMAGE is not set).

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46301
Build 43190: arc lint + arc unit

Event Timeline

kp requested review of this revision.Jul 6 2022, 8:21 PM

I wonder if compiler removes the loop and produces same code after the change.

This revision is now accepted and ready to land.Jul 6 2022, 8:28 PM

I wonder if compiler removes the loop and produces same code after the change.

It does, yes, so this is a no-op, other than making the loop work the way a reader would expect it to, regardless of VIMAGE or ! VIMAGE.

This revision was automatically updated to reflect the committed changes.