summaryrefslogtreecommitdiff
path: root/extra/gpart/gpart-0.1h-ntfs.patch
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/gpart/gpart-0.1h-ntfs.patch
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/gpart/gpart-0.1h-ntfs.patch')
-rw-r--r--extra/gpart/gpart-0.1h-ntfs.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/extra/gpart/gpart-0.1h-ntfs.patch b/extra/gpart/gpart-0.1h-ntfs.patch
new file mode 100644
index 000000000..1f887ac47
--- /dev/null
+++ b/extra/gpart/gpart-0.1h-ntfs.patch
@@ -0,0 +1,75 @@
+Ripped out of debian
+
+--- gpart-0.1h.orig/src/gm_ntfs.h
++++ gpart-0.1h/src/gm_ntfs.h
+@@ -14,6 +14,9 @@
+ *
+ */
+
++#include <stdint.h>
++#include <asm/byteorder.h>
++
+ #ifndef _GM_NTFS_H
+ #define _GM_NTFS_H
+
+@@ -29,32 +32,38 @@
+ /* 'NTFS' in little endian */
+ #define NTFS_SUPER_MAGIC 0x5346544E
+
+-#if defined(i386) || defined(__i386__) || defined(__alpha__)
+-
+ /* unsigned integral types */
+ #ifndef NTFS_INTEGRAL_TYPES
+ #define NTFS_INTEGRAL_TYPES
+-typedef unsigned char ntfs_u8;
+-typedef unsigned short ntfs_u16;
+-typedef unsigned int ntfs_u32;
+-typedef s64_t ntfs_u64;
++typedef uint8_t ntfs_u8;
++typedef uint16_t ntfs_u16;
++typedef uint32_t ntfs_u32;
++typedef uint64_t ntfs_u64;
++typedef int8_t ntfs_s8;
++typedef int16_t ntfs_s16;
+ #endif /* NTFS_INTEGRAL_TYPES */
+-#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) */
+-
+-
+-/* Macros reading unsigned integers from a byte pointer */
+-/* these should work for all little endian machines */
+-#define NTFS_GETU8(p) (*(ntfs_u8*)(p))
+-#define NTFS_GETU16(p) (*(ntfs_u16*)(p))
+-#define NTFS_GETU24(p) (NTFS_GETU32(p) & 0xFFFFFF)
+-#define NTFS_GETU32(p) (*(ntfs_u32*)(p))
+-#define NTFS_GETU64(p) (*(ntfs_u64*)(p))
+-
+-/* Macros reading signed integers, returning int */
+-#define NTFS_GETS8(p) ((int)(*(char*)(p)))
+-#define NTFS_GETS16(p) ((int)(*(short*)(p)))
+-#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? (int)NTFS_GETU24(p) :
+-
+
++#define CPU_TO_LE16(a) __cpu_to_le16(a)
++#define CPU_TO_LE32(a) __cpu_to_le32(a)
++#define CPU_TO_LE64(a) __cpu_to_le64(a)
++
++#define LE16_TO_CPU(a) __cpu_to_le16(a)
++#define LE32_TO_CPU(a) __cpu_to_le32(a)
++#define LE64_TO_CPU(a) __cpu_to_le64(a)
++
++/* Macros reading unsigned integers */
++#define NTFS_GETU8(p) (*(ntfs_u8*)(p))
++#define NTFS_GETU16(p) ((ntfs_u16)LE16_TO_CPU(*(ntfs_u16*)(p)))
++#define NTFS_GETU24(p) ((ntfs_u32)NTFS_GETU16(p) | \
++ ((ntfs_u32)NTFS_GETU8(((char*)(p)) + 2) << 16))
++#define NTFS_GETU32(p) ((ntfs_u32)LE32_TO_CPU(*(ntfs_u32*)(p)))
++#define NTFS_GETU64(p) ((ntfs_u64)LE64_TO_CPU(*(ntfs_u64*)(p)))
++
++/* Macros reading signed integers */
++#define NTFS_GETS8(p) ((*(ntfs_s8*)(p)))
++#define NTFS_GETS16(p) ((ntfs_s16)LE16_TO_CPU(*(short*)(p)))
++#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? \
++ (int)NTFS_GETU24(p) : \
++ (int)(NTFS_GETU24(p) - 0x1000000))
+
+ #endif /* _GM_NTFS_H */