Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jul 2022 08:44:55 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 37f604b49d4a - main - vnet: make VNET_FOREACH() always be a loop
Message-ID:  <202207070844.2678it6b058690@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=37f604b49d4aa1d27ad8d034ec33007bc8013671

commit 37f604b49d4aa1d27ad8d034ec33007bc8013671
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-07-06 09:13:52 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-07-07 07:52:21 +0000

    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
---
 sys/net/vnet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/vnet.h b/sys/net/vnet.h
index 48c2536be8b4..afb6857bbccc 100644
--- a/sys/net/vnet.h
+++ b/sys/net/vnet.h
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207070844.2678it6b058690>