projects/linux·commit caa28984

linux/types.h: reinstate "__bitwise__" macro for user space use

caa28984 · Linus Torvalds <[email protected]> · 2022-05-25 09:02:19 -07:00

Commit c724c866bb70 ("linux/types.h: remove unnecessary __bitwise__")
was right that there are no users of __bitwise__ in the kernel, but it
turns out there are user space users of it that do expect it.

It is, after all, in the uapi directory, so user space usage is to be
expected.

Instead of reverting the commit completely, let's just clarify the
situation so that it doesn't happen again, and have some in-code
explanations for why that "__bitwise__" still exists.

Reported-by: Jiri Slaby <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Linus Torvalds <[email protected]>
Commit
caa28984163cb63ea0be4cb8dbf05defdc7303f9
Parents
e5499dd7

Changes

1 files changed · +3 −0

FileStatusAddDelContent
include/uapi/linux/types.hmodified+3−0View file

include/uapi/linux/types.h

View file
diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
index c4dc597..308433b 100644
--- a/include/uapi/linux/types.h
+++ b/include/uapi/linux/types.h
@@ -26,6 +26,9 @@
#define __bitwise
#endif
+/* The kernel doesn't use this legacy form, but user space does */
+#define __bitwise__ __bitwise
+
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;