Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F161387471
D49608.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49608.id.diff
View Options
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -355,11 +355,6 @@
"first field address", (head), (head)->stqh_last); \
} while (0)
-#define STAILQ_ASSERT_EMPTY(head) do { \
- if (!STAILQ_EMPTY((head))) \
- panic("stailq %p is not empty", (head)); \
-} while (0)
-
/*
* QMD_STAILQ_CHECK_TAIL(STAILQ_HEAD *head)
*
@@ -370,11 +365,23 @@
panic("Stailq %p last element's next pointer is %p, " \
"not NULL", (head), *(head)->stqh_last); \
} while (0)
+
+#define STAILQ_ASSERT_EMPTY(head) do { \
+ if (!STAILQ_EMPTY((head))) \
+ panic("stailq %p is not empty", (head)); \
+} while (0)
+
+#define STAILQ_ASSERT_NONEMPTY(head) do { \
+ if (STAILQ_EMPTY((head))) \
+ panic("stailq %p is empty", (head)); \
+} while (0)
+
#else
#define QMD_STAILQ_CHECK_EMPTY(head)
-#define STAILQ_ASSERT_EMPTY(head)
#define QMD_STAILQ_CHECK_TAIL(head)
-#endif /* (_KERNEL && INVARIANTS) */
+#define STAILQ_ASSERT_EMPTY(head)
+#define STAILQ_ASSERT_NONEMPTY(head)
+#endif /* _KERNEL && INVARIANTS */
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
@@ -472,6 +479,20 @@
(head)->stqh_last = &STAILQ_FIRST((head)); \
} while (0)
+#define STAILQ_SPLIT_AFTER(head, elm, rest, field) do { \
+ STAILQ_ASSERT_NONEMPTY((head)); \
+ QMD_STAILQ_CHECK_TAIL((head)); \
+ if (STAILQ_NEXT((elm), field) == NULL) \
+ /* 'elm' is the last element in 'head'. */ \
+ STAILQ_INIT((rest)); \
+ else { \
+ STAILQ_FIRST((rest)) = STAILQ_NEXT((elm), field); \
+ (rest)->stqh_last = (head)->stqh_last; \
+ STAILQ_NEXT((elm), field) = NULL; \
+ (head)->stqh_last = &STAILQ_NEXT((elm), field); \
+ } \
+} while (0)
+
#define STAILQ_SWAP(head1, head2, type) do { \
QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 4, 8:12 AM (11 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34660668
Default Alt Text
D49608.id.diff (1 KB)
Attached To
Mode
D49608: queue: Add STAILQ_SPLIT_AFTER() and STAILQ_ASSERT_NONEMPTY()
Attached
Detach File
Event Timeline
Log In to Comment