bobrofon / easysshfs

SSHFS for Android
MIT License
97 stars 16 forks source link

autofs #39

Closed bobrofon closed 1 year ago

bobrofon commented 1 year ago

Need to check if it is possible to set up autofs on Android. If it is possible, then autofs integration may be used to solve both problems: with auto-connects and with auto-disconnects.

bobrofon commented 1 year ago

Ok. I tried to build autofs inside buildroot using my current toolchains (armv8). And I have the following results so far:

  1. For some reasons, autofs package requires glibc/uclibs and dynamic linkage

    depends on !BR2_STATIC_LIBS # dlfcn
    depends on !BR2_TOOLCHAIN_USES_MUSL # nsswitch

    dlfcn is probably not a problem. Most likely it's optional, and I don't have intention to use it. nsswitch may be a problem, but without bionic libc it will not work in Android anyway.

  2. autofs really doesn't compile with armv8-musl toolchain

    ../include/hash.h:21:2: error: #error Wordsize not 32 or 64
    21 | #error Wordsize not 32 or 64
      |  ^~~~~
    ../include/hash.h:74:8: error: unknown type name ‘__always_inline’
    74 | static __always_inline uint32_t hash_64(uint64_t val, unsigned int bits)
      |        ^~~~~~~~~~~~~~~

    It looks like musl-related problem.

bobrofon commented 1 year ago

Autofs filesystem is only implemented as a kernel module. And autofs support is not enabled in the Android version of Linux kernel by default. To move forward I need a fuse-based implementation of autofs. But I don't think it is a good idea to implement something like this to use together with sshfs. The better approach would be to implement on-demand mount/unmount features in sshfs itself.

NOTE: packaging autofs kernel modules along with sshfs is also not an option, because the Linux kernel doesn't have stable ABI, and it will require to build modules for all Linux versions supported by Android (officially and unofficially).