Module Name: src
Committed By: riastradh
Date: Sun Dec 19 11:32:09 UTC 2021
Modified Files:
src/sys/external/bsd/common/include/linux: list.h
Log Message:
Provide list_for_each_entry_safe_reverse and reorder for consistency
Author: Maya Rashish <[email protected]>
Committer: Taylor R Campbell <[email protected]>
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/common/include/linux/list.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/common/include/linux/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.27 src/sys/external/bsd/common/include/linux/list.h:1.28
--- src/sys/external/bsd/common/include/linux/list.h:1.27 Sun Dec 19 10:51:09 2021
+++ src/sys/external/bsd/common/include/linux/list.h Sun Dec 19 11:32:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: list.h,v 1.27 2021/12/19 10:51:09 riastradh Exp $ */
+/* $NetBSD: list.h,v 1.28 2021/12/19 11:32:08 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -279,12 +279,6 @@ list_del_init(struct list_head *node)
(VAR) = list_entry(list_next(&(VAR)->FIELD), typeof(*(VAR)), \
FIELD))
-#define list_for_each_entry_reverse(VAR, HEAD, FIELD) \
- for ((VAR) = list_entry(list_last((HEAD)), typeof(*(VAR)), FIELD); \
- &(VAR)->FIELD != (HEAD); \
- (VAR) = list_entry(list_prev(&(VAR)->FIELD), typeof(*(VAR)), \
- FIELD))
-
#define list_for_each_entry_safe(VAR, NEXT, HEAD, FIELD) \
for ((VAR) = list_entry(list_first((HEAD)), typeof(*(VAR)), FIELD); \
(&(VAR)->FIELD != (HEAD)) && \
@@ -292,6 +286,19 @@ list_del_init(struct list_head *node)
typeof(*(VAR)), FIELD), 1); \
(VAR) = (NEXT))
+#define list_for_each_entry_safe_reverse(VAR, NEXT, HEAD, FIELD) \
+ for ((VAR) = list_entry(list_last((HEAD)), typeof(*(VAR)), FIELD); \
+ (&(VAR)->FIELD != (HEAD)) && \
+ ((NEXT) = list_entry(list_prev(&(VAR)->FIELD), \
+ typeof(*(VAR)), FIELD), 1); \
+ (VAR) = (NEXT))
+
+#define list_for_each_entry_reverse(VAR, HEAD, FIELD) \
+ for ((VAR) = list_entry(list_last((HEAD)), typeof(*(VAR)), FIELD); \
+ &(VAR)->FIELD != (HEAD); \
+ (VAR) = list_entry(list_prev(&(VAR)->FIELD), typeof(*(VAR)), \
+ FIELD))
+
#define list_for_each_entry_continue(VAR, HEAD, FIELD) \
for ((VAR) = list_next_entry((VAR), FIELD); \
&(VAR)->FIELD != (HEAD); \