Loading src/posix_file/posix_file/file.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -180,12 +180,12 @@ public: std::size_t size() const noexcept { return std::filesystem::file_size(m_path); return m_fs_plugin->size(m_path); } auto remove() noexcept { return std::filesystem::remove(m_path); return m_fs_plugin->unlink(m_path); } void Loading src/posix_file/posix_file/fs_plugin/fs_plugin.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ public: unlink(const std::string& path) = 0; virtual int stat(const std::string& path, struct stat* buf) = 0; virtual ssize_t size(const std::string& path) = 0; }; } // namespace cargo #endif // FS_PLUGIN_HPP No newline at end of file src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,15 @@ gekko_plugin::stat(const std::string& path, struct stat* buf) { return gkfs::syscall::gkfs_stat(path, buf); } ssize_t gekko_plugin::size(const std::string& path) { struct stat buf; int res = gekko_plugin::stat(path, &buf); if(res != 0) { return -1; } return buf.st_size; } } // namespace cargo src/posix_file/posix_file/fs_plugin/gekko_plugin.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public: unlink(const std::string& path) final; int stat(const std::string& path, struct stat* buf) final; ssize_t size(const std::string& path) final; }; }; // namespace cargo Loading src/posix_file/posix_file/fs_plugin/posix_plugin.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -66,5 +66,9 @@ posix_plugin::stat(const std::string& path, struct stat* buf) { return ::stat(path.c_str(), buf); } ssize_t posix_plugin::size(const std::string& path) { return std::filesystem::file_size(path); } }; // namespace cargo No newline at end of file Loading
src/posix_file/posix_file/file.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -180,12 +180,12 @@ public: std::size_t size() const noexcept { return std::filesystem::file_size(m_path); return m_fs_plugin->size(m_path); } auto remove() noexcept { return std::filesystem::remove(m_path); return m_fs_plugin->unlink(m_path); } void Loading
src/posix_file/posix_file/fs_plugin/fs_plugin.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ public: unlink(const std::string& path) = 0; virtual int stat(const std::string& path, struct stat* buf) = 0; virtual ssize_t size(const std::string& path) = 0; }; } // namespace cargo #endif // FS_PLUGIN_HPP No newline at end of file
src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,15 @@ gekko_plugin::stat(const std::string& path, struct stat* buf) { return gkfs::syscall::gkfs_stat(path, buf); } ssize_t gekko_plugin::size(const std::string& path) { struct stat buf; int res = gekko_plugin::stat(path, &buf); if(res != 0) { return -1; } return buf.st_size; } } // namespace cargo
src/posix_file/posix_file/fs_plugin/gekko_plugin.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public: unlink(const std::string& path) final; int stat(const std::string& path, struct stat* buf) final; ssize_t size(const std::string& path) final; }; }; // namespace cargo Loading
src/posix_file/posix_file/fs_plugin/posix_plugin.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -66,5 +66,9 @@ posix_plugin::stat(const std::string& path, struct stat* buf) { return ::stat(path.c_str(), buf); } ssize_t posix_plugin::size(const std::string& path) { return std::filesystem::file_size(path); } }; // namespace cargo No newline at end of file