Mentioned below are the code changes that are required to successfully compile and use libfuse 2.9.4 on Android platform.
Download libfuse version 2.9.4 for linux from below given URL.
http://sourceforge.net/projects/fuse/
File : fuse.c
4569a4570,4574
> static void thread_exit_handler(int sig)
> {
> pthread_exit(0);
> }
>
4574a4580,4593
> #if 1
> struct sigaction actions;
> memset(&actions, 0, sizeof(actions));
> sigemptyset(&actions.sa_mask);
> actions.sa_flags = 0;
> actions.sa_handler = thread_exit_handler;
> sigaction(SIGUSR1, &actions, NULL);
>
> sigset_t setusr1;
> sigemptyset(&setusr1);
> sigaddset(&setusr1, SIGUSR1);
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> #endif
>
4593a4613
> #if 0
4594a4615,4618
> #else
> pthread_kill(f->prune_thread, SIGUSR1);
> #endif
>
File : fuse_loop_mt.c
65a66,70
> static void thread_exit_handler(int sig)
> {
> pthread_exit(0);
> }
>
70a76,91
> #if 1
> struct sigaction actions;
> int rc;
>
> memset(&actions, 0, sizeof(actions));
> sigemptyset(&actions.sa_mask);
> actions.sa_flags = 0;
> actions.sa_handler = thread_exit_handler;
> rc = sigaction(SIGUSR1,&actions,NULL);
>
> sigset_t setusr1;
> sigemptyset(&setusr1);
> sigaddset(&setusr1, SIGUSR1);
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> /**/
> #endif
79,80c100,102
<
< pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
---
>
> pthread_sigmask(SIG_UNBLOCK, &setusr1, NULL);
> //pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
82c104,106
< pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
---
>
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> //pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
244a269
> #if 0
246a272,276
> #else
> for (w = mt.main.next; w != &mt.main; w = w->next) {
> pthread_kill(w->thread_id, SIGUSR1);
> }
> #endif
File : fuse_lowlevel.c
27a28
> #include <errno.h>
453a455
> #if 0
454a457
>
456a460,461
> #else
> mbuf = memalign(pagesize, len);
457a463,466
> if (mbuf == NULL)
> return -ENOMEM;
> #endif
>
File : fuse_misc.h
17,19c17,19
< #if (!defined(__UCLIBC__) && !defined(__APPLE__))
< #define FUSE_SYMVER(x) __asm__(x)
< #else
---
> //#if (!defined(__UCLIBC__) && !defined(__APPLE__))
> //#define FUSE_SYMVER(x) __asm__(x)
> //#else
21c21
< #endif
---
> //#endif
File : mount.c
139a140,141
> #define FUSERMOUNT_DIR "/usr/bin"
>
File : fuse_common.h
20a21
> #include <pthread.h>
File : fuse_lowlevel.h
34a35,43
> #include <android/log.h>
>
> #define LOG_TAG "libfuse"
>
> #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
> #define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
> #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
> #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
>
File : Android.mk
# Copyright (C) 2012 Seth Huang<seth.hg@gmail.com>
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=29 -D__MULTI_THREAD
LOCAL_MODULE := libfuse
LOCAL_SRC_FILES := buffer.c cuse_lowlevel.c fuse.c fuse_kern_chan.c fuse_loop.c fuse_loop_mt.c fuse_lowlevel.c fuse_mt.c fuse_opt.c fuse_session.c fuse_signals.c helper.c mount.c mount_util.c ulockmgr.c
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/.
#LOCAL_C_INCLUDES += $(LOCAL_PATH)/fuse/.
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
#include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := fusermount
LOCAL_SRC_FILES := fusermount.c mount_util.c
include $(BUILD_EXECUTABLE)
Download libfuse version 2.9.4 for linux from below given URL.
http://sourceforge.net/projects/fuse/
File : fuse.c
4569a4570,4574
> static void thread_exit_handler(int sig)
> {
> pthread_exit(0);
> }
>
4574a4580,4593
> #if 1
> struct sigaction actions;
> memset(&actions, 0, sizeof(actions));
> sigemptyset(&actions.sa_mask);
> actions.sa_flags = 0;
> actions.sa_handler = thread_exit_handler;
> sigaction(SIGUSR1, &actions, NULL);
>
> sigset_t setusr1;
> sigemptyset(&setusr1);
> sigaddset(&setusr1, SIGUSR1);
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> #endif
>
4593a4613
> #if 0
4594a4615,4618
> #else
> pthread_kill(f->prune_thread, SIGUSR1);
> #endif
>
File : fuse_loop_mt.c
65a66,70
> static void thread_exit_handler(int sig)
> {
> pthread_exit(0);
> }
>
70a76,91
> #if 1
> struct sigaction actions;
> int rc;
>
> memset(&actions, 0, sizeof(actions));
> sigemptyset(&actions.sa_mask);
> actions.sa_flags = 0;
> actions.sa_handler = thread_exit_handler;
> rc = sigaction(SIGUSR1,&actions,NULL);
>
> sigset_t setusr1;
> sigemptyset(&setusr1);
> sigaddset(&setusr1, SIGUSR1);
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> /**/
> #endif
79,80c100,102
<
< pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
---
>
> pthread_sigmask(SIG_UNBLOCK, &setusr1, NULL);
> //pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
82c104,106
< pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
---
>
> pthread_sigmask(SIG_BLOCK, &setusr1, NULL);
> //pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
244a269
> #if 0
246a272,276
> #else
> for (w = mt.main.next; w != &mt.main; w = w->next) {
> pthread_kill(w->thread_id, SIGUSR1);
> }
> #endif
File : fuse_lowlevel.c
27a28
> #include <errno.h>
453a455
> #if 0
454a457
>
456a460,461
> #else
> mbuf = memalign(pagesize, len);
457a463,466
> if (mbuf == NULL)
> return -ENOMEM;
> #endif
>
File : fuse_misc.h
17,19c17,19
< #if (!defined(__UCLIBC__) && !defined(__APPLE__))
< #define FUSE_SYMVER(x) __asm__(x)
< #else
---
> //#if (!defined(__UCLIBC__) && !defined(__APPLE__))
> //#define FUSE_SYMVER(x) __asm__(x)
> //#else
21c21
< #endif
---
> //#endif
File : mount.c
139a140,141
> #define FUSERMOUNT_DIR "/usr/bin"
>
File : fuse_common.h
20a21
> #include <pthread.h>
File : fuse_lowlevel.h
34a35,43
> #include <android/log.h>
>
> #define LOG_TAG "libfuse"
>
> #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
> #define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
> #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
> #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
>
File : Android.mk
# Copyright (C) 2012 Seth Huang<seth.hg@gmail.com>
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=29 -D__MULTI_THREAD
LOCAL_MODULE := libfuse
LOCAL_SRC_FILES := buffer.c cuse_lowlevel.c fuse.c fuse_kern_chan.c fuse_loop.c fuse_loop_mt.c fuse_lowlevel.c fuse_mt.c fuse_opt.c fuse_session.c fuse_signals.c helper.c mount.c mount_util.c ulockmgr.c
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/.
#LOCAL_C_INCLUDES += $(LOCAL_PATH)/fuse/.
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
#include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := fusermount
LOCAL_SRC_FILES := fusermount.c mount_util.c
include $(BUILD_EXECUTABLE)
Android latest version list: android latest version
ReplyDelete