[PATCH] reiserfsprogs: remove dependency on asm/unaligned.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 We probably shouldn't have ever been including asm/unaligned.h, though I
 think I'm the one who might've added it there in the first place.

 This patch borrows the unaligned accessor functions from the 3.6.20 code.

Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
---
 include/reiserfs_fs.h |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

--- a/include/reiserfs_fs.h	2008-01-25 10:49:50.000000000 -0500
+++ b/include/reiserfs_fs.h	2008-01-25 10:54:05.000000000 -0500
@@ -38,14 +38,22 @@
 # define extern_inline
 #endif
 
-#include <asm/unaligned.h>
-
 #ifndef get_unaligned
-#if defined(__ppc__) || defined(ppc) || defined(__ppc) || \
-    defined(__PPC) || defined(powerpc) || defined(__powerpc__)
-#	define get_unaligned(ptr)	(*(ptr))
-#	define put_unaligned(val,ptr)	((void)(*(ptr) = (val)))
+#define get_unaligned(ptr)				\
+({							\
+        __typeof__(*(ptr)) __tmp;			\
+        memcpy(&__tmp, (ptr), sizeof(*(ptr)));		\
+        __tmp;						\
+})
 #endif
+
+#ifndef put_unaligned
+#define put_unaligned(val, ptr)				\
+({							\
+        __typeof__(*(ptr)) __tmp = (val);		\
+        memcpy((ptr), &__tmp, sizeof(*(ptr)));		\
+        (void)0;					\
+})
 #endif
 
 #define get_leXX(xx,p,field)	(le##xx##_to_cpu ((p)->field))

-- 
Jeff Mahoney
SUSE Labs

-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux