OSDN Git Service

Merge branch 'master' of git://github.com/relan/exfat into marshmallow-x86 marshmallow-x86 android-x86-6.0-r3
authorChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 23 Mar 2017 14:52:59 +0000 (22:52 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 23 Mar 2017 14:52:59 +0000 (22:52 +0800)
18 files changed:
Android.mk [new file with mode: 0644]
CleanSpec.mk [new file with mode: 0644]
fsck/Android.mk [new file with mode: 0644]
fuse/Android.mk [new file with mode: 0644]
libexfat/Android.mk [new file with mode: 0644]
libexfat/android_config.h [new file with mode: 0644]
libexfat/compiler.h
libexfat/exfat.h
libexfat/io.c
libexfat/log.c
libexfat/lookup.c
libexfat/node.c
libexfat/platform.h
libexfat/utf.h [moved from libexfat/utf.c with 96% similarity]
libexfat/utils.c
mkfs/Android.mk [new file with mode: 0644]
mkfs/main.c
mkfs/rootdir.c

diff --git a/Android.mk b/Android.mk
new file mode 100644 (file)
index 0000000..5053e7d
--- /dev/null
@@ -0,0 +1 @@
+include $(call all-subdir-makefiles)
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644 (file)
index 0000000..bffcf4b
--- /dev/null
@@ -0,0 +1 @@
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/*.exfat)
diff --git a/fsck/Android.mk b/fsck/Android.mk
new file mode 100644 (file)
index 0000000..85fea70
--- /dev/null
@@ -0,0 +1,19 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := fsck.exfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
+LOCAL_SRC_FILES := main.c
+LOCAL_SHARED_LIBRARIES := libexfat libfuse-lite
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libexfat_fsck_static
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -Dmain=fsck_exfat_main
+LOCAL_SRC_FILES := main.c
+LOCAL_C_INCLUDES := external/fuse/include
+LOCAL_STATIC_LIBRARIES := libfuse_static libexfat_static
+include $(BUILD_STATIC_LIBRARY)
+
diff --git a/fuse/Android.mk b/fuse/Android.mk
new file mode 100644 (file)
index 0000000..492bff2
--- /dev/null
@@ -0,0 +1,19 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := mount.exfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
+LOCAL_SRC_FILES := main.c
+LOCAL_SHARED_LIBRARIES := libexfat libfuse-lite
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libexfat_mount_static
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -Dmain=mount_exfat_main
+LOCAL_SRC_FILES := main.c
+LOCAL_C_INCLUDES := external/fuse/include \
+                                       external/fuse/android
+LOCAL_STATIC_LIBRARIES := libfuse_static libexfat_static
+include $(BUILD_STATIC_LIBRARY)
diff --git a/libexfat/Android.mk b/libexfat/Android.mk
new file mode 100644 (file)
index 0000000..ef0485c
--- /dev/null
@@ -0,0 +1,20 @@
+LOCAL_PATH := $(call my-dir)
+
+common_src_files := cluster.c io.c log.c lookup.c mount.c node.c time.c utils.c
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libexfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libexfat_static
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+LOCAL_STATIC_LIBRARIES := libfuse_static libexfat_static
+include $(BUILD_STATIC_LIBRARY)
diff --git a/libexfat/android_config.h b/libexfat/android_config.h
new file mode 100644 (file)
index 0000000..b3b37ec
--- /dev/null
@@ -0,0 +1,37 @@
+/* libexfat/config.h.  Generated from config.h.in by configure.  */
+/* libexfat/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Name of package */
+#define PACKAGE "exfat"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "relan@users.noreply.github.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "Free exFAT implementation"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "Free exFAT implementation 1.2.4"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "exfat"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL "https://github.com/relan/exfat"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.2.4"
+
+/* Version number of package */
+#define VERSION "1.2.4"
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
index e4f40de..babdbfa 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef COMPILER_H_INCLUDED
 #define COMPILER_H_INCLUDED
 
-#if __STDC_VERSION__ < 199901L
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901L)
 #error C99-compliant compiler is required
 #endif
 
index 21b760e..240cde1 100644 (file)
 #ifndef EXFAT_H_INCLUDED
 #define EXFAT_H_INCLUDED
 
+#if defined(__ANDROID__)
+#include "android_config.h"
+#else
 #include "config.h"
+#endif
 #include "compiler.h"
 #include "exfatfs.h"
 #include <stdio.h>
@@ -194,12 +198,6 @@ void exfat_humanize_bytes(uint64_t value, struct exfat_human_bytes* hb);
 void exfat_print_info(const struct exfat_super_block* sb,
                uint32_t free_clusters);
 
-int utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
-               size_t insize);
-int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
-               size_t insize);
-size_t utf16_length(const le16_t* str);
-
 struct exfat_node* exfat_get_node(struct exfat_node* node);
 void exfat_put_node(struct exfat* ef, struct exfat_node* node);
 int exfat_cleanup_node(struct exfat* ef, struct exfat_node* node);
index 514383c..6228f0a 100644 (file)
@@ -251,7 +251,11 @@ off_t exfat_get_size(const struct exfat_dev* dev)
 
 off_t exfat_seek(struct exfat_dev* dev, off_t offset, int whence)
 {
+#if defined(__ANDROID__)
+       return lseek64(dev->fd, offset, whence);
+#else
        return lseek(dev->fd, offset, whence);
+#endif
 }
 
 ssize_t exfat_read(struct exfat_dev* dev, void* buffer, size_t size)
@@ -267,13 +271,21 @@ ssize_t exfat_write(struct exfat_dev* dev, const void* buffer, size_t size)
 ssize_t exfat_pread(struct exfat_dev* dev, void* buffer, size_t size,
                off_t offset)
 {
+#if defined(__ANDROID__)
+       return pread64(dev->fd, buffer, size, offset);
+#else
        return pread(dev->fd, buffer, size, offset);
+#endif
 }
 
 ssize_t exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
                off_t offset)
 {
+#if defined(__ANDROID__)
+       return pwrite64(dev->fd, buffer, size, offset);
+#else
        return pwrite(dev->fd, buffer, size, offset);
+#endif
 }
 
 ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
index 5d99d30..34bcb22 100644 (file)
@@ -47,7 +47,11 @@ void exfat_bug(const char* format, ...)
                vsyslog(LOG_CRIT, format, aq);
        va_end(aq);
 
+#if defined(__ANDROID__)
+    exit(-1);
+#else
        abort();
+#endif
 }
 
 /*
index 4b27cc5..503cc4c 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "exfat.h"
+#include "utf.h"
 #include <string.h>
 #include <errno.h>
 #include <inttypes.h>
index a3f00af..ce513fd 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "exfat.h"
+#include "utf.h"
 #include <errno.h>
 #include <string.h>
 #include <inttypes.h>
index b3505f4..2fe5341 100644 (file)
@@ -46,7 +46,7 @@
 #define EXFAT_LITTLE_ENDIAN LITTLE_ENDIAN
 #define EXFAT_BIG_ENDIAN BIG_ENDIAN
 
-#elif defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__ANDROID__) || defined(__FreeBSD__) || defined(__DragonFlyBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
 
 #include <sys/endian.h>
 #define exfat_bswap16(x) bswap16(x)
similarity index 96%
rename from libexfat/utf.c
rename to libexfat/utf.h
index d8968db..f902e65 100644 (file)
@@ -101,7 +101,7 @@ static const le16_t* utf16_to_wchar(const le16_t* input, wchar_t* wc,
        }
 }
 
-int utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
+static inline int utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
                size_t insize)
 {
        const le16_t* inp = input;
@@ -202,7 +202,7 @@ static le16_t* wchar_to_utf16(le16_t* output, wchar_t wc, size_t outsize)
        return output + 2;
 }
 
-int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
+ static inline int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
                size_t insize)
 {
        const char* inp = input;
@@ -235,7 +235,7 @@ int utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
        return 0;
 }
 
-size_t utf16_length(const le16_t* str)
+static inline size_t utf16_length(const le16_t* str)
 {
        size_t i = 0;
 
index c080d4c..939e4ba 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "exfat.h"
+#include "utf.h"
 #include <string.h>
 #include <stdio.h>
 #include <inttypes.h>
diff --git a/mkfs/Android.mk b/mkfs/Android.mk
new file mode 100644 (file)
index 0000000..2559101
--- /dev/null
@@ -0,0 +1,20 @@
+LOCAL_PATH := $(call my-dir)
+
+common_src_files := cbm.c fat.c main.c mkexfat.c rootdir.c uct.c uctc.c vbr.c
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := mkfs.exfat
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_SHARED_LIBRARIES := libexfat libfuse-lite
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libexfat_mkfs_static
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -Dmain=mkfs_exfat_main
+LOCAL_SRC_FILES := $(common_src_files)
+LOCAL_C_INCLUDES := external/fuse/include
+LOCAL_STATIC_LIBRARIES := libfuse_static libexfat_static
+include $(BUILD_STATIC_LIBRARY)
index 02ac9c7..c6efa8f 100644 (file)
@@ -26,6 +26,7 @@
 #include "cbm.h"
 #include "uct.h"
 #include "rootdir.h"
+#include <utf.h>
 #include <exfat.h>
 #include <sys/types.h>
 #include <sys/time.h>
index a8cc834..e98ed7c 100644 (file)
@@ -24,6 +24,7 @@
 #include "uct.h"
 #include "cbm.h"
 #include "uctc.h"
+#include <utf.h>
 #include <string.h>
 
 static off_t rootdir_alignment(void)