Skip to contentSkip to conversation

f2fs-tools: add big-endian fixes/patches from upstream

PATCH New Gustavo Zacarias 2 participants 2 messages Dec 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: add big-endian fixes/patches from upstream

Fixes:
http://autobuild.buildroot.net/results/8f9/8f97186489134619de7086028a59523d528b0d51/

---
 ...tools-fix-for-build-big-endian-processors.patch | 95 ++++++++++++++++++++++
 ...sible-endianes-bug-in-mkfs.f2fs-roll-forw.patch | 81 ++++++++++++++++++
 2 files changed, 176 insertions(+)
 create mode 100644 package/f2fs-tools/0001-f2fs-tools-fix-for-build-big-endian-processors.patch
 create mode 100644 package/f2fs-tools/0002-mkfs.f2fs-possible-endianes-bug-in-mkfs.f2fs-roll-forw.patch
package/f2fs-tools/0001-f2fs-tools-fix-for-build-big-endian-processors.patch new file +95 -0
new file mode 100644
index 0000000..e0c9233
@@ -0,0 +1,95 @@
+From f3a1ea9c7af493b873641fa4263e1b2101fc277b Mon Sep 17 00:00:00 2001
+From: Jaegeuk Kim <[email protected]>
+Date: Mon, 22 Sep 2014 22:22:33 -0700
+Subject: [PATCH] f2fs-tools: fix for build big-endian processors
+
+This patch fixes build failure on big-endian systems.
+
+Reported-and-Tested-by: Jan Engelhardt <[email protected]>
+Signed-off-by: Jaegeuk Kim <[email protected]>
+Signed-off-by: Gustavo Zacarias <[email protected]>
+---
+ include/f2fs_fs.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 60 insertions(+)
+
+diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
+index 6367e05..df37cdf 100644
+--- a/include/f2fs_fs.h
++++ b/include/f2fs_fs.h
+@@ -5,6 +5,9 @@
+  *             http://www.samsung.com/
+  *
+  * Dual licensed under the GPL or LGPL version 2 licenses.
++ *
++ * The byteswap codes are copied from:
++ *   samba_3_master/lib/ccan/endian/endian.h under LGPL 2.1
+  */
+ #ifndef __F2FS_FS_H__
+ #define __F2FS_FS_H__
+@@ -26,6 +29,63 @@ typedef u32		nid_t;
+ typedef u8		bool;
+ typedef unsigned long	pgoff_t;
+ 
++#if HAVE_BYTESWAP_H
++#include <byteswap.h>
++#else
++/**
++ * bswap_16 - reverse bytes in a uint16_t value.
++ * @val: value whose bytes to swap.
++ *
++ * Example:
++ *	// Output contains "1024 is 4 as two bytes reversed"
++ *	printf("1024 is %u as two bytes reversed\n", bswap_16(1024));
++ */
++static inline uint16_t bswap_16(uint16_t val)
++{
++	return ((val & (uint16_t)0x00ffU) << 8)
++		| ((val & (uint16_t)0xff00U) >> 8);
++}
++
++/**
++ * bswap_32 - reverse bytes in a uint32_t value.
++ * @val: value whose bytes to swap.
++ *
++ * Example:
++ *	// Output contains "1024 is 262144 as four bytes reversed"
++ *	printf("1024 is %u as four bytes reversed\n", bswap_32(1024));
++ */
++static inline uint32_t bswap_32(uint32_t val)
++{
++	return ((val & (uint32_t)0x000000ffUL) << 24)
++		| ((val & (uint32_t)0x0000ff00UL) <<  8)
++		| ((val & (uint32_t)0x00ff0000UL) >>  8)
++		| ((val & (uint32_t)0xff000000UL) >> 24);
++}
++#endif /* !HAVE_BYTESWAP_H */
++
++#if !HAVE_BSWAP_64
++/**
++ * bswap_64 - reverse bytes in a uint64_t value.
++ * @val: value whose bytes to swap.
++ *
++ * Example:
++ *	// Output contains "1024 is 1125899906842624 as eight bytes reversed"
++ *	printf("1024 is %llu as eight bytes reversed\n",
++ *		(unsigned long long)bswap_64(1024));
++ */
++static inline uint64_t bswap_64(uint64_t val)
++{
++	return ((val & (uint64_t)0x00000000000000ffULL) << 56)
++		| ((val & (uint64_t)0x000000000000ff00ULL) << 40)
++		| ((val & (uint64_t)0x0000000000ff0000ULL) << 24)
++		| ((val & (uint64_t)0x00000000ff000000ULL) <<  8)
++		| ((val & (uint64_t)0x000000ff00000000ULL) >>  8)
++		| ((val & (uint64_t)0x0000ff0000000000ULL) >> 24)
++		| ((val & (uint64_t)0x00ff000000000000ULL) >> 40)
++		| ((val & (uint64_t)0xff00000000000000ULL) >> 56);
++}
++#endif
++
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define le16_to_cpu(x)	((__u16)(x))
+ #define le32_to_cpu(x)	((__u32)(x))
+-- 
+2.0.4
+
package/f2fs-tools/0002-mkfs.f2fs-possible-endianes-bug-in-mkfs.f2fs-roll-forw.patch new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/1 f2fs-tools: add big-endian fixes/patches from upstream

Dear Gustavo Zacarias,

Quoted 10 lines · Gustavo Zacarias

Fixes:
http://autobuild.buildroot.net/results/8f9/8f97186489134619de7086028a59523d528b0d51/

---
 ...tools-fix-for-build-big-endian-processors.patch | 95 ++++++++++++++++++++++
 ...sible-endianes-bug-in-mkfs.f2fs-roll-forw.patch | 81 ++++++++++++++++++
 2 files changed, 176 insertions(+)
 create mode 100644 package/f2fs-tools/0001-f2fs-tools-fix-for-build-big-endian-processors.patch
 create mode 100644 package/f2fs-tools/0002-mkfs.f2fs-possible-endianes-bug-in-mkfs.f2fs-roll-forw.patch

Applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com