aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-04-22 16:21:40 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-04-22 20:46:58 +0000
commit47e1ca7f3720c76fdc729e03034fa53c798b9318 (patch)
tree64c61e3048be4ef1606b27689bacdfbf006cd479 /sys/compat/linuxkpi
parent43b47418e769df02f43f2b4636dd5c7516fa51f8 (diff)
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bitops.h4
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bits.h14
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 125081ab5b74..0244c7d6f476 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -35,6 +35,8 @@
#include <sys/errno.h>
#include <sys/libkern.h>
+#include <linux/bits.h>
+
#define BIT(nr) (1UL << (nr))
#define BIT_ULL(nr) (1ULL << (nr))
#define BITS_PER_LONG (__SIZEOF_LONG__ * __CHAR_BIT__)
@@ -45,8 +47,6 @@
#define BITS_TO_LONGS(n) howmany((n), BITS_PER_LONG)
#define BIT_MASK(nr) (1UL << ((nr) & (BITS_PER_LONG - 1)))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
-#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
#define BITS_PER_BYTE 8
#define BITS_PER_TYPE(t) (sizeof(t) * BITS_PER_BYTE)
#define BITS_TO_BYTES(n) howmany((n), BITS_PER_BYTE)
diff --git a/sys/compat/linuxkpi/common/include/linux/bits.h b/sys/compat/linuxkpi/common/include/linux/bits.h
new file mode 100644
index 000000000000..53deb7cbbe88
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/bits.h
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2016 Kip Macy
+ * Copyright (c) 2018 Johannes Lundberg
+ */
+
+#ifndef _LINUXKPI_LINUX_BITS_H_
+#define _LINUXKPI_LINUX_BITS_H_
+
+#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
+#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
+
+#endif /* _LINUXKPI_LINUX_BITS_H_ */