Compare commits
1 Commits
5a823f975c
...
master
Author | SHA1 | Date | |
---|---|---|---|
87d336141c |
@@ -28,6 +28,7 @@ cppvsdbg
|
||||
create_notraverse
|
||||
crypto_aead_xchacha20poly1305_ietf_npubbytes
|
||||
cstdint
|
||||
curle_couldnt_resolve_host
|
||||
curlopt_aws_sigv4
|
||||
cxxflags
|
||||
cxxstd
|
||||
@@ -200,6 +201,7 @@ secp256k1
|
||||
secur32
|
||||
sfml_project
|
||||
shlwapi
|
||||
sigchld
|
||||
skynet
|
||||
source_subdir
|
||||
spdlog
|
||||
|
@@ -3,11 +3,6 @@
|
||||
## 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`
|
||||
@@ -19,9 +14,13 @@
|
||||
|
||||
### Changes from v2.0.5-rc
|
||||
|
||||
* Added request retry on `libcurl` error code `CURLE_COULDNT_RESOLVE_HOST`
|
||||
* Added `libcurl` DNS caching
|
||||
* Drive letters in UI should always be lowercase
|
||||
* Fixed WinFSP directory rename for non-empty directories
|
||||
* Fixed segfault in UI due to incorrect `SIGCHLD` handling
|
||||
* Migrated to v2 error handling
|
||||
* Upgraded WinFSP to v2.1 (2025)
|
||||
|
||||
## v2.0.5-rc
|
||||
|
||||
|
@@ -48,7 +48,7 @@ on Windows.
|
||||
* [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v2.0.0+ for Sia support
|
||||
* Linux requires `fusermount3`; otherwise, `repertory` must be manually compiled with `libfuse2` support
|
||||
* Windows requires the following dependencies to be installed:
|
||||
* [WinFSP 2023](https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi)
|
||||
* [WinFSP 2025](https://github.com/winfsp/winfsp/releases/download/v2.1/winfsp-2.1.25156.msi)
|
||||
|
||||
### Supported Operating Systems
|
||||
|
||||
|
@@ -1,20 +1,20 @@
|
||||
set(BINUTILS_HASH ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237)
|
||||
set(BOOST2_HASH 7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca)
|
||||
set(BOOST_HASH 3621533e820dcab1e8012afd583c0c73cf0f77694952b81352bf38c1488f9cb4)
|
||||
set(CPP_HTTPLIB_HASH 18064587e0cc6a0d5d56d619f4cbbcaba47aa5d84d86013abbd45d95c6653866)
|
||||
set(CURL_HASH ccc5ba45d9f5320c70ffb24e5411b66ba55ea1f333bf78be0963ed90a9328699)
|
||||
set(CPP_HTTPLIB_HASH 410a1347ed6bcbcc4a19af8ed8ad3873fe9fa97731d52db845c4c78f3f9c31e6)
|
||||
set(CURL_HASH 2937cadde007aa3a52a17c21ac9153ea054700f37926d1d96602bf07e888c847)
|
||||
set(EXPAT_HASH 85372797ff0673a8fc4a6be16466bb5a0ca28c0dcf3c6f7ac1686b4a3ba2aabb)
|
||||
set(GCC_HASH 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293)
|
||||
set(GTEST_HASH 78c676fc63881529bf97bf9d45948d905a66833fbfa5318ea2cd7478cb98f399)
|
||||
set(GCC_HASH 51b9919ea69c980d7a381db95d4be27edf73b21254eb13d752a08003b4d013b1)
|
||||
set(GTEST_HASH 65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c)
|
||||
set(ICU_HASH a2c443404f00098e9e90acf29dc318e049d2dc78d9ae5f46efb261934a730ce2)
|
||||
set(JSON_HASH 4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187)
|
||||
set(LIBSODIUM_HASH 8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1)
|
||||
set(MINGW_HASH cc41898aac4b6e8dd5cffd7331b9d9515b912df4420a3a612b5ea2955bbeed2f)
|
||||
set(OPENSSL_HASH 344d0a79f1a9b08029b0744e2cc401a43f9c90acd1044d09a530b4885a8e9fc0)
|
||||
set(MINGW_HASH 5afe822af5c4edbf67daaf45eec61d538f49eef6b19524de64897c6b95828caf)
|
||||
set(OPENSSL_HASH 529043b15cffa5f36077a4d0af83f3de399807181d607441d734196d889b641f)
|
||||
set(PKG_CONFIG_HASH 6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591)
|
||||
set(PUGIXML_HASH 655ade57fa703fb421c2eb9a0113b5064bddb145d415dd1f88c79353d90d511a)
|
||||
set(ROCKSDB_HASH 3fdc9ca996971c4c039959866382c4a3a6c8ade4abf888f3b2ff77153e07bf28)
|
||||
set(SPDLOG_HASH 7a80896357f3e8e920e85e92633b14ba0f229c506e6f978578bdc35ba09e9a5d)
|
||||
set(SQLITE_HASH 6cebd1d8403fc58c30e93939b246f3e6e58d0765a5cd50546f16c00fd805d2c3)
|
||||
set(ROCKSDB_HASH afccfab496556904900afacf7d99887f1d50cb893e5d2288bd502db233adacac)
|
||||
set(SPDLOG_HASH 15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67)
|
||||
set(SQLITE_HASH 9ad6d16cbc1df7cd55c8b55127c82a9bca5e9f287818de6dc87e04e73599d754)
|
||||
set(STDUUID_HASH b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3)
|
||||
set(ZLIB_HASH 17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c)
|
||||
|
@@ -2,9 +2,9 @@ if(PROJECT_ENABLE_WINFSP AND PROJECT_IS_MINGW)
|
||||
if(PROJECT_BUILD)
|
||||
add_definitions(-DPROJECT_ENABLE_WINFSP)
|
||||
|
||||
include_directories(BEFORE SYSTEM ${PROJECT_3RD_PARTY_DIR}/winfsp-2.0/inc)
|
||||
include_directories(BEFORE SYSTEM ${PROJECT_3RD_PARTY_DIR}/winfsp-2.1/inc)
|
||||
|
||||
link_directories(BEFORE ${PROJECT_3RD_PARTY_DIR}/winfsp-2.0/lib)
|
||||
link_directories(BEFORE ${PROJECT_3RD_PARTY_DIR}/winfsp-2.1/lib)
|
||||
|
||||
if(PROJECT_IS_ARM64)
|
||||
link_libraries(winfsp-a64)
|
||||
|
@@ -1,27 +1,27 @@
|
||||
set(BINUTILS_VERSION 2.44)
|
||||
set(BOOST_MAJOR_VERSION 1)
|
||||
set(BOOST_MINOR_VERSION 88)
|
||||
set(BOOST_PATCH_VERSION 0)
|
||||
set(BOOST2_MAJOR_VERSION 1)
|
||||
set(BOOST2_MINOR_VERSION 76)
|
||||
set(BOOST2_PATCH_VERSION 0)
|
||||
set(CPP_HTTPLIB_VERSION 0.20.0)
|
||||
set(CURL_VERSION 8.13.0)
|
||||
set(CURL2_VERSION 8_13_0)
|
||||
set(EXPAT_VERSION 2.7.1)
|
||||
set(BOOST_MAJOR_VERSION 1)
|
||||
set(BOOST_MINOR_VERSION 88)
|
||||
set(BOOST_PATCH_VERSION 0)
|
||||
set(CPP_HTTPLIB_VERSION 0.23.1)
|
||||
set(CURL2_VERSION 8_15_0)
|
||||
set(CURL_VERSION 8.15.0)
|
||||
set(EXPAT2_VERSION 2_7_1)
|
||||
set(GCC_VERSION 14.2.0)
|
||||
set(GTEST_VERSION 1.16.0)
|
||||
set(EXPAT_VERSION 2.7.1)
|
||||
set(GCC_VERSION 15.1.0)
|
||||
set(GTEST_VERSION 1.17.0)
|
||||
set(ICU_VERSION 76-1)
|
||||
set(JSON_VERSION 3.12.0)
|
||||
set(LIBSODIUM_VERSION 1.0.20)
|
||||
set(MINGW_VERSION 12.0.0)
|
||||
set(OPENSSL_VERSION 3.5.0)
|
||||
set(MINGW_VERSION 13.0.0)
|
||||
set(OPENSSL_VERSION 3.5.1)
|
||||
set(PKG_CONFIG_VERSION 0.29.2)
|
||||
set(PUGIXML_VERSION 1.15)
|
||||
set(ROCKSDB_VERSION 10.0.1)
|
||||
set(SPDLOG_VERSION 1.15.2)
|
||||
set(SQLITE_VERSION 3490100)
|
||||
set(SQLITE2_VERSION 3.49.1)
|
||||
set(ROCKSDB_VERSION 10.4.2)
|
||||
set(SPDLOG_VERSION 1.15.3)
|
||||
set(SQLITE2_VERSION 3.50.3)
|
||||
set(SQLITE_VERSION 3500300)
|
||||
set(STDUUID_VERSION 1.2.3)
|
||||
set(ZLIB_VERSION 1.3.1)
|
||||
|
@@ -11,8 +11,8 @@ PROJECT_DESC="Mount utility for Sia and S3"
|
||||
PROJECT_MAJOR_VERSION=2
|
||||
PROJECT_MINOR_VERSION=0
|
||||
PROJECT_REVISION_VERSION=6
|
||||
PROJECT_RELEASE_NUM=0
|
||||
PROJECT_RELEASE_ITER=rc
|
||||
PROJECT_RELEASE_NUM=1
|
||||
PROJECT_RELEASE_ITER=release
|
||||
|
||||
PROJECT_APP_LIST=(${PROJECT_NAME})
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#comment
|
||||
FROM arm64v8/alpine:3.21.3
|
||||
FROM arm64v8/alpine:3.21.4
|
||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||
CMD bash
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#comment
|
||||
FROM alpine:3.21.3
|
||||
FROM alpine:3.21.4
|
||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||
CMD bash
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#comment
|
||||
FROM alpine:3.21.3
|
||||
FROM alpine:3.21.4
|
||||
|
||||
RUN apk update
|
||||
RUN apk upgrade
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#define REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "comm/curl/curl_shared.hpp"
|
||||
#include "comm/curl/multi_request.hpp"
|
||||
#include "comm/i_http_comm.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
@@ -48,6 +49,7 @@ private:
|
||||
|
||||
static const write_callback write_data;
|
||||
static const write_callback write_headers;
|
||||
static constexpr std::uint8_t retry_request_count{5U};
|
||||
|
||||
private:
|
||||
std::optional<host_config> host_config_;
|
||||
@@ -135,101 +137,125 @@ public:
|
||||
long &response_code, stop_type &stop_requested) -> bool {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (request.decryption_token.has_value() &&
|
||||
not request.decryption_token.value().empty()) {
|
||||
return make_encrypted_request(cfg, request, response_code,
|
||||
stop_requested);
|
||||
}
|
||||
|
||||
response_code = 0;
|
||||
|
||||
auto *curl = create_curl();
|
||||
if (not request.set_method(curl, stop_requested)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not cfg.agent_string.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, cfg.agent_string.c_str());
|
||||
}
|
||||
|
||||
if (request.allow_timeout && cfg.timeout_ms) {
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, cfg.timeout_ms);
|
||||
}
|
||||
|
||||
std::string range_list{};
|
||||
if (request.range.has_value()) {
|
||||
range_list = std::to_string(request.range.value().begin) + '-' +
|
||||
std::to_string(request.range.value().end);
|
||||
curl_easy_setopt(curl, CURLOPT_RANGE, range_list.c_str());
|
||||
}
|
||||
|
||||
if (request.response_headers.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERDATA,
|
||||
&request.response_headers.value());
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_headers);
|
||||
}
|
||||
|
||||
read_write_info write_info{
|
||||
{},
|
||||
[&stop_requested]() -> bool {
|
||||
return stop_requested || app_config::get_stop_requested();
|
||||
},
|
||||
};
|
||||
if (request.response_handler.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_info);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
}
|
||||
|
||||
std::string parameters{};
|
||||
for (const auto ¶m : request.query) {
|
||||
parameters += (parameters.empty() ? '?' : '&') + param.first + '=' +
|
||||
url_encode(curl, param.second, false);
|
||||
}
|
||||
|
||||
if (not cfg.api_password.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, cfg.api_user.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, cfg.api_password.c_str());
|
||||
} else if (not cfg.api_user.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, cfg.api_user.c_str());
|
||||
}
|
||||
|
||||
if (request.aws_service.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_AWS_SIGV4,
|
||||
request.aws_service.value().c_str());
|
||||
}
|
||||
|
||||
curl_slist *header_list{nullptr};
|
||||
if (not request.headers.empty()) {
|
||||
for (const auto &header : request.headers) {
|
||||
header_list = curl_slist_append(
|
||||
header_list,
|
||||
fmt::format("{}: {}", header.first, header.second).c_str());
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
|
||||
}
|
||||
|
||||
auto url = construct_url(curl, request.get_path(), cfg) + parameters;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
|
||||
multi_request curl_request(curl, stop_requested);
|
||||
|
||||
CURLcode curl_code{};
|
||||
curl_request.get_result(curl_code, response_code);
|
||||
const auto do_request = [&]() -> bool {
|
||||
if (request.decryption_token.has_value() &&
|
||||
not request.decryption_token.value().empty()) {
|
||||
return make_encrypted_request(cfg, request, response_code,
|
||||
stop_requested);
|
||||
}
|
||||
|
||||
if (header_list != nullptr) {
|
||||
curl_slist_free_all(header_list);
|
||||
response_code = 0;
|
||||
|
||||
auto *curl = create_curl();
|
||||
if (not request.set_method(curl, stop_requested)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not cfg.agent_string.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, cfg.agent_string.c_str());
|
||||
}
|
||||
|
||||
if (request.allow_timeout && cfg.timeout_ms) {
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, cfg.timeout_ms);
|
||||
}
|
||||
|
||||
std::string range_list{};
|
||||
if (request.range.has_value()) {
|
||||
range_list = std::to_string(request.range.value().begin) + '-' +
|
||||
std::to_string(request.range.value().end);
|
||||
curl_easy_setopt(curl, CURLOPT_RANGE, range_list.c_str());
|
||||
}
|
||||
|
||||
if (request.response_headers.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERDATA,
|
||||
&request.response_headers.value());
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_headers);
|
||||
}
|
||||
|
||||
read_write_info write_info{
|
||||
{},
|
||||
[&stop_requested]() -> bool {
|
||||
return stop_requested || app_config::get_stop_requested();
|
||||
},
|
||||
};
|
||||
if (request.response_handler.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_info);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
}
|
||||
|
||||
std::string parameters{};
|
||||
for (const auto ¶m : request.query) {
|
||||
parameters += (parameters.empty() ? '?' : '&') + param.first + '=' +
|
||||
url_encode(curl, param.second, false);
|
||||
}
|
||||
|
||||
if (not cfg.api_password.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, cfg.api_user.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, cfg.api_password.c_str());
|
||||
} else if (not cfg.api_user.empty()) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, cfg.api_user.c_str());
|
||||
}
|
||||
|
||||
if (request.aws_service.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_AWS_SIGV4,
|
||||
request.aws_service.value().c_str());
|
||||
}
|
||||
|
||||
curl_slist *header_list{nullptr};
|
||||
if (not request.headers.empty()) {
|
||||
for (const auto &header : request.headers) {
|
||||
header_list = curl_slist_append(
|
||||
header_list,
|
||||
fmt::format("{}: {}", header.first, header.second).c_str());
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
|
||||
}
|
||||
|
||||
curl_shared::set_share(curl);
|
||||
|
||||
auto url = construct_url(curl, request.get_path(), cfg) + parameters;
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
|
||||
multi_request curl_request(curl, stop_requested);
|
||||
|
||||
curl_code = CURLE_OK;
|
||||
curl_request.get_result(curl_code, response_code);
|
||||
|
||||
if (header_list != nullptr) {
|
||||
curl_slist_free_all(header_list);
|
||||
}
|
||||
|
||||
if (curl_code != CURLE_OK) {
|
||||
event_system::instance().raise<curl_error>(curl_code, function_name,
|
||||
request.get_type(), url);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.response_handler.has_value()) {
|
||||
request.response_handler.value()(write_info.data, response_code);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
bool ret{false};
|
||||
for (std::uint8_t retry = 0U; !ret && retry < retry_request_count;
|
||||
++retry) {
|
||||
ret = do_request();
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (curl_code == CURLE_COULDNT_RESOLVE_HOST) {
|
||||
std::this_thread::sleep_for(1s);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (curl_code != CURLE_OK) {
|
||||
event_system::instance().raise<curl_error>(curl_code, function_name, url);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.response_handler.has_value()) {
|
||||
request.response_handler.value()(write_info.data, response_code);
|
||||
}
|
||||
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public:
|
||||
|
67
repertory/librepertory/include/comm/curl/curl_shared.hpp
Normal file
67
repertory/librepertory/include/comm/curl/curl_shared.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright <2018-2025> <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 REPERTORY_INCLUDE_COMM_CURL_CURL_SHARED_HPP_
|
||||
#define REPERTORY_INCLUDE_COMM_CURL_CURL_SHARED_HPP_
|
||||
|
||||
namespace repertory {
|
||||
class curl_shared final {
|
||||
private:
|
||||
struct curl_sh_deleter final {
|
||||
void operator()(CURLSH *ptr) {
|
||||
if (ptr != nullptr) {
|
||||
curl_share_cleanup(ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using curl_sh_t = std::unique_ptr<CURLSH, curl_sh_deleter>;
|
||||
|
||||
public:
|
||||
curl_shared() = delete;
|
||||
curl_shared(const curl_shared &) = delete;
|
||||
curl_shared(curl_shared &&) = delete;
|
||||
~curl_shared() = delete;
|
||||
|
||||
auto operator=(const curl_shared &) -> curl_shared & = delete;
|
||||
auto operator=(curl_shared &&) -> curl_shared & = delete;
|
||||
|
||||
private:
|
||||
static curl_sh_t cache_;
|
||||
static std::recursive_mutex mtx_;
|
||||
|
||||
private:
|
||||
static void lock_callback(CURL * /* curl */, curl_lock_data /* data */,
|
||||
curl_lock_access /* access */, void * /* ptr */);
|
||||
|
||||
static void unlock_callback(CURL * /* curl */, curl_lock_data /* data */,
|
||||
curl_lock_access /* access */, void * /* ptr */);
|
||||
|
||||
public:
|
||||
static void cleanup();
|
||||
|
||||
[[nodiscard]] static auto init() -> bool;
|
||||
|
||||
static void set_share(CURL *curl);
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_COMM_CURL_DNS_CACHE_HPP_
|
@@ -26,11 +26,13 @@
|
||||
|
||||
namespace repertory::curl::requests {
|
||||
struct http_delete final : http_request_base {
|
||||
~http_delete() override = default;
|
||||
[[nodiscard]] auto get_type() const -> std::string override {
|
||||
return "delete";
|
||||
}
|
||||
|
||||
[[nodiscard]] auto
|
||||
set_method(CURL *curl,
|
||||
stop_type & /* stop_requested */) const -> bool override {
|
||||
[[nodiscard]] auto set_method(CURL *curl,
|
||||
stop_type & /* stop_requested */) const
|
||||
-> bool override {
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||
return true;
|
||||
}
|
||||
|
@@ -33,9 +33,11 @@ struct http_get final : http_request_base {
|
||||
auto operator=(http_get &&) -> http_get & = default;
|
||||
~http_get() override = default;
|
||||
|
||||
[[nodiscard]] auto
|
||||
set_method(CURL *curl,
|
||||
stop_type & /*stop_requested*/) const -> bool override {
|
||||
[[nodiscard]] auto get_type() const -> std::string override { return "get"; }
|
||||
|
||||
[[nodiscard]] auto set_method(CURL *curl,
|
||||
stop_type & /*stop_requested*/) const
|
||||
-> bool override {
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
|
||||
return true;
|
||||
}
|
||||
|
@@ -26,11 +26,11 @@
|
||||
|
||||
namespace repertory::curl::requests {
|
||||
struct http_head final : http_request_base {
|
||||
~http_head() override = default;
|
||||
[[nodiscard]] auto get_type() const -> std::string override { return "head"; }
|
||||
|
||||
[[nodiscard]] auto
|
||||
set_method(CURL *curl,
|
||||
stop_type & /* stop_requested */) const -> bool override {
|
||||
[[nodiscard]] auto set_method(CURL *curl,
|
||||
stop_type & /* stop_requested */) const
|
||||
-> bool override {
|
||||
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "HEAD");
|
||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
||||
return true;
|
||||
|
@@ -26,16 +26,10 @@
|
||||
|
||||
namespace repertory::curl::requests {
|
||||
struct http_post final : http_request_base {
|
||||
http_post() = default;
|
||||
http_post(const http_post &) = default;
|
||||
http_post(http_post &&) = default;
|
||||
auto operator=(const http_post &) -> http_post & = default;
|
||||
auto operator=(http_post &&) -> http_post & = default;
|
||||
|
||||
~http_post() override = default;
|
||||
|
||||
std::optional<nlohmann::json> json;
|
||||
|
||||
[[nodiscard]] auto get_type() const -> std::string override { return "post"; }
|
||||
|
||||
[[nodiscard]] auto set_method(CURL *curl,
|
||||
stop_type & /*stop_requested*/) const
|
||||
-> bool override;
|
||||
|
@@ -27,18 +27,11 @@
|
||||
|
||||
namespace repertory::curl::requests {
|
||||
struct http_put_file final : http_request_base {
|
||||
http_put_file() = default;
|
||||
http_put_file(const http_put_file &) = default;
|
||||
http_put_file(http_put_file &&) = default;
|
||||
|
||||
auto operator=(const http_put_file &) -> http_put_file & = default;
|
||||
auto operator=(http_put_file &&) -> http_put_file & = default;
|
||||
|
||||
~http_put_file() override = default;
|
||||
|
||||
std::shared_ptr<utils::encryption::encrypting_reader> reader;
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_type() const -> std::string override { return "put"; }
|
||||
|
||||
[[nodiscard]] auto set_method(CURL *curl, stop_type &stop_requested) const
|
||||
-> bool override;
|
||||
|
||||
|
@@ -61,6 +61,8 @@ struct http_request_base {
|
||||
|
||||
[[nodiscard]] virtual auto get_path() const -> std::string { return path; }
|
||||
|
||||
[[nodiscard]] virtual auto get_type() const -> std::string = 0;
|
||||
|
||||
[[nodiscard]] virtual auto set_method(CURL *curl,
|
||||
stop_type &stop_requested) const
|
||||
-> bool = 0;
|
||||
|
@@ -64,17 +64,14 @@ protected:
|
||||
[[nodiscard]] auto get_effective_uid() const -> uid_t;
|
||||
|
||||
[[nodiscard]] static auto check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error;
|
||||
api_error fail_error) -> api_error;
|
||||
|
||||
[[nodiscard]] auto check_owner(const api_meta_map &meta) const -> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_readable(int flags,
|
||||
const api_error &fail_error)
|
||||
[[nodiscard]] static auto check_readable(int flags, api_error fail_error)
|
||||
-> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_writeable(int flags,
|
||||
const api_error &fail_error)
|
||||
[[nodiscard]] static auto check_writeable(int flags, api_error fail_error)
|
||||
-> api_error;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
@@ -28,9 +28,11 @@
|
||||
namespace repertory {
|
||||
struct curl_error final : public i_event {
|
||||
curl_error() = default;
|
||||
curl_error(CURLcode code_, std::string_view function_name_, std::string url_)
|
||||
curl_error(CURLcode code_, std::string_view function_name_, std::string type_,
|
||||
std::string url_)
|
||||
: code(code_),
|
||||
function_name(std::string{function_name_}),
|
||||
type(std::move(type_)),
|
||||
url(std::move(url_)) {}
|
||||
|
||||
static constexpr event_level level{event_level::error};
|
||||
@@ -38,6 +40,7 @@ struct curl_error final : public i_event {
|
||||
|
||||
CURLcode code{};
|
||||
std::string function_name;
|
||||
std::string type;
|
||||
std::string url;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
@@ -49,8 +52,8 @@ struct curl_error final : public i_event {
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|url|{}|code|{}", name, function_name, url,
|
||||
static_cast<int>(code));
|
||||
return fmt::format("{}|func|{}|type|{}|url|{}|code|{}", name, function_name,
|
||||
type, url, static_cast<int>(code));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
@@ -60,12 +63,14 @@ template <> struct adl_serializer<repertory::curl_error> {
|
||||
static void to_json(json &data, const repertory::curl_error &value) {
|
||||
data["code"] = value.code;
|
||||
data["function_name"] = value.function_name;
|
||||
data["type"] = value.type;
|
||||
data["url"] = value.url;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::curl_error &value) {
|
||||
data.at("code").get_to<CURLcode>(value.code);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("type").get_to<std::string>(value.type);
|
||||
data.at("url").get_to<std::string>(value.url);
|
||||
}
|
||||
};
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
std::condition_variable notify_;
|
||||
|
||||
public:
|
||||
void notify(const api_error &err);
|
||||
void notify(api_error err);
|
||||
|
||||
auto wait() -> api_error;
|
||||
};
|
||||
@@ -149,7 +149,7 @@ protected:
|
||||
|
||||
void reset_timeout();
|
||||
|
||||
auto set_api_error(const api_error &err) -> api_error;
|
||||
auto set_api_error(api_error err) -> api_error;
|
||||
|
||||
void set_file_size(std::uint64_t size);
|
||||
|
||||
|
@@ -70,8 +70,9 @@ private:
|
||||
-> api_error;
|
||||
|
||||
[[nodiscard]] auto get_last_modified(bool directory,
|
||||
const std::string &api_path) const
|
||||
-> std::uint64_t;
|
||||
const std::string &api_path,
|
||||
std::uint64_t &last_modified) const
|
||||
-> api_error;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_object_info(bool directory, const std::string &api_path,
|
||||
|
@@ -30,8 +30,13 @@ class app_config;
|
||||
class server {
|
||||
public:
|
||||
explicit server(app_config &config);
|
||||
server(const server &) = delete;
|
||||
server(server &&) = delete;
|
||||
|
||||
virtual ~server() { stop(); }
|
||||
auto operator=(const server &) -> server & = delete;
|
||||
auto operator=(server &&) -> server & = delete;
|
||||
|
||||
virtual ~server();
|
||||
|
||||
private:
|
||||
app_config &config_;
|
||||
|
@@ -221,8 +221,7 @@ enum class api_error {
|
||||
|
||||
[[nodiscard]] auto api_error_from_string(std::string_view str) -> api_error;
|
||||
|
||||
[[nodiscard]] auto api_error_to_string(const api_error &error)
|
||||
-> const std::string &;
|
||||
[[nodiscard]] auto api_error_to_string(api_error error) -> const std::string &;
|
||||
|
||||
enum class database_type {
|
||||
rocksdb,
|
||||
|
@@ -27,7 +27,7 @@
|
||||
namespace repertory::utils::error {
|
||||
void raise_error(std::string_view function, std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const std::exception &exception);
|
||||
@@ -41,7 +41,7 @@ void raise_error(std::string_view function, std::int64_t err,
|
||||
void raise_error(std::string_view function, const json &err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view file_path, std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, std::int64_t err,
|
||||
@@ -51,7 +51,7 @@ void raise_error(std::string_view function, const std::exception &exception,
|
||||
std::string_view file_path, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const api_error &err, std::string_view msg);
|
||||
api_error err, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const std::exception &exception);
|
||||
@@ -67,7 +67,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const json &err, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
std::string_view source_path, const api_error &err,
|
||||
std::string_view source_path, api_error err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
|
@@ -37,7 +37,7 @@ inline const std::array<std::string, 4U> attribute_namespaces = {
|
||||
};
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &err) -> int;
|
||||
[[nodiscard]] auto from_api_error(api_error err) -> int;
|
||||
|
||||
[[nodiscard]] auto to_api_error(int err) -> api_error;
|
||||
|
||||
|
@@ -28,19 +28,19 @@
|
||||
#include "utils/windows.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
[[nodiscard]] auto
|
||||
get_accessed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_accessed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_changed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_changed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_creation_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_creation_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_written_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_written_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &e) -> NTSTATUS;
|
||||
[[nodiscard]] auto from_api_error(api_error e) -> NTSTATUS;
|
||||
|
||||
[[nodiscard]] auto unix_access_mask_to_windows(std::int32_t mask) -> int;
|
||||
|
||||
|
@@ -41,8 +41,8 @@ const curl_comm::write_callback curl_comm::write_headers =
|
||||
size_t nitems,
|
||||
void *outstream) -> size_t {
|
||||
auto &headers = *reinterpret_cast<http_headers *>(outstream);
|
||||
const auto header = std::string(buffer, size * nitems);
|
||||
const auto parts = utils::string::split(header, ':', false);
|
||||
auto header = std::string(buffer, size * nitems);
|
||||
auto parts = utils::string::split(header, ':', false);
|
||||
if (parts.size() > 1U) {
|
||||
auto data = header.substr(parts[0U].size() + 1U);
|
||||
utils::string::left_trim(data);
|
||||
|
82
repertory/librepertory/src/comm/curl/curl_shared.cpp
Normal file
82
repertory/librepertory/src/comm/curl/curl_shared.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
Copyright <2018-2025> <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.
|
||||
*/
|
||||
#include "comm/curl/curl_shared.hpp"
|
||||
#include "utils/error.hpp"
|
||||
|
||||
namespace repertory {
|
||||
curl_shared::curl_sh_t curl_shared::cache_;
|
||||
|
||||
std::recursive_mutex curl_shared::mtx_;
|
||||
|
||||
void curl_shared::cleanup() {
|
||||
cache_.reset(nullptr);
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
auto curl_shared::init() -> bool {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if (res != 0) {
|
||||
utils::error::handle_error(function_name,
|
||||
"failed to initialize curl|result|" +
|
||||
std::to_string(res));
|
||||
return false;
|
||||
}
|
||||
|
||||
auto *cache = curl_share_init();
|
||||
if (cache == nullptr) {
|
||||
utils::error::handle_error(function_name, "failed to create curl share");
|
||||
return false;
|
||||
}
|
||||
cache_.reset(cache);
|
||||
|
||||
curl_share_setopt(cache, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
||||
curl_share_setopt(cache, CURLSHOPT_LOCKFUNC, lock_callback);
|
||||
curl_share_setopt(cache, CURLSHOPT_UNLOCKFUNC, unlock_callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
void curl_shared::lock_callback(CURL * /* curl */, curl_lock_data data,
|
||||
curl_lock_access /* access */,
|
||||
void * /* ptr */) {
|
||||
if (data != CURL_LOCK_DATA_DNS) {
|
||||
return;
|
||||
}
|
||||
|
||||
mtx_.lock();
|
||||
}
|
||||
|
||||
void curl_shared::set_share(CURL *curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_SHARE, cache_.get());
|
||||
}
|
||||
|
||||
void curl_shared::unlock_callback(CURL * /* curl */, curl_lock_data data,
|
||||
curl_lock_access /* access */,
|
||||
void * /* ptr */) {
|
||||
if (data != CURL_LOCK_DATA_DNS) {
|
||||
return;
|
||||
}
|
||||
|
||||
mtx_.unlock();
|
||||
}
|
||||
} // namespace repertory
|
@@ -44,21 +44,22 @@ void multi_request::get_result(CURLcode &curl_code, long &http_code) {
|
||||
curl_code = CURLcode::CURLE_ABORTED_BY_CALLBACK;
|
||||
http_code = -1;
|
||||
|
||||
auto error = false;
|
||||
int running_handles = 0;
|
||||
auto error{false};
|
||||
int running_handles{0};
|
||||
curl_multi_perform(multi_handle_, &running_handles);
|
||||
while (not error && (running_handles > 0) && not get_stop_requested()) {
|
||||
int ignored{};
|
||||
curl_multi_wait(multi_handle_, nullptr, 0, timeout_ms, &ignored);
|
||||
|
||||
const auto ret = curl_multi_perform(multi_handle_, &running_handles);
|
||||
auto ret = curl_multi_perform(multi_handle_, &running_handles);
|
||||
error = (ret != CURLM_CALL_MULTI_PERFORM) && (ret != CURLM_OK);
|
||||
}
|
||||
|
||||
if (not get_stop_requested()) {
|
||||
int remaining_messages = 0;
|
||||
auto *multi_result =
|
||||
curl_multi_info_read(multi_handle_, &remaining_messages);
|
||||
int remaining_messages{0};
|
||||
auto *multi_result{
|
||||
curl_multi_info_read(multi_handle_, &remaining_messages),
|
||||
};
|
||||
if ((multi_result != nullptr) && (multi_result->msg == CURLMSG_DONE)) {
|
||||
curl_easy_getinfo(multi_result->easy_handle, CURLINFO_RESPONSE_CODE,
|
||||
&http_code);
|
||||
|
@@ -381,6 +381,7 @@ auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * {
|
||||
if (not console_enabled_ && not repertory::project_initialize()) {
|
||||
utils::error::raise_error(function_name, "failed to initialize repertory");
|
||||
event_system::instance().raise<unmount_requested>(function_name);
|
||||
repertory::project_cleanup();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@@ -138,8 +138,7 @@ auto fuse_drive_base::check_and_perform(
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error {
|
||||
api_error fail_error) -> api_error {
|
||||
return (((flags & mask) == 0) ? api_error::success : fail_error);
|
||||
}
|
||||
|
||||
@@ -196,13 +195,13 @@ auto fuse_drive_base::check_parent_access(const std::string &api_path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_readable(int flags, const api_error &fail_error)
|
||||
auto fuse_drive_base::check_readable(int flags, api_error fail_error)
|
||||
-> api_error {
|
||||
auto mode = (flags & O_ACCMODE);
|
||||
return ((mode == O_WRONLY) ? fail_error : api_error::success);
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_writeable(int flags, const api_error &fail_error)
|
||||
auto fuse_drive_base::check_writeable(int flags, api_error fail_error)
|
||||
-> api_error {
|
||||
return (((flags & O_ACCMODE) == 0) ? fail_error : api_error::success);
|
||||
}
|
||||
|
@@ -370,7 +370,7 @@ auto file_manager::is_processing(const std::string &api_path) const -> bool {
|
||||
}
|
||||
|
||||
unique_mutex_lock upload_lock(upload_mtx_);
|
||||
if (upload_lookup_.find(api_path) != upload_lookup_.end()) {
|
||||
if (upload_lookup_.contains(api_path)) {
|
||||
return true;
|
||||
}
|
||||
upload_lock.unlock();
|
||||
@@ -695,7 +695,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
||||
"failed to remove active upload");
|
||||
}
|
||||
|
||||
if (upload_lookup_.find(api_path) != upload_lookup_.end()) {
|
||||
if (upload_lookup_.contains(api_path)) {
|
||||
upload_lookup_.at(api_path)->cancel();
|
||||
upload_lookup_.erase(api_path);
|
||||
}
|
||||
@@ -871,9 +871,12 @@ void file_manager::start() {
|
||||
stop_requested_ = false;
|
||||
|
||||
polling::instance().set_callback({
|
||||
"timed_out_close",
|
||||
polling::frequency::second,
|
||||
[this](auto && /* stop_requested */) { this->close_timed_out_files(); },
|
||||
.name = "timed_out_close",
|
||||
.freq = polling::frequency::second,
|
||||
.action =
|
||||
[this](auto && /* stop_requested */) {
|
||||
this->close_timed_out_files();
|
||||
},
|
||||
});
|
||||
|
||||
if (provider_.is_read_only()) {
|
||||
@@ -1002,10 +1005,10 @@ void file_manager::store_resume(const i_open_file &file) {
|
||||
}
|
||||
|
||||
if (mgr_db_->add_resume(i_file_mgr_db::resume_entry{
|
||||
file.get_api_path(),
|
||||
file.get_chunk_size(),
|
||||
file.get_read_state(),
|
||||
file.get_source_path(),
|
||||
.api_path = file.get_api_path(),
|
||||
.chunk_size = file.get_chunk_size(),
|
||||
.read_state = file.get_read_state(),
|
||||
.source_path = file.get_source_path(),
|
||||
})) {
|
||||
event_system::instance().raise<download_resume_added>(
|
||||
file.get_api_path(), file.get_source_path(), function_name);
|
||||
@@ -1110,8 +1113,8 @@ void file_manager::upload_handler() {
|
||||
if (mgr_db_->remove_upload(entry->api_path)) {
|
||||
if (not mgr_db_->add_upload_active(
|
||||
i_file_mgr_db::upload_active_entry{
|
||||
entry->api_path,
|
||||
entry->source_path,
|
||||
.api_path = entry->api_path,
|
||||
.source_path = entry->source_path,
|
||||
})) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, entry->api_path, entry->source_path,
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "utils/path.hpp"
|
||||
|
||||
namespace repertory {
|
||||
void open_file_base::download::notify(const api_error &err) {
|
||||
void open_file_base::download::notify(api_error err) {
|
||||
complete_ = true;
|
||||
error_ = err;
|
||||
unique_mutex_lock lock(mtx_);
|
||||
@@ -360,7 +360,7 @@ void open_file_base::reset_timeout() {
|
||||
last_access_ = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
auto open_file_base::set_api_error(const api_error &err) -> api_error {
|
||||
auto open_file_base::set_api_error(api_error err) -> api_error {
|
||||
mutex_lock error_lock(error_mtx_);
|
||||
if (error_ == err) {
|
||||
return error_;
|
||||
|
@@ -19,10 +19,6 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#if defined(PROJECT_ENABLE_CURL)
|
||||
#include <curl/curl.h>
|
||||
#endif // defined(PROJECT_ENABLE_CURL)
|
||||
|
||||
#if defined(PROJECT_ENABLE_OPENSSL)
|
||||
#include <openssl/ssl.h>
|
||||
#endif // defined(PROJECT_ENABLE_OPENSSL)
|
||||
@@ -43,13 +39,25 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#include "initialize.hpp"
|
||||
#include "utils/error.hpp"
|
||||
|
||||
#if defined(PROJECT_REQUIRE_ALPINE) && !defined(PROJECT_IS_MINGW)
|
||||
#include "utils/path.hpp"
|
||||
#endif // defined(PROJECT_REQUIRE_ALPINE) && !defined (PROJECT_IS_MINGW)
|
||||
|
||||
#if defined(PROJECT_ENABLE_CURL)
|
||||
#include "comm/curl/curl_shared.hpp"
|
||||
#endif // defined(PROJECT_ENABLE_CURL)
|
||||
|
||||
namespace {
|
||||
bool curl_initialized{false};
|
||||
bool sqlite3_initialized{false};
|
||||
} // namespace
|
||||
|
||||
namespace repertory {
|
||||
auto project_initialize() -> bool {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
#if defined(PROJECT_REQUIRE_ALPINE) && !defined(PROJECT_IS_MINGW)
|
||||
{
|
||||
static constexpr auto guard_size{4096U};
|
||||
@@ -65,41 +73,39 @@ auto project_initialize() -> bool {
|
||||
#endif // defined(PROJECT_REQUIRE_ALPINE) && !defined (PROJECT_IS_MINGW)
|
||||
|
||||
spdlog::drop_all();
|
||||
spdlog::flush_every(std::chrono::seconds(10));
|
||||
spdlog::flush_every(std::chrono::seconds(5));
|
||||
spdlog::set_pattern("%Y-%m-%d|%T.%e|%^%l%$|%v");
|
||||
|
||||
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
||||
{
|
||||
if (sodium_init() == -1) {
|
||||
return false;
|
||||
}
|
||||
if (sodium_init() == -1) {
|
||||
utils::error::handle_error(function_name, "failed to initialize sodium");
|
||||
return false;
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
|
||||
|
||||
#if defined(PROJECT_ENABLE_OPENSSL)
|
||||
{
|
||||
SSL_library_init();
|
||||
}
|
||||
SSL_library_init();
|
||||
#endif // defined(PROJECT_ENABLE_OPENSSL)
|
||||
|
||||
#if defined(PROJECT_ENABLE_CURL)
|
||||
{
|
||||
auto res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if (res != 0) {
|
||||
return false;
|
||||
}
|
||||
if (not curl_shared::init()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
curl_initialized = true;
|
||||
#endif // defined(PROJECT_ENABLE_CURL)
|
||||
|
||||
#if defined(PROJECT_ENABLE_SQLITE)
|
||||
{
|
||||
auto res = sqlite3_initialize();
|
||||
if (res != SQLITE_OK) {
|
||||
#if defined(PROJECT_ENABLE_CURL)
|
||||
curl_global_cleanup();
|
||||
#endif // defined(PROJECT_ENABLE_CURL)
|
||||
utils::error::handle_error(function_name,
|
||||
"failed to initialize sqlite3|result|" +
|
||||
std::to_string(res));
|
||||
return false;
|
||||
}
|
||||
|
||||
sqlite3_initialized = true;
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_SQLITE)
|
||||
|
||||
@@ -108,12 +114,17 @@ auto project_initialize() -> bool {
|
||||
|
||||
void project_cleanup() {
|
||||
#if defined(PROJECT_ENABLE_CURL)
|
||||
curl_global_cleanup();
|
||||
if (curl_initialized) {
|
||||
curl_shared::cleanup();
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_CURL)
|
||||
|
||||
#if defined(PROJECT_ENABLE_SQLITE)
|
||||
sqlite3_shutdown();
|
||||
if (sqlite3_initialized) {
|
||||
sqlite3_shutdown();
|
||||
}
|
||||
#endif // defined(PROJECT_ENABLE_SQLITE)
|
||||
|
||||
spdlog::shutdown();
|
||||
}
|
||||
} // namespace repertory
|
||||
|
@@ -209,10 +209,18 @@ auto s3_provider::create_directory_paths(const std::string &api_path,
|
||||
}
|
||||
}
|
||||
|
||||
std::uint64_t last_modified{};
|
||||
if (exists) {
|
||||
res = get_last_modified(true, cur_path, last_modified);
|
||||
if (res != api_error::success) {
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
last_modified = utils::time::get_time_now();
|
||||
}
|
||||
|
||||
auto dir{
|
||||
create_api_file(cur_path, cur_key, 0U,
|
||||
exists ? get_last_modified(true, cur_path)
|
||||
: utils::time::get_time_now()),
|
||||
create_api_file(cur_path, cur_key, 0U, last_modified),
|
||||
};
|
||||
get_api_item_added()(true, dir);
|
||||
}
|
||||
@@ -624,16 +632,19 @@ auto s3_provider::get_file_list(api_file_list &list, std::string &marker) const
|
||||
return api_error::error;
|
||||
}
|
||||
|
||||
auto s3_provider::get_last_modified(bool directory,
|
||||
const std::string &api_path) const
|
||||
-> std::uint64_t {
|
||||
auto s3_provider::get_last_modified(bool directory, const std::string &api_path,
|
||||
std::uint64_t &last_modified) const
|
||||
-> api_error {
|
||||
bool is_encrypted{};
|
||||
std::string object_name;
|
||||
head_object_result result{};
|
||||
return (get_object_info(directory, api_path, is_encrypted, object_name,
|
||||
result) == api_error::success)
|
||||
? result.last_modified
|
||||
: utils::time::get_time_now();
|
||||
auto res =
|
||||
get_object_info(directory, api_path, is_encrypted, object_name, result);
|
||||
if (res == api_error::success) {
|
||||
last_modified = result.last_modified;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
auto s3_provider::get_object_info(bool directory, const std::string &api_path,
|
||||
@@ -836,6 +847,8 @@ auto s3_provider::read_file_bytes(const std::string &api_path, std::size_t size,
|
||||
idx < get_config().get_retry_read_count() + 1U;
|
||||
++idx) {
|
||||
if (idx > 0U) {
|
||||
read_buffer.clear();
|
||||
|
||||
std::this_thread::sleep_for(1s);
|
||||
}
|
||||
|
||||
|
@@ -691,32 +691,34 @@ auto sia_provider::read_file_bytes(const std::string &api_path,
|
||||
res != api_error::success &&
|
||||
idx < get_config().get_retry_read_count() + 1U;
|
||||
++idx) {
|
||||
long response_code{};
|
||||
const auto notify_retry = [&]() {
|
||||
if (response_code == 0) {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, api_path, api_error::comm_error,
|
||||
"read file bytes failed|offset|" + std::to_string(offset) +
|
||||
"|size|" + std::to_string(size) + "|retry|" +
|
||||
std::to_string(idx + 1U));
|
||||
} else {
|
||||
utils::error::raise_api_path_error(
|
||||
function_name, api_path, response_code,
|
||||
"read file bytes failed|offset|" + std::to_string(offset) +
|
||||
"|size|" + std::to_string(size) + "|retry|" +
|
||||
std::to_string(idx + 1U));
|
||||
}
|
||||
if (idx > 0U) {
|
||||
buffer.clear();
|
||||
std::this_thread::sleep_for(1s);
|
||||
}
|
||||
|
||||
const auto notify_retry = [=](long response_code) {
|
||||
auto msg =
|
||||
fmt::format("read file bytes failed|offset|{}|size|{}|retry|{}",
|
||||
std::to_string(offset), std::to_string(size),
|
||||
std::to_string(idx + 1U));
|
||||
if (response_code == 0) {
|
||||
utils::error::raise_api_path_error(function_name, api_path,
|
||||
api_error::comm_error, msg);
|
||||
} else {
|
||||
utils::error::raise_api_path_error(function_name, api_path,
|
||||
response_code, msg);
|
||||
}
|
||||
};
|
||||
|
||||
long response_code{};
|
||||
if (not get_comm().make_request(get, response_code, stop_requested)) {
|
||||
notify_retry();
|
||||
notify_retry(response_code);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (response_code < http_error_codes::ok ||
|
||||
response_code >= http_error_codes::multiple_choices) {
|
||||
notify_retry();
|
||||
notify_retry(response_code);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,8 @@
|
||||
namespace repertory {
|
||||
server::server(app_config &config) : config_(config) {}
|
||||
|
||||
server::~server() { stop(); }
|
||||
|
||||
void server::handle_get_config(const httplib::Request & /*req*/,
|
||||
httplib::Response &res) {
|
||||
auto data = config_.get_json();
|
||||
|
@@ -230,7 +230,7 @@ auto api_error_from_string(std::string_view str) -> api_error {
|
||||
return iter == LOOKUP.end() ? api_error::error : iter->first;
|
||||
}
|
||||
|
||||
auto api_error_to_string(const api_error &error) -> const std::string & {
|
||||
auto api_error_to_string(api_error error) -> const std::string & {
|
||||
if (LOOKUP.size() != static_cast<std::size_t>(api_error::ERROR_COUNT)) {
|
||||
throw startup_exception("undefined api_error strings");
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ void raise_error(std::string_view function, std::string_view msg) {
|
||||
function, static_cast<std::string>(msg));
|
||||
}
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function,
|
||||
@@ -121,7 +121,7 @@ void raise_error(std::string_view function, std::int64_t err,
|
||||
function, static_cast<std::string>(msg) + "|err|" + std::to_string(err));
|
||||
}
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view file_path, std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|sp|" +
|
||||
@@ -147,7 +147,7 @@ void raise_error(std::string_view function, const std::exception &exception,
|
||||
}
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const api_error &err, std::string_view msg) {
|
||||
api_error err, std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|ap|" +
|
||||
static_cast<std::string>(api_path) + "|err|" +
|
||||
@@ -181,7 +181,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
}
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
std::string_view source_path, const api_error &err,
|
||||
std::string_view source_path, api_error err,
|
||||
std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|ap|" +
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "utils/error_utils.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
auto from_api_error(const api_error &err) -> int {
|
||||
auto from_api_error(api_error err) -> int {
|
||||
switch (err) {
|
||||
case api_error::access_denied:
|
||||
return -EACCES;
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
namespace repertory::utils {
|
||||
auto from_api_error(const api_error &e) -> NTSTATUS {
|
||||
auto from_api_error(api_error e) -> NTSTATUS {
|
||||
switch (e) {
|
||||
case api_error::access_denied:
|
||||
return STATUS_ACCESS_DENIED;
|
||||
|
@@ -38,6 +38,7 @@ auto main(int argc, char **argv) -> int {
|
||||
|
||||
if (not repertory::project_initialize()) {
|
||||
std::cerr << "fatal: failed to initialize repertory" << std::endl;
|
||||
repertory::project_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -119,7 +119,10 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
|
||||
setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
|
||||
reinterpret_cast<const char *>(&enable), sizeof(enable));
|
||||
#else // !defined(_WIN32)
|
||||
linger opt{1, 0};
|
||||
linger opt{
|
||||
.l_onoff = 1,
|
||||
.l_linger = 0,
|
||||
};
|
||||
setsockopt(sock, SOL_SOCKET, SO_LINGER,
|
||||
reinterpret_cast<const char *>(&opt), sizeof(opt));
|
||||
#endif // defined(_WIN32)
|
||||
@@ -718,6 +721,7 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
|
||||
args.insert(std::next(args.begin(), 4U), "/MIN");
|
||||
args.insert(std::next(args.begin(), 5U), repertory_binary_);
|
||||
#else // !defined(_WIN32)
|
||||
args.insert(args.begin(), "-f");
|
||||
args.insert(args.begin(), repertory_binary_);
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
@@ -733,21 +737,35 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
|
||||
const_cast<char *const *>(exec_args.data()));
|
||||
#else // !defined(_WIN32)
|
||||
auto pid = fork();
|
||||
if (pid < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
setsid();
|
||||
chdir("/");
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
|
||||
if (setsid() < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(STDIN_FILENO);
|
||||
close(STDOUT_FILENO);
|
||||
close(STDERR_FILENO);
|
||||
open("/dev/null", O_RDONLY);
|
||||
open("/dev/null", O_WRONLY);
|
||||
open("/dev/null", O_WRONLY);
|
||||
|
||||
if (open("/dev/null", O_RDONLY) != 0 ||
|
||||
open("/dev/null", O_WRONLY) != 1 ||
|
||||
open("/dev/null", O_WRONLY) != 2) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
chdir(utils::path::get_parent_path(repertory_binary_).c_str());
|
||||
execvp(exec_args.at(0U), const_cast<char *const *>(exec_args.data()));
|
||||
exit(1);
|
||||
} else {
|
||||
signal(SIGCHLD, SIG_IGN);
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@@ -25,23 +25,32 @@
|
||||
|
||||
#include "initialize.hpp"
|
||||
#include "test_common.hpp"
|
||||
#include "utils/error.hpp"
|
||||
|
||||
using namespace repertory;
|
||||
|
||||
int PROJECT_TEST_RESULT{0};
|
||||
|
||||
auto main(int argc, char **argv) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
|
||||
static backward::SignalHandling sh;
|
||||
#endif // defined(PROJECT_ENABLE_BACKWARD_CPP)
|
||||
|
||||
if (not repertory::project_initialize()) {
|
||||
std::cerr << "fatal: failed to initialize repertory" << std::endl;
|
||||
repertory::project_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
PROJECT_TEST_RESULT = RUN_ALL_TESTS();
|
||||
try {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
PROJECT_TEST_RESULT = RUN_ALL_TESTS();
|
||||
} catch (const std::exception &e) {
|
||||
utils::error::handle_exception(function_name, e);
|
||||
} catch (...) {
|
||||
utils::error::handle_exception(function_name);
|
||||
}
|
||||
|
||||
repertory::project_cleanup();
|
||||
|
||||
|
@@ -66,7 +66,7 @@ protected:
|
||||
std::atomic<std::size_t> open_file_test::inst{0U};
|
||||
|
||||
static void test_closeable_open_file(const open_file &file, bool directory,
|
||||
const api_error &err, std::uint64_t size,
|
||||
api_error err, std::uint64_t size,
|
||||
const std::string &source_path) {
|
||||
EXPECT_EQ(directory, file.is_directory());
|
||||
EXPECT_EQ(err, file.get_api_error());
|
||||
|
@@ -8,7 +8,7 @@ constexpr std::string_view version =
|
||||
} // namespace
|
||||
|
||||
namespace repertory {
|
||||
auto project_get_git_rev() -> std::string_view { return git_rev; }
|
||||
auto project_get_git_rev() -> std::string_view { return git_rev; }
|
||||
|
||||
auto project_get_version() -> std::string_view { return version; }
|
||||
} // namespace repertory
|
||||
auto project_get_version() -> std::string_view { return version; }
|
||||
} // namespace %PROJECT_NAME %
|
||||
|
@@ -194,7 +194,7 @@ if [ "${PROJECT_ENABLE_WINFSP}" == "ON" ]; then
|
||||
fi
|
||||
|
||||
if [ "${WINFSP_DLL_PART}" != "" ]; then
|
||||
PROJECT_MINGW64_COPY_DEPENDENCIES+=(${PROJECT_3RD_PARTY_DIR}/winfsp-2.0/bin/winfsp-${WINFSP_DLL_PART}.dll)
|
||||
PROJECT_MINGW64_COPY_DEPENDENCIES+=(${PROJECT_3RD_PARTY_DIR}/winfsp-2.1/bin/winfsp-${WINFSP_DLL_PART}.dll)
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -48,7 +48,7 @@ PROJECT_DOWNLOADS[BOOST]="https://archives.boost.io/release/${PROJECT_VERSIONS[B
|
||||
PROJECT_DOWNLOADS[CPP_HTTPLIB]="https://github.com/yhirose/cpp-httplib/archive/refs/tags/v${PROJECT_VERSIONS[CPP_HTTPLIB]}.tar.gz;cpp-httplib-${PROJECT_VERSIONS[CPP_HTTPLIB]}.tar.gz;3rd_party"
|
||||
PROJECT_DOWNLOADS[CURL]="https://github.com/curl/curl/archive/refs/tags/curl-${PROJECT_VERSIONS[CURL2]}.tar.gz;curl-${PROJECT_VERSIONS[CURL]}.tar.gz;3rd_party"
|
||||
PROJECT_DOWNLOADS[EXPAT]="https://github.com/libexpat/libexpat/archive/refs/tags/R_${PROJECT_VERSIONS[EXPAT2]}.tar.gz;expat-${PROJECT_VERSIONS[EXPAT]}.tar.gz;3rd_party/mingw64"
|
||||
PROJECT_DOWNLOADS[GCC]="https://ftp.gnu.org/gnu/gcc/gcc-${PROJECT_VERSIONS[GCC]}/gcc-${PROJECT_VERSIONS[GCC]}.tar.gz;gcc-${PROJECT_VERSIONS[GCC]}.tar.gz;3rd_party/mingw64"
|
||||
PROJECT_DOWNLOADS[GCC]="https://mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-${PROJECT_VERSIONS[GCC]}/gcc-${PROJECT_VERSIONS[GCC]}.tar.gz;gcc-${PROJECT_VERSIONS[GCC]}.tar.gz;3rd_party/mingw64"
|
||||
PROJECT_DOWNLOADS[GTEST]="https://github.com/google/googletest/archive/refs/tags/v${PROJECT_VERSIONS[GTEST]}.tar.gz;googletest-${PROJECT_VERSIONS[GTEST]}.tar.gz;3rd_party"
|
||||
PROJECT_DOWNLOADS[ICU]="https://github.com/unicode-org/icu/archive/refs/tags/release-${PROJECT_VERSIONS[ICU]}.tar.gz;icu-release-${PROJECT_VERSIONS[ICU]}.tar.gz;3rd_party/mingw64"
|
||||
PROJECT_DOWNLOADS[JSON]="https://github.com/nlohmann/json/archive/refs/tags/v${PROJECT_VERSIONS[JSON]}.tar.gz;json-${PROJECT_VERSIONS[JSON]}.tar.gz;3rd_party"
|
||||
|
@@ -8,24 +8,24 @@ PROJECT_VERSIONS[BOOST2_PATCH]="0"
|
||||
PROJECT_VERSIONS[BOOST_MAJOR]="1"
|
||||
PROJECT_VERSIONS[BOOST_MINOR]="88"
|
||||
PROJECT_VERSIONS[BOOST_PATCH]="0"
|
||||
PROJECT_VERSIONS[CPP_HTTPLIB]="0.20.0"
|
||||
PROJECT_VERSIONS[CURL]="8.13.0"
|
||||
PROJECT_VERSIONS[CURL2]="8_13_0"
|
||||
PROJECT_VERSIONS[CPP_HTTPLIB]="0.23.1"
|
||||
PROJECT_VERSIONS[CURL]="8.15.0"
|
||||
PROJECT_VERSIONS[CURL2]="8_15_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[GCC]="15.1.0"
|
||||
PROJECT_VERSIONS[GTEST]="1.17.0"
|
||||
PROJECT_VERSIONS[ICU]="76-1"
|
||||
PROJECT_VERSIONS[JSON]="3.12.0"
|
||||
PROJECT_VERSIONS[LIBSODIUM]="1.0.20"
|
||||
PROJECT_VERSIONS[MINGW]="12.0.0"
|
||||
PROJECT_VERSIONS[OPENSSL]="3.5.0"
|
||||
PROJECT_VERSIONS[MINGW]="13.0.0"
|
||||
PROJECT_VERSIONS[OPENSSL]="3.5.1"
|
||||
PROJECT_VERSIONS[PKG_CONFIG]="0.29.2"
|
||||
PROJECT_VERSIONS[PUGIXML]="1.15"
|
||||
PROJECT_VERSIONS[ROCKSDB]="10.0.1"
|
||||
PROJECT_VERSIONS[SPDLOG]="1.15.2"
|
||||
PROJECT_VERSIONS[SQLITE]="3490100"
|
||||
PROJECT_VERSIONS[SQLITE2]="3.49.1"
|
||||
PROJECT_VERSIONS[ROCKSDB]="10.4.2"
|
||||
PROJECT_VERSIONS[SPDLOG]="1.15.3"
|
||||
PROJECT_VERSIONS[SQLITE]="3500300"
|
||||
PROJECT_VERSIONS[SQLITE2]="3.50.3"
|
||||
PROJECT_VERSIONS[STDUUID]="1.2.3"
|
||||
PROJECT_VERSIONS[ZLIB]="1.3.1"
|
||||
export PROJECT_VERSIONS
|
||||
|
BIN
support/3rd_party/cpp-httplib-0.20.0.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/cpp-httplib-0.20.0.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
18064587e0cc6a0d5d56d619f4cbbcaba47aa5d84d86013abbd45d95c6653866 cpp-httplib-0.20.0.tar.gz
|
BIN
support/3rd_party/cpp-httplib-0.23.1.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/cpp-httplib-0.23.1.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/cpp-httplib-0.23.1.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/cpp-httplib-0.23.1.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
410a1347ed6bcbcc4a19af8ed8ad3873fe9fa97731d52db845c4c78f3f9c31e6 cpp-httplib-0.23.1.tar.gz
|
BIN
support/3rd_party/curl-8.13.0.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/curl-8.13.0.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
1
support/3rd_party/curl-8.13.0.tar.gz.sha256
vendored
1
support/3rd_party/curl-8.13.0.tar.gz.sha256
vendored
@@ -1 +0,0 @@
|
||||
ccc5ba45d9f5320c70ffb24e5411b66ba55ea1f333bf78be0963ed90a9328699 curl-8.13.0.tar.gz
|
BIN
support/3rd_party/curl-8.15.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/curl-8.15.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/curl-8.15.0.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/curl-8.15.0.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
2937cadde007aa3a52a17c21ac9153ea054700f37926d1d96602bf07e888c847 curl-8.15.0.tar.gz
|
BIN
support/3rd_party/googletest-1.15.2.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/googletest-1.15.2.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926 googletest-1.15.2.tar.gz
|
BIN
support/3rd_party/googletest-1.16.0.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/googletest-1.16.0.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
78c676fc63881529bf97bf9d45948d905a66833fbfa5318ea2cd7478cb98f399 *googletest-1.16.0.tar.gz
|
BIN
support/3rd_party/googletest-1.17.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/googletest-1.17.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/googletest-1.17.0.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/googletest-1.17.0.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c googletest-1.17.0.tar.gz
|
BIN
support/3rd_party/mingw64/gcc-14.2.0.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/mingw64/gcc-14.2.0.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293 gcc-14.2.0.tar.gz
|
BIN
support/3rd_party/mingw64/gcc-15.1.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/mingw64/gcc-15.1.0.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/mingw64/gcc-15.1.0.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/mingw64/gcc-15.1.0.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
51b9919ea69c980d7a381db95d4be27edf73b21254eb13d752a08003b4d013b1 *gcc-15.1.0.tar.gz
|
@@ -1 +0,0 @@
|
||||
cc41898aac4b6e8dd5cffd7331b9d9515b912df4420a3a612b5ea2955bbeed2f mingw-w64-v12.0.0.tar.bz2
|
Binary file not shown.
1
support/3rd_party/mingw64/mingw-w64-v13.0.0.tar.bz2.sha256
vendored
Normal file
1
support/3rd_party/mingw64/mingw-w64-v13.0.0.tar.bz2.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
5afe822af5c4edbf67daaf45eec61d538f49eef6b19524de64897c6b95828caf mingw-w64-v13.0.0.tar.bz2
|
BIN
support/3rd_party/openssl-3.5.0.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/openssl-3.5.0.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
344d0a79f1a9b08029b0744e2cc401a43f9c90acd1044d09a530b4885a8e9fc0 openssl-3.5.0.tar.gz
|
BIN
support/3rd_party/openssl-3.5.1.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/openssl-3.5.1.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/openssl-3.5.1.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/openssl-3.5.1.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
529043b15cffa5f36077a4d0af83f3de399807181d607441d734196d889b641f openssl-3.5.1.tar.gz
|
BIN
support/3rd_party/rocksdb-10.0.1.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/rocksdb-10.0.1.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
3fdc9ca996971c4c039959866382c4a3a6c8ade4abf888f3b2ff77153e07bf28 rocksdb-10.0.1.tar.gz
|
BIN
support/3rd_party/rocksdb-10.4.2.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/rocksdb-10.4.2.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/rocksdb-10.4.2.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/rocksdb-10.4.2.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
afccfab496556904900afacf7d99887f1d50cb893e5d2288bd502db233adacac rocksdb-10.4.2.tar.gz
|
BIN
support/3rd_party/spdlog-1.15.2.tar.gz
(Stored with Git LFS)
vendored
BIN
support/3rd_party/spdlog-1.15.2.tar.gz
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
7a80896357f3e8e920e85e92633b14ba0f229c506e6f978578bdc35ba09e9a5d spdlog-1.15.2.tar.gz
|
BIN
support/3rd_party/spdlog-1.15.3.tar.gz
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/spdlog-1.15.3.tar.gz
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/spdlog-1.15.3.tar.gz.sha256
vendored
Normal file
1
support/3rd_party/spdlog-1.15.3.tar.gz.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
15a04e69c222eb6c01094b5c7ff8a249b36bb22788d72519646fb85feb267e67 spdlog-1.15.3.tar.gz
|
BIN
support/3rd_party/sqlite-amalgamation-3490100.zip
(Stored with Git LFS)
vendored
BIN
support/3rd_party/sqlite-amalgamation-3490100.zip
(Stored with Git LFS)
vendored
Binary file not shown.
@@ -1 +0,0 @@
|
||||
6cebd1d8403fc58c30e93939b246f3e6e58d0765a5cd50546f16c00fd805d2c3 *sqlite-amalgamation-3490100.zip
|
BIN
support/3rd_party/sqlite-amalgamation-3500300.zip
(Stored with Git LFS)
vendored
Normal file
BIN
support/3rd_party/sqlite-amalgamation-3500300.zip
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
1
support/3rd_party/sqlite-amalgamation-3500300.zip.sha256
vendored
Normal file
1
support/3rd_party/sqlite-amalgamation-3500300.zip.sha256
vendored
Normal file
@@ -0,0 +1 @@
|
||||
9ad6d16cbc1df7cd55c8b55127c82a9bca5e9f287818de6dc87e04e73599d754 sqlite-amalgamation-3500300.zip
|
BIN
support/3rd_party/winfsp-2.0/bin/memfs-a64.exe
vendored
BIN
support/3rd_party/winfsp-2.0/bin/memfs-a64.exe
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/memfs-x64.exe
vendored
BIN
support/3rd_party/winfsp-2.0/bin/memfs-x64.exe
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/memfs-x86.exe
vendored
BIN
support/3rd_party/winfsp-2.0/bin/memfs-x86.exe
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-a64.dll
vendored
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-a64.dll
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x64.dll
vendored
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x64.dll
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x64.sys
vendored
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x64.sys
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x86.dll
vendored
BIN
support/3rd_party/winfsp-2.0/bin/winfsp-x86.dll
vendored
Binary file not shown.
839
support/3rd_party/winfsp-2.0/inc/winfsp/fsctl.h
vendored
839
support/3rd_party/winfsp-2.0/inc/winfsp/fsctl.h
vendored
@@ -1,839 +0,0 @@
|
||||
/**
|
||||
* @file winfsp/fsctl.h
|
||||
*
|
||||
* @copyright 2015-2022 Bill Zissimopoulos
|
||||
*/
|
||||
/*
|
||||
* This file is part of WinFsp.
|
||||
*
|
||||
* You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License version 3 as published by the Free Software
|
||||
* Foundation.
|
||||
*
|
||||
* Licensees holding a valid commercial license may use this software
|
||||
* in accordance with the commercial license agreement provided in
|
||||
* conjunction with the software. The terms and conditions of any such
|
||||
* commercial license agreement shall govern, supersede, and render
|
||||
* ineffective any application of the GPLv3 license to this software,
|
||||
* notwithstanding of any reference thereto in the software or
|
||||
* associated repository.
|
||||
*/
|
||||
|
||||
#ifndef WINFSP_FSCTL_H_INCLUDED
|
||||
#define WINFSP_FSCTL_H_INCLUDED
|
||||
|
||||
#include <devioctl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* static_assert is a C++11 feature, but seems to work with C on MSVC 2015 */
|
||||
#if defined(WINFSP_SYS_INTERNAL) || defined(WINFSP_DLL_INTERNAL)
|
||||
#define FSP_FSCTL_STATIC_ASSERT(e, m) static_assert(e, m)
|
||||
#else
|
||||
#define FSP_FSCTL_STATIC_ASSERT(e, m) static_assert(1, "")
|
||||
#endif
|
||||
|
||||
#define FSP_FSCTL_STR(x) FSP_FSCTL_STR_(x)
|
||||
#define FSP_FSCTL_STR_(x) #x
|
||||
#if defined(MyProductName)
|
||||
#define FSP_FSCTL_PRODUCT_NAME FSP_FSCTL_STR(MyProductName)
|
||||
#else
|
||||
#define FSP_FSCTL_PRODUCT_NAME "WinFsp"
|
||||
#endif
|
||||
#if defined(MyProductFileName)
|
||||
#define FSP_FSCTL_PRODUCT_FILE_NAME FSP_FSCTL_STR(MyProductFileName)
|
||||
#else
|
||||
#define FSP_FSCTL_PRODUCT_FILE_NAME "winfsp"
|
||||
#endif
|
||||
|
||||
#define FSP_FSCTL_DRIVER_NAME FSP_FSCTL_PRODUCT_NAME
|
||||
#define FSP_FSCTL_DISK_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Disk"
|
||||
#define FSP_FSCTL_NET_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Net"
|
||||
#define FSP_FSCTL_MUP_DEVICE_NAME FSP_FSCTL_DRIVER_NAME ".Mup"
|
||||
|
||||
#if defined(MyFspFsctlDeviceClassGuid)
|
||||
extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid =
|
||||
MyFspFsctlDeviceClassGuid;
|
||||
#else
|
||||
extern const __declspec(selectany) GUID FspFsctlDeviceClassGuid = {
|
||||
0x6f9d25fa,
|
||||
0x6dee,
|
||||
0x4a9d,
|
||||
{0x80, 0xf5, 0xe9, 0x8e, 0x14, 0xf3, 0x5e, 0x54}};
|
||||
#endif
|
||||
#if defined(MyFspFsvrtDeviceClassGuid)
|
||||
extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid =
|
||||
MyFspFsvrtDeviceClassGuid;
|
||||
#else
|
||||
extern const __declspec(selectany) GUID FspFsvrtDeviceClassGuid = {
|
||||
0xb48171c3,
|
||||
0xdd50,
|
||||
0x4852,
|
||||
{0x83, 0xa3, 0x34, 0x4c, 0x50, 0xd9, 0x3b, 0x17}};
|
||||
#endif
|
||||
|
||||
/* locations */
|
||||
#define FSP_FSCTL_PRODUCT_REGKEY "Software\\" FSP_FSCTL_PRODUCT_NAME
|
||||
#define FSP_FSCTL_PRODUCT_REGKEY_WOW64 KEY_WOW64_32KEY
|
||||
#if defined(_ARM64_)
|
||||
#define FSP_FSCTL_PRODUCT_FULL_REGKEY \
|
||||
"Software\\WOW6432Node\\" FSP_FSCTL_PRODUCT_NAME
|
||||
#define FSP_FSCTL_PRODUCT_FILE_ARCH "a64"
|
||||
#elif defined(_AMD64_)
|
||||
#define FSP_FSCTL_PRODUCT_FULL_REGKEY \
|
||||
"Software\\WOW6432Node\\" FSP_FSCTL_PRODUCT_NAME
|
||||
#define FSP_FSCTL_PRODUCT_FILE_ARCH "x64"
|
||||
#elif defined(_X86_)
|
||||
#define FSP_FSCTL_PRODUCT_FULL_REGKEY "Software\\" FSP_FSCTL_PRODUCT_NAME
|
||||
#define FSP_FSCTL_PRODUCT_FILE_ARCH "x86"
|
||||
#else
|
||||
#error unknown architecture
|
||||
#endif
|
||||
|
||||
/* alignment macros */
|
||||
#define FSP_FSCTL_ALIGN_UP(x, s) (((x) + ((s)-1L)) & ~((s)-1L))
|
||||
#define FSP_FSCTL_DEFAULT_ALIGNMENT 8
|
||||
#define FSP_FSCTL_DEFAULT_ALIGN_UP(x) \
|
||||
FSP_FSCTL_ALIGN_UP(x, FSP_FSCTL_DEFAULT_ALIGNMENT)
|
||||
#define FSP_FSCTL_DECLSPEC_ALIGN __declspec(align(FSP_FSCTL_DEFAULT_ALIGNMENT))
|
||||
|
||||
/* fsctl device codes */
|
||||
#define FSP_FSCTL_MOUNTDEV \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'M', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_MOUNTMGR \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'm', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_VOLUME_NAME \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'N', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_VOLUME_LIST \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'L', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_TRANSACT \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'T', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_IOCTL_TRANSACT \
|
||||
CTL_CODE(0x8000 | ('F' << 8) | 'W', 0x800 + 'T', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_TRANSACT_BATCH \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 't', METHOD_OUT_DIRECT, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_IOCTL_TRANSACT_BATCH \
|
||||
CTL_CODE(0x8000 | ('F' << 8) | 'W', 0x800 + 't', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_STOP \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'S', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_STOP0 \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 's', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_NOTIFY \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'n', METHOD_NEITHER, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_FSCTL_UNLOAD \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'U', METHOD_NEITHER, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
/* fsctl internal device codes (usable only in-kernel) */
|
||||
#define FSP_FSCTL_TRANSACT_INTERNAL \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + 'I', METHOD_NEITHER, \
|
||||
FILE_ANY_ACCESS)
|
||||
#define FSP_IOCTL_TRANSACT_INTERNAL \
|
||||
CTL_CODE(0x8000 | ('F' << 8) | 'W', 0x800 + 'I', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
/* fsvol device codes */
|
||||
#define FSP_FSCTL_QUERY_WINFSP \
|
||||
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800 + '?', METHOD_BUFFERED, \
|
||||
FILE_ANY_ACCESS)
|
||||
|
||||
#define FSP_FSCTL_VOLUME_PARAMS_PREFIX "\\VolumeParams="
|
||||
|
||||
#define FSP_FSCTL_VOLUME_NAME_SIZE (64 * sizeof(WCHAR))
|
||||
#define FSP_FSCTL_VOLUME_PREFIX_SIZE (192 * sizeof(WCHAR))
|
||||
#define FSP_FSCTL_VOLUME_FSNAME_SIZE (16 * sizeof(WCHAR))
|
||||
#define FSP_FSCTL_VOLUME_NAME_SIZEMAX \
|
||||
(FSP_FSCTL_VOLUME_NAME_SIZE + FSP_FSCTL_VOLUME_PREFIX_SIZE)
|
||||
FSP_FSCTL_STATIC_ASSERT(FSP_FSCTL_VOLUME_NAME_SIZEMAX <= 260 * sizeof(WCHAR),
|
||||
"Max volume name size is greater than MAX_PATH.");
|
||||
|
||||
#define FSP_FSCTL_TRANSACT_PATH_SIZEMAX (1024 * sizeof(WCHAR))
|
||||
|
||||
#define FSP_FSCTL_TRANSACT_REQ_SIZEMAX \
|
||||
(16 * 1024 - 64) /* 64: size for internal request header */
|
||||
#define FSP_FSCTL_TRANSACT_RSP_SIZEMAX (16 * 1024)
|
||||
#define FSP_FSCTL_TRANSACT_REQ_BUFFER_SIZEMAX \
|
||||
(FSP_FSCTL_TRANSACT_REQ_SIZEMAX - sizeof(FSP_FSCTL_TRANSACT_REQ))
|
||||
#define FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX \
|
||||
(FSP_FSCTL_TRANSACT_RSP_SIZEMAX - sizeof(FSP_FSCTL_TRANSACT_RSP))
|
||||
#define FSP_FSCTL_TRANSACT_BATCH_BUFFER_SIZEMIN (64 * 1024)
|
||||
#define FSP_FSCTL_TRANSACT_BUFFER_SIZEMIN FSP_FSCTL_TRANSACT_REQ_SIZEMAX
|
||||
|
||||
#define FSP_FSCTL_TRANSACT_REQ_TOKEN_HANDLE(T) \
|
||||
((HANDLE)((UINT_PTR)((T) & 0xffffffff)))
|
||||
#define FSP_FSCTL_TRANSACT_REQ_TOKEN_PID(T) ((UINT32)(((T) >> 32) & 0xffffffff))
|
||||
|
||||
#define FSP_FSCTL_DEVICECONTROL_SIZEMAX \
|
||||
(4 * 1024) /* must be < FSP_FSCTL_TRANSACT_{REQ,RSP}_SIZEMAX */
|
||||
|
||||
/* marshalling */
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4200 4201) /* zero-sized array in struct/union; \
|
||||
nameless struct/union */
|
||||
enum {
|
||||
FspFsctlTransactReservedKind = 0,
|
||||
FspFsctlTransactCreateKind,
|
||||
FspFsctlTransactOverwriteKind,
|
||||
FspFsctlTransactCleanupKind,
|
||||
FspFsctlTransactCloseKind,
|
||||
FspFsctlTransactReadKind,
|
||||
FspFsctlTransactWriteKind,
|
||||
FspFsctlTransactQueryInformationKind,
|
||||
FspFsctlTransactSetInformationKind,
|
||||
FspFsctlTransactQueryEaKind,
|
||||
FspFsctlTransactSetEaKind,
|
||||
FspFsctlTransactFlushBuffersKind,
|
||||
FspFsctlTransactQueryVolumeInformationKind,
|
||||
FspFsctlTransactSetVolumeInformationKind,
|
||||
FspFsctlTransactQueryDirectoryKind,
|
||||
FspFsctlTransactFileSystemControlKind,
|
||||
FspFsctlTransactDeviceControlKind,
|
||||
FspFsctlTransactShutdownKind,
|
||||
FspFsctlTransactLockControlKind,
|
||||
FspFsctlTransactQuerySecurityKind,
|
||||
FspFsctlTransactSetSecurityKind,
|
||||
FspFsctlTransactQueryStreamInformationKind,
|
||||
FspFsctlTransactKindCount,
|
||||
};
|
||||
enum {
|
||||
FspFsctlTransactTimeoutMinimum = 1000,
|
||||
FspFsctlTransactTimeoutMaximum = 10000,
|
||||
FspFsctlTransactTimeoutDefault =
|
||||
1000, /* DEPRECATED: default is unspecified */
|
||||
FspFsctlIrpTimeoutMinimum = 60000,
|
||||
FspFsctlIrpTimeoutMaximum = 600000,
|
||||
FspFsctlIrpTimeoutDefault = 300000,
|
||||
FspFsctlIrpTimeoutDebug = 142, /* special value for IRP timeout testing */
|
||||
FspFsctlIrpCapacityMinimum = 100,
|
||||
FspFsctlIrpCapacityMaximum = 1000,
|
||||
FspFsctlIrpCapacityDefault = 1000,
|
||||
};
|
||||
#define FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN \
|
||||
UINT16 Version; /* set to 0 or sizeof(FSP_FSCTL_VOLUME_PARAMS) */ \
|
||||
/* volume information */ \
|
||||
UINT16 SectorSize; \
|
||||
UINT16 SectorsPerAllocationUnit; \
|
||||
UINT16 MaxComponentLength; /* maximum file name component length (bytes) */ \
|
||||
UINT64 VolumeCreationTime; \
|
||||
UINT32 VolumeSerialNumber; \
|
||||
/* I/O timeouts, capacity, etc. */ \
|
||||
UINT32 TransactTimeout; /* DEPRECATED: (millis; 1 sec - 10 sec) */ \
|
||||
UINT32 IrpTimeout; /* pending IRP timeout (millis; 1 min - 10 min) */ \
|
||||
UINT32 IrpCapacity; /* maximum number of pending IRP's (100 - 1000)*/ \
|
||||
UINT32 FileInfoTimeout; /* FileInfo/Security/VolumeInfo timeout (millis) */ \
|
||||
/* FILE_FS_ATTRIBUTE_INFORMATION::FileSystemAttributes */ \
|
||||
UINT32 CaseSensitiveSearch : 1; /* file system supports case-sensitive file \
|
||||
names */ \
|
||||
UINT32 CasePreservedNames : 1; /* file system preserves the case of file \
|
||||
names */ \
|
||||
UINT32 UnicodeOnDisk : 1; /* file system supports Unicode in file names */ \
|
||||
UINT32 PersistentAcls : 1; /* file system preserves and enforces access \
|
||||
control lists */ \
|
||||
UINT32 ReparsePoints : 1; /* file system supports reparse points */ \
|
||||
UINT32 ReparsePointsAccessCheck : 1; /* file system performs reparse point \
|
||||
access checks */ \
|
||||
UINT32 NamedStreams : 1; /* file system supports named streams */ \
|
||||
UINT32 HardLinks : 1; /* unimplemented; set to 0 */ \
|
||||
UINT32 \
|
||||
ExtendedAttributes: \
|
||||
1; /* file system supports extended attributes */ \
|
||||
UINT32 ReadOnlyVolume : 1; \
|
||||
/* kernel-mode flags */ \
|
||||
UINT32 PostCleanupWhenModifiedOnly : 1; /* post Cleanup when a file was \
|
||||
modified/deleted */ \
|
||||
UINT32 PassQueryDirectoryPattern : 1; /* pass Pattern during QueryDirectory \
|
||||
operations */ \
|
||||
UINT32 AlwaysUseDoubleBuffering : 1; \
|
||||
UINT32 \
|
||||
PassQueryDirectoryFileName: \
|
||||
1; /* pass FileName during QueryDirectory \
|
||||
(GetDirInfoByName) */ \
|
||||
UINT32 FlushAndPurgeOnCleanup : 1; /* keeps file off "standby" list */ \
|
||||
UINT32 DeviceControl : 1; /* support user-mode ioctl handling */ \
|
||||
/* user-mode flags */ \
|
||||
UINT32 UmFileContextIsUserContext2 : 1; /* user mode: FileContext parameter \
|
||||
is UserContext2 */ \
|
||||
UINT32 UmFileContextIsFullContext : 1; /* user mode: FileContext parameter \
|
||||
is FullContext */ \
|
||||
UINT32 UmNoReparsePointsDirCheck : 1; /* user mode: no dir option check for \
|
||||
reparse points */ \
|
||||
UINT32 UmReservedFlags : 5; \
|
||||
/* additional kernel-mode flags */ \
|
||||
UINT32 AllowOpenInKernelMode : 1; /* allow kernel mode to open files when \
|
||||
possible */ \
|
||||
UINT32 CasePreservedExtendedAttributes : 1; /* preserve case of EA (default \
|
||||
is UPPERCASE) */ \
|
||||
UINT32 WslFeatures : 1; /* support features required for WSLinux */ \
|
||||
UINT32 DirectoryMarkerAsNextOffset : 1; /* directory marker is next offset \
|
||||
instead of last name */ \
|
||||
UINT32 RejectIrpPriorToTransact0 : 1; /* DEPRECATED: reject IRP's prior to \
|
||||
FspFsctlTransact0 */ \
|
||||
UINT32 SupportsPosixUnlinkRename : 1; /* file system supports POSIX-style \
|
||||
unlink and rename */ \
|
||||
UINT32 PostDispositionWhenNecessaryOnly : 1; /* post Disposition for dirs or \
|
||||
READONLY attr check */ \
|
||||
UINT32 KmReservedFlags : 1; \
|
||||
WCHAR Prefix[FSP_FSCTL_VOLUME_PREFIX_SIZE / \
|
||||
sizeof(WCHAR)]; /* UNC prefix (\Server\Share) */ \
|
||||
WCHAR FileSystemName[FSP_FSCTL_VOLUME_FSNAME_SIZE / sizeof(WCHAR)];
|
||||
#define FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN \
|
||||
/* additional fields; specify .Version == sizeof(FSP_FSCTL_VOLUME_PARAMS) */ \
|
||||
UINT32 VolumeInfoTimeoutValid : 1; /* VolumeInfoTimeout field is valid */ \
|
||||
UINT32 DirInfoTimeoutValid : 1; /* DirInfoTimeout field is valid */ \
|
||||
UINT32 SecurityTimeoutValid : 1; /* SecurityTimeout field is valid*/ \
|
||||
UINT32 StreamInfoTimeoutValid : 1; /* StreamInfoTimeout field is valid */ \
|
||||
UINT32 EaTimeoutValid : 1; /* EaTimeout field is valid */ \
|
||||
UINT32 KmAdditionalReservedFlags : 27; \
|
||||
UINT32 VolumeInfoTimeout; /* volume info timeout (millis); overrides \
|
||||
FileInfoTimeout */ \
|
||||
UINT32 DirInfoTimeout; /* dir info timeout (millis); overrides \
|
||||
FileInfoTimeout */ \
|
||||
UINT32 SecurityTimeout; /* security info timeout (millis); overrides \
|
||||
FileInfoTimeout */ \
|
||||
UINT32 StreamInfoTimeout; /* stream info timeout (millis); overrides \
|
||||
FileInfoTimeout */ \
|
||||
UINT32 EaTimeout; /* EA timeout (millis); overrides FileInfoTimeout */ \
|
||||
UINT32 FsextControlCode; \
|
||||
UINT32 Reserved32[1]; \
|
||||
UINT64 Reserved64[2];
|
||||
typedef struct {
|
||||
FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN
|
||||
} FSP_FSCTL_VOLUME_PARAMS_V0;
|
||||
FSP_FSCTL_STATIC_ASSERT(
|
||||
456 == sizeof(FSP_FSCTL_VOLUME_PARAMS_V0),
|
||||
"sizeof(FSP_FSCTL_VOLUME_PARAMS_V0) must be exactly 456.");
|
||||
typedef struct {
|
||||
FSP_FSCTL_VOLUME_PARAMS_V0_FIELD_DEFN
|
||||
FSP_FSCTL_VOLUME_PARAMS_V1_FIELD_DEFN
|
||||
} FSP_FSCTL_VOLUME_PARAMS;
|
||||
FSP_FSCTL_STATIC_ASSERT(504 == sizeof(FSP_FSCTL_VOLUME_PARAMS),
|
||||
"sizeof(FSP_FSCTL_VOLUME_PARAMS) is currently 504. "
|
||||
"Update this assertion check if it changes.");
|
||||
typedef struct {
|
||||
UINT64 TotalSize;
|
||||
UINT64 FreeSize;
|
||||
UINT16 VolumeLabelLength;
|
||||
WCHAR VolumeLabel[32];
|
||||
} FSP_FSCTL_VOLUME_INFO;
|
||||
FSP_FSCTL_STATIC_ASSERT(88 == sizeof(FSP_FSCTL_VOLUME_INFO),
|
||||
"sizeof(FSP_FSCTL_VOLUME_INFO) must be exactly 88.");
|
||||
typedef struct {
|
||||
UINT32 FileAttributes;
|
||||
UINT32 ReparseTag;
|
||||
UINT64 AllocationSize;
|
||||
UINT64 FileSize;
|
||||
UINT64 CreationTime;
|
||||
UINT64 LastAccessTime;
|
||||
UINT64 LastWriteTime;
|
||||
UINT64 ChangeTime;
|
||||
UINT64 IndexNumber;
|
||||
UINT32 HardLinks; /* unimplemented: set to 0 */
|
||||
UINT32 EaSize;
|
||||
} FSP_FSCTL_FILE_INFO;
|
||||
FSP_FSCTL_STATIC_ASSERT(72 == sizeof(FSP_FSCTL_FILE_INFO),
|
||||
"sizeof(FSP_FSCTL_FILE_INFO) must be exactly 72.");
|
||||
typedef struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
PWSTR NormalizedName;
|
||||
UINT16 NormalizedNameSize;
|
||||
} FSP_FSCTL_OPEN_FILE_INFO;
|
||||
typedef struct {
|
||||
UINT16 Size;
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
union {
|
||||
UINT64 NextOffset;
|
||||
UINT8 Padding[24];
|
||||
/* make struct as big as FILE_ID_BOTH_DIR_INFORMATION; allows for in-place
|
||||
* copying */
|
||||
} DUMMYUNIONNAME;
|
||||
WCHAR FileNameBuf[];
|
||||
} FSP_FSCTL_DIR_INFO;
|
||||
FSP_FSCTL_STATIC_ASSERT(104 == sizeof(FSP_FSCTL_DIR_INFO),
|
||||
"sizeof(FSP_FSCTL_DIR_INFO) must be exactly 104.");
|
||||
typedef struct {
|
||||
UINT16 Size;
|
||||
UINT64 StreamSize;
|
||||
UINT64 StreamAllocationSize;
|
||||
WCHAR StreamNameBuf[];
|
||||
} FSP_FSCTL_STREAM_INFO;
|
||||
FSP_FSCTL_STATIC_ASSERT(24 == sizeof(FSP_FSCTL_STREAM_INFO),
|
||||
"sizeof(FSP_FSCTL_STREAM_INFO) must be exactly 24.");
|
||||
typedef struct {
|
||||
UINT16 Size;
|
||||
UINT32 Filter;
|
||||
UINT32 Action;
|
||||
WCHAR FileNameBuf[];
|
||||
} FSP_FSCTL_NOTIFY_INFO;
|
||||
FSP_FSCTL_STATIC_ASSERT(12 == sizeof(FSP_FSCTL_NOTIFY_INFO),
|
||||
"sizeof(FSP_FSCTL_NOTIFY_INFO) must be exactly 12.");
|
||||
typedef struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} FSP_FSCTL_TRANSACT_FULL_CONTEXT;
|
||||
typedef struct {
|
||||
UINT16 Offset;
|
||||
UINT16 Size;
|
||||
} FSP_FSCTL_TRANSACT_BUF;
|
||||
typedef struct {
|
||||
UINT16 Version;
|
||||
UINT16 Size;
|
||||
UINT32 Kind;
|
||||
UINT64 Hint;
|
||||
union {
|
||||
struct {
|
||||
UINT32 CreateOptions; /* Disposition: high 8 bits; Options: low 24 bits */
|
||||
UINT32 FileAttributes; /* file attributes for new files */
|
||||
FSP_FSCTL_TRANSACT_BUF
|
||||
SecurityDescriptor; /* security descriptor for new files */
|
||||
UINT64 AllocationSize; /* initial allocation size */
|
||||
UINT64 AccessToken; /* request access token (PID,HANDLE) */
|
||||
UINT32 DesiredAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
|
||||
UINT32 GrantedAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
|
||||
UINT32 ShareAccess; /* FILE_SHARE_{READ,WRITE,DELETE} */
|
||||
FSP_FSCTL_TRANSACT_BUF
|
||||
Ea; /* extended attributes or reparse point buffer */
|
||||
UINT32 UserMode : 1; /* request originated in user mode */
|
||||
UINT32 HasTraversePrivilege : 1; /* requestor has
|
||||
TOKEN_HAS_TRAVERSE_PRIVILEGE */
|
||||
UINT32
|
||||
HasBackupPrivilege : 1; /* requestor has TOKEN_HAS_BACKUP_PRIVILEGE */
|
||||
UINT32 HasRestorePrivilege : 1; /* requestor has
|
||||
TOKEN_HAS_RESTORE_PRIVILEGE */
|
||||
UINT32 OpenTargetDirectory : 1; /* open target dir and report
|
||||
FILE_{EXISTS,DOES_NOT_EXIST} */
|
||||
UINT32
|
||||
CaseSensitive : 1; /* FileName comparisons should be case-sensitive */
|
||||
UINT32 HasTrailingBackslash : 1; /* FileName had trailing backslash */
|
||||
UINT32 AcceptsSecurityDescriptor : 1;
|
||||
UINT32 EaIsReparsePoint : 1; /* Ea buffer is reparse point */
|
||||
UINT32 ReservedFlags : 24;
|
||||
UINT16 NamedStream; /* request targets named stream; colon offset in
|
||||
FileName */
|
||||
} Create;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32
|
||||
FileAttributes; /* file attributes for overwritten/superseded files */
|
||||
UINT64
|
||||
AllocationSize; /* allocation size for overwritten/superseded files */
|
||||
UINT32 Supersede : 1; /* 0: FILE_OVERWRITE operation, 1: FILE_SUPERSEDE
|
||||
operation */
|
||||
FSP_FSCTL_TRANSACT_BUF Ea; /* extended attributes buffer */
|
||||
} Overwrite;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 Delete : 1; /* file must be deleted */
|
||||
UINT32 SetAllocationSize : 1;
|
||||
UINT32 SetArchiveBit : 1;
|
||||
UINT32 SetLastAccessTime : 1;
|
||||
UINT32 SetLastWriteTime : 1;
|
||||
UINT32 SetChangeTime : 1;
|
||||
} Cleanup;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} Close;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT64 Address;
|
||||
UINT64 Offset;
|
||||
UINT32 Length;
|
||||
UINT32 Key;
|
||||
} Read;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT64 Address;
|
||||
UINT64 Offset;
|
||||
UINT32 Length;
|
||||
UINT32 Key;
|
||||
UINT32 ConstrainedIo : 1;
|
||||
} Write;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} QueryInformation;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 FileInformationClass;
|
||||
union {
|
||||
struct {
|
||||
UINT64 AllocationSize;
|
||||
} Allocation;
|
||||
struct {
|
||||
UINT32 FileAttributes;
|
||||
UINT64 CreationTime;
|
||||
UINT64 LastAccessTime;
|
||||
UINT64 LastWriteTime;
|
||||
UINT64 ChangeTime;
|
||||
} Basic;
|
||||
struct {
|
||||
UINT32 Delete : 1;
|
||||
} Disposition;
|
||||
struct {
|
||||
UINT32 Flags;
|
||||
} DispositionEx;
|
||||
struct {
|
||||
UINT64 FileSize;
|
||||
} EndOfFile;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF NewFileName;
|
||||
UINT64 AccessToken; /* request access token (PID,HANDLE) */
|
||||
} Rename;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF NewFileName;
|
||||
UINT64 AccessToken; /* request access token (PID,HANDLE) */
|
||||
UINT32 Flags;
|
||||
} RenameEx;
|
||||
} Info;
|
||||
} SetInformation;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} QueryEa;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
FSP_FSCTL_TRANSACT_BUF Ea;
|
||||
} SetEa;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} FlushBuffers;
|
||||
struct {
|
||||
UINT32 FsInformationClass;
|
||||
union {
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF VolumeLabel;
|
||||
} Label;
|
||||
} Info;
|
||||
} SetVolumeInformation;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT64 Address;
|
||||
UINT32 Length;
|
||||
FSP_FSCTL_TRANSACT_BUF Pattern;
|
||||
FSP_FSCTL_TRANSACT_BUF Marker;
|
||||
UINT32
|
||||
CaseSensitive : 1; /* FileName comparisons should be case-sensitive */
|
||||
UINT32 PatternIsFileName : 1; /* Pattern does not contain wildcards */
|
||||
} QueryDirectory;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 FsControlCode;
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
UINT16 TargetOnFileSystem; /* the target of the symbolic link is on this
|
||||
file system */
|
||||
} FileSystemControl;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 IoControlCode;
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
UINT32 OutputLength;
|
||||
} DeviceControl;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} QuerySecurity;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
UINT32 SecurityInformation;
|
||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor;
|
||||
} SetSecurity;
|
||||
struct {
|
||||
UINT64 UserContext;
|
||||
UINT64 UserContext2;
|
||||
} QueryStreamInformation;
|
||||
} Req;
|
||||
FSP_FSCTL_TRANSACT_BUF FileName;
|
||||
/* Create,Cleanup,SetInformation{Disposition,Rename},FileSystemControl{ReparsePoint}
|
||||
*/
|
||||
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
||||
} FSP_FSCTL_TRANSACT_REQ;
|
||||
typedef struct {
|
||||
UINT16 Version;
|
||||
UINT16 Size;
|
||||
UINT32 Kind;
|
||||
UINT64 Hint;
|
||||
struct {
|
||||
UINT32 Information;
|
||||
UINT32 Status;
|
||||
} IoStatus;
|
||||
union {
|
||||
union {
|
||||
/* IoStatus.Status == STATUS_SUCCESS */
|
||||
struct {
|
||||
UINT64 UserContext; /* user context associated with file node */
|
||||
UINT64 UserContext2; /* user context associated with file descriptor
|
||||
(handle) */
|
||||
UINT32 GrantedAccess; /* FILE_{READ_DATA,WRITE_DATA,etc.} */
|
||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor;
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
FSP_FSCTL_TRANSACT_BUF FileName;
|
||||
UINT32 DisableCache : 1;
|
||||
UINT32 HasSecurityDescriptor : 1;
|
||||
} Opened;
|
||||
/* IoStatus.Status == STATUS_REPARSE */
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
} Reparse;
|
||||
} Create;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
} Overwrite;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
} Write;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
} QueryInformation;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO
|
||||
FileInfo; /* valid: File{Allocation,Basic,EndOfFile}Information */
|
||||
} SetInformation;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF Ea;
|
||||
} QueryEa;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo;
|
||||
FSP_FSCTL_TRANSACT_BUF
|
||||
Ea; /* Size==0 means no extended atttributed returned */
|
||||
} SetEa;
|
||||
struct {
|
||||
FSP_FSCTL_FILE_INFO FileInfo; /* valid when flushing file (not volume) */
|
||||
} FlushBuffers;
|
||||
struct {
|
||||
FSP_FSCTL_VOLUME_INFO VolumeInfo;
|
||||
} QueryVolumeInformation;
|
||||
struct {
|
||||
FSP_FSCTL_VOLUME_INFO VolumeInfo;
|
||||
} SetVolumeInformation;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
} FileSystemControl;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
} DeviceControl;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor;
|
||||
} QuerySecurity;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF SecurityDescriptor; /* Size==0 means no security
|
||||
descriptor returned */
|
||||
} SetSecurity;
|
||||
struct {
|
||||
FSP_FSCTL_TRANSACT_BUF Buffer;
|
||||
} QueryStreamInformation;
|
||||
} Rsp;
|
||||
FSP_FSCTL_DECLSPEC_ALIGN UINT8 Buffer[];
|
||||
} FSP_FSCTL_TRANSACT_RSP;
|
||||
#pragma warning(pop)
|
||||
FSP_FSCTL_STATIC_ASSERT(FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX >
|
||||
FSP_FSCTL_TRANSACT_PATH_SIZEMAX,
|
||||
"FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX must be greater "
|
||||
"than FSP_FSCTL_TRANSACT_PATH_SIZEMAX "
|
||||
"to detect when a normalized name has been set during "
|
||||
"a Create/Open request.");
|
||||
static inline BOOLEAN
|
||||
FspFsctlTransactCanProduceRequest(FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID RequestBufEnd) {
|
||||
return (PUINT8)Request + FSP_FSCTL_TRANSACT_REQ_SIZEMAX <=
|
||||
(PUINT8)RequestBufEnd;
|
||||
}
|
||||
static inline FSP_FSCTL_TRANSACT_REQ *
|
||||
FspFsctlTransactProduceRequest(FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
SIZE_T RequestSize) {
|
||||
PVOID NextRequest = (PUINT8)Request + FSP_FSCTL_DEFAULT_ALIGN_UP(RequestSize);
|
||||
return (FSP_FSCTL_TRANSACT_REQ *)NextRequest;
|
||||
}
|
||||
static inline FSP_FSCTL_TRANSACT_REQ *
|
||||
FspFsctlTransactConsumeRequest(FSP_FSCTL_TRANSACT_REQ *Request,
|
||||
PVOID RequestBufEnd) {
|
||||
if ((PUINT8)Request + sizeof(Request->Size) > (PUINT8)RequestBufEnd ||
|
||||
sizeof(FSP_FSCTL_TRANSACT_REQ) > Request->Size)
|
||||
return 0;
|
||||
PVOID NextRequest =
|
||||
(PUINT8)Request + FSP_FSCTL_DEFAULT_ALIGN_UP(Request->Size);
|
||||
return NextRequest <= RequestBufEnd ? (FSP_FSCTL_TRANSACT_REQ *)NextRequest
|
||||
: 0;
|
||||
}
|
||||
static inline BOOLEAN
|
||||
FspFsctlTransactCanProduceResponse(FSP_FSCTL_TRANSACT_RSP *Response,
|
||||
PVOID ResponseBufEnd) {
|
||||
return (PUINT8)Response + FSP_FSCTL_TRANSACT_RSP_SIZEMAX <=
|
||||
(PUINT8)ResponseBufEnd;
|
||||
}
|
||||
static inline FSP_FSCTL_TRANSACT_RSP *
|
||||
FspFsctlTransactProduceResponse(FSP_FSCTL_TRANSACT_RSP *Response,
|
||||
SIZE_T ResponseSize) {
|
||||
PVOID NextResponse =
|
||||
(PUINT8)Response + FSP_FSCTL_DEFAULT_ALIGN_UP(ResponseSize);
|
||||
return (FSP_FSCTL_TRANSACT_RSP *)NextResponse;
|
||||
}
|
||||
static inline FSP_FSCTL_TRANSACT_RSP *
|
||||
FspFsctlTransactConsumeResponse(FSP_FSCTL_TRANSACT_RSP *Response,
|
||||
PVOID ResponseBufEnd) {
|
||||
if ((PUINT8)Response + sizeof(Response->Size) > (PUINT8)ResponseBufEnd ||
|
||||
sizeof(FSP_FSCTL_TRANSACT_RSP) > Response->Size)
|
||||
return 0;
|
||||
PVOID NextResponse =
|
||||
(PUINT8)Response + FSP_FSCTL_DEFAULT_ALIGN_UP(Response->Size);
|
||||
return NextResponse <= ResponseBufEnd ? (FSP_FSCTL_TRANSACT_RSP *)NextResponse
|
||||
: 0;
|
||||
}
|
||||
|
||||
#if !defined(_KERNEL_MODE)
|
||||
FSP_API NTSTATUS FspFsctlCreateVolume(
|
||||
PWSTR DevicePath, const FSP_FSCTL_VOLUME_PARAMS *VolumeParams,
|
||||
PWCHAR VolumeNameBuf, SIZE_T VolumeNameSize, PHANDLE PVolumeHandle);
|
||||
FSP_API NTSTATUS FspFsctlMakeMountdev(HANDLE VolumeHandle, BOOLEAN Persistent,
|
||||
GUID *UniqueId);
|
||||
FSP_API NTSTATUS FspFsctlUseMountmgr(HANDLE VolumeHandle, PWSTR MountPoint);
|
||||
FSP_API NTSTATUS FspFsctlTransact(HANDLE VolumeHandle, PVOID ResponseBuf,
|
||||
SIZE_T ResponseBufSize, PVOID RequestBuf,
|
||||
SIZE_T *PRequestBufSize, BOOLEAN Batch);
|
||||
FSP_API NTSTATUS FspFsctlStop(HANDLE VolumeHandle);
|
||||
FSP_API NTSTATUS FspFsctlStop0(HANDLE VolumeHandle);
|
||||
FSP_API NTSTATUS FspFsctlNotify(HANDLE VolumeHandle,
|
||||
FSP_FSCTL_NOTIFY_INFO *NotifyInfo, SIZE_T Size);
|
||||
FSP_API NTSTATUS FspFsctlGetVolumeList(PWSTR DevicePath, PWCHAR VolumeListBuf,
|
||||
PSIZE_T PVolumeListSize);
|
||||
FSP_API NTSTATUS FspFsctlPreflight(PWSTR DevicePath);
|
||||
FSP_API NTSTATUS FspFsctlStartService(VOID);
|
||||
FSP_API NTSTATUS FspFsctlStopService(VOID);
|
||||
FSP_API NTSTATUS FspFsctlEnumServices(VOID (*EnumFn)(PVOID Context,
|
||||
PWSTR ServiceName,
|
||||
BOOLEAN Running),
|
||||
PVOID Context);
|
||||
|
||||
typedef struct {
|
||||
/* in */
|
||||
HANDLE VolumeHandle; /* volume handle returned by FspFsctlCreateVolume */
|
||||
PWSTR VolumeName; /* volume name returned by FspFsctlCreateVolume */
|
||||
PSECURITY_DESCRIPTOR
|
||||
Security; /* optional: security descriptor for directories */
|
||||
UINT64 Reserved; /* reserved for future use */
|
||||
/* in/out */
|
||||
PWSTR MountPoint; /* FspMountSet sets drive in buffer when passed "*:" */
|
||||
HANDLE MountHandle; /* FspMountSet sets, FspMountRemove uses */
|
||||
} FSP_MOUNT_DESC;
|
||||
FSP_API NTSTATUS FspMountSet(FSP_MOUNT_DESC *Desc);
|
||||
FSP_API NTSTATUS FspMountRemove(FSP_MOUNT_DESC *Desc);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Atomics
|
||||
*
|
||||
* See https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html
|
||||
* (https://archive.is/mJfFX)
|
||||
*/
|
||||
#if _MSC_VER >= 1920 /* VS2019 or later */
|
||||
__int32 __iso_volatile_load32(const volatile __int32 *);
|
||||
void __iso_volatile_store32(volatile __int32 *, __int32);
|
||||
__int64 __iso_volatile_load64(const volatile __int64 *);
|
||||
void __iso_volatile_store64(volatile __int64 *, __int64);
|
||||
#define FSP_INTERLOCKED__LOAD32(p) __iso_volatile_load32(p)
|
||||
#define FSP_INTERLOCKED__STORE32(p, v) __iso_volatile_store32(p, v)
|
||||
#define FSP_INTERLOCKED__LOAD64(p) __iso_volatile_load64(p)
|
||||
#define FSP_INTERLOCKED__STORE64(p, v) __iso_volatile_store64(p, v)
|
||||
#else
|
||||
#define FSP_INTERLOCKED__LOAD32(p) (*(p))
|
||||
#define FSP_INTERLOCKED__STORE32(p, v) (*(p) = (v))
|
||||
#define FSP_INTERLOCKED__LOAD64(p) (*(p))
|
||||
#define FSP_INTERLOCKED__STORE64(p, v) (*(p) = (v))
|
||||
#endif
|
||||
static inline INT32 FspInterlockedLoad32(INT32 volatile *p) {
|
||||
#if defined(_M_ARM64)
|
||||
void __dmb(unsigned int);
|
||||
INT32 v = FSP_INTERLOCKED__LOAD32(p);
|
||||
__dmb(0xb);
|
||||
return v;
|
||||
|
||||
#elif defined(_M_X64) || defined(_M_IX86)
|
||||
#ifndef _ReadWriteBarrier
|
||||
void _ReadWriteBarrier(void);
|
||||
#endif
|
||||
INT32 v = FSP_INTERLOCKED__LOAD32(p);
|
||||
_ReadWriteBarrier();
|
||||
return v;
|
||||
|
||||
#endif
|
||||
}
|
||||
static inline VOID FspInterlockedStore32(INT32 volatile *p, INT32 v) {
|
||||
#if defined(_M_ARM64)
|
||||
void __dmb(unsigned int);
|
||||
__dmb(0xb);
|
||||
FSP_INTERLOCKED__STORE32(p, v);
|
||||
__dmb(0xb);
|
||||
|
||||
#elif defined(_M_X64) || defined(_M_IX86)
|
||||
long _InterlockedExchange(long volatile *, long);
|
||||
_InterlockedExchange((long volatile *)p, v);
|
||||
|
||||
#endif
|
||||
}
|
||||
static inline VOID *FspInterlockedLoadPointer(VOID *volatile *p) {
|
||||
#if defined(_M_ARM64)
|
||||
void __dmb(unsigned int);
|
||||
VOID *v = (VOID *)FSP_INTERLOCKED__LOAD64((__int64 volatile *)(p));
|
||||
__dmb(0xb);
|
||||
return v;
|
||||
|
||||
#elif defined(_M_X64)
|
||||
#ifndef _ReadWriteBarrier
|
||||
void _ReadWriteBarrier(void);
|
||||
#endif
|
||||
VOID *v = (VOID *)FSP_INTERLOCKED__LOAD64((__int64 volatile *)(p));
|
||||
_ReadWriteBarrier();
|
||||
return v;
|
||||
|
||||
#elif defined(_M_IX86)
|
||||
#ifndef _ReadWriteBarrier
|
||||
void _ReadWriteBarrier(void);
|
||||
#endif
|
||||
VOID *v = (VOID *)FSP_INTERLOCKED__LOAD32((__int32 volatile *)(p));
|
||||
_ReadWriteBarrier();
|
||||
return v;
|
||||
|
||||
#endif
|
||||
}
|
||||
static inline VOID FspInterlockedStorePointer(VOID *volatile *p, VOID *v) {
|
||||
#if defined(_M_ARM64)
|
||||
void __dmb(unsigned int);
|
||||
__dmb(0xb);
|
||||
FSP_INTERLOCKED__STORE64((__int64 volatile *)(p), (__int64)(v));
|
||||
__dmb(0xb);
|
||||
|
||||
#elif defined(_M_X64) || defined(_M_IX86)
|
||||
void *_InterlockedExchangePointer(void *volatile *, void *);
|
||||
_InterlockedExchangePointer(p, v);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-a64.lib
vendored
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-a64.lib
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-x64.lib
vendored
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-x64.lib
vendored
Binary file not shown.
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-x86.lib
vendored
BIN
support/3rd_party/winfsp-2.0/lib/winfsp-x86.lib
vendored
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,54 +1,54 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
REM Determine the SxS (side-by-side) identifier.
|
||||
set SxsDir=
|
||||
set RegKey="HKLM\SOFTWARE\WinFsp"
|
||||
set RegVal="SxsDir"
|
||||
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
||||
if !ERRORLEVEL! equ 0 (
|
||||
for /f "tokens=2,*" %%i in ('reg query !RegKey! /v !RegVal! /reg:32 ^| findstr !RegVal!') do (
|
||||
set SxsDir=%%j
|
||||
)
|
||||
)
|
||||
set SxsSuffix=
|
||||
if defined SxsDir (
|
||||
set SxsSuffix=!SxsDir:*SxS\sxs.=!
|
||||
if !SxsSuffix:~-1!==\ set SxsSuffix=!SxsSuffix:~0,-1!
|
||||
set SxsSuffix=+!SxsSuffix!
|
||||
)
|
||||
|
||||
echo WINFSP FSD
|
||||
sc query WinFsp!SxsSuffix!
|
||||
sc qc WinFsp!SxsSuffix!
|
||||
sc sdshow WinFsp!SxsSuffix!
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo WINFSP DLL
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\WinFsp.Np\NetworkProvider
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\WinFsp
|
||||
echo.
|
||||
|
||||
echo WINFSP LAUNCHER
|
||||
sc query WinFsp.Launcher
|
||||
sc qc WinFsp.Launcher
|
||||
sc sdshow WinFsp.Launcher
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo WINFSP REGISTRY
|
||||
reg query HKLM\SOFTWARE\WinFsp /s /reg:32
|
||||
echo.
|
||||
|
||||
echo FILE SYSTEM FILTERS (REQUIRES ADMINISTRATOR)
|
||||
fltmc filters
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo OS INFORMATION
|
||||
systeminfo
|
||||
echo.
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
REM Determine the SxS (side-by-side) identifier.
|
||||
set SxsDir=
|
||||
set RegKey="HKLM\SOFTWARE\WinFsp"
|
||||
set RegVal="SxsDir"
|
||||
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
||||
if !ERRORLEVEL! equ 0 (
|
||||
for /f "tokens=2,*" %%i in ('reg query !RegKey! /v !RegVal! /reg:32 ^| findstr !RegVal!') do (
|
||||
set SxsDir=%%j
|
||||
)
|
||||
)
|
||||
set SxsSuffix=
|
||||
if defined SxsDir (
|
||||
set SxsSuffix=!SxsDir:*SxS\sxs.=!
|
||||
if !SxsSuffix:~-1!==\ set SxsSuffix=!SxsSuffix:~0,-1!
|
||||
set SxsSuffix=+!SxsSuffix!
|
||||
)
|
||||
|
||||
echo WINFSP FSD
|
||||
sc query WinFsp!SxsSuffix!
|
||||
sc qc WinFsp!SxsSuffix!
|
||||
sc sdshow WinFsp!SxsSuffix!
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo WINFSP DLL
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\WinFsp.Np\NetworkProvider
|
||||
reg query HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\WinFsp
|
||||
echo.
|
||||
|
||||
echo WINFSP LAUNCHER
|
||||
sc query WinFsp.Launcher
|
||||
sc qc WinFsp.Launcher
|
||||
sc sdshow WinFsp.Launcher
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo WINFSP REGISTRY
|
||||
reg query HKLM\SOFTWARE\WinFsp /s /reg:32
|
||||
echo.
|
||||
|
||||
echo FILE SYSTEM FILTERS (REQUIRES ADMINISTRATOR)
|
||||
fltmc filters
|
||||
echo.
|
||||
echo.
|
||||
|
||||
echo OS INFORMATION
|
||||
systeminfo
|
||||
echo.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user