aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/netgraph/util.c
diff options
context:
space:
mode:
authorLutz Donnerhacke <donner@FreeBSD.org>2021-06-08 19:45:20 +0000
committerLutz Donnerhacke <donner@FreeBSD.org>2021-06-09 11:32:22 +0000
commit5554abd9cc9702af30af90925b33c5efff4e7d88 (patch)
tree6f0eb92004fc1ca74729f8a736c761e366e3bb2a /tests/sys/netgraph/util.c
parenta664ade93972ce617f0888ff79e715dff9cf0f87 (diff)
downloadsrc-5554abd9cc9702af30af90925b33c5efff4e7d88.tar.gz
src-5554abd9cc9702af30af90925b33c5efff4e7d88.zip
tests/netgraph: Factor out univeral data counter functions
Factor out the data counter helpers for other tests to use. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30699
Diffstat (limited to 'tests/sys/netgraph/util.c')
-rw-r--r--tests/sys/netgraph/util.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/sys/netgraph/util.c b/tests/sys/netgraph/util.c
index 307bacfa8cc6..b25e63dfa76d 100644
--- a/tests/sys/netgraph/util.c
+++ b/tests/sys/netgraph/util.c
@@ -255,3 +255,23 @@ _ng_init(char const *file, size_t line)
CHECK(, 0 == NgMkSockNode(NULL, &cs, &ds));
NgSetDebug(3);
}
+
+#define GD(x) void \
+get_data##x(void *data, size_t len, void *ctx) {\
+ int *cnt = ctx; \
+ \
+ (void)data; \
+ (void)len; \
+ cnt[x]++; \
+}
+
+GD(0)
+GD(1)
+GD(2)
+GD(3)
+GD(4)
+GD(5)
+GD(6)
+GD(7)
+GD(8)
+GD(9)