~aleteoryx/muditaos

1c0c20e69cadec3ed0301f8542d5e142b35b9f2e — Lucjan Bryndza 5 years ago ff5ed52
[EGD-4498] Add user functions for mount

Add user functions and methods for mount and unmount
capable with linux filesystem.
M board/rt1051/newlib/io_syscalls.cpp => board/rt1051/newlib/io_syscalls.cpp +14 -0
@@ 8,6 8,7 @@
#include <dirent.h>
#include <newlib/vfs_io_syscalls.hpp>
#include <sys/statvfs.h>
#include <sys/mount.h>
extern "C"
{
    using namespace vfsn::internal;


@@ 114,5 115,18 @@ extern "C"
    {
        return syscalls::statvfs( _REENT->_errno, path,buf);
    }
    /* Mount a filesystem.  */
    int mount (const char *special_file, const char *dir,
           const char *fstype, unsigned long int rwflag,
           const void *data)
    {
        return syscalls::mount(_REENT->_errno, special_file, dir,
                               fstype, rwflag, data );
    }
    /* Unmount a filesystem.  */
    int umount (const char *special_file)
    {
        return syscalls::umount(_REENT->_errno, special_file);
    }
}


M module-vfs/include/internal/newlib/vfs_io_syscalls.hpp => module-vfs/include/internal/newlib/vfs_io_syscalls.hpp +7 -0
@@ 35,6 35,13 @@ namespace vfsn::internal::syscalls
    int chmod(int &_errno_, const char *path, mode_t mode);
    int fchmod(int &_errno_, int fd, mode_t mode);
    int fsync(int &_errno_, int fd);
    int mount(int &_errno_,
              const char *special_file,
              const char *dir,
              const char *fstype,
              unsigned long int rwflag,
              const void *data);
    int umount(int &_errno_, const char *special_file);
    int statvfs(int &_errno_, const char *path, struct statvfs *buf);

} // namespace vfsn::internal::syscalls

M module-vfs/src/newlib/vfs_io_syscalls.cpp => module-vfs/src/newlib/vfs_io_syscalls.cpp +15 -0
@@ 343,5 343,20 @@ namespace vfsn::internal::syscalls
        }
    }

    int umount(int &_errno_, const char *special_file)
    {
        return invoke_fs(_errno_, &purefs::fs::filesystem::umount, special_file);
    }

    int mount(int &_errno_,
              const char *special_file,
              const char *dir,
              const char *fstype,
              unsigned long int rwflag,
              const void * /*data*/)
    {
        return invoke_fs(_errno_, &purefs::fs::filesystem::mount, special_file, dir, fstype, rwflag);
    }

} // namespace vfsn::internal::syscalls