vnet: make VNET_FOREACH() always be a loop

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).

Reviewed by:	karels, melifaro, glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35739
This commit is contained in:
Kristof Provost 2022-07-06 11:13:52 +02:00
parent a526ec4351
commit 37f604b49d

View File

@ -414,7 +414,7 @@ do { \
#define VNET_LIST_RUNLOCK()
#define VNET_LIST_RUNLOCK_NOSLEEP()
#define VNET_ITERATOR_DECL(arg)
#define VNET_FOREACH(arg)
#define VNET_FOREACH(arg) for (int _vn = 0; _vn == 0; _vn++)
#define IS_DEFAULT_VNET(arg) 1
#define CRED_TO_VNET(cr) NULL