2.0.0-rc (#9)
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
### Issues * \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception * \#2 Require bucket name for S3 mounts * \#3 \[bug\] File size is not being updated in S3 mount * \#4 Upgrade to libfuse-3.x.x * \#5 Switch to renterd for Sia support * \#6 Switch to cpp-httplib to further reduce dependencies * \#7 Remove global_data and calculate used disk space per provider * \#8 Switch to libcurl for S3 mount support ### Changes from v1.x.x * Added read-only encrypt provider * Pass-through mount point that transparently encrypts source data using `XChaCha20-Poly1305` * Added S3 encryption support via `XChaCha20-Poly1305` * Added replay protection to remote mounts * Added support base64 writes in remote FUSE * Created static linked Linux binaries for `amd64` and `aarch64` using `musl-libc` * Removed legacy Sia renter support * Removed Skynet support * Fixed multiple remote mount WinFSP API issues on \*NIX servers * Implemented chunked read and write * Writes for non-cached files are performed in chunks of 8Mib * Removed `repertory-ui` support * Removed `FreeBSD` support * Switched to `libsodium` over `CryptoPP` * Switched to `XChaCha20-Poly1305` for remote mounts * Updated `GoogleTest` to v1.14.0 * Updated `JSON for Modern C++` to v3.11.2 * Updated `OpenSSL` to v1.1.1w * Updated `RocksDB` to v8.5.3 * Updated `WinFSP` to 2023 * Updated `boost` to v1.78.0 * Updated `cURL` to v8.3.0 * Updated `zlib` to v1.3 * Use `upload_manager` for all providers * Adds a delay to uploads to prevent excessive API calls * Supports re-upload after mount restart for incomplete uploads * NOTE: Uploads for all providers are full file (no resume support) * Multipart upload support is planned for S3 Reviewed-on: #9
This commit is contained in:
@ -1,25 +1,27 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
Copyright <2018-2023> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||
|
||||
#include "common.hpp"
|
||||
#include "drives/remote/i_remote_json.hpp"
|
||||
#include "types/remote.hpp"
|
||||
|
||||
@ -28,124 +30,179 @@ class i_remote_instance : public virtual i_remote_json {
|
||||
INTERFACE_SETUP(i_remote_instance);
|
||||
|
||||
public:
|
||||
virtual packet::error_type fuse_access(const char *path, const std::int32_t &mask) = 0;
|
||||
[[nodiscard]] virtual auto fuse_access(const char *path,
|
||||
const std::int32_t &mask)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_chflags(const char *path, const std::uint32_t &flags) = 0;
|
||||
[[nodiscard]] virtual auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_chmod(const char *path, const remote::file_mode &mode) = 0;
|
||||
[[nodiscard]] virtual auto fuse_chmod(const char *path,
|
||||
const remote::file_mode &mode)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid) = 0;
|
||||
[[nodiscard]] virtual auto fuse_chown(const char *path,
|
||||
const remote::user_id &uid,
|
||||
const remote::group_id &gid)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle) = 0;
|
||||
virtual packet::error_type fuse_destroy() = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
[[nodiscard]] virtual auto fuse_destroy() -> packet::error_type = 0;
|
||||
|
||||
/*virtual packet::error_type fuse_fallocate(const char *path, const std::int32_t &mode,
|
||||
const remote::file_offset &offset,
|
||||
const remote::file_offset &length,
|
||||
const remote::file_offset &length,
|
||||
const remote::file_handle &handle) = 0;*/
|
||||
/*[[nodiscard]] virtual packet::error_type fuse_fallocate(const char *path,
|
||||
const std::int32_t &mode, const remote::file_offset &offset, const
|
||||
remote::file_offset &length, const remote::file_offset &length, const
|
||||
remote::file_handle &handle) = 0;*/
|
||||
|
||||
virtual packet::error_type fuse_fgetattr(const char *path, remote::stat &st, bool &directory,
|
||||
const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_fgetattr(const char *path, remote::stat &st,
|
||||
bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_fsetattr_x(const char *path, const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_fsync(const char *path,
|
||||
const std::int32_t &datasync,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_getattr(const char *path, remote::stat &st, bool &directory) = 0;
|
||||
[[nodiscard]] virtual auto fuse_getattr(const char *path, remote::stat &st,
|
||||
bool &directory)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
/*virtual packet::error_type fuse_getxattr(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size) = 0;
|
||||
/*[[nodiscard]] virtual packet::error_type fuse_getxattr(const char *path,
|
||||
const char *name, char *value, const remote::file_size &size) = 0;
|
||||
|
||||
virtual packet::error_type fuse_getxattrOSX(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size,
|
||||
const std::uint32_t &position) = 0;*/
|
||||
[[nodiscard]] virtual packet::error_type fuse_getxattrOSX(const char *path,
|
||||
const char *name, char *value, const remote::file_size &size, std::uint32_t
|
||||
position) = 0;*/
|
||||
|
||||
virtual packet::error_type fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
||||
remote::file_time &crtime) = 0;
|
||||
[[nodiscard]] virtual auto fuse_getxtimes(const char *path,
|
||||
remote::file_time &bkuptime,
|
||||
remote::file_time &crtime)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_init() = 0;
|
||||
[[nodiscard]] virtual auto fuse_init() -> packet::error_type = 0;
|
||||
|
||||
/*virtual packet::error_type fuse_listxattr(const char *path, char *buffer,
|
||||
const remote::file_size &size) = 0;*/
|
||||
[[nodiscard]] /*virtual packet::error_type fuse_listxattr(const char *path,
|
||||
char *buffer, const remote::file_size &size) = 0;*/
|
||||
|
||||
virtual packet::error_type fuse_mkdir(const char *path, const remote::file_mode &mode) = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_open(const char *path,
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_opendir(const char *path, remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_opendir(const char *path,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_read(const char *path, char *buffer,
|
||||
[[nodiscard]] virtual auto fuse_read(const char *path, char *buffer,
|
||||
const remote::file_size &readSize,
|
||||
const remote::file_offset &readOffset,
|
||||
const remote::file_handle &handle) = 0;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &itemPath) = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &itemPath)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_release(const char *path, const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_releasedir(const char *path, const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_releasedir(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
// virtual packet::error_type fuse_removexattr(const char *path, const char *name) = 0;
|
||||
//[[nodiscard]] virtual packet::error_type fuse_removexattr(const char *path,
|
||||
// const char *name) =
|
||||
// 0;
|
||||
|
||||
virtual packet::error_type fuse_rename(const char *from, const char *to) = 0;
|
||||
[[nodiscard]] virtual auto fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_rmdir(const char *path) = 0;
|
||||
[[nodiscard]] virtual auto fuse_rmdir(const char *path)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_setattr_x(const char *path, remote::setattr_x &attr) = 0;
|
||||
[[nodiscard]] virtual auto fuse_setattr_x(const char *path,
|
||||
remote::setattr_x &attr)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_setbkuptime(const char *path, const remote::file_time &bkuptime) = 0;
|
||||
[[nodiscard]] virtual auto fuse_setbkuptime(const char *path,
|
||||
const remote::file_time &bkuptime)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_setchgtime(const char *path, const remote::file_time &chgtime) = 0;
|
||||
[[nodiscard]] virtual auto fuse_setchgtime(const char *path,
|
||||
const remote::file_time &chgtime)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_setcrtime(const char *path, const remote::file_time &crtime) = 0;
|
||||
[[nodiscard]] virtual auto fuse_setcrtime(const char *path,
|
||||
const remote::file_time &crtime)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_setvolname(const char *volname) = 0;
|
||||
[[nodiscard]] virtual auto fuse_setvolname(const char *volname)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
/*virtual packet::error_type fuse_setxattr(const char *path, const char *name,
|
||||
const char *value, const remote::file_size &size,
|
||||
const std::int32_t &flags) = 0;
|
||||
virtual packet::error_type fuse_setxattr_osx(const char *path, const char *name,
|
||||
const char *value, const remote::file_size &size,
|
||||
const std::int32_t &flags,
|
||||
const std::uint32_t &position) = 0;*/
|
||||
/*[[nodiscard]] virtual packet::error_type fuse_setxattr(const char *path,
|
||||
const char *name, const char *value, const remote::file_size &size, const
|
||||
std::int32_t &flags) = 0;
|
||||
[[nodiscard]] virtual packet::error_type fuse_setxattr_osx(const char *path,
|
||||
const char *name, const char *value, const remote::file_size &size, const
|
||||
std::int32_t &flags, std::uint32_t position) = 0;*/
|
||||
|
||||
virtual packet::error_type fuse_statfs(const char *path, const std::uint64_t &frsize,
|
||||
remote::statfs &st) = 0;
|
||||
[[nodiscard]] virtual auto fuse_statfs(const char *path, std::uint64_t frsize,
|
||||
remote::statfs &st)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_statfs_x(const char *path, const std::uint64_t &bsize,
|
||||
remote::statfs_x &st) = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
fuse_statfs_x(const char *path, std::uint64_t bsize, remote::statfs_x &st)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_truncate(const char *path, const remote::file_offset &size) = 0;
|
||||
[[nodiscard]] virtual auto fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_unlink(const char *path) = 0;
|
||||
[[nodiscard]] virtual auto fuse_unlink(const char *path)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
const std::uint64_t &op0, const std::uint64_t &op1) = 0;
|
||||
[[nodiscard]] virtual auto fuse_utimens(const char *path,
|
||||
const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_write(const char *path, const char *buffer,
|
||||
[[nodiscard]] virtual auto fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_size &writeSize,
|
||||
const remote::file_offset &writeOffset,
|
||||
const remote::file_handle &handle) = 0;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual packet::error_type fuse_write_base64(const char *path, const char *buffer,
|
||||
const remote::file_size &writeSize,
|
||||
const remote::file_offset &writeOffset,
|
||||
const remote::file_handle &handle) = 0;
|
||||
[[nodiscard]] virtual auto fuse_write_base64(
|
||||
const char *path, const char *buffer, const remote::file_size &writeSize,
|
||||
const remote::file_offset &writeOffset, const remote::file_handle &handle)
|
||||
-> packet::error_type = 0;
|
||||
|
||||
virtual void set_fuse_uid_gid(const remote::user_id &uid, const remote::group_id &gid) = 0;
|
||||
virtual void set_fuse_uid_gid(const remote::user_id &uid,
|
||||
const remote::group_id &gid) = 0;
|
||||
};
|
||||
typedef std::function<std::unique_ptr<i_remote_instance>()> remote_instance_factory;
|
||||
|
||||
using remote_instance_factory =
|
||||
std::function<std::unique_ptr<i_remote_instance>()>;
|
||||
} // namespace repertory::remote_fuse
|
||||
|
||||
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
|
||||
|
@ -1,25 +1,27 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
Copyright <2018-2023> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
|
||||
|
||||
#include "common.hpp"
|
||||
#include "comm/packet/packet_client.hpp"
|
||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
@ -40,131 +42,183 @@ private:
|
||||
remote::group_id gid_ = 0;
|
||||
|
||||
public:
|
||||
packet::error_type fuse_access(const char *path, const std::int32_t &mask) override;
|
||||
[[nodiscard]] auto fuse_access(const char *path, const std::int32_t &mask)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chflags(const char *path, const std::uint32_t &flags) override;
|
||||
[[nodiscard]] auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chmod(const char *path, const remote::file_mode &mode) override;
|
||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid) override;
|
||||
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_destroy() override;
|
||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_fallocate(const char *path, const std::int32_t &mode,
|
||||
const remote::file_offset &offset,
|
||||
const remote::file_offset &length,
|
||||
const remote::file_handle &handle) override ;*/
|
||||
[[nodiscard]] /*packet::error_type fuse_fallocate(const char *path, const
|
||||
std::int32_t &mode, const remote::file_offset &offset, const
|
||||
remote::file_offset &length, const remote::file_handle
|
||||
&handle) override ;*/
|
||||
|
||||
packet::error_type fuse_fgetattr(const char *path, remote::stat &st, bool &directory,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_fgetattr(const char *path, remote::stat &st, bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_fsetattr_x(const char *path, const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_getattr(const char *path, remote::stat &st, bool &directory) override;
|
||||
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &st,
|
||||
bool &directory)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_getxattr(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size) override ;
|
||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||
*name, char *value, const remote::file_size &size) override ;
|
||||
|
||||
packet::error_type fuse_getxattrOSX(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size,
|
||||
const std::uint32_t &position) override ;*/
|
||||
[[nodiscard]] packet::error_type fuse_getxattrOSX(const char *path, const char
|
||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||
override ;*/
|
||||
|
||||
packet::error_type fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
||||
remote::file_time &crtime) override;
|
||||
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||
remote::file_time &bkuptime,
|
||||
remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_init() override;
|
||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_listxattr(const char *path, char *buffer,
|
||||
const remote::file_size &size) override ;*/
|
||||
/*[[nodiscard]] packet::error_type fuse_listxattr(const char *path, char
|
||||
*buffer, const remote::file_size &size) override ;*/
|
||||
|
||||
packet::error_type fuse_mkdir(const char *path, const remote::file_mode &mode) override;
|
||||
[[nodiscard]] auto fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_opendir(const char *path, remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_open(const char *path,
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
||||
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
||||
const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_rename(const char *from, const char *to) override;
|
||||
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_release(const char *path, const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_releasedir(const char *path, const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_releasedir(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_removexattr(const char *path, const char *name) override ;*/
|
||||
/*[[nodiscard]] packet::error_type fuse_removexattr(const char *path, const
|
||||
* char *name) override
|
||||
* ;*/
|
||||
|
||||
packet::error_type fuse_rmdir(const char *path) override;
|
||||
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setattr_x(const char *path, remote::setattr_x &attr) override;
|
||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setbkuptime(const char *path, const remote::file_time &bkuptime) override;
|
||||
[[nodiscard]] auto fuse_setbkuptime(const char *path,
|
||||
const remote::file_time &bkuptime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setchgtime(const char *path, const remote::file_time &chgtime) override;
|
||||
[[nodiscard]] auto fuse_setchgtime(const char *path,
|
||||
const remote::file_time &chgtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setcrtime(const char *path, const remote::file_time &crtime) override;
|
||||
[[nodiscard]] auto fuse_setcrtime(const char *path,
|
||||
const remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setvolname(const char *volname) override;
|
||||
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_setxattr(const char *path, const char *name, const char *value,
|
||||
const remote::file_size &size,
|
||||
const std::int32_t &flags) override ;
|
||||
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
|
||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||
&flags) override ;
|
||||
|
||||
packet::error_type fuse_setxattr_osx(const char *path, const char *name, const char *value,
|
||||
const remote::file_size &size, const std::int32_t &flags,
|
||||
const std::uint32_t &position) override ;*/
|
||||
[[nodiscard]] packet::error_type fuse_setxattr_osx(const char *path, const
|
||||
char *name, const char *value, const remote::file_size &size, const
|
||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||
|
||||
packet::error_type fuse_statfs(const char *path, const std::uint64_t &frsize,
|
||||
remote::statfs &st) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_statfs(const char *path, std::uint64_t frsize, remote::statfs &st)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_statfs_x(const char *path, const std::uint64_t &bsize,
|
||||
remote::statfs_x &st) override;
|
||||
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
remote::statfs_x &st)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_truncate(const char *path, const remote::file_offset &size) override;
|
||||
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_unlink(const char *path) override;
|
||||
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
const std::uint64_t &op0, const std::uint64_t &op1) override;
|
||||
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_write(const char *path, const char *buffer,
|
||||
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_write_base64(const char *path, const char *buffer,
|
||||
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data) override;
|
||||
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type json_read_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle,
|
||||
const std::uint32_t &page,
|
||||
json &json_data) override;
|
||||
[[nodiscard]] auto json_read_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||
|
||||
packet::error_type json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto
|
||||
json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
void set_fuse_uid_gid(const remote::user_id &uid, const remote::group_id &gid) override;
|
||||
void set_fuse_uid_gid(const remote::user_id &uid,
|
||||
const remote::group_id &gid) override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
@ -1,26 +1,29 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
Copyright <2018-2023> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||
#ifndef _WIN32
|
||||
|
||||
#include "common.hpp"
|
||||
#include "drives/fuse/fuse_base.hpp"
|
||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
|
||||
@ -32,223 +35,206 @@ class lock_data;
|
||||
class server;
|
||||
|
||||
namespace remote_fuse {
|
||||
class remote_fuse_drive final {
|
||||
E_CONSUMER();
|
||||
|
||||
class remote_fuse_drive final : public fuse_base {
|
||||
public:
|
||||
remote_fuse_drive(app_config &config, lock_data &lock, remote_instance_factory factory);
|
||||
remote_fuse_drive(app_config &config, remote_instance_factory factory,
|
||||
lock_data &lock)
|
||||
: fuse_base(config), factory_(std::move(factory)), lock_data_(lock) {}
|
||||
|
||||
~remote_fuse_drive() { E_CONSUMER_RELEASE(); }
|
||||
~remote_fuse_drive() override = default;
|
||||
|
||||
private:
|
||||
app_config &config_;
|
||||
lock_data &lock_;
|
||||
remote_instance_factory factory_;
|
||||
std::string mount_location_;
|
||||
lock_data &lock_data_;
|
||||
std::shared_ptr<console_consumer> console_consumer_;
|
||||
std::shared_ptr<logging_consumer> logging_consumer_;
|
||||
std::shared_ptr<i_remote_instance> remote_instance_;
|
||||
std::shared_ptr<server> server_;
|
||||
bool was_mounted_ = false;
|
||||
|
||||
private:
|
||||
static void shutdown(std::string mount_location);
|
||||
void populate_stat(const remote::stat &r, bool directory, struct stat &st);
|
||||
|
||||
private:
|
||||
class remote_fuse_impl final {
|
||||
public:
|
||||
static app_config *config_;
|
||||
static lock_data *lock_;
|
||||
static std::string *mount_location_;
|
||||
static remote_instance_factory *factory_;
|
||||
static std::unique_ptr<console_consumer> console_consumer_;
|
||||
static std::unique_ptr<logging_consumer> logging_consumer_;
|
||||
static std::unique_ptr<i_remote_instance> remote_instance_;
|
||||
static std::unique_ptr<server> server_;
|
||||
static std::optional<gid_t> forced_gid_;
|
||||
static std::optional<uid_t> forced_uid_;
|
||||
static std::optional<mode_t> forced_umask_;
|
||||
static bool console_enabled_;
|
||||
static bool was_mounted_;
|
||||
|
||||
public:
|
||||
static void tear_down(const int &ret);
|
||||
|
||||
private:
|
||||
static void populate_stat(const remote::stat &r, const bool &directory, struct stat &st);
|
||||
|
||||
public:
|
||||
static int repertory_access(const char *path, int mask);
|
||||
protected:
|
||||
[[nodiscard]] auto access_impl(std::string api_path, int mask)
|
||||
-> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int repertory_chflags(const char *path, uint32_t flags);
|
||||
#endif
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path, uint32_t flags)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
static int repertory_chmod(const char *path, mode_t mode);
|
||||
|
||||
static int repertory_chown(const char *path, uid_t uid, gid_t gid);
|
||||
|
||||
static int repertory_create(const char *path, mode_t mode, struct fuse_file_info *fi);
|
||||
|
||||
static void repertory_destroy(void * /*ptr*/);
|
||||
|
||||
/*static int repertory_fallocate(const char *path, int mode, off_t offset, off_t length,
|
||||
struct fuse_file_info *fi) ;*/
|
||||
|
||||
static int repertory_fgetattr(const char *path, struct stat *st, struct fuse_file_info *fi);
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int repertory_fsetattr_x(const char *path, struct setattr_x *attr,
|
||||
struct fuse_file_info *fi);
|
||||
#endif
|
||||
|
||||
static int repertory_fsync(const char *path, int datasync, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_ftruncate(const char *path, off_t size, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_getattr(const char *path, struct stat *st);
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int repertory_getxtimes(const char *path, struct timespec *bkuptime,
|
||||
struct timespec *crtime);
|
||||
#endif
|
||||
|
||||
static void *repertory_init(struct fuse_conn_info *conn);
|
||||
|
||||
static int repertory_mkdir(const char *path, mode_t mode);
|
||||
|
||||
static int repertory_open(const char *path, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_opendir(const char *path, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_read(const char *path, char *buffer, size_t readSize, off_t readOffset,
|
||||
struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_readdir(const char *path, void *buf, fuse_fill_dir_t fuseFillDir,
|
||||
off_t offset, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_release(const char *path, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_releasedir(const char *path, struct fuse_file_info *fi);
|
||||
|
||||
static int repertory_rename(const char *from, const char *to);
|
||||
|
||||
static int repertory_rmdir(const char *path);
|
||||
/*
|
||||
#ifdef HAS_SETXATTR
|
||||
#ifdef __APPLE__
|
||||
static int repertory_getxattr(const char *path, const char *name, char *value, size_t size,
|
||||
uint32_t position) ;
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#else
|
||||
static int repertory_getxattr(const char *path, const char *name, char *value, size_t size) ;
|
||||
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
#endif
|
||||
static int repertory_listxattr(const char *path, char *buffer, size_t size) ;
|
||||
|
||||
static int repertory_removexattr(const char *path, const char *name) ;
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
void destroy_impl(void * /*ptr*/) override;
|
||||
|
||||
[[nodiscard]] auto fgetattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int repertory_setxattr(const char *path, const char *name, const char *value,
|
||||
size_t size, int flags, uint32_t position) ;
|
||||
[[nodiscard]] auto fsetattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
[[nodiscard]] auto fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#else
|
||||
static int repertory_setxattr(const char *path, const char *name, const char *value,
|
||||
size_t size, int flags) ;
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *st)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
static int repertory_setattr_x(const char *path, struct setattr_x *attr);
|
||||
[[nodiscard]] auto getxtimes_impl(std::string api_path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
static int repertory_setbkuptime(const char *path, const struct timespec *bkuptime);
|
||||
|
||||
static int repertory_setchgtime(const char *path, const struct timespec *chgtime);
|
||||
|
||||
static int repertory_setcrtime(const char *path, const struct timespec *crtime);
|
||||
|
||||
static int repertory_setvolname(const char *volname);
|
||||
|
||||
static int repertory_statfs_x(const char *path, struct statfs *stbuf);
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * override;
|
||||
#else
|
||||
|
||||
static int repertory_statfs(const char *path, struct statvfs *stbuf);
|
||||
|
||||
auto init_impl(struct fuse_conn_info *conn) -> void * override;
|
||||
#endif
|
||||
|
||||
static int repertory_truncate(const char *path, off_t size);
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
|
||||
static int repertory_unlink(const char *path);
|
||||
void notify_fuse_main_exit(int &ret) override;
|
||||
|
||||
static int repertory_utimens(const char *path, const struct timespec tv[2]);
|
||||
[[nodiscard]] auto open_impl(std::string api_path, struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
static int repertory_write(const char *path, const char *buffer, size_t writeSize,
|
||||
off_t writeOffset, struct fuse_file_info *fi);
|
||||
};
|
||||
[[nodiscard]] auto opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto read_impl(std::string api_path, char *buffer,
|
||||
size_t read_size, off_t read_offset,
|
||||
struct fuse_file_info *fi,
|
||||
std::size_t &bytes_read) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir, off_t offset,
|
||||
struct fuse_file_info *fi,
|
||||
fuse_readdir_flags flags)
|
||||
-> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir, off_t offset,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto release_impl(std::string api_path,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path, unsigned int flags)
|
||||
-> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto rmdir_impl(std::string api_path) -> api_error override;
|
||||
|
||||
private:
|
||||
// clang-format off
|
||||
struct fuse_operations fuse_ops_ {
|
||||
.getattr = remote_fuse_impl::repertory_getattr,
|
||||
.readlink = nullptr, // int (*readlink) (const char *, char *, size_t);
|
||||
.getdir = nullptr, // int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
|
||||
.mknod = nullptr, // int (*mknod) (const char *, mode_t, dev_t);
|
||||
.mkdir = remote_fuse_impl::repertory_mkdir,
|
||||
.unlink = remote_fuse_impl::repertory_unlink,
|
||||
.rmdir = remote_fuse_impl::repertory_rmdir,
|
||||
.symlink = nullptr, // int (*symlink) (const char *, const char *);
|
||||
.rename = remote_fuse_impl::repertory_rename,
|
||||
.link = nullptr, // int (*link) (const char *, const char *);
|
||||
.chmod = remote_fuse_impl::repertory_chmod,
|
||||
.chown = remote_fuse_impl::repertory_chown,
|
||||
.truncate = remote_fuse_impl::repertory_truncate,
|
||||
.utime = nullptr, // int (*utime) (const char *, struct utimbuf *);
|
||||
.open = remote_fuse_impl::repertory_open,
|
||||
.read = remote_fuse_impl::repertory_read,
|
||||
.write = remote_fuse_impl::repertory_write,
|
||||
#ifdef __APPLE__
|
||||
.statfs = nullptr,
|
||||
[[nodiscard]] auto setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto setchgtime_impl(std::string api_path,
|
||||
const struct timespec *chgtime)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto setcrtime_impl(std::string api_path,
|
||||
const struct timespec *crtime)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] virtual auto setvolname_impl(const char *volname)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path, struct statfs *stbuf)
|
||||
-> api_error override;
|
||||
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#else
|
||||
.statfs = remote_fuse_impl::repertory_statfs,
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error override;
|
||||
#endif
|
||||
.flush = nullptr, // int (*flush) (const char *, struct fuse_file_info *);
|
||||
.release = remote_fuse_impl::repertory_release,
|
||||
.fsync = remote_fuse_impl::repertory_fsync,
|
||||
#if HAS_SETXATTR
|
||||
.setxattr = nullptr, // remote_fuse_impl::repertory_setxattr,
|
||||
.getxattr = nullptr, // remote_fuse_impl::repertory_getxattr,
|
||||
.listxattr = nullptr, // remote_fuse_impl::repertory_listxattr,
|
||||
.removexattr = nullptr, // remote_fuse_impl::repertory_removexattr,
|
||||
|
||||
[[nodiscard]] auto unlink_impl(std::string api_path) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info *fi)
|
||||
-> api_error override;
|
||||
#else
|
||||
.setxattr = nullptr,
|
||||
.getxattr = nullptr,
|
||||
.listxattr = nullptr,
|
||||
.removexattr = nullptr,
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2])
|
||||
-> api_error override;
|
||||
#endif
|
||||
.opendir = remote_fuse_impl::repertory_opendir,
|
||||
.readdir = remote_fuse_impl::repertory_readdir,
|
||||
.releasedir = remote_fuse_impl::repertory_releasedir,
|
||||
.fsyncdir = nullptr, // int (*fsyncdir) (const char *, int, struct fuse_file_info *);
|
||||
.init = remote_fuse_impl::repertory_init,
|
||||
.destroy = remote_fuse_impl::repertory_destroy,
|
||||
.access = remote_fuse_impl::repertory_access,
|
||||
.create = remote_fuse_impl::repertory_create,
|
||||
.ftruncate = remote_fuse_impl::repertory_ftruncate,
|
||||
.fgetattr = remote_fuse_impl::repertory_fgetattr,
|
||||
.lock = nullptr, // int (*lock) (const char *, struct fuse_file_info *, int cmd, struct flock *);
|
||||
.utimens = remote_fuse_impl::repertory_utimens,
|
||||
.bmap = nullptr, // int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
|
||||
.flag_nullpath_ok = 0,
|
||||
.flag_nopath = 0,
|
||||
.flag_utime_omit_ok = 1,
|
||||
.flag_reserved = 0,
|
||||
.ioctl = nullptr, // int (*ioctl) (const char *, int cmd, void *arg, struct fuse_file_info *, unsigned int flags, void *data);
|
||||
.poll = nullptr, // int (*poll) (const char *, struct fuse_file_info *, struct fuse_pollhandle *ph, unsigned *reventsp);
|
||||
.write_buf = nullptr, // int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, struct fuse_file_info *);
|
||||
.read_buf = nullptr, // int (*read_buf) (const char *, struct fuse_bufvec **bufp, size_t size, off_t off, struct fuse_file_info *);
|
||||
.flock = nullptr, // int (*flock) (const char *, struct fuse_file_info *, int op);
|
||||
.fallocate = nullptr // remote_fuse_impl::repertory_fallocate,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
public:
|
||||
int mount(std::vector<std::string> drive_args);
|
||||
|
||||
static void display_options(int argc, char *argv[]);
|
||||
|
||||
static void display_version_information(int argc, char *argv[]);
|
||||
[[nodiscard]] auto write_impl(std::string api_path, const char *buffer,
|
||||
size_t write_size, off_t write_offset,
|
||||
struct fuse_file_info *fi,
|
||||
std::size_t &bytes_written)
|
||||
-> api_error override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE2_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE2_HPP_
|
||||
#ifndef _WIN32
|
||||
#if 0
|
||||
|
||||
#include "common.hpp"
|
||||
#include "drives/fuse/fuse_base.hpp"
|
||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class app_config;
|
||||
class console_consumer;
|
||||
class logging_consumer;
|
||||
class lock_data;
|
||||
class server;
|
||||
|
||||
namespace utils {
|
||||
api_error to_api_error(packet::error_type e) { return api_error::success; }
|
||||
} // namespace utils
|
||||
|
||||
namespace remote_fuse {
|
||||
class remote_fuse_drive2 final : public fuse_base {
|
||||
E_CONSUMER();
|
||||
|
||||
public:
|
||||
~remote_fuse_drive2() override = default;
|
||||
|
||||
private:
|
||||
std::unique_ptr<i_remote_instance> remote_instance_;
|
||||
|
||||
protected:
|
||||
api_error access_impl(std::string api_path, int mask) override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
api_error chflags_impl(std::string api_path, uint32_t flags) override;
|
||||
#endif // __APPLE__
|
||||
|
||||
api_error chmod_impl(std::string api_path, mode_t mode) override;
|
||||
|
||||
public:
|
||||
api_error check_parent_access(const std::string &api_path, int mask) const override;
|
||||
|
||||
std::uint64_t get_directory_item_count(const std::string &api_path) const override;
|
||||
|
||||
directory_item_list get_directory_items(const std::string &api_path) const override;
|
||||
|
||||
std::uint64_t get_file_size(const std::string &api_path) const override;
|
||||
|
||||
api_error get_item_meta(const std::string &api_path, api_meta_map &meta) const override;
|
||||
|
||||
api_error get_item_meta(const std::string &api_path, const std::string &name,
|
||||
std::string &value) const override;
|
||||
|
||||
std::uint64_t get_total_drive_space() const override;
|
||||
|
||||
std::uint64_t get_total_item_count() const override;
|
||||
|
||||
std::uint64_t get_used_drive_space() const override;
|
||||
|
||||
void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) const override;
|
||||
|
||||
bool is_processing(const std::string &api_path) const override;
|
||||
|
||||
void populate_stat(const directory_item &di, struct stat &st) const override;
|
||||
|
||||
int rename_directory(const std::string &from_api_path, const std::string &to_api_path) override;
|
||||
|
||||
int rename_file(const std::string &from_api_path, const std::string &to_api_path,
|
||||
const bool &overwrite) override;
|
||||
|
||||
void set_item_meta(const std::string &api_path, const std::string &key,
|
||||
const std::string &value) override;
|
||||
|
||||
void update_directory_item(directory_item &di) const override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
||||
#endif // 0
|
||||
#endif // _WIN32
|
||||
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE2_HPP_
|
@ -1,26 +1,28 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
Copyright <2018-2023> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||
#ifndef _WIN32
|
||||
|
||||
#include "common.hpp"
|
||||
#include "drives/directory_cache.hpp"
|
||||
#include "drives/fuse/i_fuse_drive.hpp"
|
||||
#include "drives/remote/remote_server_base.hpp"
|
||||
@ -31,220 +33,303 @@ class app_config;
|
||||
namespace remote_fuse {
|
||||
class remote_server final : public virtual remote_server_base<i_fuse_drive> {
|
||||
public:
|
||||
remote_server(app_config &config, i_fuse_drive &drive, const std::string &mount_location);
|
||||
remote_server(app_config &config, i_fuse_drive &drive,
|
||||
const std::string &mount_location);
|
||||
|
||||
private:
|
||||
directory_cache directory_cache_;
|
||||
|
||||
private:
|
||||
std::string construct_path(std::string path);
|
||||
[[nodiscard]] auto construct_path(std::string path) -> std::string;
|
||||
|
||||
std::string construct_path(const std::wstring &path);
|
||||
[[nodiscard]] auto construct_path(const std::wstring &path) -> std::string;
|
||||
|
||||
static std::string empty_as_zero(const json &data);
|
||||
[[nodiscard]] static auto empty_as_zero(const json &data) -> std::string;
|
||||
|
||||
packet::error_type populate_file_info(const std::string &api_path, remote::file_info &file_info);
|
||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info)
|
||||
-> packet::error_type;
|
||||
|
||||
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
||||
const UINT32 &attributes, remote::file_info &file_info);
|
||||
const UINT32 &attributes,
|
||||
remote::file_info &file_info);
|
||||
|
||||
static void populate_stat(const struct stat &st1, remote::stat &st);
|
||||
static void populate_stat(const struct stat64 &st1, remote::stat &st);
|
||||
|
||||
json &update_to_windows_format(json &item);
|
||||
[[nodiscard]] auto update_to_windows_format(json &item) -> json &;
|
||||
|
||||
protected:
|
||||
void delete_open_directory(void *dir) override;
|
||||
|
||||
public:
|
||||
// FUSE Layer
|
||||
packet::error_type fuse_access(const char *path, const std::int32_t &mask) override;
|
||||
[[nodiscard]] auto fuse_access(const char *path, const std::int32_t &mask)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chflags(const char *path, const std::uint32_t &flags) override;
|
||||
[[nodiscard]] auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chmod(const char *path, const remote::file_mode &mode) override;
|
||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid) override;
|
||||
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_destroy() override;
|
||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_fallocate(const char *path, const std::int32_t &mode,
|
||||
const remote::file_offset &offset,
|
||||
const remote::file_offset &length,
|
||||
const remote::file_handle &handle) override ;*/
|
||||
/*[[nodiscard]] packet::error_type fuse_fallocate(const char *path, const
|
||||
std::int32_t &mode, const remote::file_offset &offset, const
|
||||
remote::file_offset &length, const remote::file_handle &handle) override
|
||||
;*/
|
||||
|
||||
packet::error_type fuse_fgetattr(const char *path, remote::stat &st, bool &directory,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_fgetattr(const char *path, remote::stat &st,
|
||||
bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_fsetattr_x(const char *path, const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_getattr(const char *path, remote::stat &st, bool &directory) override;
|
||||
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &st,
|
||||
bool &directory)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_getxattr(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size) override ;
|
||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||
*name, char *value, const remote::file_size &size) override ;
|
||||
|
||||
packet::error_type fuse_getxattrOSX(const char *path, const char *name, char *value,
|
||||
const remote::file_size &size,
|
||||
const std::uint32_t &position) override ;*/
|
||||
[[nodiscard]] packet::error_type fuse_getxattrOSX(const char *path, const char
|
||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||
override ;*/
|
||||
|
||||
packet::error_type fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
||||
remote::file_time &crtime) override;
|
||||
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||
remote::file_time &bkuptime,
|
||||
remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_init() override;
|
||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_listxattr(const char *path, char *buffer,
|
||||
const remote::file_size &size) override ;*/
|
||||
[[nodiscard]] /*packet::error_type fuse_listxattr(const char *path, char
|
||||
*buffer, const remote::file_size &size) override ;*/
|
||||
|
||||
packet::error_type fuse_mkdir(const char *path, const remote::file_mode &mode) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_open(const char *path,
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_opendir(const char *path, remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
||||
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
||||
const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_rename(const char *from, const char *to) override;
|
||||
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path) override;
|
||||
[[nodiscard]] auto
|
||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_release(const char *path, const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_releasedir(const char *path, const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto fuse_releasedir(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_removexattr(const char *path, const char *name) override ;*/
|
||||
/*[[nodiscard]] packet::error_type fuse_removexattr(const char *path, const
|
||||
* char *name) override
|
||||
* ;*/
|
||||
|
||||
packet::error_type fuse_rmdir(const char *path) override;
|
||||
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setattr_x(const char *path, remote::setattr_x &attr) override;
|
||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setbkuptime(const char *path, const remote::file_time &bkuptime) override;
|
||||
[[nodiscard]] auto fuse_setbkuptime(const char *path,
|
||||
const remote::file_time &bkuptime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setchgtime(const char *path, const remote::file_time &chgtime) override;
|
||||
[[nodiscard]] auto fuse_setchgtime(const char *path,
|
||||
const remote::file_time &chgtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setcrtime(const char *path, const remote::file_time &crtime) override;
|
||||
[[nodiscard]] auto fuse_setcrtime(const char *path,
|
||||
const remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_setvolname(const char *volname) override;
|
||||
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||
-> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_setxattr(const char *path, const char *name, const char *value,
|
||||
const remote::file_size &size,
|
||||
const std::int32_t &flags) override ;
|
||||
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||
&flags) override ;
|
||||
|
||||
packet::error_type fuse_setxattr_osx(const char *path, const char *name, const char *value,
|
||||
const remote::file_size &size, const std::int32_t &flags,
|
||||
const std::uint32_t &position) override ;*/
|
||||
[[nodiscard]] packet::error_type fuse_setxattr_osx(const char *path, const
|
||||
char *name, const char *value, const remote::file_size &size, const
|
||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||
|
||||
packet::error_type fuse_statfs(const char *path, const std::uint64_t &frsize,
|
||||
remote::statfs &st) override;
|
||||
[[nodiscard]] auto fuse_statfs(const char *path, std::uint64_t frsize,
|
||||
remote::statfs &st)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_statfs_x(const char *path, const std::uint64_t &bsize,
|
||||
remote::statfs_x &st) override;
|
||||
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
remote::statfs_x &st)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_truncate(const char *path, const remote::file_offset &size) override;
|
||||
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_unlink(const char *path) override;
|
||||
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
const std::uint64_t &op0, const std::uint64_t &op1) override;
|
||||
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_write(const char *path, const char *buffer,
|
||||
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type fuse_write_base64(const char *path, const char *buffer,
|
||||
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) override;
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
void set_fuse_uid_gid(const remote::user_id &, const remote::group_id &) override {}
|
||||
void set_fuse_uid_gid(const remote::user_id &,
|
||||
const remote::group_id &) override {}
|
||||
|
||||
// JSON Layer
|
||||
packet::error_type winfsp_get_dir_buffer(PVOID /*file_desc*/, PVOID *& /*ptr*/) override {
|
||||
[[nodiscard]] auto winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
||||
PVOID *& /*ptr*/)
|
||||
-> packet::error_type override {
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
packet::error_type json_create_directory_snapshot(const std::string &path,
|
||||
json &jsonData) override;
|
||||
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||
json &jsonData)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type json_read_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle,
|
||||
const std::uint32_t &page,
|
||||
json &jsonData) override;
|
||||
[[nodiscard]] auto json_read_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle,
|
||||
std::uint32_t page, json &jsonData) -> packet::error_type override;
|
||||
|
||||
packet::error_type json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle) override;
|
||||
[[nodiscard]] auto
|
||||
json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
// WinFSP Layer
|
||||
packet::error_type winfsp_can_delete(PVOID file_desc, PWSTR file_name) override;
|
||||
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||
BOOLEAN &wasClosed) override;
|
||||
[[nodiscard]] auto winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||
UINT32 flags, BOOLEAN &wasClosed)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_close(PVOID file_desc) override;
|
||||
[[nodiscard]] auto winfsp_close(PVOID file_desc)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
UINT32 attributes, UINT64 /*allocation_size*/, PVOID *file_desc,
|
||||
remote::file_info *file_info, std::string &normalized_name,
|
||||
BOOLEAN &exists) override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
UINT32 attributes, UINT64 /*allocation_size*/, PVOID *file_desc,
|
||||
remote::file_info *file_info, std::string &normalized_name,
|
||||
BOOLEAN &exists) -> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_flush(PVOID file_desc, remote::file_info *file_info) override;
|
||||
[[nodiscard]] auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info) override;
|
||||
[[nodiscard]] auto winfsp_get_file_info(PVOID file_desc,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t * /*securityDescriptorSize*/,
|
||||
std::wstring & /*strDescriptor*/) override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t * /*securityDescriptorSize*/,
|
||||
std::wstring & /*strDescriptor*/)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) override;
|
||||
[[nodiscard]] auto winfsp_get_volume_info(UINT64 &total_size,
|
||||
UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_mounted(const std::wstring &location) override;
|
||||
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_desc, remote::file_info *file_info,
|
||||
std::string &normalized_name) override;
|
||||
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info) override;
|
||||
[[nodiscard]] auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
PUINT32 bytes_transferred) override;
|
||||
[[nodiscard]] auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
UINT32 length, PUINT32 bytes_transferred)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, PWSTR marker,
|
||||
json &itemList) override;
|
||||
[[nodiscard]] auto winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
PWSTR marker, json &itemList)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) override;
|
||||
[[nodiscard]] auto winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_set_basic_info(PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||
UINT64 last_access_time, UINT64 last_write_time,
|
||||
UINT64 change_time,
|
||||
remote::file_info *file_info) override;
|
||||
[[nodiscard]] auto winfsp_set_basic_info(
|
||||
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_set_file_size(PVOID file_desc, UINT64 newSize,
|
||||
[[nodiscard]] auto winfsp_set_file_size(PVOID file_desc, UINT64 newSize,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) override;
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_unmounted(const std::wstring &location) override;
|
||||
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
|
||||
packet::error_type winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||
PUINT32 bytes_transferred, remote::file_info *file_info) override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||
PUINT32 bytes_transferred, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
Reference in New Issue
Block a user