Why get/put_unaligned are hidden behind #ifdef __KERNEL__ on PowerPCand Microblaze?

From: Igor Zhbanov
Date: Sun Oct 31 2010 - 11:13:39 EST


Hello!

I have found that functions get_unaligned and put_unaligned from unaligned.h
are hidden behind #ifdef __KERNEL__ on PowerPC and Microblaze architectures.
And are not hidden on other platforms. But why?
I think that these functions are very useful in user space.

So here is the patch:

diff -purN -U 5 linux-2.6.36/arch/microblaze/include/asm/unaligned.h
linux/arch/microblaze/include/asm/unaligned.h
--- linux-2.6.36/arch/microblaze/include/asm/unaligned.h 2010-10-21
00:30:22.000000000 +0400
+++ linux/arch/microblaze/include/asm/unaligned.h 2010-10-31
18:05:31.513345000 +0300
@@ -8,16 +8,13 @@
*/

#ifndef _ASM_MICROBLAZE_UNALIGNED_H
#define _ASM_MICROBLAZE_UNALIGNED_H

-# ifdef __KERNEL__
-
# include <linux/unaligned/be_struct.h>
# include <linux/unaligned/le_byteshift.h>
# include <linux/unaligned/generic.h>

# define get_unaligned __get_unaligned_be
# define put_unaligned __put_unaligned_be

-# endif /* __KERNEL__ */
#endif /* _ASM_MICROBLAZE_UNALIGNED_H */
diff -purN -U 5 linux-2.6.36/arch/powerpc/include/asm/unaligned.h
linux/arch/powerpc/include/asm/unaligned.h
--- linux-2.6.36/arch/powerpc/include/asm/unaligned.h 2010-10-21
00:30:22.000000000 +0400
+++ linux/arch/powerpc/include/asm/unaligned.h 2010-10-31
18:05:43.968057400 +0300
@@ -1,16 +1,13 @@
#ifndef _ASM_POWERPC_UNALIGNED_H
#define _ASM_POWERPC_UNALIGNED_H

-#ifdef __KERNEL__
-
/*
* The PowerPC can do unaligned accesses itself in big endian mode.
*/
#include <linux/unaligned/access_ok.h>
#include <linux/unaligned/generic.h>

#define get_unaligned __get_unaligned_be
#define put_unaligned __put_unaligned_be

-#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_UNALIGNED_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/