aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-06-12 20:21:12 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-06-20 10:35:51 +0000
commitaf187b20cdb00b89a39dfea1a8eef41ce5c134aa (patch)
tree5d5bc15806a7eacae3a00588378a819e1b3a55de
parent50aa145171bc88edde8cf3b7eb13dbbf88a3f8a7 (diff)
linuxkpi: Define `COUNT_ARGS()` and `CONCATENATE()`
`COUNT_ARGS()` counts the number of arguments it is passed. The implementation is heavily inspired from the one of `CTR()`. `CONCATENATE()` is an alias for `__CONCAT()`. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57584
-rw-r--r--sys/compat/linuxkpi/common/include/linux/args.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/args.h b/sys/compat/linuxkpi/common/include/linux/args.h
new file mode 100644
index 000000000000..74c9e43345db
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/args.h
@@ -0,0 +1,17 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ */
+
+#ifndef _LINUXKPI_LINUX_ARGS_H_
+#define _LINUXKPI_LINUX_ARGS_H_
+
+#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, __count, ...) \
+ __count
+#define COUNT_ARGS(X...) \
+ __COUNT_ARGS(, ##X, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+
+#define CONCATENATE(a, b) __CONCAT(a, b)
+
+#endif /* _LINUXKPI_LINUX_ARGS_H_ */