summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-11-21 00:32:47 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-11-21 00:32:47 +0000
commit9f7e052a7fca5c9ece1df332904e2e3695a0d889 (patch)
tree7183d3d5f6241132c63da183735ebf481d208620 /sys
parent0fa2d7a2b33773a35ccd3372f54eb80dba5a30b2 (diff)
provide MBUF_LIST_FIRST and MBUF_LIST_NEXT for iterating over an mbuf_list.
MBUF_LIST_FOREACH is then rewritten on top of those. this makes it easier to get at the head of a list too, which may make the hfsc ifq backend nicer. based on a discussion with kenjiro cho ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/mbuf.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 81bcdddacc5..2d1f5271d8f 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.203 2015/11/20 03:35:23 dlg Exp $ */
+/* $OpenBSD: mbuf.h,v 1.204 2015/11/21 00:32:46 dlg Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -504,8 +504,13 @@ unsigned int ml_purge(struct mbuf_list *);
#define ml_len(_ml) ((_ml)->ml_len)
#define ml_empty(_ml) ((_ml)->ml_len == 0)
-#define MBUF_LIST_FOREACH(_ml, _m) \
- for ((_m) = (_ml)->ml_head; (_m) != NULL; (_m) = (_m)->m_nextpkt)
+#define MBUF_LIST_FIRST(_ml) ((_ml)->ml_head)
+#define MBUF_LIST_NEXT(_m) ((_m)->m_nextpkt)
+
+#define MBUF_LIST_FOREACH(_ml, _m) \
+ for ((_m) = MBUF_LIST_FIRST(_ml); \
+ (_m) != NULL; \
+ (_m) = MBUF_LIST_NEXT(_m))
/*
* mbuf queues