summaryrefslogtreecommitdiff
authorFrank Chen <frank.chen@amlogic.com>2014-12-18 04:32:52 (GMT)
committer Frank Chen <frank.chen@amlogic.com>2014-12-19 01:35:39 (GMT)
commit054af4a2cbdb6fcccb3e7e16f4890cb05dcc8e7b (patch)
tree33863d22f3669958648dde491d7ef62c52363694
parentae3fe1baa3849d43869390b28e97a96009d702eb (diff)
downloadntfs-3g-054af4a2cbdb6fcccb3e7e16f4890cb05dcc8e7b.zip
ntfs-3g-054af4a2cbdb6fcccb3e7e16f4890cb05dcc8e7b.tar.gz
ntfs-3g-054af4a2cbdb6fcccb3e7e16f4890cb05dcc8e7b.tar.bz2
fix segmentation faults of Ntfsfix
Change-Id: I52a6aa829cf5d7d104d0cdeee5b7ef49078ef527
Diffstat
-rwxr-xr-xAndroid.mk2
-rwxr-xr-xinclude/ntfs-3g/logging.h22
-rwxr-xr-xntfsprogs/mkntfs.c4
-rwxr-xr-xntfsprogs/ntfsfix.c4
-rwxr-xr-xsrc/ntfs-3g.c4
5 files changed, 34 insertions, 2 deletions
diff --git a/Android.mk b/Android.mk
index e67abd7..1910532 100755
--- a/Android.mk
+++ b/Android.mk
@@ -1,7 +1,7 @@
ifneq ($(TARGET_SIMULATOR), true)
LOCAL_PATH := $(call my-dir)
-MY_CFLAG:= -O2 -g -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H
+MY_CFLAG:= -O2 -g -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -DANDROID
###################################################################
## For stage1, we have to make libfuse
###################################################################
diff --git a/include/ntfs-3g/logging.h b/include/ntfs-3g/logging.h
index 82f39fe..61754ef 100755
--- a/include/ntfs-3g/logging.h
+++ b/include/ntfs-3g/logging.h
@@ -32,6 +32,9 @@
#endif
#include "types.h"
+#ifdef ANDROID
+#include <cutils/log.h>
+#endif
/* Function prototype for the logging handlers */
typedef int (ntfs_log_handler)(const char *function, const char *file, int line,
@@ -86,10 +89,10 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define NTFS_LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */
#define NTFS_LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */
#define NTFS_LOG_FLAG_ONLYNAME (1 << 4) /* Only display the filename, not the pathname */
-
/* Macros to simplify logging. One for each level defined above.
* Note, ntfs_log_debug/trace have effect only if DEBUG is defined.
*/
+#ifndef ANDROID
#define ntfs_log_critical(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS)
#define ntfs_log_error(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS)
#define ntfs_log_info(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_INFO,NULL,FORMAT,##ARGS)
@@ -98,15 +101,32 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define ntfs_log_quiet(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS)
#define ntfs_log_verbose(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS)
#define ntfs_log_warning(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS)
+#else
+#define ntfs_log_critical(FORMAT, ARGS...) SLOGE(FORMAT,##ARGS)
+#define ntfs_log_error(FORMAT, ARGS...) SLOGE(FORMAT,##ARGS)
+#define ntfs_log_info(FORMAT, ARGS...) SLOGI(FORMAT,##ARGS)
+#define ntfs_log_perror(FORMAT, ARGS...) SLOGE(FORMAT,##ARGS)
+#define ntfs_log_progress(FORMAT, ARGS...) SLOGI(FORMAT,##ARGS)
+#define ntfs_log_quiet(FORMAT, ARGS...) SLOGI(FORMAT,##ARGS)
+#define ntfs_log_verbose(FORMAT, ARGS...) SLOGV(FORMAT,##ARGS)
+#define ntfs_log_warning(FORMAT, ARGS...) SLOGW(FORMAT,##ARGS)
+#endif
/* By default debug and trace messages are compiled into the program,
* but not displayed.
*/
#ifdef DEBUG
+#ifdef ANDROID
+#define ntfs_log_debug(FORMAT, ARGS...) SLOGD(FORMAT,##ARGS)
+#define ntfs_log_trace(FORMAT, ARGS...) SLOGV(FORMAT,##ARGS)
+#define ntfs_log_enter(FORMAT, ARGS...) SLOGV(FORMAT,##ARGS)
+#define ntfs_log_leave(FORMAT, ARGS...) SLOGV(FORMAT,##ARGS)
+#else
#define ntfs_log_debug(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS)
#define ntfs_log_trace(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS)
#define ntfs_log_enter(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ENTER,NULL,FORMAT,##ARGS)
#define ntfs_log_leave(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_LEAVE,NULL,FORMAT,##ARGS)
+#endif
#else
#define ntfs_log_debug(FORMAT, ARGS...)do {} while (0)
#define ntfs_log_trace(FORMAT, ARGS...)do {} while (0)
diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c
index f8da9ce..506b540 100755
--- a/ntfsprogs/mkntfs.c
+++ b/ntfsprogs/mkntfs.c
@@ -145,6 +145,10 @@
#define basename(name) name
#endif
+#ifdef ANDROID
+#define LOG_TAG "mkntfs"
+#endif
+
typedef enum { WRITE_STANDARD, WRITE_BITMAP, WRITE_LOGFILE } WRITE_TYPE;
#ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS
diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c
index eaf474c..2518eed 100755
--- a/ntfsprogs/ntfsfix.c
+++ b/ntfsprogs/ntfsfix.c
@@ -86,6 +86,10 @@ You need to run ./configure without the --disable-default-device-io-ops \
switch if you want to be able to build the NTFS utilities."
#endif
+#ifdef ANDROID
+#define LOG_TAG "Ntfsfix"
+#endif
+
static const char *EXEC_NAME = "ntfsfix";
static const char OK[] = "OK\n";
static const char FAILED[] = "FAILED\n";
diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c
index efd9891..31f3a48 100755
--- a/src/ntfs-3g.c
+++ b/src/ntfs-3g.c
@@ -126,6 +126,10 @@
#define set_archive(ni) (ni)->flags |= FILE_ATTR_ARCHIVE
+#ifdef ANDROID
+#define LOG_TAG "Ntfs-3g"
+#endif
+
typedef enum {
FSTYPE_NONE,
FSTYPE_UNKNOWN,