Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Drop the exporting of empty <linux/byteorder/generic.h>

Fix up the contents of <linux/byteorder/> so that it doesn't export a
content-free generic.h to user space. This involves:

* Removing the __KERNEL__ tests from generic.h and dropping it from
Kbuild.
* Wrapping the inclusions of generic.h in both big_endian.h and
little_endian.h in __KERNEL__ tests.
* Shifting big_endian.h and little_endian.h from header-y to
unifdef-y in Kbuild.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Robert P. J. Day and committed by
Linus Torvalds
969a19f1 ae50884f

+6 -12
+2 -4
include/linux/byteorder/Kbuild
··· 1 - header-y += big_endian.h 2 - header-y += little_endian.h 3 - 4 - unifdef-y += generic.h 1 + unifdef-y += big_endian.h 2 + unifdef-y += little_endian.h 5 3 unifdef-y += swab.h
+2
include/linux/byteorder/big_endian.h
··· 101 101 #define __cpu_to_be16s(x) do {} while (0) 102 102 #define __be16_to_cpus(x) do {} while (0) 103 103 104 + #ifdef __KERNEL__ 104 105 #include <linux/byteorder/generic.h> 106 + #endif 105 107 106 108 #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
-8
include/linux/byteorder/generic.h
··· 82 82 * 83 83 */ 84 84 85 - 86 - #if defined(__KERNEL__) 87 - /* 88 - * inside the kernel, we can use nicknames; 89 - * outside of it, we must avoid POSIX namespace pollution... 90 - */ 91 85 #define cpu_to_le64 __cpu_to_le64 92 86 #define le64_to_cpu __le64_to_cpu 93 87 #define cpu_to_le32 __cpu_to_le32 ··· 169 175 { 170 176 *var = cpu_to_be64(be64_to_cpu(*var) + val); 171 177 } 172 - 173 - #endif /* KERNEL */ 174 178 175 179 #endif /* _LINUX_BYTEORDER_GENERIC_H */
+2
include/linux/byteorder/little_endian.h
··· 101 101 #define __cpu_to_be16s(x) __swab16s((x)) 102 102 #define __be16_to_cpus(x) __swab16s((x)) 103 103 104 + #ifdef __KERNEL__ 104 105 #include <linux/byteorder/generic.h> 106 + #endif 105 107 106 108 #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */