Skip to content

Commit 969a19f

Browse files
robertpjdaytorvalds
authored andcommitted
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>
1 parent ae50884 commit 969a19f

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

include/linux/byteorder/Kbuild

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
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
53
unifdef-y += swab.h

include/linux/byteorder/big_endian.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101101
#define __cpu_to_be16s(x) do {} while (0)
102102
#define __be16_to_cpus(x) do {} while (0)
103103

104+
#ifdef __KERNEL__
104105
#include <linux/byteorder/generic.h>
106+
#endif
105107

106108
#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */

include/linux/byteorder/generic.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@
8282
*
8383
*/
8484

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-
*/
9185
#define cpu_to_le64 __cpu_to_le64
9286
#define le64_to_cpu __le64_to_cpu
9387
#define cpu_to_le32 __cpu_to_le32
@@ -176,6 +170,4 @@ static inline void be64_add_cpu(__be64 *var, u64 val)
176170
*var = cpu_to_be64(be64_to_cpu(*var) + val);
177171
}
178172

179-
#endif /* KERNEL */
180-
181173
#endif /* _LINUX_BYTEORDER_GENERIC_H */

include/linux/byteorder/little_endian.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ static inline __u16 __be16_to_cpup(const __be16 *p)
101101
#define __cpu_to_be16s(x) __swab16s((x))
102102
#define __be16_to_cpus(x) __swab16s((x))
103103

104+
#ifdef __KERNEL__
104105
#include <linux/byteorder/generic.h>
106+
#endif
105107

106108
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */

0 commit comments

Comments
 (0)