From 1c0c20e69cadec3ed0301f8542d5e142b35b9f2e Mon Sep 17 00:00:00 2001 From: Lucjan Bryndza Date: Tue, 12 Jan 2021 13:44:50 +0100 Subject: [PATCH] [EGD-4498] Add user functions for mount Add user functions and methods for mount and unmount capable with linux filesystem. --- board/rt1051/newlib/io_syscalls.cpp | 14 ++++++++++++++ .../include/internal/newlib/vfs_io_syscalls.hpp | 7 +++++++ module-vfs/src/newlib/vfs_io_syscalls.cpp | 15 +++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/board/rt1051/newlib/io_syscalls.cpp b/board/rt1051/newlib/io_syscalls.cpp index 38795add51604ba4e1ee361aff07481bd588c3d5..6a5c46d87084d182c4a45557712c0ce9aa6fd076 100644 --- a/board/rt1051/newlib/io_syscalls.cpp +++ b/board/rt1051/newlib/io_syscalls.cpp @@ -8,6 +8,7 @@ #include #include #include +#include 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); + } } diff --git a/module-vfs/include/internal/newlib/vfs_io_syscalls.hpp b/module-vfs/include/internal/newlib/vfs_io_syscalls.hpp index 5481249629a66bf8125dc6ad7f99edeba997f808..c038a061fd029a6ffaa67837855b083a6ad9ff6b 100644 --- a/module-vfs/include/internal/newlib/vfs_io_syscalls.hpp +++ b/module-vfs/include/internal/newlib/vfs_io_syscalls.hpp @@ -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 diff --git a/module-vfs/src/newlib/vfs_io_syscalls.cpp b/module-vfs/src/newlib/vfs_io_syscalls.cpp index ac9c118a14e83a82a2b0eecb1cee2a36cd5bbde3..87956cf7fdfc5682a53cb7b6c7b2ad8109734c46 100644 --- a/module-vfs/src/newlib/vfs_io_syscalls.cpp +++ b/module-vfs/src/newlib/vfs_io_syscalls.cpp @@ -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