[v2,6/7] vhost: replace open coded TAILQ_FOREACH_SAFE

Message ID 20250214172134.73908-7-stephen@networkplumber.org (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series Introduce FOREACH_SAFE macros |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 14, 2025, 5:20 p.m. UTC
Proper macro is now in EAL rte_queue.h use it instead.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/vhost/socket.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
  

Patch

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 4c6c551c3d..dc9c9da9d1 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -10,10 +10,10 @@ 
 #include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <sys/queue.h>
 #include <errno.h>
 #include <fcntl.h>
 
+#include <rte_queue.h>
 #include <rte_thread.h>
 #include <rte_log.h>
 
@@ -456,14 +456,7 @@  vhost_user_client_reconnect(void *arg __rte_unused)
 	while (1) {
 		pthread_mutex_lock(&reconn_list.mutex);
 
-		/*
-		 * An equal implementation of TAILQ_FOREACH_SAFE,
-		 * which does not exist on all platforms.
-		 */
-		for (reconn = TAILQ_FIRST(&reconn_list.head);
-		     reconn != NULL; reconn = next) {
-			next = TAILQ_NEXT(reconn, next);
-
+		TAILQ_FOREACH_SAFE(reconn, &reconn_list.head, next, next) {
 			ret = vhost_user_connect_nonblock(reconn->vsocket->path, reconn->fd,
 						(struct sockaddr *)&reconn->un,
 						sizeof(reconn->un));