62 Commits

Author SHA1 Message Date
a4d53c1011 cleanup
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-14 12:30:49 -05:00
4b925c15c2 [bug] Changes to maximum cache size should be updated live #46
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-13 19:19:52 -05:00
bbd82e3f0f updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-13 12:25:41 -05:00
37f2cbc78d refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-11 22:02:05 -05:00
1ad3704fa0 refactor
Some checks are pending
BlockStorage/repertory/pipeline/head Build started...
2025-04-11 20:58:16 -05:00
a6e70d93cb cleanup 2025-04-11 20:56:41 -05:00
967324a368 updated build system dependencies 2025-04-11 20:49:42 -05:00
69b31bfde8 updated build system dependencies 2025-04-11 20:32:50 -05:00
8b4724a9c1 Merge branch 'v2.0.6-release-develop' of ssh://git.fifthgrid.com:3022/blockstorage/repertory into v2.0.6-release-develop
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 22:26:51 -05:00
6a0d50bc66 fix 2025-04-04 22:26:32 -05:00
69910bef4c fix test
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 22:10:30 -05:00
8c298c84c5 fix
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 22:06:00 -05:00
47dea2cc38 refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 21:47:42 -05:00
d8b476e80a fix test
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 21:34:24 -05:00
c86c6e2ec6 fix test
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-04-04 21:31:11 -05:00
c397497eb7 fix test
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 21:21:17 -05:00
f8803dfbf0 updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 20:13:48 -05:00
5d5cacc482 [bug] Windows-to-Linux remote mount is not handling attempts to remove a non-empty directory properly 2025-04-04 20:07:07 -05:00
3ce4210d56 [bug] Windows-to-Linux remote mount is not handling attempts to remove a non-empty directory propery #45 2025-04-04 20:06:33 -05:00
d109344544 [bug] Windows-to-Linux remote mount ignores CREATE_NEW #44
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 17:35:00 -05:00
ff746a7bec [bug] Windows-to-Linux remote mount ignores CREATE_NEW #44 2025-04-04 17:33:51 -05:00
a613ec77ff debugging
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 13:23:45 -05:00
00d3dd95a8 update 2025-04-04 13:22:45 -05:00
28d1789f04 debugging
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-04-04 13:21:07 -05:00
0603463885 [bug] Windows-to-Linux remote mount ignores CREATE_NEW #44
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 13:05:02 -05:00
88398485e1 fix log
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 12:42:08 -05:00
908e75c696 debugging
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 12:37:33 -05:00
dab8c61f87 debugging
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-04-04 12:36:02 -05:00
e0cf58b01e debugging 2025-04-04 12:24:17 -05:00
281d3758e0 [bug] Windows-to-Linux remote mount ignores CREATE_NEW #44
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-04 10:55:01 -05:00
dfa170022a refactor
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2025-04-04 10:05:17 -05:00
52c2780283 [bug] Windows-to-Linux remote mount ignores CREATE_NEW #44 2025-04-04 10:02:37 -05:00
c2dbfc970a refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 21:18:37 -05:00
6f9b1f8f08 fix marker 2025-04-03 21:17:44 -05:00
078d603be9 refactor 2025-04-03 21:15:08 -05:00
983e47103b refactor
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-04-03 21:02:49 -05:00
8d2024d34b refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 19:34:42 -05:00
4f2ee2ad99 [bug] Directories are not importing properly for Sia #43 2025-04-03 19:27:46 -05:00
533938bcef [bug] Directories are not importing properly for Sia #43 2025-04-03 19:26:42 -05:00
98edf33be4 updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 17:23:11 -05:00
a080c9ff86 refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 17:20:03 -05:00
e6cdcd74a1 [bug] Directories are not importing properly for Sia #43
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 14:26:22 -05:00
573ae549be updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 13:01:48 -05:00
fca149f998 removed debugging 2025-04-03 12:57:40 -05:00
76e375c488 debugging
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 11:59:28 -05:00
3f9322f659 debugging
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 11:48:22 -05:00
c286d496c3 fix
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-03 11:16:03 -05:00
56ba0fcb83 debugging
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2025-04-03 11:08:48 -05:00
dcafb104ea [Unit Test] Complete WinFSP unit tests #21
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
initial support for winfsp to linux remote testing
initial support for linx to winfsp remote testing
2025-04-02 14:18:35 -05:00
ab757dfd36 [Unit Test] Complete WinFSP unit tests #21
initial support for winfsp to linux remote testing
2025-04-02 14:11:37 -05:00
eec2d2e9a9 fix and refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-02 14:05:10 -05:00
8c1c91e02b fix
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2025-04-02 13:58:29 -05:00
bb85015733 [bug] Remote mount directory listing on Windows connected to Linux is failing #42
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2025-04-02 13:40:15 -05:00
883de836c6 fix missing function name
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-02 11:09:05 -05:00
bf2bdd1b5d [bug] Remote mount directory listing on Windows connected to Linux is failing #42
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-02 10:41:05 -05:00
f1e82d8f9f [bug] Remote mount directory listing on Windows connected to Linux is failing #42
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-04-02 10:21:29 -05:00
f5c4aebdac fix json names 2025-04-02 10:17:23 -05:00
f2f9e8fd15 updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-03-27 10:01:18 -05:00
2a673915af updated CHANGELOG.md 2025-03-27 10:00:06 -05:00
df3db38ae7 letters should be lowercase 2025-03-27 09:58:11 -05:00
b0b69c6dd4 refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-03-26 14:33:34 -05:00
11b118a30f updated version 2025-03-26 07:11:35 -05:00
66 changed files with 783 additions and 618 deletions

View File

@ -1,36 +0,0 @@
{
"configurations": {
"UnixDebug": {
"adapter": "vscode-cpptools",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/build/debug/repertory",
"args": ["-f", "/home/sgraves/mnt"],
"cwd": "${workspaceRoot}/build/debug",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"stopAtEntry": true,
"logging": {
"engineLogging": false
}
}
},
"UnixDebugTest": {
"adapter": "vscode-cpptools",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/build/debug/unittests",
"args": ["--gtest_filter=file_manager.can_close_after_download_timeout"],
"cwd": "${workspaceRoot}/build",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"stopAtEntry": true,
"logging": {
"engineLogging": false
}
}
}
}
}

View File

@ -1,7 +1,26 @@
# Changelog
## v2.0.6-release
### Issues
* ~~\#12 [Unit Test] Complete all providers unit tests~~
* ~~\#21 [Unit Test] Complete WinFSP unit tests~~
* ~~\#22 [Unit Test] Complete FUSE unit tests~~
* ~~\#33 Complete initial v2.0 documentation~~
* \#42 [bug] Remote mount directory listing on Windows connected to Linux is failing
* \#43 [bug] Directories are not importing properly for Sia
* \#44 [bug] Windows-to-Linux remote mount ignores `CREATE_NEW`
* \#45 [bug] Windows-to-Linux remote mount is not handling attempts to remove a non-empty directory properly
* \#46 [bug] Changes to maximum cache size should be updated live
### Changes from v2.0.5-rc
* Drive letters in UI should always be lowercase
## v2.0.5-rc
<!-- markdownlint-disable-next-line -->
### Issues
* \#39 Create management portal in Flutter
@ -69,6 +88,7 @@
## v2.0.2-rc
<!-- markdownlint-disable-next-line -->
### BREAKING CHANGES
* Refactored `config.json` - will need to verify configuration settings prior to mounting

View File

@ -1,20 +1,20 @@
set(BINUTILS_HASH b53606f443ac8f01d1d5fc9c39497f2af322d99e14cea5c0b4b124d630379365)
set(BINUTILS_HASH ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237)
set(BOOST2_HASH 7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca)
set(BOOST_HASH f55c340aa49763b1925ccf02b2e83f35fdcf634c9d5164a2acb87540173c741d)
set(CPP_HTTPLIB_HASH c9b9e0524666e1cd088f0874c57c1ce7c0eaa8552f9f4e15c755d5201fc8c608)
set(CURL_HASH 6edc063d1ebaf9cf3b3b46e9fef2f3cd8932694989ecd43d005d6e828426d09f)
set(EXPAT_HASH 372b18f6527d162fa9658f1c74d22a37429b82d822f5a1e1fc7e00f6045a06a2)
set(BOOST_HASH 3621533e820dcab1e8012afd583c0c73cf0f77694952b81352bf38c1488f9cb4)
set(CPP_HTTPLIB_HASH 18064587e0cc6a0d5d56d619f4cbbcaba47aa5d84d86013abbd45d95c6653866)
set(CURL_HASH ccc5ba45d9f5320c70ffb24e5411b66ba55ea1f333bf78be0963ed90a9328699)
set(EXPAT_HASH 85372797ff0673a8fc4a6be16466bb5a0ca28c0dcf3c6f7ac1686b4a3ba2aabb)
set(GCC_HASH 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293)
set(GTEST_HASH 78c676fc63881529bf97bf9d45948d905a66833fbfa5318ea2cd7478cb98f399)
set(ICU_HASH a2c443404f00098e9e90acf29dc318e049d2dc78d9ae5f46efb261934a730ce2)
set(JSON_HASH 0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
set(JSON_HASH 4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187)
set(LIBSODIUM_HASH 8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1)
set(MINGW_HASH cc41898aac4b6e8dd5cffd7331b9d9515b912df4420a3a612b5ea2955bbeed2f)
set(OPENSSL_HASH 002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3)
set(OPENSSL_HASH 344d0a79f1a9b08029b0744e2cc401a43f9c90acd1044d09a530b4885a8e9fc0)
set(PKG_CONFIG_HASH 6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591)
set(PUGIXML_HASH 655ade57fa703fb421c2eb9a0113b5064bddb145d415dd1f88c79353d90d511a)
set(ROCKSDB_HASH fdccab16133c9d927a183c2648bcea8d956fb41eb1df2aacaa73eb0b95e43724)
set(SPDLOG_HASH 25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc)
set(ROCKSDB_HASH 3fdc9ca996971c4c039959866382c4a3a6c8ade4abf888f3b2ff77153e07bf28)
set(SPDLOG_HASH 7a80896357f3e8e920e85e92633b14ba0f229c506e6f978578bdc35ba09e9a5d)
set(SQLITE_HASH 6cebd1d8403fc58c30e93939b246f3e6e58d0765a5cd50546f16c00fd805d2c3)
set(STDUUID_HASH b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3)
set(ZLIB_HASH 17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c)

View File

@ -1,27 +1,27 @@
set(BINUTILS_VERSION 2.43)
set(BINUTILS_VERSION 2.44)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(BOOST_MAJOR_VERSION 1)
set(BOOST_MINOR_VERSION 87)
set(BOOST_MINOR_VERSION 88)
set(BOOST_PATCH_VERSION 0)
set(CPP_HTTPLIB_VERSION 0.19.0)
set(CURL2_VERSION 8_12_1)
set(CURL_VERSION 8.12.1)
set(EXPAT2_VERSION 2_6_4)
set(EXPAT_VERSION 2.6.4)
set(CPP_HTTPLIB_VERSION 0.20.0)
set(CURL2_VERSION 8_13_0)
set(CURL_VERSION 8.13.0)
set(EXPAT2_VERSION 2_7_1)
set(EXPAT_VERSION 2.7.1)
set(GCC_VERSION 14.2.0)
set(GTEST_VERSION 1.16.0)
set(ICU_VERSION 76-1)
set(JSON_VERSION 3.11.3)
set(JSON_VERSION 3.12.0)
set(LIBSODIUM_VERSION 1.0.20)
set(MESA_VERSION 23.3.3)
set(MINGW_VERSION 12.0.0)
set(OPENSSL_VERSION 3.4.1)
set(OPENSSL_VERSION 3.5.0)
set(PKG_CONFIG_VERSION 0.29.2)
set(PUGIXML_VERSION 1.15)
set(ROCKSDB_VERSION 9.10.0)
set(SPDLOG_VERSION 1.15.1)
set(ROCKSDB_VERSION 10.0.1)
set(SPDLOG_VERSION 1.15.2)
set(SQLITE2_VERSION 3.49.1)
set(SQLITE_VERSION 3490100)
set(STDUUID_VERSION 1.2.3)

View File

@ -10,7 +10,7 @@ PROJECT_DESC="Mount utility for Sia and S3"
PROJECT_MAJOR_VERSION=2
PROJECT_MINOR_VERSION=0
PROJECT_REVISION_VERSION=5
PROJECT_REVISION_VERSION=6
PROJECT_RELEASE_NUM=0
PROJECT_RELEASE_ITER=rc

View File

@ -351,9 +351,9 @@ RUN cd /3rd_party/mingw64 && sha256sum -c ./expat-${MY_EXPAT_VERSION}.tar.gz.sha
ARG FONTCONFIG_VERSION
ENV MY_FONTCONFIG_VERSION=${FONTCONFIG_VERSION}
RUN if [ -f "/3rd_party/fontconfig-${MY_FONTCONFIG_VERSION}.tar.gz" ]; then \
cd /3rd_party && sha256sum -c ./fontconfig-${MY_FONTCONFIG_VERSION}.tar.gz.sha256 && cd - \
&& tar xvzf /3rd_party/fontconfig-${MY_FONTCONFIG_VERSION}.tar.gz \
RUN if [ -f "/3rd_party/fontconfig-${MY_FONTCONFIG_VERSION}.tar.xz" ]; then \
cd /3rd_party && sha256sum -c ./fontconfig-${MY_FONTCONFIG_VERSION}.tar.xz.sha256 && cd - \
&& tar xvJf /3rd_party/fontconfig-${MY_FONTCONFIG_VERSION}.tar.xz \
&& cd fontconfig-${MY_FONTCONFIG_VERSION} \
&& meson setup \
--cross-file ${MY_TOOLCHAIN_FILE_MESON} \

View File

@ -225,8 +225,7 @@ public:
}
if (curl_code != CURLE_OK) {
event_system::instance().raise<curl_error>(curl_code, function_name,
url);
event_system::instance().raise<curl_error>(curl_code, function_name, url);
return false;
}

View File

@ -54,12 +54,13 @@ REPERTORY_IGNORE_WARNINGS_DISABLE()
using namespace std::chrono_literals;
using json = nlohmann::json;
inline constexpr const std::string_view REPERTORY = "repertory";
inline constexpr const std::wstring_view REPERTORY_W = L"repertory";
inline constexpr const std::string_view REPERTORY{"repertory"};
inline constexpr const std::string_view REPERTORY_DATA_NAME{"repertory2"};
inline constexpr const std::wstring_view REPERTORY_W{L"repertory"};
inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 2ULL;
inline constexpr const std::string_view REPERTORY_DATA_NAME = "repertory2";
inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION = "2.0.0";
inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION{2ULL};
inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION{"2.0.0"};
inline constexpr const std::string_view RENTERD_MIN_VERSION{"2.0.0"};
#define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE
@ -221,7 +222,6 @@ using WCHAR = wchar_t;
#define MAX_PATH 260
#define STATUS_SUCCESS std::uint32_t{0U}
#define STATUS_ACCESS_DENIED std::uint32_t{0xC0000022L}
#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L}
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L}
@ -234,11 +234,13 @@ using WCHAR = wchar_t;
#define STATUS_INVALID_HANDLE std::uint32_t{0xC0000006L}
#define STATUS_INVALID_IMAGE_FORMAT std::uint32_t{0xC000007BL}
#define STATUS_INVALID_PARAMETER std::uint32_t{0xC000000DL}
#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L}
#define STATUS_NOT_IMPLEMENTED std::uint32_t{0xC0000002L}
#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L}
#define STATUS_OBJECT_NAME_COLLISION std::uint32_t{0xC0000035L}
#define STATUS_OBJECT_NAME_EXISTS std::uint32_t{0x40000000L}
#define STATUS_OBJECT_NAME_NOT_FOUND std::uint32_t{0xC0000034L}
#define STATUS_OBJECT_PATH_INVALID std::uint32_t{0xC0000039L}
#define STATUS_SUCCESS std::uint32_t{0U}
#define STATUS_UNEXPECTED_IO_ERROR std::uint32_t{0xC00000E9L}
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \

View File

@ -59,7 +59,8 @@ private:
static void populate_stat(const struct stat64 &unix_st, remote::stat &r_stat);
[[nodiscard]] auto update_to_windows_format(json &item) -> json &;
[[nodiscard]] auto update_to_windows_format(const std::string &root_api_path,
json &item) -> json &;
public:
// FUSE Layer

View File

@ -143,14 +143,17 @@ public:
allocation_size, &file_desc, &file_info,
normalized_name, exists);
if (ret == STATUS_SUCCESS) {
if (exists == 0U) {
#if defined(_WIN32)
this->set_client_id(file_desc, client_id);
this->set_client_id(file_desc, client_id);
#else // !defined(_WIN32)
this->set_client_id(
static_cast<native_handle>(
reinterpret_cast<std::uintptr_t>(file_desc)),
client_id);
this->set_client_id(
static_cast<native_handle>(
reinterpret_cast<std::uintptr_t>(file_desc)),
client_id);
#endif // defined(_WIN32)
}
response.encode(file_desc);
response.encode(file_info);
response.encode(normalized_name);
@ -589,8 +592,9 @@ public:
DECODE_OR_RETURN(request, flags);
remote::file_handle handle{};
if ((ret = this->fuse_create(path.data(), mode, flags, handle)) >=
0) {
ret = this->fuse_create(path.data(), mode, flags, handle);
if (ret >= 0) {
#if defined(_WIN32)
this->set_compat_client_id(handle, client_id);
#else // !defined(_WIN32)
@ -846,7 +850,8 @@ public:
DECODE_OR_RETURN(request, flags);
remote::file_handle handle;
if ((ret = this->fuse_open(path.c_str(), flags, handle)) >= 0) {
ret = this->fuse_open(path.c_str(), flags, handle);
if (ret >= 0) {
#if defined(_WIN32)
this->set_compat_client_id(handle, client_id);
#else // !defined(_WIN32)
@ -867,7 +872,8 @@ public:
DECODE_OR_RETURN(request, path);
remote::file_handle handle{0};
if ((ret = this->fuse_opendir(path.c_str(), handle)) >= 0) {
ret = this->fuse_opendir(path.c_str(), handle);
if (ret >= 0) {
this->add_directory(client_id, handle);
response.encode(handle);
}

View File

@ -49,16 +49,28 @@ private:
sia_config sia_config_;
private:
[[nodiscard]] auto create_directory_key(const std::string &api_path) const
-> repertory::api_error;
[[nodiscard]] auto ensure_directory_exists(const std::string &api_path) const
-> api_error;
[[nodiscard]] auto get_object_info(const std::string &api_path,
json &object_info) const -> api_error;
[[nodiscard]] auto get_object_list(const std::string &api_path,
nlohmann::json &object_list) const -> bool;
[[nodiscard]] auto
get_object_list(const std::string &api_path, nlohmann::json &object_list,
std::optional<std::string> marker = std::nullopt) const
-> bool;
[[nodiscard]] auto get_sia_config() const -> const auto & {
return sia_config_;
}
void iterate_objects(
const std::string &api_path, const json &object_list,
std::function<void(const std::string &, bool, json)> handle_entry) const;
protected:
[[nodiscard]] auto create_directory_impl(const std::string &api_path,
api_meta_map &meta)

View File

@ -374,13 +374,13 @@ auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * {
if (not utils::file::change_to_process_directory()) {
utils::error::raise_error(function_name,
"failed to change to process directory");
event_system::instance().raise<unmount_requested>();
event_system::instance().raise<unmount_requested>(function_name);
return this;
}
if (not console_enabled_ && not repertory::project_initialize()) {
utils::error::raise_error(function_name, "failed to initialize repertory");
event_system::instance().raise<unmount_requested>();
event_system::instance().raise<unmount_requested>(function_name);
}
return this;

View File

@ -85,8 +85,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::chown_impl(std::string api_path, uid_t uid,
gid_t gid) -> api_error {
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
-> api_error {
#endif
return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
@ -464,7 +464,7 @@ auto fuse_drive::get_file_size(const std::string &api_path) const
std::uint64_t file_size{};
auto res = provider_.get_file_size(api_path, file_size);
if (res == api_error::success) {
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, api_path, res,
"failed to get file size from provider");
}
@ -494,8 +494,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::getattr_impl(std::string api_path,
struct stat *unix_st) -> api_error {
auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
-> api_error {
#endif
auto parent = utils::path::get_parent_api_path(api_path);
@ -561,8 +561,8 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto fuse_drive::init_impl(struct fuse_conn_info *conn,
struct fuse_config *cfg) -> void * {
auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
-> void * {
#else
void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
#endif
@ -804,8 +804,9 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
return api_error::success;
}
auto fuse_drive::releasedir_impl(
std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error {
auto fuse_drive::releasedir_impl(std::string /*api_path*/,
struct fuse_file_info *file_info)
-> api_error {
auto iter = directory_cache_->get_directory(file_info->fh);
if (iter == nullptr) {
return api_error::invalid_handle;
@ -823,8 +824,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
}
auto fuse_drive::rename_file(const std::string &from_api_path,
const std::string &to_api_path,
bool overwrite) -> int {
const std::string &to_api_path, bool overwrite)
-> int {
auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
errno = std::abs(utils::from_api_error(res));
return (res == api_error::success) ? 0 : -1;
@ -834,8 +835,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
unsigned int /*flags*/) -> api_error {
#else
auto fuse_drive::rename_impl(std::string from_api_path,
std::string to_api_path) -> api_error {
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path)
-> api_error {
#endif
auto res = check_parent_access(to_api_path, W_OK | X_OK);
if (res != api_error::success) {
@ -937,15 +938,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
}
#else // __APPLE__
auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
char *value, size_t size,
int &attribute_size) -> api_error {
char *value, size_t size, int &attribute_size)
-> api_error {
return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
}
#endif // __APPLE__
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
int &required_size,
bool &return_size) -> api_error {
int &required_size, bool &return_size)
-> api_error {
auto check_size = (size == 0);
auto res = check_parent_access(api_path, X_OK);
@ -985,8 +986,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
return res;
}
auto fuse_drive::removexattr_impl(std::string api_path,
const char *name) -> api_error {
auto fuse_drive::removexattr_impl(std::string api_path, const char *name)
-> api_error {
std::string attribute_name;
#if defined(__APPLE__)
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
@ -1014,8 +1015,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
uint32_t position) -> api_error {
#else // __APPLE__
auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size,
int flags) -> api_error {
const char *value, size_t size, int flags)
-> api_error {
#endif
std::string attribute_name;
#if defined(__APPLE__)
@ -1093,8 +1094,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
}
#if defined(__APPLE__)
auto fuse_drive::setattr_x_impl(std::string api_path,
struct setattr_x *attr) -> api_error {
auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
-> api_error {
bool exists{};
auto res = provider_.is_file(api_path, exists);
if (res != api_error::success) {
@ -1148,7 +1149,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
ts[0].tv_sec = attr->acctime.tv_sec;
ts[0].tv_nsec = attr->acctime.tv_nsec;
} else {
struct timeval tv {};
struct timeval tv{};
gettimeofday(&tv, NULL);
ts[0].tv_sec = tv.tv_sec;
ts[0].tv_nsec = tv.tv_usec * 1000;
@ -1193,8 +1194,9 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
return api_error::success;
}
auto fuse_drive::setbkuptime_impl(
std::string api_path, const struct timespec *bkuptime) -> api_error {
auto fuse_drive::setbkuptime_impl(std::string api_path,
const struct timespec *bkuptime)
-> api_error {
return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
auto nanos = bkuptime->tv_nsec +
@ -1230,8 +1232,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
return api_error::success;
}
auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
struct statfs *stbuf) -> api_error {
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
-> api_error {
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
return api_error::os_error;
}
@ -1256,8 +1258,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
return api_error::success;
}
#else // __APPLE__
auto fuse_drive::statfs_impl(std::string /*api_path*/,
struct statvfs *stbuf) -> api_error {
auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf)
-> api_error {
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
return api_error::os_error;
}
@ -1341,8 +1343,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::utimens_impl(std::string api_path,
const struct timespec tv[2]) -> api_error {
auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2])
-> api_error {
#endif
api_meta_map meta;
auto res = provider_.get_item_meta(api_path, meta);

View File

@ -259,7 +259,7 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
if (remote_instance_->fuse_init() != 0) {
utils::error::raise_error(function_name,
"failed to connect to remote server");
event_system::instance().raise<unmount_requested>();
event_system::instance().raise<unmount_requested>(function_name);
} else {
server_ = std::make_shared<server>(config_);
server_->start();

View File

@ -83,17 +83,17 @@ auto remote_server::populate_file_info(const std::string &api_path,
remote::file_info &file_info)
-> packet::error_type {
std::string meta_attributes;
auto directory = utils::file::directory(construct_path(api_path)).exists();
auto error = drive_.get_item_meta(api_path, META_ATTRIBUTES, meta_attributes);
if (error == api_error::success) {
if (meta_attributes.empty()) {
meta_attributes =
utils::file::directory(construct_path(api_path)).exists()
? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_ARCHIVE);
meta_attributes = directory ? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_ARCHIVE);
drive_.set_item_meta(api_path, META_ATTRIBUTES, meta_attributes);
}
const auto attributes = utils::string::to_uint32(meta_attributes);
const auto file_size = drive_.get_file_size(api_path);
auto attributes = utils::string::to_uint32(meta_attributes);
auto file_size = directory ? 0U : drive_.get_file_size(api_path);
populate_file_info(api_path, file_size, attributes, file_info);
return STATUS_SUCCESS;
}
@ -1016,8 +1016,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
auto relative_path = utils::string::to_utf8(file_name);
auto file_path = construct_path(relative_path);
auto ret = static_cast<packet::error_type>(
has_open_info(static_cast<native_handle>(
reinterpret_cast<remote::file_handle>(file_desc)),
@ -1026,13 +1026,12 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
ret = static_cast<packet::error_type>(
utils::file::directory(file_path).exists()
? drive_.get_directory_item_count(
utils::path::create_api_path(relative_path))
? STATUS_DIRECTORY_NOT_EMPTY
: STATUS_SUCCESS
utils::path::create_api_path(relative_path)) == 0U
? STATUS_SUCCESS
: STATUS_DIRECTORY_NOT_EMPTY
: STATUS_SUCCESS);
}
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret);
return ret;
}
@ -1042,17 +1041,20 @@ auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
auto relative_path = utils::string::to_utf8(file_name);
auto file_path = construct_path(relative_path);
was_deleted = 0U;
const auto directory = utils::file::directory(file_path).exists();
auto directory = utils::file::directory(file_path).exists();
if (flags & FileSystemBase::FspCleanupDelete) {
remove_all(file_path);
was_deleted = 1U;
if (directory) {
rmdir(file_path.c_str());
if (drive_.get_directory_item_count(
utils::path::create_api_path(relative_path)) == 0U) {
rmdir(file_path.c_str());
}
} else {
unlink(file_path.c_str());
}
@ -1120,49 +1122,55 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
exists = utils::file::file(file_path).exists();
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
attributes |= FILE_ATTRIBUTE_DIRECTORY;
} else {
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY);
attributes |= FILE_ATTRIBUTE_ARCHIVE;
}
remote::file_mode mode{0U};
std::uint32_t flags{0U};
utils::windows_create_to_unix(create_options, granted_access, flags, mode);
int res = 0;
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
res = mkdir(file_path.c_str(), mode);
if (res >= 0) {
res = open(file_path.c_str(), static_cast<int>(flags));
auto relative_path = utils::string::to_utf8(file_name);
auto file_path = construct_path(relative_path);
exists = utils::file::file{file_path}.exists() ||
utils::file::directory{file_path}.exists()
? 1
: 0;
auto ret{static_cast<packet::error_type>(STATUS_SUCCESS)};
if (exists == 0U) {
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
attributes |= FILE_ATTRIBUTE_DIRECTORY;
} else {
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY);
attributes |= FILE_ATTRIBUTE_ARCHIVE;
}
} else {
res = open(file_path.c_str(), static_cast<int>(flags), mode);
remote::file_mode mode{0U};
std::uint32_t flags{0U};
utils::windows_create_to_unix(create_options, granted_access, flags, mode);
auto res{0};
if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
res = mkdir(file_path.c_str(), mode);
if (res >= 0) {
res = open(file_path.c_str(), static_cast<int>(flags));
}
} else {
res = open(file_path.c_str(), static_cast<int>(flags), mode);
}
if (res >= 0) {
*file_desc = reinterpret_cast<PVOID>(res);
drive_.set_item_meta(construct_api_path(file_path), META_ATTRIBUTES,
std::to_string(attributes));
set_open_info(res, open_info{
"",
nullptr,
{},
file_path,
});
const auto api_path = utils::path::create_api_path(relative_path);
normalized_name = utils::string::replace_copy(api_path, '/', '\\');
populate_file_info(api_path, 0, attributes, *file_info);
}
ret = static_cast<packet::error_type>(
utils::unix_error_to_windows((res < 0) ? errno : 0));
}
if (res >= 0) {
*file_desc = reinterpret_cast<PVOID>(res);
drive_.set_item_meta(construct_api_path(file_path), META_ATTRIBUTES,
std::to_string(attributes));
set_open_info(res, open_info{
"",
nullptr,
{},
file_path,
});
const auto api_path = utils::path::create_api_path(relative_path);
normalized_name = utils::string::replace_copy(api_path, '/', '\\');
populate_file_info(api_path, 0, attributes, *file_info);
}
auto ret = static_cast<packet::error_type>(
utils::unix_error_to_windows((res < 0) ? errno : 0));
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret);
return ret;
}
@ -1261,9 +1269,9 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
const auto directory = utils::file::directory(file_path).exists();
auto relative_path = utils::string::to_utf8(file_name);
auto file_path = construct_path(relative_path);
auto directory = utils::file::directory(file_path).exists();
if (directory) {
create_options |= FILE_DIRECTORY_FILE;
}
@ -1283,7 +1291,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
file_path,
});
const auto api_path = utils::path::create_api_path(relative_path);
auto api_path = utils::path::create_api_path(relative_path);
normalized_name = utils::string::replace_copy(api_path, '/', '\\');
res = populate_file_info(api_path, *file_info);
if (res != STATUS_SUCCESS) {
@ -1390,11 +1398,11 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
item_list.clear();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE));
if (ret == STATUS_SUCCESS) {
const auto api_path = construct_api_path(
auto api_path = construct_api_path(
get_open_file_path(static_cast<native_handle>(handle)));
directory_iterator iterator(drive_.get_directory_items(api_path));
auto offset = marker == nullptr
@ -1405,7 +1413,7 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
json item;
while (iterator.get_json(offset++, item) == 0) {
try {
item_list.emplace_back(update_to_windows_format(item));
item_list.emplace_back(update_to_windows_format(api_path, item));
} catch (const std::exception &e) {
utils::error::raise_error(function_name, e, "exception occurred");
}
@ -1425,25 +1433,32 @@ auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
const auto new_relative_path = utils::string::to_utf8(new_file_name);
const auto new_file_path = construct_path(new_relative_path);
auto relative_path = utils::string::to_utf8(file_name);
auto file_path = construct_path(relative_path);
auto new_relative_path = utils::string::to_utf8(new_file_name);
auto new_file_path = construct_path(new_relative_path);
auto res = -1;
packet::error_type ret{};
auto res{-1};
errno = ENOENT;
if (utils::file::file(file_path).exists()) {
res = drive_.rename_file(construct_api_path(file_path),
construct_api_path(new_file_path),
replace_if_exists != 0U);
ret = ((res < 0) ? static_cast<packet::error_type>(
utils::unix_error_to_windows(errno))
: 0);
} else if (utils::file::directory(file_path).exists()) {
res = drive_.rename_directory(construct_api_path(file_path),
construct_api_path(new_file_path));
ret =
((res < 0) ? errno == EISDIR
? static_cast<packet::error_type>(STATUS_ACCESS_DENIED)
: static_cast<packet::error_type>(
utils::unix_error_to_windows(errno))
: 0);
}
auto ret = ((res < 0) ? static_cast<packet::error_type>(
utils::unix_error_to_windows(errno))
: 0);
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path + "|" + new_file_path,
ret);
return ret;
@ -1679,30 +1694,53 @@ auto remote_server::json_release_directory_snapshot(
return 0;
}
auto remote_server::update_to_windows_format(json &item) -> json & {
const auto api_path = item["path"].get<std::string>();
item["meta"][META_ACCESSED] = std::to_string(
utils::string::to_uint64(empty_as_zero(item["meta"][META_ACCESSED])));
item["meta"][META_CREATION] = std::to_string(
utils::string::to_uint64(empty_as_zero(item["meta"][META_CREATION])));
item["meta"][META_MODIFIED] = std::to_string(
utils::string::to_uint64(empty_as_zero(item["meta"][META_MODIFIED])));
auto remote_server::update_to_windows_format(const std::string &root_api_path,
json &item) -> json & {
REPERTORY_USES_FUNCTION_NAME();
if (item["meta"][META_WRITTEN].empty() ||
(item["meta"][META_WRITTEN].get<std::string>() == "0") ||
(item["meta"][META_WRITTEN].get<std::string>() ==
std::to_string(utils::time::WIN32_TIME_CONVERSION))) {
drive_.set_item_meta(api_path, META_WRITTEN,
item["meta"][META_MODIFIED].get<std::string>());
item["meta"][META_WRITTEN] = item["meta"][META_MODIFIED];
auto api_path = item[JSON_API_PATH].get<std::string>();
if (api_path == "." || api_path == "..") {
auto orig_api_path{api_path};
api_path = api_path == "."
? root_api_path
: utils::path::get_parent_api_path(root_api_path);
api_meta_map meta;
auto res = drive_.get_item_meta(api_path, meta);
if (res != api_error::success) {
utils::error::raise_api_path_error(
function_name, api_path, res,
fmt::format("failed to get '{}' meta", orig_api_path));
return item;
}
item[JSON_META] = meta;
}
if (item["meta"][META_ATTRIBUTES].empty()) {
item["meta"][META_ATTRIBUTES] =
item["directory"].get<bool>() ? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_ARCHIVE);
item[JSON_META][META_ACCESSED] = std::to_string(
utils::string::to_uint64(empty_as_zero(item[JSON_META][META_ACCESSED])));
item[JSON_META][META_CREATION] = std::to_string(
utils::string::to_uint64(empty_as_zero(item[JSON_META][META_CREATION])));
item[JSON_META][META_MODIFIED] = std::to_string(
utils::string::to_uint64(empty_as_zero(item[JSON_META][META_MODIFIED])));
if (item[JSON_META][META_WRITTEN].empty() ||
(item[JSON_META][META_WRITTEN].get<std::string>() == "0") ||
(item[JSON_META][META_WRITTEN].get<std::string>() ==
std::to_string(utils::time::WIN32_TIME_CONVERSION))) {
drive_.set_item_meta(api_path, META_WRITTEN,
item[JSON_META][META_MODIFIED].get<std::string>());
item[JSON_META][META_WRITTEN] = item[JSON_META][META_MODIFIED];
}
if (item[JSON_META][META_ATTRIBUTES].empty()) {
item[JSON_META][META_ATTRIBUTES] =
item[JSON_DIRECTORY].get<bool>()
? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_ARCHIVE);
drive_.set_item_meta(api_path, META_ATTRIBUTES,
item["meta"][META_ATTRIBUTES].get<std::string>());
item[JSON_META][META_ATTRIBUTES].get<std::string>());
}
return item;

View File

@ -188,7 +188,7 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
DECODE_OR_IGNORE(&response, normalized_name);
DECODE_OR_IGNORE(&response, exists);
if (ret == STATUS_SUCCESS) {
if (exists == 0U) {
*file_desc = reinterpret_cast<PVOID>(handle);
set_open_info(to_handle(*file_desc),
open_info{
@ -197,12 +197,12 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
{},
utils::string::to_utf8(file_name),
});
#if defined(_WIN32)
if (exists) {
::SetLastError(ERROR_ALREADY_EXISTS);
}
#endif
}
#if defined(_WIN32)
else {
ret = STATUS_OBJECT_NAME_COLLISION;
}
#endif // defined(_WIN32)
}
return ret;

View File

@ -1061,7 +1061,7 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
auto file_path = utils::string::from_utf8(utils::path::combine(
mount_location_, {utils::string::to_utf8(file_name)}));
auto ret = STATUS_BUFFER_OVERFLOW;
auto ret{STATUS_BUFFER_OVERFLOW};
if ((descriptor_size == nullptr) ||
(*descriptor_size <= std::numeric_limits<SIZE_T>::max())) {
auto *descriptor = descriptor_size == nullptr

View File

@ -131,14 +131,14 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
UINT64 allocation_size, PVOID * /*file_node*/,
PVOID *file_desc, OpenFileInfo *ofi)
-> NTSTATUS {
remote::file_info fi{};
remote::file_info f_info{};
std::string normalized_name;
BOOLEAN exists = 0;
BOOLEAN exists{0};
auto ret = remote_instance_->winfsp_create(
file_name, create_options, granted_access, attributes, allocation_size,
file_desc, &fi, normalized_name, exists);
file_desc, &f_info, normalized_name, exists);
if (ret == STATUS_SUCCESS) {
set_file_info(ofi->FileInfo, fi);
set_file_info(ofi->FileInfo, f_info);
auto file_path = utils::string::from_utf8(normalized_name);
wcsncpy(ofi->NormalizedName, file_path.data(), wcslen(file_path.c_str()));
ofi->NormalizedNameSize =
@ -168,24 +168,32 @@ auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size)
-> NTSTATUS {
std::uint64_t sds{
(descriptor_size == nullptr) ? 0U : *descriptor_size,
};
std::wstring string_descriptor;
std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
auto ret = remote_instance_->winfsp_get_security_by_name(
file_name, attributes, descriptor_size ? &sds : nullptr,
string_descriptor);
*descriptor_size = static_cast<SIZE_T>(sds);
if ((ret == STATUS_SUCCESS) && *descriptor_size) {
PSECURITY_DESCRIPTOR sd{nullptr};
ULONG sz2{0U};
auto ret{
remote_instance_->winfsp_get_security_by_name(
file_name, attributes, descriptor_size ? &sds : nullptr,
string_descriptor),
};
if ((ret == STATUS_SUCCESS) && (descriptor_size != nullptr)) {
*descriptor_size = static_cast<SIZE_T>(sds);
PSECURITY_DESCRIPTOR desc{nullptr};
ULONG size{0U};
if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(
string_descriptor.data(), SDDL_REVISION_1, &sd, &sz2)) {
if (sz2 > *descriptor_size) {
string_descriptor.data(), SDDL_REVISION_1, &desc, &size)) {
if (size > *descriptor_size) {
ret = STATUS_BUFFER_TOO_SMALL;
} else {
::CopyMemory(descriptor, sd, sz2);
::CopyMemory(descriptor, desc, size);
}
*descriptor_size = sz2;
::LocalFree(sd);
*descriptor_size = size;
::LocalFree(desc);
} else {
ret = FspNtStatusFromWin32(::GetLastError());
}
@ -361,11 +369,10 @@ auto remote_winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
&ret)) {
auto item_found = false;
for (const auto &item : item_list) {
auto item_path = item["path"].get<std::string>();
auto item_path = item[JSON_API_PATH].get<std::string>();
auto display_name = utils::string::from_utf8(
utils::path::strip_to_file_name(item_path));
if (not marker || (marker && item_found)) {
// if (not utils::path::is_ads_file_path(item_path)) {
union {
UINT8 B[FIELD_OFFSET(FSP_FSCTL_DIR_INFO, FileNameBuf) +
((repertory::max_path_length + 1U) * sizeof(WCHAR))];
@ -380,10 +387,8 @@ auto remote_winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
display_name.size()) *
sizeof(WCHAR)));
if (not item["meta"].empty() ||
((item_path != ".") && (item_path != ".."))) {
populate_file_info(item, directory_info->FileInfo);
}
populate_file_info(item, directory_info->FileInfo);
if (ret == STATUS_SUCCESS) {
::wcscpy_s(&directory_info->FileNameBuf[0],
repertory::max_path_length, &display_name[0]);
@ -394,7 +399,6 @@ auto remote_winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
break;
}
}
// }
} else {
item_found = display_name == std::wstring(marker);
}
@ -418,8 +422,13 @@ auto remote_winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
auto remote_winfsp_drive::Rename(PVOID /*file_node*/, PVOID file_desc,
PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> NTSTATUS {
return remote_instance_->winfsp_rename(file_desc, file_name, new_file_name,
replace_if_exists);
auto res = remote_instance_->winfsp_rename(file_desc, file_name,
new_file_name, replace_if_exists);
if (res == STATUS_OBJECT_NAME_EXISTS) {
return FspNtStatusFromWin32(ERROR_ALREADY_EXISTS);
}
return res;
}
auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
@ -428,11 +437,11 @@ auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT64 last_write_time,
UINT64 change_time, FileInfo *file_info)
-> NTSTATUS {
remote::file_info fi{};
remote::file_info f_info{};
auto ret = remote_instance_->winfsp_set_basic_info(
file_desc, attributes, creation_time, last_access_time, last_write_time,
change_time, &fi);
set_file_info(*file_info, fi);
change_time, &f_info);
set_file_info(*file_info, f_info);
return ret;
}
@ -473,7 +482,6 @@ VOID remote_winfsp_drive::Unmounted(PVOID host) {
}
remote_instance_->winfsp_unmounted(file_system_host->MountPoint());
remote_instance_.reset();
mount_location_ = "";
}
auto remote_winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc,

View File

@ -26,7 +26,7 @@
#include "events/types/invalid_cache_size.hpp"
#include "events/types/max_cache_size_reached.hpp"
#include "types/startup_exception.hpp"
#include "utils/file_utils.hpp"
#include "utils/file.hpp"
namespace repertory {
cache_size_mgr cache_size_mgr::instance_{};
@ -49,16 +49,15 @@ auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
auto last_cache_size{cache_size_};
cache_size_ += size;
auto max_cache_size{cfg_->get_max_cache_size_bytes()};
auto cache_dir{
utils::file::directory{cfg_->get_cache_directory()},
};
while (not get_stop_requested() && cache_size_ > max_cache_size &&
while (not get_stop_requested() &&
cache_size_ > cfg_->get_max_cache_size_bytes() &&
cache_dir.count() > 1U) {
if (last_cache_size != cache_size_) {
event_system::instance().raise<max_cache_size_reached>(
cache_size_, function_name, max_cache_size);
cache_size_, function_name, cfg_->get_max_cache_size_bytes());
last_cache_size = cache_size_;
}
notify_.wait_for(lock, cache_wait_secs);

View File

@ -40,7 +40,6 @@
#include "utils/file_utils.hpp"
#include "utils/path.hpp"
#include "utils/polling.hpp"
#include <spdlog/fmt/bundled/base.h>
namespace repertory {
encrypt_provider::encrypt_provider(app_config &config)
@ -225,8 +224,7 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
}
if (result == api_error::directory_not_found) {
process_directory_entry(*dir_entry.get(), cfg,
current_api_path);
process_directory_entry(*dir_entry, cfg, current_api_path);
result = db_->get_directory_api_path(dir_entry->get_path(),
current_api_path);
@ -247,7 +245,7 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
continue;
}
if (result == api_error::item_not_found &&
not process_directory_entry(*dir_entry.get(), cfg,
not process_directory_entry(*dir_entry, cfg,
current_api_path)) {
continue;
}
@ -347,12 +345,12 @@ auto encrypt_provider::get_file_list(api_file_list &list,
for (const auto &dir_entry : utils::file::directory{path}.get_items()) {
std::string api_path{};
if (dir_entry->is_directory_item()) {
process_directory_entry(*dir_entry.get(), cfg, api_path);
process_directory_entry(*dir_entry, cfg, api_path);
process_directory(dir_entry->get_path());
continue;
}
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
if (process_directory_entry(*dir_entry, cfg, api_path)) {
list.emplace_back(create_api_file(
api_path, dir_entry->is_directory_item(), dir_entry->get_path()));
}

View File

@ -67,7 +67,7 @@ auto sia_provider::check_version(std::string &required_version,
std::string &returned_version) const -> bool {
REPERTORY_USES_FUNCTION_NAME();
required_version = "2.0.0";
required_version = RENTERD_MIN_VERSION;
try {
curl::requests::http_get get{};
@ -149,12 +149,58 @@ auto sia_provider::create_directory_impl(const std::string &api_path,
return api_error::success;
}
auto sia_provider::create_directory_key(const std::string &api_path) const
-> api_error {
auto parent_api_path = utils::path::get_parent_api_path(api_path);
json object_list;
if (not get_object_list(parent_api_path, object_list)) {
return api_error::comm_error;
}
if (not object_list.contains("objects")) {
return api_error::directory_not_found;
}
const auto &list = object_list.at("objects");
if (std::ranges::find_if(list, [&api_path](auto &&entry) -> bool {
return entry.at("key").template get<std::string>() == api_path + '/';
}) == list.end()) {
return api_error::directory_not_found;
}
api_meta_map meta;
return const_cast<sia_provider *>(this)->create_directory_impl(api_path,
meta);
}
auto sia_provider::ensure_directory_exists(const std::string &api_path) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
bool exists{};
auto res{is_directory(api_path, exists)};
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, api_path, res,
"failed detect existing directory");
return res;
}
if (not exists) {
utils::error::raise_api_path_error(function_name, api_path, res,
"directory not found");
return api_error::directory_not_found;
}
return api_error::success;
}
auto sia_provider::get_directory_item_count(const std::string &api_path) const
-> std::uint64_t {
REPERTORY_USES_FUNCTION_NAME();
try {
json object_list{};
json object_list;
if (not get_object_list(api_path, object_list)) {
return 0U;
}
@ -192,41 +238,25 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path,
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
json object_list{};
json object_list;
if (not get_object_list(api_path, object_list)) {
return api_error::comm_error;
}
if (object_list.contains("objects")) {
for (const auto &entry : object_list.at("objects")) {
try {
auto name{entry.at("key").get<std::string>()};
auto entry_api_path{utils::path::create_api_path(name)};
auto directory{utils::string::ends_with(name, "/")};
if (directory && (entry_api_path == api_path)) {
continue;
iterate_objects(
api_path, object_list,
[&](auto &&entry_api_path, auto &&directory, auto &&entry) {
api_meta_map meta;
auto res{get_item_meta(entry_api_path, meta)};
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, entry_api_path, res,
"failed to get item meta");
return;
}
api_file file{};
api_meta_map meta{};
if (get_item_meta(entry_api_path, meta) == api_error::item_not_found) {
file = create_api_file(entry_api_path, "",
directory ? 0U
: entry["size"].get<std::uint64_t>(),
get_last_modified(entry));
get_api_item_added()(directory, file);
auto res{get_item_meta(entry_api_path, meta)};
if (res != api_error::success) {
utils::error::raise_api_path_error(function_name, entry_api_path,
res, "failed to get item meta");
continue;
}
} else {
file = create_api_file(
entry_api_path,
directory ? 0U : entry["size"].get<std::uint64_t>(), meta);
}
auto file = create_api_file(
entry_api_path,
directory ? 0U : entry["size"].template get<std::uint64_t>(), meta);
directory_item dir_item{};
dir_item.api_parent = file.api_parent;
@ -235,13 +265,7 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path,
dir_item.meta = meta;
dir_item.size = file.file_size;
list.emplace_back(std::move(dir_item));
} catch (const std::exception &e) {
utils::error::raise_api_path_error(function_name, api_path, e,
"failed to process entry|" +
entry.dump());
}
}
}
});
return api_error::success;
}
@ -290,73 +314,45 @@ auto sia_provider::get_file(const std::string &api_path, api_file &file) const
return api_error::error;
}
auto sia_provider::get_file_list(api_file_list &list,
std::string & /* marker */) const
auto sia_provider::get_file_list(api_file_list &list, std::string &marker) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
using dir_func = std::function<api_error(std::string api_path)>;
const dir_func get_files_in_dir = [&](std::string api_path) -> api_error {
try {
nlohmann::json object_list{};
if (not get_object_list(api_path, object_list)) {
return api_error::comm_error;
}
if (object_list.contains("objects")) {
for (const auto &entry : object_list.at("objects")) {
auto name{entry.at("key").get<std::string>()};
auto entry_api_path{utils::path::create_api_path(name)};
if (utils::string::ends_with(name, "/")) {
if (entry_api_path == utils::path::create_api_path(api_path)) {
continue;
}
api_meta_map meta{};
if (get_item_meta(entry_api_path, meta) ==
api_error::item_not_found) {
auto dir{
create_api_file(entry_api_path, "", 0U,
get_last_modified(entry)),
};
get_api_item_added()(true, dir);
}
auto res{get_files_in_dir(entry_api_path)};
if (res != api_error::success) {
return res;
}
continue;
}
api_file file{};
api_meta_map meta{};
if (get_item_meta(entry_api_path, meta) ==
api_error::item_not_found) {
file = create_api_file(entry_api_path, "",
entry["size"].get<std::uint64_t>(),
get_last_modified(entry));
get_api_item_added()(false, file);
} else {
file = create_api_file(entry_api_path,
entry["size"].get<std::uint64_t>(), meta);
}
list.emplace_back(std::move(file));
}
}
return api_error::success;
} catch (const std::exception &e) {
utils::error::raise_api_path_error(function_name, api_path, e,
"failed to process directory");
try {
json object_list;
if (not get_object_list("", object_list, marker)) {
return api_error::comm_error;
}
return api_error::error;
};
iterate_objects("/", object_list,
[&](auto &&entry_api_path, auto &&directory, auto &&entry) {
if (directory) {
return;
}
return get_files_in_dir("");
api_meta_map meta;
auto res{get_item_meta(entry_api_path, meta)};
if (res != api_error::success) {
utils::error::raise_api_path_error(
function_name, entry_api_path, res,
"failed to get item meta");
return;
}
list.emplace_back(create_api_file(
entry_api_path,
entry["size"].template get<std::uint64_t>(), meta));
});
marker = object_list.at("nextMarker").get<std::string>();
return object_list.at("hasMore").get<bool>() ? api_error::more_data
: api_error::success;
} catch (const std::exception &e) {
utils::error::raise_api_path_error(function_name, "/", e,
"failed to process directory");
}
return api_error::error;
}
auto sia_provider::get_object_info(const std::string &api_path,
@ -408,7 +404,9 @@ auto sia_provider::get_object_info(const std::string &api_path,
}
auto sia_provider::get_object_list(const std::string &api_path,
nlohmann::json &object_list) const -> bool {
nlohmann::json &object_list,
std::optional<std::string> marker) const
-> bool {
REPERTORY_USES_FUNCTION_NAME();
try {
@ -416,7 +414,12 @@ auto sia_provider::get_object_list(const std::string &api_path,
get.allow_timeout = true;
get.path = "/api/bus/objects" + api_path + "/";
get.query["bucket"] = get_bucket(get_sia_config());
get.query["delimiter"] = "/";
if (marker.has_value()) {
get.query["limit"] = "1000";
get.query["marker"] = marker.value();
} else {
get.query["delimiter"] = "/";
}
std::string error_data;
get.response_handler = [&error_data, &object_list](auto &&data,
@ -513,6 +516,14 @@ auto sia_provider::is_directory(const std::string &api_path, bool &exists) const
json file_data{};
auto res{get_object_info(api_path + '/', file_data)};
if (res == api_error::item_not_found) {
if (create_directory_key(api_path) == api_error::success) {
exists = true;
return api_error::success;
}
}
if (res == api_error::directory_not_found ||
res == api_error::item_not_found) {
return api_error::success;
}
@ -609,6 +620,52 @@ auto sia_provider::is_online() const -> bool {
return false;
}
void sia_provider::iterate_objects(
const std::string &api_path, const json &object_list,
std::function<void(const std::string &, bool, json)> handle_entry) const {
REPERTORY_USES_FUNCTION_NAME();
if (not object_list.contains("objects")) {
return;
}
for (const auto &entry : object_list.at("objects")) {
try {
auto name{entry.at("key").get<std::string>()};
auto directory{utils::string::ends_with(name, "/")};
auto entry_api_path{utils::path::create_api_path(name)};
{
api_meta_map meta{};
if (get_item_meta(entry_api_path, meta) == api_error::item_not_found) {
auto file = create_api_file(
entry_api_path, "",
directory ? 0U : entry["size"].get<std::uint64_t>(),
get_last_modified(entry));
if (directory) {
auto res{ensure_directory_exists(entry_api_path)};
if (res != api_error::success) {
utils::error::raise_api_path_error(
function_name, entry_api_path, res,
"failed detect existing directory");
continue;
}
}
get_api_item_added()(directory, file);
}
}
handle_entry(entry_api_path, directory, entry);
} catch (const std::exception &e) {
utils::error::raise_api_path_error(
function_name, api_path, e,
fmt::format("failed to process entry|{}", entry.dump()));
}
}
}
auto sia_provider::read_file_bytes(const std::string &api_path,
std::size_t size, std::uint64_t offset,
data_buffer &buffer,
@ -636,7 +693,6 @@ auto sia_provider::read_file_bytes(const std::string &api_path,
++idx) {
long response_code{};
const auto notify_retry = [&]() {
fmt::println("{}", std::string(buffer.begin(), buffer.end()));
if (response_code == 0) {
utils::error::raise_api_path_error(
function_name, api_path, api_error::comm_error,

View File

@ -68,7 +68,9 @@ void server::handle_set_config_value_by_name(const httplib::Request &req,
void server::handle_unmount(const httplib::Request & /*req*/,
httplib::Response &res) {
event_system::instance().raise<unmount_requested>();
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<unmount_requested>(function_name);
res.status = http_error_codes::ok;
}

View File

@ -79,7 +79,7 @@ private:
void handle_get_mount(const httplib::Request &req,
httplib::Response &res) const;
void handle_get_mount_list(httplib::Response &res) const;
static void handle_get_mount_list(httplib::Response &res);
void handle_get_mount_location(const httplib::Request &req,
httplib::Response &res) const;

View File

@ -44,7 +44,7 @@ auto main(int argc, char **argv) -> int {
std::vector<const char *> args;
{
auto args_span = std::span(argv, static_cast<std::size_t>(argc));
std::copy(args_span.begin(), args_span.end(), std::back_inserter(args));
std::ranges::copy(args_span, std::back_inserter(args));
}
if (argc == 1) {

View File

@ -34,7 +34,9 @@
#include "utils/path.hpp"
#include "utils/string.hpp"
#include <boost/process.hpp>
#include <boost/process/v1/args.hpp>
#include <boost/process/v1/child.hpp>
#include <boost/process/v1/io.hpp>
namespace {
[[nodiscard]] auto decrypt(std::string_view data, std::string_view password)
@ -183,7 +185,7 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
handle_get_mount_location(req, res);
});
server->Get("/api/v1/mount_list", [this](auto && /* req */, auto &&res) {
server->Get("/api/v1/mount_list", [](auto && /* req */, auto &&res) {
handle_get_mount_list(res);
});
@ -326,9 +328,9 @@ void handlers::handle_put_mount_location(const httplib::Request &req,
void handlers::handle_get_available_locations(httplib::Response &res) {
#if defined(_WIN32)
constexpr const std::array<std::string_view, 26U> letters{
"A:", "B:", "C:", "D:", "E:", "F:", "G:", "H:", "I:",
"J:", "K:", "L:", "M:", "N:", "O:", "P:", "Q:", "R:",
"S:", "T:", "U:", "V:", "W:", "X:", "Y:", "Z:",
"a:", "b:", "c:", "d:", "e:", "f:", "g:", "h:", "i:",
"j:", "k:", "l:", "m:", "n:", "o:", "p:", "q:", "r:",
"s:", "t:", "u:", "v:", "w:", "x:", "y:", "z:",
};
auto available = std::accumulate(
@ -382,7 +384,7 @@ void handlers::handle_get_mount(const httplib::Request &req,
res.status = http_error_codes::ok;
}
void handlers::handle_get_mount_list(httplib::Response &res) const {
void handlers::handle_get_mount_list(httplib::Response &res) {
auto data_dir = utils::file::directory{app_config::get_root_data_directory()};
nlohmann::json result;
@ -693,9 +695,10 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
return {};
}
boost::process::ipstream out;
boost::process::child proc(repertory_binary_, boost::process::args(args),
boost::process::std_out > out);
boost::process::v1::ipstream out;
boost::process::v1::child proc(repertory_binary_,
boost::process::v1::args(args),
boost::process::v1::std_out > out);
std::string data;
std::string line;

View File

@ -54,21 +54,31 @@ namespace repertory {
struct local_s3 final {
static constexpr const provider_type type{provider_type::s3};
static constexpr const provider_type type2{provider_type::s3};
static constexpr const std::uint16_t port{0U};
};
struct local_sia final {
static constexpr const provider_type type{provider_type::sia};
static constexpr const provider_type type2{provider_type::sia};
static constexpr const std::uint16_t port{0U};
};
struct remote_s3 final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::s3};
static constexpr const std::uint16_t port{0U};
};
struct remote_sia final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::sia};
static constexpr const std::uint16_t port{0U};
};
struct remote_linux_to_winfsp final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::unknown};
static constexpr const std::uint16_t port{40001U};
};
template <typename provider_t> class fuse_test : public ::testing::Test {
@ -113,7 +123,7 @@ protected:
auto r_cfg = config->get_remote_mount();
r_cfg.enable = true;
r_cfg.api_port = 30000U;
r_cfg.api_port = 40000U;
config->set_remote_mount(r_cfg);
}
@ -160,7 +170,7 @@ protected:
auto r_cfg = config->get_remote_mount();
r_cfg.enable = true;
r_cfg.api_port = 30000U;
r_cfg.api_port = 40000U;
config->set_remote_mount(r_cfg);
}
@ -178,7 +188,7 @@ protected:
execute_mount(drive_args, mount_location);
};
const auto mount_remote = [&]() {
const auto mount_remote = [&](std::uint16_t port = 40000U) {
{
mount_location2 = mount_location;
@ -187,7 +197,8 @@ protected:
{
"fuse_test",
app_config::get_provider_name(provider_t::type) + '_' +
app_config::get_provider_name(provider_t::type2),
app_config::get_provider_name(provider_t::type2) + '_' +
std::to_string(port),
});
mount_location = utils::path::combine(test_directory, {"mount"});
@ -206,7 +217,7 @@ protected:
"-dd",
config2->get_data_directory(),
"-rm",
"localhost:30000",
fmt::format("localhost:{}", port),
mount_location,
});
}
@ -233,6 +244,10 @@ protected:
mount_sia();
} break;
case provider_type::unknown:
mount_remote(provider_t::port);
return;
default:
throw std::runtime_error("remote provider type is not implemented");
return;
@ -410,9 +425,15 @@ std::string fuse_test<provider_t>::mount_location;
template <typename provider_t>
std::string fuse_test<provider_t>::mount_location2;
// using fuse_provider_types = ::testing::Types<local_s3, remote_s3>;
#if defined(__linux__)
using fuse_provider_types =
::testing::Types<local_s3, remote_s3, local_sia, remote_sia>;
// using fuse_provider_types =
// ::testing::Types<local_s3, remote_s3, local_sia, remote_sia,
// remote_linux_to_winfsp>;
#else // !defined(__linux__)
build fails here
#endif // defined(_WIN32)
} // namespace repertory
#endif // !defined(_WIN32)

View File

@ -45,21 +45,31 @@ namespace repertory {
struct local_s3 final {
static constexpr const provider_type type{provider_type::s3};
static constexpr const provider_type type2{provider_type::s3};
static constexpr const std::uint16_t port{0U};
};
struct local_sia final {
static constexpr const provider_type type{provider_type::sia};
static constexpr const provider_type type2{provider_type::sia};
static constexpr const std::uint16_t port{0U};
};
struct remote_s3 final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::s3};
static constexpr const std::uint16_t port{0U};
};
struct remote_sia final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::sia};
static constexpr const std::uint16_t port{0U};
};
struct remote_winfsp_to_linux final {
static constexpr const provider_type type{provider_type::remote};
static constexpr const provider_type type2{provider_type::unknown};
static constexpr const std::uint16_t port{40001U};
};
template <typename provider_t> class winfsp_test : public ::testing::Test {
@ -102,7 +112,7 @@ protected:
auto r_cfg = config->get_remote_mount();
r_cfg.enable = true;
r_cfg.api_port = 30000U;
r_cfg.api_port = 40000U;
config->set_remote_mount(r_cfg);
}
@ -144,7 +154,7 @@ protected:
auto r_cfg = config->get_remote_mount();
r_cfg.enable = true;
r_cfg.api_port = 30000U;
r_cfg.api_port = 40000U;
config->set_remote_mount(r_cfg);
}
@ -160,13 +170,15 @@ protected:
execute_mount(drive_args, mount_location);
};
const auto mount_remote = [&]() {
const auto mount_remote = [&](std::uint16_t port = 40000U) {
{
auto test_directory = utils::path::combine(
test::get_test_output_dir(),
{
"winfsp_test",
app_config::get_provider_name(provider_type::remote),
app_config::get_provider_name(provider_t::type) + '_' +
app_config::get_provider_name(provider_t::type2) + '_' +
std::to_string(port),
});
mount_location2 = mount_location;
@ -184,7 +196,7 @@ protected:
"-dd",
config->get_data_directory(),
"-rm",
"localhost:30000",
fmt::format("localhost:{}", port),
mount_location,
});
}
@ -211,6 +223,10 @@ protected:
mount_sia();
} break;
case provider_type::unknown:
mount_remote(provider_t::port);
return;
default:
throw std::runtime_error("remote provider type is not implemented");
return;
@ -228,7 +244,9 @@ protected:
static void TearDownTestCase() {
if (provider_t::type == provider_type::remote) {
execute_unmount(drive_args2, mount_location);
execute_unmount(drive_args, mount_location2);
if (provider_t::type2 != provider_type::unknown) {
execute_unmount(drive_args, mount_location2);
}
} else {
execute_unmount(drive_args, mount_location);
}
@ -245,6 +263,7 @@ protected:
}
static void execute_unmount(auto args, auto location) {
std::this_thread::sleep_for(10s);
auto unmounted{false};
auto unmount_cmd =
@ -282,7 +301,8 @@ std::string winfsp_test<provider_t>::mount_location2;
// using winfsp_provider_types = ::testing::Types<local_s3, remote_s3,
// local_sia, remote_sia>;
using winfsp_provider_types = ::testing::Types<local_s3, remote_s3>;
// using winfsp_provider_types = ::testing::Types<local_s3, remote_s3>;
using winfsp_provider_types = ::testing::Types<remote_winfsp_to_linux>;
} // namespace repertory
#endif // defined(_WIN32)

View File

@ -73,6 +73,9 @@ TYPED_TEST(winfsp_test, rename_fails_if_dest_exists_and_replace_is_false) {
auto file_path2{
utils::path::combine(dir_path, {"test_file2_4"}),
};
auto file_path3{
utils::path::combine(dir_path, {"test_file_5"}),
};
ASSERT_TRUE(::CreateDirectoryA(dir_path.c_str(), nullptr));
@ -84,9 +87,16 @@ TYPED_TEST(winfsp_test, rename_fails_if_dest_exists_and_replace_is_false) {
EXPECT_TRUE(::MoveFileExA(file_path.c_str(), file_path2.c_str(), 0));
EXPECT_FALSE(::MoveFileExA(file_path.c_str(), file_path2.c_str(), 0));
handle = ::CreateFileA(file_path3.c_str(), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
::CloseHandle(handle);
EXPECT_FALSE(::MoveFileExA(file_path3.c_str(), file_path2.c_str(), 0));
EXPECT_EQ(ERROR_ALREADY_EXISTS, ::GetLastError());
EXPECT_TRUE(::DeleteFileA(file_path3.c_str()));
EXPECT_TRUE(::DeleteFileA(file_path2.c_str()));
EXPECT_TRUE(::RemoveDirectoryA(dir_path.c_str()));
}
@ -105,6 +115,9 @@ TYPED_TEST(winfsp_test, rename_succeeds_if_dest_exists_and_replace_is_true) {
auto file_path2{
utils::path::combine(dir_path, {"test_file2_4"}),
};
auto file_path3{
utils::path::combine(dir_path, {"test_file_5"}),
};
ASSERT_TRUE(::CreateDirectoryA(dir_path.c_str(), nullptr));
@ -116,13 +129,13 @@ TYPED_TEST(winfsp_test, rename_succeeds_if_dest_exists_and_replace_is_true) {
EXPECT_TRUE(::MoveFileExA(file_path.c_str(), file_path2.c_str(), 0));
handle = ::CreateFileA(file_path.c_str(), GENERIC_READ | GENERIC_WRITE,
handle = ::CreateFileA(file_path3.c_str(), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
::CloseHandle(handle);
EXPECT_TRUE(::MoveFileExA(file_path.c_str(), file_path2.c_str(),
EXPECT_TRUE(::MoveFileExA(file_path3.c_str(), file_path2.c_str(),
MOVEFILE_REPLACE_EXISTING));
EXPECT_TRUE(::DeleteFileA(file_path2.c_str()));

View File

@ -1,30 +1,30 @@
#!/bin/bash
declare -A PROJECT_VERSIONS
PROJECT_VERSIONS[BINUTILS]="2.43"
PROJECT_VERSIONS[BINUTILS]="2.44"
PROJECT_VERSIONS[BOOST2_MAJOR]="1"
PROJECT_VERSIONS[BOOST2_MINOR]="76"
PROJECT_VERSIONS[BOOST2_PATCH]="0"
PROJECT_VERSIONS[BOOST_MAJOR]="1"
PROJECT_VERSIONS[BOOST_MINOR]="87"
PROJECT_VERSIONS[BOOST_MINOR]="88"
PROJECT_VERSIONS[BOOST_PATCH]="0"
PROJECT_VERSIONS[CPP_HTTPLIB]="0.19.0"
PROJECT_VERSIONS[CURL]="8.12.1"
PROJECT_VERSIONS[CURL2]="8_12_1"
PROJECT_VERSIONS[EXPAT]="2.6.4"
PROJECT_VERSIONS[EXPAT2]="2_6_4"
PROJECT_VERSIONS[CPP_HTTPLIB]="0.20.0"
PROJECT_VERSIONS[CURL]="8.13.0"
PROJECT_VERSIONS[CURL2]="8_13_0"
PROJECT_VERSIONS[EXPAT]="2.7.1"
PROJECT_VERSIONS[EXPAT2]="2_7_1"
PROJECT_VERSIONS[GCC]="14.2.0"
PROJECT_VERSIONS[GTEST]="1.16.0"
PROJECT_VERSIONS[ICU]="76-1"
PROJECT_VERSIONS[JSON]="3.11.3"
PROJECT_VERSIONS[JSON]="3.12.0"
PROJECT_VERSIONS[LIBSODIUM]="1.0.20"
PROJECT_VERSIONS[MESA]="23.3.3"
PROJECT_VERSIONS[MINGW]="12.0.0"
PROJECT_VERSIONS[OPENSSL]="3.4.1"
PROJECT_VERSIONS[OPENSSL]="3.5.0"
PROJECT_VERSIONS[PKG_CONFIG]="0.29.2"
PROJECT_VERSIONS[PUGIXML]="1.15"
PROJECT_VERSIONS[ROCKSDB]="9.10.0"
PROJECT_VERSIONS[SPDLOG]="1.15.1"
PROJECT_VERSIONS[ROCKSDB]="10.0.1"
PROJECT_VERSIONS[SPDLOG]="1.15.2"
PROJECT_VERSIONS[SQLITE]="3490100"
PROJECT_VERSIONS[SQLITE2]="3.49.1"
PROJECT_VERSIONS[STDUUID]="1.2.3"

BIN
support/3rd_party/boost_1_87_0.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
f55c340aa49763b1925ccf02b2e83f35fdcf634c9d5164a2acb87540173c741d *boost_1_87_0.tar.gz

BIN
support/3rd_party/boost_1_88_0.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
3621533e820dcab1e8012afd583c0c73cf0f77694952b81352bf38c1488f9cb4 boost_1_88_0.tar.gz

BIN
support/3rd_party/cpp-httplib-0.19.0.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
c9b9e0524666e1cd088f0874c57c1ce7c0eaa8552f9f4e15c755d5201fc8c608 *cpp-httplib-0.19.0.tar.gz

BIN
support/3rd_party/cpp-httplib-0.20.0.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
18064587e0cc6a0d5d56d619f4cbbcaba47aa5d84d86013abbd45d95c6653866 cpp-httplib-0.20.0.tar.gz

BIN
support/3rd_party/curl-8.12.1.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
6edc063d1ebaf9cf3b3b46e9fef2f3cd8932694989ecd43d005d6e828426d09f *curl-8.12.1.tar.gz

BIN
support/3rd_party/curl-8.13.0.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
ccc5ba45d9f5320c70ffb24e5411b66ba55ea1f333bf78be0963ed90a9328699 curl-8.13.0.tar.gz

BIN
support/3rd_party/json-3.11.3.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406 json-3.11.3.tar.gz

BIN
support/3rd_party/json-3.12.0.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187 json-3.12.0.tar.gz

BIN
support/3rd_party/mingw64/binutils-2.43.tar.xz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
b53606f443ac8f01d1d5fc9c39497f2af322d99e14cea5c0b4b124d630379365 binutils-2.43.tar.xz

BIN
support/3rd_party/mingw64/binutils-2.44.tar.xz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237 binutils-2.44.tar.xz

BIN
support/3rd_party/mingw64/expat-2.6.4.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
372b18f6527d162fa9658f1c74d22a37429b82d822f5a1e1fc7e00f6045a06a2 *expat-2.6.4.tar.gz

BIN
support/3rd_party/mingw64/expat-2.7.1.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
85372797ff0673a8fc4a6be16466bb5a0ca28c0dcf3c6f7ac1686b4a3ba2aabb expat-2.7.1.tar.gz

BIN
support/3rd_party/openssl-3.4.1.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3 *openssl-3.4.1.tar.gz

BIN
support/3rd_party/openssl-3.5.0.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
344d0a79f1a9b08029b0744e2cc401a43f9c90acd1044d09a530b4885a8e9fc0 openssl-3.5.0.tar.gz

BIN
support/3rd_party/rocksdb-10.0.1.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
3fdc9ca996971c4c039959866382c4a3a6c8ade4abf888f3b2ff77153e07bf28 rocksdb-10.0.1.tar.gz

BIN
support/3rd_party/rocksdb-9.10.0.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
fdccab16133c9d927a183c2648bcea8d956fb41eb1df2aacaa73eb0b95e43724 *rocksdb-9.10.0.tar.gz

BIN
support/3rd_party/spdlog-1.15.1.tar.gz (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1 +0,0 @@
25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc *spdlog-1.15.1.tar.gz

BIN
support/3rd_party/spdlog-1.15.2.tar.gz (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
7a80896357f3e8e920e85e92633b14ba0f229c506e6f978578bdc35ba09e9a5d spdlog-1.15.2.tar.gz

View File

@ -157,6 +157,7 @@ auto get_next_available_port(std::uint16_t first_port,
++check_port;
continue;
}
acceptor.set_option(boost::asio::ip::tcp::acceptor::linger(true, 0));
acceptor.bind({tcp::v4(), static_cast<std::uint16_t>(check_port)},
error_code);