OSDN Git Service

Handle 64-bit offsets correctly on Android
authorSteve Kondik <shade@chemlab.org>
Sun, 7 Jul 2013 07:33:03 +0000 (00:33 -0700)
committerSteve Kondik <shade@chemlab.org>
Mon, 8 Jul 2013 01:26:18 +0000 (18:26 -0700)
15 files changed:
fsck/Android.mk
fsck/main.c
fuse/Android.mk
fuse/main.c
libexfat/Android.mk
libexfat/exfat.h
libexfat/io.c
libexfat/platform.h
mkfs/Android.mk
mkfs/cbm.c
mkfs/fat.c
mkfs/main.c
mkfs/mkexfat.c
mkfs/rootdir.c
mkfs/vbr.c

index 145384a..eab2d97 100644 (file)
@@ -9,8 +9,8 @@ LOCAL_SRC_FILES =  main.c
 LOCAL_C_INCLUDES += $(LOCAL_PATH) \
                                        external/exfat/libexfat \
                                        external/fuse/include
-LOCAL_SHARED_LIBRARIES += libz libc libexfat libdl 
-LOCAL_STATIC_LIBRARIES += libfuse
+LOCAL_SHARED_LIBRARIES += libz libc libdl
+LOCAL_STATIC_LIBRARIES += libexfat libfuse
 
 include $(BUILD_EXECUTABLE)
 
index f6ba4fd..104b8af 100644 (file)
@@ -18,9 +18,9 @@
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <exfat.h>
 #include <stdio.h>
 #include <string.h>
-#include <exfat.h>
 #include <exfatfs.h>
 #include <inttypes.h>
 #include <unistd.h>
index cf7688f..ff35c78 100644 (file)
@@ -9,7 +9,7 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH) \
                                        external/exfat/libexfat \
                                        external/fuse/include \
                                        external/fuse/android
-LOCAL_SHARED_LIBRARIES += libz libc libexfat libdl 
-LOCAL_STATIC_LIBRARIES += libfuse
+LOCAL_SHARED_LIBRARIES += libz libc libdl
+LOCAL_STATIC_LIBRARIES += libexfat libfuse
 
 include $(BUILD_EXECUTABLE)
index 6d91fb5..191ae93 100644 (file)
 */
 
 #define FUSE_USE_VERSION 26
+#include <exfat.h>
 #include <fuse.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <exfat.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <sys/types.h>
index 39a7faa..44b8b4b 100644 (file)
@@ -9,4 +9,4 @@ LOCAL_SRC_FILES = cluster.c io.c log.c lookup.c mount.c node.c time.c utf.c util
 LOCAL_C_INCLUDES += $(LOCAL_PATH) \
 LOCAL_SHARED_LIBRARIES += libc
 
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_STATIC_LIBRARY)
index 9a9d596..f8480b5 100644 (file)
 #ifndef EXFAT_H_INCLUDED
 #define EXFAT_H_INCLUDED
 
+#if defined(__ANDROID__)
+#define _OFF_T_DEFINED_
+typedef long long off_t;
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
index fea3562..9bd1233 100644 (file)
@@ -251,6 +251,8 @@ off_t exfat_seek(struct exfat_dev* dev, off_t offset, int whence)
 #ifdef USE_UBLIO
        /* XXX SEEK_CUR will be handled incorrectly */
        return dev->pos = lseek(dev->fd, offset, whence);
+#elif defined(__ANDROID__)
+    return lseek64(dev->fd, offset, whence);
 #else
        return lseek(dev->fd, offset, whence);
 #endif
@@ -285,6 +287,8 @@ void exfat_pread(struct exfat_dev* dev, void* buffer, size_t size,
 {
 #ifdef USE_UBLIO
        if (ublio_pread(dev->ufh, buffer, size, offset) != size)
+#elif defined(__ANDROID__)
+    if (pread64(dev->fd, buffer, size, offset) != size)
 #else
        if (pread(dev->fd, buffer, size, offset) != size)
 #endif
@@ -297,6 +301,8 @@ void exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
 {
 #ifdef USE_UBLIO
        if (ublio_pwrite(dev->ufh, buffer, size, offset) != size)
+#elif defined(__ANDROID__)
+    if (pwrite64(dev->fd, buffer, size, offset) != size)
 #else
        if (pwrite(dev->fd, buffer, size, offset) != size)
 #endif
index 1537283..f3429ae 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef PLATFORM_H_INCLUDED
 #define PLATFORM_H_INCLUDED
 
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined (__ANDROID__)
 
 #include <endian.h>
 #include <byteswap.h>
@@ -38,7 +38,7 @@
 #define __LITTLE_ENDIAN LITTLE_ENDIAN
 #define __BIG_ENDIAN BIG_ENDIAN
 
-#elif defined(__ANDROID__) || defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__)
 
 #include <sys/endian.h>
 #define bswap_16(x) bswap16(x)
index 4ca91bc..dfaae73 100644 (file)
@@ -9,7 +9,7 @@ LOCAL_SRC_FILES =  cbm.c fat.c main.c mkexfat.c rootdir.c uct.c uctc.c vbr.c
 LOCAL_C_INCLUDES += $(LOCAL_PATH) \
                                        external/exfat/libexfat \
                                        external/fuse/include
-LOCAL_SHARED_LIBRARIES += libz libc libexfat libdl 
-LOCAL_STATIC_LIBRARIES += libfuse
+LOCAL_SHARED_LIBRARIES += libz libc libdl
+LOCAL_STATIC_LIBRARIES += libexfat libfuse
 
 include $(BUILD_EXECUTABLE)
index c631d8a..8abdad0 100644 (file)
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <limits.h>
 #include "cbm.h"
 #include "fat.h"
 #include "uct.h"
 #include "rootdir.h"
+#include <limits.h>
 
 static off_t cbm_alignment(void)
 {
index 9df890a..2cfed58 100644 (file)
@@ -18,6 +18,7 @@
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <exfat.h>
 #include <unistd.h>
 #include "fat.h"
 #include "cbm.h"
index 28b3ec1..8a419f1 100644 (file)
@@ -18,6 +18,7 @@
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <exfat.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <unistd.h>
@@ -25,7 +26,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <limits.h>
-#include <exfat.h>
 #include "mkexfat.h"
 #include "vbr.h"
 #include "fat.h"
index 7e300df..dd7d404 100644 (file)
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "mkexfat.h"
 #include <sys/types.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
-#include "mkexfat.h"
 
 static int check_size(off_t volume_size)
 {
index 22add95..6370565 100644 (file)
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <string.h>
 #include "rootdir.h"
 #include "uct.h"
 #include "cbm.h"
 #include "uctc.h"
+#include <string.h>
 
 static off_t rootdir_alignment(void)
 {
index ce7a3bf..42c70f4 100644 (file)
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <string.h>
 #include "vbr.h"
 #include "fat.h"
 #include "cbm.h"
 #include "uct.h"
 #include "rootdir.h"
+#include <string.h>
 
 static off_t vbr_alignment(void)
 {