refactor event system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2025-01-23 19:10:06 -06:00
parent 4b3582cbb0
commit 03485935b7
7 changed files with 235 additions and 302 deletions

View File

@ -72,6 +72,48 @@ E_SIMPLE3(fuse_event, debug,
E_SIMPLE1(fuse_args_parsed, info, E_SIMPLE1(fuse_args_parsed, info,
std::string, arguments, args, E_FROM_STRING std::string, arguments, args, E_FROM_STRING
); );
E_SIMPLE2(invalid_cache_size, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, by, by, E_FROM_UINT64
);
E_SIMPLE2(max_cache_size_reached, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, max_cache_size, max, E_FROM_UINT64
);
E_SIMPLE2(packet_client_timeout, error,
std::string, event_name, en, E_FROM_STRING,
std::string, message, msg, E_FROM_STRING
);
//FUSE
E_SIMPLE3(remote_fuse_server_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
//WINFSP
E_SIMPLE3(winfsp_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
NTSTATUS, result, res, E_FROM_INT32
);
E_SIMPLE(drive_stop_begin, info);
E_SIMPLE(drive_stop_end, info);
E_SIMPLE(drive_stop_timed_out, info);
E_SIMPLE3(remote_winfsp_client_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
E_SIMPLE3(remote_winfsp_server_event, debug,
std::string, function, FUNC, E_FROM_STRING,
std::string, api_path, AP, E_FROM_STRING,
packet::error_type, result, RES, E_FROM_INT32
);
// clang-format on // clang-format on
} // namespace repertory } // namespace repertory

View File

@ -31,13 +31,6 @@
#include "version.hpp" #include "version.hpp"
namespace repertory { namespace repertory {
// clang-format off
E_SIMPLE2(packet_client_timeout, error,
std::string, event_name, en, E_FROM_STRING,
std::string, message, msg, E_FROM_STRING
);
// clang-format on
packet_client::packet_client(remote::remote_config cfg) packet_client::packet_client(remote::remote_config cfg)
: cfg_(std::move(cfg)), unique_id_(utils::create_uuid_string()) {} : cfg_(std::move(cfg)), unique_id_(utils::create_uuid_string()) {}
@ -112,8 +105,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
} }
} }
auto packet_client::read_packet(client &cli, packet &response) const auto packet_client::read_packet(client &cli,
-> packet::error_type { packet &response) const -> packet::error_type {
data_buffer buffer(sizeof(std::uint32_t)); data_buffer buffer(sizeof(std::uint32_t));
const auto read_buffer = [&]() { const auto read_buffer = [&]() {
std::uint32_t offset{}; std::uint32_t offset{};
@ -154,8 +147,8 @@ void packet_client::resolve() {
.resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port)); .resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port));
} }
auto packet_client::send(std::string_view method, std::uint32_t &service_flags) auto packet_client::send(std::string_view method,
-> packet::error_type { std::uint32_t &service_flags) -> packet::error_type {
packet request; packet request;
return send(method, request, service_flags); return send(method, request, service_flags);
} }
@ -167,8 +160,8 @@ auto packet_client::send(std::string_view method, packet &request,
} }
auto packet_client::send(std::string_view method, packet &request, auto packet_client::send(std::string_view method, packet &request,
packet &response, std::uint32_t &service_flags) packet &response,
-> packet::error_type { std::uint32_t &service_flags) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto success = false; auto success = false;

View File

@ -43,16 +43,8 @@ namespace repertory::remote_fuse {
(((config_.get_event_level() >= remote_fuse_server_event::level) && \ (((config_.get_event_level() >= remote_fuse_server_event::level) && \
((ret) < 0)) || \ ((ret) < 0)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system2::instance().raise<remote_fuse_server_event>(std::string{func}, \ event_system2::instance().raise<remote_fuse_server_event>(std::string{func}, \
file, ret) file, ret)
// clang-format off
E_SIMPLE3(remote_fuse_server_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
// clang-format on
remote_server::remote_server(app_config &config, i_fuse_drive &drive, remote_server::remote_server(app_config &config, i_fuse_drive &drive,
const std::string &mount_location) const std::string &mount_location)
@ -208,8 +200,8 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask)
return ret; return ret;
} }
auto remote_server::fuse_chflags(const char *path, std::uint32_t flags) auto remote_server::fuse_chflags(const char *path,
-> packet::error_type { std::uint32_t flags) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -321,10 +313,9 @@ length); ret = ((res < 0) ? -errno : 0); #endif
return ret; return ret;
}*/ }*/
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, auto remote_server::fuse_fgetattr(
bool &directory, const char *path, remote::stat &r_stat, bool &directory,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
r_stat = {}; r_stat = {};
@ -334,7 +325,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
auto res = has_open_info(static_cast<native_handle>(handle), EBADF); auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
if (res == 0) { if (res == 0) {
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st{}; struct stat64 unix_st {};
res = fstat64(static_cast<native_handle>(handle), &unix_st); res = fstat64(static_cast<native_handle>(handle), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -346,10 +337,9 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
return ret; return ret;
} }
auto remote_server::fuse_fsetattr_x(const char *path, auto remote_server::fuse_fsetattr_x(
const remote::setattr_x &attr, const char *path, const remote::setattr_x &attr,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -465,10 +455,9 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
return ret; return ret;
} }
auto remote_server::fuse_ftruncate(const char *path, auto remote_server::fuse_ftruncate(
const remote::file_offset &size, const char *path, const remote::file_offset &size,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -496,7 +485,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st{}; struct stat64 unix_st {};
auto res = stat64(file_path.c_str(), &unix_st); auto res = stat64(file_path.c_str(), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -561,10 +550,9 @@ STATUS_NOT_IMPLEMENTED; #endif RAISE_REMOTE_FUSE_SERVER_EVENT(function_name,
file_path, ret); return ret; file_path, ret); return ret;
}*/ }*/
auto remote_server::fuse_getxtimes(const char *path, auto remote_server::fuse_getxtimes(
remote::file_time &bkuptime, const char *path, remote::file_time &bkuptime,
remote::file_time &crtime) remote::file_time &crtime) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -669,11 +657,10 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
return ret; return ret;
} }
auto remote_server::fuse_read(const char *path, char *buffer, auto remote_server::fuse_read(
const remote::file_size &read_size, const char *path, char *buffer, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -694,8 +681,8 @@ auto remote_server::fuse_read(const char *path, char *buffer,
return static_cast<packet::error_type>(ret); return static_cast<packet::error_type>(ret);
} }
auto remote_server::fuse_rename(const char *from, const char *to) auto remote_server::fuse_rename(const char *from,
-> packet::error_type { const char *to) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto from_path = utils::path::combine(mount_location_, {from}); const auto from_path = utils::path::combine(mount_location_, {from});
@ -733,9 +720,8 @@ auto remote_server::fuse_readdir(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_release(const char *path, auto remote_server::fuse_release(
const remote::file_handle &handle) const char *path, const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet::error_type ret = 0; packet::error_type ret = 0;
@ -752,9 +738,8 @@ auto remote_server::fuse_release(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_releasedir(const char *path, auto remote_server::fuse_releasedir(
const remote::file_handle &handle) const char *path, const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -799,9 +784,8 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr)
return ret; return ret;
} }
auto remote_server::fuse_setbkuptime(const char *path, auto remote_server::fuse_setbkuptime(
const remote::file_time &bkuptime) const char *path, const remote::file_time &bkuptime) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -820,9 +804,8 @@ auto remote_server::fuse_setbkuptime(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_setchgtime(const char *path, auto remote_server::fuse_setchgtime(
const remote::file_time &chgtime) const char *path, const remote::file_time &chgtime) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -841,9 +824,8 @@ auto remote_server::fuse_setchgtime(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_setcrtime(const char *path, auto remote_server::fuse_setcrtime(
const remote::file_time &crtime) const char *path, const remote::file_time &crtime) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -934,9 +916,8 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0; return 0;
} }
auto remote_server::fuse_truncate(const char *path, auto remote_server::fuse_truncate(
const remote::file_offset &size) const char *path, const remote::file_offset &size) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -957,8 +938,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
} }
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
std::uint64_t op0, std::uint64_t op1) std::uint64_t op0,
-> packet::error_type { std::uint64_t op1) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -985,11 +966,10 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
return ret; return ret;
} }
auto remote_server::fuse_write(const char *path, const char *buffer, auto remote_server::fuse_write(
const remote::file_size &write_size, const char *path, const char *buffer, const remote::file_size &write_size,
const remote::file_offset &write_offset, const remote::file_offset &write_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -1019,8 +999,8 @@ auto remote_server::fuse_write_base64(
} }
// WinFSP Layer // WinFSP Layer
auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name) auto remote_server::winfsp_can_delete(PVOID file_desc,
-> packet::error_type { PWSTR file_name) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1045,8 +1025,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
} }
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name, auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
UINT32 flags, BOOLEAN &was_deleted) UINT32 flags,
-> packet::error_type { BOOLEAN &was_deleted) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1123,8 +1103,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc, UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, BOOLEAN &exists) std::string &normalized_name,
-> packet::error_type { BOOLEAN &exists) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1196,9 +1176,8 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret; return ret;
} }
auto remote_server::winfsp_get_file_info(PVOID file_desc, auto remote_server::winfsp_get_file_info(
remote::file_info *file_info) PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1241,10 +1220,9 @@ auto remote_server::winfsp_get_security_by_name(
return ret; return ret;
} }
auto remote_server::winfsp_get_volume_info(UINT64 &total_size, auto remote_server::winfsp_get_volume_info(
UINT64 &free_size, UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) std::string &volume_label) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label); drive_.get_volume_info(total_size, free_size, volume_label);
@ -1261,11 +1239,10 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, auto remote_server::winfsp_open(
UINT32 granted_access, PVOID *file_desc, PWSTR file_name, UINT32 create_options, UINT32 granted_access,
remote::file_info *file_info, PVOID *file_desc, remote::file_info *file_info,
std::string &normalized_name) std::string &normalized_name) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1306,11 +1283,10 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
return ret; return ret;
} }
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes, auto remote_server::winfsp_overwrite(
BOOLEAN replace_attributes, PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1426,10 +1402,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret; return ret;
} }
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, auto remote_server::winfsp_rename(
PWSTR new_file_name, PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) BOOLEAN replace_if_exists) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1523,10 +1498,9 @@ auto remote_server::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, auto remote_server::winfsp_set_file_size(
BOOLEAN set_allocation_size, PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1562,12 +1536,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, auto remote_server::winfsp_write(
UINT32 length, BOOLEAN write_to_end, PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
BOOLEAN constrained_io, BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred,
PUINT32 bytes_transferred, remote::file_info *file_info) -> packet::error_type {
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0; *bytes_transferred = 0;
@ -1615,9 +1587,8 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
return ret; return ret;
} }
auto remote_server::json_create_directory_snapshot(const std::string &path, auto remote_server::json_create_directory_snapshot(
json &json_data) const std::string &path, json &json_data) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -1676,8 +1647,8 @@ auto remote_server::json_read_directory_snapshot(
} }
auto remote_server::json_release_directory_snapshot( auto remote_server::json_release_directory_snapshot(
const std::string &path, const remote::file_handle &handle) const std::string &path,
-> packet::error_type { const remote::file_handle &handle) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);

View File

@ -37,22 +37,14 @@ namespace repertory::remote_winfsp {
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \ (((config_.get_event_level() >= remote_winfsp_client_event::level) && \
((ret) != STATUS_SUCCESS)) || \ ((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system2::instance().raise<remote_winfsp_client_event>( \ event_system2::instance().raise<remote_winfsp_client_event>( \
std::string{func}, file, ret) std::string{func}, file, ret)
// clang-format off
E_SIMPLE3(remote_winfsp_client_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
// clang-format on
remote_client::remote_client(const app_config &config) remote_client::remote_client(const app_config &config)
: config_(config), packet_client_(config.get_remote_config()) {} : config_(config), packet_client_(config.get_remote_config()) {}
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name) auto remote_client::winfsp_can_delete(PVOID file_desc,
-> packet::error_type { PWSTR file_name) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -70,9 +62,8 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
return ret; return ret;
} }
auto remote_client::json_create_directory_snapshot(const std::string &path, auto remote_client::json_create_directory_snapshot(
json &json_data) const std::string &path, json &json_data) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -115,8 +106,8 @@ auto remote_client::json_read_directory_snapshot(
} }
auto remote_client::json_release_directory_snapshot( auto remote_client::json_release_directory_snapshot(
const std::string &path, const remote::file_handle &handle) const std::string &path,
-> packet::error_type { const remote::file_handle &handle) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -133,8 +124,8 @@ auto remote_client::json_release_directory_snapshot(
} }
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
UINT32 flags, BOOLEAN &was_deleted) UINT32 flags,
-> packet::error_type { BOOLEAN &was_deleted) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto handle{ auto handle{
@ -199,8 +190,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 allocation_size, PVOID *file_desc, UINT64 allocation_size, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, BOOLEAN &exists) std::string &normalized_name,
-> packet::error_type { BOOLEAN &exists) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -274,9 +265,8 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc,
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE); return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
} }
auto remote_client::winfsp_get_file_info(PVOID file_desc, auto remote_client::winfsp_get_file_info(
remote::file_info *file_info) PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -294,11 +284,9 @@ auto remote_client::winfsp_get_file_info(PVOID file_desc,
return ret; return ret;
} }
auto remote_client::winfsp_get_security_by_name(PWSTR file_name, auto remote_client::winfsp_get_security_by_name(
PUINT32 attributes, PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
std::uint64_t *descriptor_size, std::wstring &string_descriptor) -> packet::error_type {
std::wstring &string_descriptor)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -328,10 +316,9 @@ auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
return ret; return ret;
} }
auto remote_client::winfsp_get_volume_info(UINT64 &total_size, auto remote_client::winfsp_get_volume_info(
UINT64 &free_size, UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) std::string &volume_label) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -369,11 +356,10 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
return ret; return ret;
} }
auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options, auto remote_client::winfsp_open(
UINT32 granted_access, PVOID *file_desc, PWSTR file_name, UINT32 create_options, UINT32 granted_access,
remote::file_info *file_info, PVOID *file_desc, remote::file_info *file_info,
std::string &normalized_name) std::string &normalized_name) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -409,11 +395,10 @@ auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
return ret; return ret;
} }
auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes, auto remote_client::winfsp_overwrite(
BOOLEAN replace_attributes, PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 allocation_size, UINT64 allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -454,7 +439,7 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
ret = response.decode(buffer, *bytes_transferred); ret = response.decode(buffer, *bytes_transferred);
#if defined(_WIN32) #if defined(_WIN32)
if ((ret == STATUS_SUCCESS) && if ((ret == STATUS_SUCCESS) &&
(not*bytes_transferred || (*bytes_transferred != length))) { (not *bytes_transferred || (*bytes_transferred != length))) {
::SetLastError(ERROR_HANDLE_EOF); ::SetLastError(ERROR_HANDLE_EOF);
} }
#endif #endif
@ -492,10 +477,9 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
return ret; return ret;
} }
auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name, auto remote_client::winfsp_rename(
PWSTR new_file_name, PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) BOOLEAN replace_if_exists) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -543,10 +527,9 @@ auto remote_client::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, auto remote_client::winfsp_set_file_size(
BOOLEAN set_allocation_size, PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -589,12 +572,10 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
return ret; return ret;
} }
auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, auto remote_client::winfsp_write(
UINT32 length, BOOLEAN write_to_end, PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
BOOLEAN constrained_io, BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred,
PUINT32 bytes_transferred, remote::file_info *file_info) -> packet::error_type {
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;

View File

@ -48,17 +48,9 @@ namespace repertory::remote_winfsp {
(((config_.get_event_level() >= remote_winfsp_server_event::level) && \ (((config_.get_event_level() >= remote_winfsp_server_event::level) && \
((ret) != STATUS_SUCCESS)) || \ ((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system2::instance().raise<remote_winfsp_server_event>( \ event_system2::instance().raise<remote_winfsp_server_event>( \
std::string{func}, file, ret) std::string{func}, file, ret)
// clang-format off
E_SIMPLE3(remote_winfsp_server_event, debug,
std::string, function, FUNC, E_FROM_STRING,
std::string, api_path, AP, E_FROM_STRING,
packet::error_type, result, RES, E_FROM_INT32
);
// clang-format on
auto remote_server::get_next_handle() -> std::uint64_t { auto remote_server::get_next_handle() -> std::uint64_t {
if (++next_handle_ == 0U) { if (++next_handle_ == 0U) {
return ++next_handle_; return ++next_handle_;
@ -149,10 +141,9 @@ auto remote_server::fuse_chmod(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_chown(const char *path, auto remote_server::fuse_chown(
const remote::user_id & /*uid*/, const char *path, const remote::user_id & /*uid*/,
const remote::group_id & /*gid*/) const remote::group_id & /*gid*/) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -180,10 +171,9 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
return ret; return ret;
}*/ }*/
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, auto remote_server::fuse_fgetattr(
bool &directory, const char *path, remote::stat &r_stat, bool &directory,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
r_stat = {}; r_stat = {};
@ -195,7 +185,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
}; };
if (res == 0) { if (res == 0) {
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct _stat64 unix_st{}; struct _stat64 unix_st {};
res = _fstat64(static_cast<int>(handle), &unix_st); res = _fstat64(static_cast<int>(handle), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(path, directory, r_stat, unix_st); populate_stat(path, directory, r_stat, unix_st);
@ -207,10 +197,9 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
return ret; return ret;
} }
auto remote_server::fuse_fsetattr_x(const char *path, auto remote_server::fuse_fsetattr_x(
const remote::setattr_x & /*attr*/, const char *path, const remote::setattr_x & /*attr*/,
const remote::file_handle & /*handle*/) const remote::file_handle & /*handle*/) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -219,10 +208,9 @@ auto remote_server::fuse_fsetattr_x(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_fsync(const char *path, auto remote_server::fuse_fsync(
const std::int32_t & /*datasync*/, const char *path, const std::int32_t & /*datasync*/,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -249,10 +237,9 @@ auto remote_server::fuse_fsync(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_ftruncate(const char *path, auto remote_server::fuse_ftruncate(
const remote::file_offset &size, const char *path, const remote::file_offset &size,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -292,7 +279,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct _stat64 st1{}; struct _stat64 st1 {};
auto res{ auto res{
_stat64(file_path.c_str(), &st1), _stat64(file_path.c_str(), &st1),
}; };
@ -318,10 +305,9 @@ STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
file_path, ret); return ret; file_path, ret); return ret;
}*/ }*/
auto remote_server::fuse_getxtimes(const char *path, auto remote_server::fuse_getxtimes(
remote::file_time & /*bkuptime*/, const char *path, remote::file_time & /*bkuptime*/,
remote::file_time & /*crtime*/) remote::file_time & /*crtime*/) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -452,11 +438,10 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
return ret; return ret;
} }
auto remote_server::fuse_read(const char *path, char *buffer, auto remote_server::fuse_read(
const remote::file_size &read_size, const char *path, char *buffer, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -487,8 +472,8 @@ auto remote_server::fuse_read(const char *path, char *buffer,
return ret; return ret;
} }
auto remote_server::fuse_rename(const char *from, const char *to) auto remote_server::fuse_rename(const char *from,
-> packet::error_type { const char *to) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto from_path = utils::path::combine(mount_location_, {from}); auto from_path = utils::path::combine(mount_location_, {from});
@ -503,11 +488,10 @@ auto remote_server::fuse_rename(const char *from, const char *to)
return ret; return ret;
} }
auto remote_server::fuse_write(const char *path, const char *buffer, auto remote_server::fuse_write(
const remote::file_size &write_size, const char *path, const char *buffer, const remote::file_size &write_size,
const remote::file_offset &write_offset, const remote::file_offset &write_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -574,9 +558,8 @@ auto remote_server::fuse_readdir(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_release(const char *path, auto remote_server::fuse_release(
const remote::file_handle &handle) const char *path, const remote::file_handle &handle) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -620,9 +603,8 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
return ret; return ret;
} }
auto remote_server::fuse_setattr_x(const char *path, auto remote_server::fuse_setattr_x(
remote::setattr_x & /*attr*/) const char *path, remote::setattr_x & /*attr*/) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -734,9 +716,8 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0; return 0;
} }
auto remote_server::fuse_truncate(const char *path, auto remote_server::fuse_truncate(
const remote::file_offset &size) const char *path, const remote::file_offset &size) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -783,8 +764,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
} }
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
std::uint64_t op0, std::uint64_t op1) std::uint64_t op0,
-> packet::error_type { std::uint64_t op1) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -843,9 +824,8 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
} }
// JSON Layer // JSON Layer
auto remote_server::json_create_directory_snapshot(const std::string &path, auto remote_server::json_create_directory_snapshot(
json &json_data) const std::string &path, json &json_data) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -903,8 +883,8 @@ auto remote_server::json_read_directory_snapshot(
} }
auto remote_server::json_release_directory_snapshot( auto remote_server::json_release_directory_snapshot(
const std::string &path, const remote::file_handle & /*handle*/) const std::string &path,
-> packet::error_type { const remote::file_handle & /*handle*/) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -935,8 +915,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/)
} }
auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
UINT32 flags, BOOLEAN &was_deleted) UINT32 flags,
-> packet::error_type { BOOLEAN &was_deleted) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = get_open_file_path(file_desc); auto file_path = get_open_file_path(file_desc);
@ -973,8 +953,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc, UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, BOOLEAN &exists) std::string &normalized_name,
-> packet::error_type { BOOLEAN &exists) -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1042,9 +1022,8 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret; return ret;
} }
auto remote_server::winfsp_get_file_info(PVOID file_desc, auto remote_server::winfsp_get_file_info(
remote::file_info *file_info) PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1058,11 +1037,9 @@ auto remote_server::winfsp_get_file_info(PVOID file_desc,
return ret; return ret;
} }
auto remote_server::winfsp_get_security_by_name(PWSTR file_name, auto remote_server::winfsp_get_security_by_name(
PUINT32 attributes, PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
std::uint64_t *descriptor_size, std::wstring &string_descriptor) -> packet::error_type {
std::wstring &string_descriptor)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1101,10 +1078,9 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
return ret; return ret;
} }
auto remote_server::winfsp_get_volume_info(UINT64 &total_size, auto remote_server::winfsp_get_volume_info(
UINT64 &free_size, UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) std::string &volume_label) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label); drive_.get_volume_info(total_size, free_size, volume_label);
@ -1121,11 +1097,10 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, auto remote_server::winfsp_open(
UINT32 granted_access, PVOID *file_desc, PWSTR file_name, UINT32 create_options, UINT32 granted_access,
remote::file_info *file_info, PVOID *file_desc, remote::file_info *file_info,
std::string &normalized_name) std::string &normalized_name) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1161,11 +1136,10 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
return ret; return ret;
} }
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes, auto remote_server::winfsp_overwrite(
BOOLEAN replace_attributes, PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1266,10 +1240,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret; return ret;
} }
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, auto remote_server::winfsp_rename(
PWSTR new_file_name, PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) BOOLEAN replace_if_exists) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto from_path = utils::string::from_utf8(utils::path::combine( auto from_path = utils::string::from_utf8(utils::path::combine(
@ -1320,10 +1293,9 @@ auto remote_server::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, auto remote_server::winfsp_set_file_size(
BOOLEAN set_allocation_size, PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) remote::file_info *file_info) -> packet::error_type {
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1366,12 +1338,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, auto remote_server::winfsp_write(
UINT32 length, BOOLEAN /*write_to_end*/, PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
BOOLEAN constrained_io, BOOLEAN /*write_to_end*/, BOOLEAN constrained_io, PUINT32 bytes_transferred,
PUINT32 bytes_transferred, remote::file_info *file_info) -> packet::error_type {
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);

View File

@ -49,18 +49,6 @@
#include "utils/utils.hpp" #include "utils/utils.hpp"
namespace repertory { namespace repertory {
// clang-format off
E_SIMPLE3(winfsp_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
NTSTATUS, result, res, E_FROM_INT32
);
E_SIMPLE(drive_stop_begin, info);
E_SIMPLE(drive_stop_end, info);
E_SIMPLE(drive_stop_timed_out, info);
// clang-format on
#define RAISE_WINFSP_EVENT(func, file, ret) \ #define RAISE_WINFSP_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \ if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= winfsp_event::level) && \ (((config_.get_event_level() >= winfsp_event::level) && \

View File

@ -28,18 +28,6 @@
#include "utils/file_utils.hpp" #include "utils/file_utils.hpp"
namespace repertory { namespace repertory {
// clang-format off
E_SIMPLE2(invalid_cache_size, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, by, by, E_FROM_UINT64
);
E_SIMPLE2(max_cache_size_reached, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, max_cache_size, max, E_FROM_UINT64
);
// clang-format on
cache_size_mgr cache_size_mgr::instance_{}; cache_size_mgr cache_size_mgr::instance_{};
auto cache_size_mgr::expand(std::uint64_t size) -> api_error { auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
@ -67,7 +55,7 @@ auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
cache_dir.count() > 1U) { cache_dir.count() > 1U) {
if (last_cache_size != cache_size_) { if (last_cache_size != cache_size_) {
event_system2::instance().raise<max_cache_size_reached>(cache_size_, event_system2::instance().raise<max_cache_size_reached>(cache_size_,
max_cache_size); max_cache_size);
last_cache_size = cache_size_; last_cache_size = cache_size_;
} }
notify_.wait_for(lock, cache_wait_secs); notify_.wait_for(lock, cache_wait_secs);