~aleteoryx/muditaos

6f3a6b4f7d4604f1a314a8a19b00f54d0eaa0af8 — Lucjan Bryndza 5 years ago eff6c3f
[EGD-5199] Add support for mount umount

Add support for mount umount in the libiosyscall library
due to planning to use ro fatfs and remount to rw only
for update purposes.

Signed-off-by: Lucjan Bryndza <lucjan.bryndza@mudita.com>
2 files changed, 37 insertions(+), 0 deletions(-)

M board/linux/libiosyscalls/src/syscalls_posix.cpp
M board/linux/libiosyscalls/version.txt
M board/linux/libiosyscalls/src/syscalls_posix.cpp => board/linux/libiosyscalls/src/syscalls_posix.cpp +34 -0
@@ 6,6 6,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <fcntl.h>

#include <errno.h>


@@ 550,4 551,37 @@ extern "C" {
        return -1;
    }
    __asm__(".symver _iosys_fxstatat64,__fxstatat64@GLIBC_2.4");

    int _iosys_mount (const char *special_file, const char *dir,
		  const char *fstype, unsigned long int rwflag,
		  const void *data)
    {
        if(vfs::redirect_to_image(dir))
        {
            return vfs::invoke_fs(__VFS(mount), special_file, dir, fstype, rwflag );
        }
        else
        {
            //NOTE: Always return zero because we will use fileystem which is always RW
            TRACE_SYSCALLN("(%s, %s, %s, %08lx,%p) -> linux fs", special_file, dir,fstype, rwflag, data);
            return 0;
        }
    }
    __asm__(".symver _iosys_mount,mount@GLIBC_2.2.5");

    int _iosys_umount (const char *mount_point)
    {
        if(vfs::redirect_to_image(mount_point))
        {
            return vfs::invoke_fs(__VFS(umount), mount_point );
        }
        else
        {
            //NOTE: Always return zero because we will use fileystem which is always RW
            TRACE_SYSCALLN("(%s) -> linux fs", mount_point);
            return 0;
        }
    }
    __asm__(".symver _iosys_umount,umount@GLIBC_2.2.5");

}

M board/linux/libiosyscalls/version.txt => board/linux/libiosyscalls/version.txt +3 -0
@@ 68,6 68,9 @@ GLIBC_2.2.5 {
                __xstat64;
                __lxstat64;
                __fxstat64;
                mount;
                umount;

        local:
                *;
};