Skip to main content

libfuse for android version 2.9.4

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)



Comments

Post a Comment

Popular posts from this blog

Getting and Setting Microphone Gain or Microphone Boost on Windows 7 / 8 Programmatically

After hours of searching the net I have finally figured out a way to programmatically get and set the microphone gain (boost) value. The code mentioned below can be built on VS and does the job of setting gain value. #include "stdafx.h" #include <mmdeviceapi.h> #include <endpointvolume.h> #include <Functiondiscoverykeys_devpkey.h> #include "Audioclient.h" #include "comutil.h" #define EXIT_ON_ERROR(hres)   if (FAILED(hres)) { goto Exit; } #define SAFE_RELEASE(punk)   if ((punk) != NULL)  { (punk)->Release(); (punk) = NULL; } HRESULT getMicrophoneBoostVolumeLevel(IMMDevice *pEndptDev, IAudioVolumeLevel** ppVolumeLevel) { HRESULT hr = S_OK; DataFlow flow; IDeviceTopology *pDeviceTopology = NULL; IConnector *pConnFrom = NULL; IConnector *pConnTo = NULL; IPart *pPartPrev = NULL; IPart *pPartNext = NULL; *ppVolumeLevel = NULL; wchar_t microphoneBoostName[] = L"Microphone Boost";//if your system ...

Simple example of strong and weak pointers on Android using RefBase class

Here is a simple example explaining the usage of strong and weak pointers using android's RefBase class and the Android.mk to compile the same. Its a modified version of code written by Daniel in the following link. http://himmele.blogspot.com/2012/03/androids-c-reference-counting.html strong_pointer.cpp file:  #include <stdio.h> #include "utils/RefBase.h" namespace android {  class RefTest : public RefBase { public:     RefTest(int32_t id) : mID(id) {         printf("RefTest ctor: %d\n", mID);     }     virtual ~RefTest() {         printf("RefTest dtor: %d\n", mID);     }     int32_t id() const {         return mID;     } private:     int32_t mID; }; int strong_pointer() {     sp<RefTest> ref1 = new RefTest(1);     sp<RefTest> ref5;   ...

Acts Automation Framework For Android

1. Introduction The Android Comms Test Suite, is a lightweight Python-based automation tool set that is used to perform automated testing of current and upcoming Android devices. It provides a simple execution interface; a set of pluggable libraries for accessing commercially available devices, Android devices, and a collection of utility functions to further ease test development. It is an ideal desktop tool for a wireless stack developer or integrator whether exercising a new code path, performing sanity testing, or running extended regression test suites. Included in the tests/google directory are a bundle of tests, many of which can be run with as little as one or two Android devices with wifi, cellular, or bluetooth connectivity, including: 1. Wifi tests for access point interopability, enterprise server integration, WiFi scanning, WiFi auto join, and round trip time. 2. Bluetooth tests for low energy, GATT, SPP, and bonding. 3. Cellular tests for circuit switch and...