diff --git a/repertory/librepertory/include/events/events.hpp b/repertory/librepertory/include/events/events.hpp index c09a5ed2..5e3ebf16 100644 --- a/repertory/librepertory/include/events/events.hpp +++ b/repertory/librepertory/include/events/events.hpp @@ -72,6 +72,48 @@ E_SIMPLE3(fuse_event, debug, E_SIMPLE1(fuse_args_parsed, info, 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 } // namespace repertory diff --git a/repertory/librepertory/src/comm/packet/packet_client.cpp b/repertory/librepertory/src/comm/packet/packet_client.cpp index 5712e581..454bd15c 100644 --- a/repertory/librepertory/src/comm/packet/packet_client.cpp +++ b/repertory/librepertory/src/comm/packet/packet_client.cpp @@ -31,13 +31,6 @@ #include "version.hpp" 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) : cfg_(std::move(cfg)), unique_id_(utils::create_uuid_string()) {} @@ -112,8 +105,8 @@ void packet_client::put_client(std::shared_ptr &cli) { } } -auto packet_client::read_packet(client &cli, packet &response) const - -> packet::error_type { +auto packet_client::read_packet(client &cli, + packet &response) const -> packet::error_type { data_buffer buffer(sizeof(std::uint32_t)); const auto read_buffer = [&]() { std::uint32_t offset{}; @@ -154,8 +147,8 @@ void packet_client::resolve() { .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) - -> packet::error_type { +auto packet_client::send(std::string_view method, + std::uint32_t &service_flags) -> packet::error_type { packet request; 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, - packet &response, std::uint32_t &service_flags) - -> packet::error_type { + packet &response, + std::uint32_t &service_flags) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto success = false; diff --git a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp index 40474e1a..af34a677 100644 --- a/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp +++ b/repertory/librepertory/src/drives/fuse/remotefuse/remote_server.cpp @@ -43,16 +43,8 @@ namespace repertory::remote_fuse { (((config_.get_event_level() >= remote_fuse_server_event::level) && \ ((ret) < 0)) || \ (config_.get_event_level() >= event_level::trace))) \ - event_system2::instance().raise(std::string{func}, \ - 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 + event_system2::instance().raise(std::string{func}, \ + file, ret) remote_server::remote_server(app_config &config, i_fuse_drive &drive, const std::string &mount_location) @@ -208,8 +200,8 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask) return ret; } -auto remote_server::fuse_chflags(const char *path, std::uint32_t flags) - -> packet::error_type { +auto remote_server::fuse_chflags(const char *path, + std::uint32_t flags) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto api_path = utils::path::create_api_path(path); @@ -321,10 +313,9 @@ length); ret = ((res < 0) ? -errno : 0); #endif return ret; }*/ -auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, - bool &directory, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_fgetattr( + const char *path, remote::stat &r_stat, bool &directory, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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(handle), EBADF); if (res == 0) { directory = utils::file::directory(file_path).exists(); - struct stat64 unix_st{}; + struct stat64 unix_st {}; res = fstat64(static_cast(handle), &unix_st); if (res == 0) { populate_stat(unix_st, r_stat); @@ -346,10 +337,9 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, return ret; } -auto remote_server::fuse_fsetattr_x(const char *path, - const remote::setattr_x &attr, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_fsetattr_x( + const char *path, const remote::setattr_x &attr, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_ftruncate(const char *path, - const remote::file_offset &size, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_ftruncate( + const char *path, const remote::file_offset &size, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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(); - struct stat64 unix_st{}; + struct stat64 unix_st {}; auto res = stat64(file_path.c_str(), &unix_st); if (res == 0) { 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; }*/ -auto remote_server::fuse_getxtimes(const char *path, - remote::file_time &bkuptime, - remote::file_time &crtime) - -> packet::error_type { +auto remote_server::fuse_getxtimes( + const char *path, remote::file_time &bkuptime, + remote::file_time &crtime) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_read(const char *path, char *buffer, - const remote::file_size &read_size, - const remote::file_offset &read_offset, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_read( + const char *path, char *buffer, const remote::file_size &read_size, + const remote::file_offset &read_offset, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto file_path = construct_path(path); @@ -694,8 +681,8 @@ auto remote_server::fuse_read(const char *path, char *buffer, return static_cast(ret); } -auto remote_server::fuse_rename(const char *from, const char *to) - -> packet::error_type { +auto remote_server::fuse_rename(const char *from, + const char *to) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto from_path = utils::path::combine(mount_location_, {from}); @@ -733,9 +720,8 @@ auto remote_server::fuse_readdir(const char *path, return ret; } -auto remote_server::fuse_release(const char *path, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_release( + const char *path, const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet::error_type ret = 0; @@ -752,9 +738,8 @@ auto remote_server::fuse_release(const char *path, return ret; } -auto remote_server::fuse_releasedir(const char *path, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_releasedir( + const char *path, const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_setbkuptime(const char *path, - const remote::file_time &bkuptime) - -> packet::error_type { +auto remote_server::fuse_setbkuptime( + const char *path, const remote::file_time &bkuptime) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto api_path = utils::path::create_api_path(path); @@ -820,9 +804,8 @@ auto remote_server::fuse_setbkuptime(const char *path, return ret; } -auto remote_server::fuse_setchgtime(const char *path, - const remote::file_time &chgtime) - -> packet::error_type { +auto remote_server::fuse_setchgtime( + const char *path, const remote::file_time &chgtime) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto api_path = utils::path::create_api_path(path); @@ -841,9 +824,8 @@ auto remote_server::fuse_setchgtime(const char *path, return ret; } -auto remote_server::fuse_setcrtime(const char *path, - const remote::file_time &crtime) - -> packet::error_type { +auto remote_server::fuse_setcrtime( + const char *path, const remote::file_time &crtime) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_truncate(const char *path, - const remote::file_offset &size) - -> packet::error_type { +auto remote_server::fuse_truncate( + const char *path, const remote::file_offset &size) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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, - std::uint64_t op0, std::uint64_t op1) - -> packet::error_type { + std::uint64_t op0, + std::uint64_t op1) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_write(const char *path, const char *buffer, - const remote::file_size &write_size, - const remote::file_offset &write_offset, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_write( + const char *path, const char *buffer, const remote::file_size &write_size, + const remote::file_offset &write_offset, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto file_path = construct_path(path); @@ -1019,8 +999,8 @@ auto remote_server::fuse_write_base64( } // WinFSP Layer -auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name) - -> packet::error_type { +auto remote_server::winfsp_can_delete(PVOID file_desc, + PWSTR file_name) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto relative_path = utils::string::to_utf8(file_name); @@ -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, - UINT32 flags, BOOLEAN &was_deleted) - -> packet::error_type { + UINT32 flags, + BOOLEAN &was_deleted) -> packet::error_type { REPERTORY_USES_FUNCTION_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, UINT64 /*allocation_size*/, PVOID *file_desc, remote::file_info *file_info, - std::string &normalized_name, BOOLEAN &exists) - -> packet::error_type { + std::string &normalized_name, + BOOLEAN &exists) -> packet::error_type { REPERTORY_USES_FUNCTION_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; } -auto remote_server::winfsp_get_file_info(PVOID file_desc, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_get_file_info( + PVOID file_desc, remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto handle = reinterpret_cast(file_desc); @@ -1241,10 +1220,9 @@ auto remote_server::winfsp_get_security_by_name( return ret; } -auto remote_server::winfsp_get_volume_info(UINT64 &total_size, - UINT64 &free_size, - std::string &volume_label) - -> packet::error_type { +auto remote_server::winfsp_get_volume_info( + UINT64 &total_size, UINT64 &free_size, + std::string &volume_label) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, - UINT32 granted_access, PVOID *file_desc, - remote::file_info *file_info, - std::string &normalized_name) - -> packet::error_type { +auto remote_server::winfsp_open( + PWSTR file_name, UINT32 create_options, UINT32 granted_access, + PVOID *file_desc, remote::file_info *file_info, + std::string &normalized_name) -> packet::error_type { REPERTORY_USES_FUNCTION_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; } -auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes, - BOOLEAN replace_attributes, - UINT64 /*allocation_size*/, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_overwrite( + PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, + UINT64 /*allocation_size*/, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto handle = reinterpret_cast(file_desc); @@ -1426,10 +1402,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, return ret; } -auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, - PWSTR new_file_name, - BOOLEAN replace_if_exists) - -> packet::error_type { +auto remote_server::winfsp_rename( + PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, + BOOLEAN replace_if_exists) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto relative_path = utils::string::to_utf8(file_name); @@ -1523,10 +1498,9 @@ auto remote_server::winfsp_set_basic_info( return ret; } -auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, - BOOLEAN set_allocation_size, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_set_file_size( + PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto handle = reinterpret_cast(file_desc); @@ -1562,12 +1536,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location) return STATUS_SUCCESS; } -auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, - UINT32 length, BOOLEAN write_to_end, - BOOLEAN constrained_io, - PUINT32 bytes_transferred, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_write( + PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, + BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); *bytes_transferred = 0; @@ -1615,9 +1587,8 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, return ret; } -auto remote_server::json_create_directory_snapshot(const std::string &path, - json &json_data) - -> packet::error_type { +auto remote_server::json_create_directory_snapshot( + const std::string &path, json &json_data) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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( - const std::string &path, const remote::file_handle &handle) - -> packet::error_type { + const std::string &path, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); const auto file_path = construct_path(path); diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp index b2d35c27..c662d9da 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_client.cpp @@ -37,22 +37,14 @@ namespace repertory::remote_winfsp { (((config_.get_event_level() >= remote_winfsp_client_event::level) && \ ((ret) != STATUS_SUCCESS)) || \ (config_.get_event_level() >= event_level::trace))) \ - event_system2::instance().raise( \ + event_system2::instance().raise( \ 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) : config_(config), packet_client_(config.get_remote_config()) {} -auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name) - -> packet::error_type { +auto remote_client::winfsp_can_delete(PVOID file_desc, + PWSTR file_name) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -70,9 +62,8 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name) return ret; } -auto remote_client::json_create_directory_snapshot(const std::string &path, - json &json_data) - -> packet::error_type { +auto remote_client::json_create_directory_snapshot( + const std::string &path, json &json_data) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -115,8 +106,8 @@ auto remote_client::json_read_directory_snapshot( } auto remote_client::json_release_directory_snapshot( - const std::string &path, const remote::file_handle &handle) - -> packet::error_type { + const std::string &path, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -133,8 +124,8 @@ auto remote_client::json_release_directory_snapshot( } auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, - UINT32 flags, BOOLEAN &was_deleted) - -> packet::error_type { + UINT32 flags, + BOOLEAN &was_deleted) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto handle{ @@ -199,8 +190,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 attributes, UINT64 allocation_size, PVOID *file_desc, remote::file_info *file_info, - std::string &normalized_name, BOOLEAN &exists) - -> packet::error_type { + std::string &normalized_name, + BOOLEAN &exists) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -274,9 +265,8 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc, return static_cast(STATUS_INVALID_HANDLE); } -auto remote_client::winfsp_get_file_info(PVOID file_desc, - remote::file_info *file_info) - -> packet::error_type { +auto remote_client::winfsp_get_file_info( + PVOID file_desc, remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -294,11 +284,9 @@ auto remote_client::winfsp_get_file_info(PVOID file_desc, return ret; } -auto remote_client::winfsp_get_security_by_name(PWSTR file_name, - PUINT32 attributes, - std::uint64_t *descriptor_size, - std::wstring &string_descriptor) - -> packet::error_type { +auto remote_client::winfsp_get_security_by_name( + PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, + std::wstring &string_descriptor) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -328,10 +316,9 @@ auto remote_client::winfsp_get_security_by_name(PWSTR file_name, return ret; } -auto remote_client::winfsp_get_volume_info(UINT64 &total_size, - UINT64 &free_size, - std::string &volume_label) - -> packet::error_type { +auto remote_client::winfsp_get_volume_info( + UINT64 &total_size, UINT64 &free_size, + std::string &volume_label) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -369,11 +356,10 @@ auto remote_client::winfsp_mounted(const std::wstring &location) return ret; } -auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options, - UINT32 granted_access, PVOID *file_desc, - remote::file_info *file_info, - std::string &normalized_name) - -> packet::error_type { +auto remote_client::winfsp_open( + PWSTR file_name, UINT32 create_options, UINT32 granted_access, + PVOID *file_desc, remote::file_info *file_info, + std::string &normalized_name) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -409,11 +395,10 @@ auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options, return ret; } -auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes, - BOOLEAN replace_attributes, - UINT64 allocation_size, - remote::file_info *file_info) - -> packet::error_type { +auto remote_client::winfsp_overwrite( + PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, + UINT64 allocation_size, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -454,7 +439,7 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, ret = response.decode(buffer, *bytes_transferred); #if defined(_WIN32) if ((ret == STATUS_SUCCESS) && - (not*bytes_transferred || (*bytes_transferred != length))) { + (not *bytes_transferred || (*bytes_transferred != length))) { ::SetLastError(ERROR_HANDLE_EOF); } #endif @@ -492,10 +477,9 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern, return ret; } -auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name, - PWSTR new_file_name, - BOOLEAN replace_if_exists) - -> packet::error_type { +auto remote_client::winfsp_rename( + PVOID file_desc, PWSTR file_name, PWSTR new_file_name, + BOOLEAN replace_if_exists) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -543,10 +527,9 @@ auto remote_client::winfsp_set_basic_info( return ret; } -auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, - BOOLEAN set_allocation_size, - remote::file_info *file_info) - -> packet::error_type { +auto remote_client::winfsp_set_file_size( + PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; @@ -589,12 +572,10 @@ auto remote_client::winfsp_unmounted(const std::wstring &location) return ret; } -auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, - UINT32 length, BOOLEAN write_to_end, - BOOLEAN constrained_io, - PUINT32 bytes_transferred, - remote::file_info *file_info) - -> packet::error_type { +auto remote_client::winfsp_write( + PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, + BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); packet request; diff --git a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp index ff306dea..752f8dec 100644 --- a/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp +++ b/repertory/librepertory/src/drives/winfsp/remotewinfsp/remote_server.cpp @@ -48,17 +48,9 @@ namespace repertory::remote_winfsp { (((config_.get_event_level() >= remote_winfsp_server_event::level) && \ ((ret) != STATUS_SUCCESS)) || \ (config_.get_event_level() >= event_level::trace))) \ - event_system2::instance().raise( \ + event_system2::instance().raise( \ 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 { if (++next_handle_ == 0U) { return ++next_handle_; @@ -149,10 +141,9 @@ auto remote_server::fuse_chmod(const char *path, return ret; } -auto remote_server::fuse_chown(const char *path, - const remote::user_id & /*uid*/, - const remote::group_id & /*gid*/) - -> packet::error_type { +auto remote_server::fuse_chown( + const char *path, const remote::user_id & /*uid*/, + const remote::group_id & /*gid*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -180,10 +171,9 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res return ret; }*/ -auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, - bool &directory, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_fgetattr( + const char *path, remote::stat &r_stat, bool &directory, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); r_stat = {}; @@ -195,7 +185,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat, }; if (res == 0) { directory = utils::file::directory(file_path).exists(); - struct _stat64 unix_st{}; + struct _stat64 unix_st {}; res = _fstat64(static_cast(handle), &unix_st); if (res == 0) { 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; } -auto remote_server::fuse_fsetattr_x(const char *path, - const remote::setattr_x & /*attr*/, - const remote::file_handle & /*handle*/) - -> packet::error_type { +auto remote_server::fuse_fsetattr_x( + const char *path, const remote::setattr_x & /*attr*/, + const remote::file_handle & /*handle*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -219,10 +208,9 @@ auto remote_server::fuse_fsetattr_x(const char *path, return ret; } -auto remote_server::fuse_fsync(const char *path, - const std::int32_t & /*datasync*/, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_fsync( + const char *path, const std::int32_t & /*datasync*/, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -249,10 +237,9 @@ auto remote_server::fuse_fsync(const char *path, return ret; } -auto remote_server::fuse_ftruncate(const char *path, - const remote::file_offset &size, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_ftruncate( + const char *path, const remote::file_offset &size, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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(); - struct _stat64 st1{}; + struct _stat64 st1 {}; auto res{ _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; }*/ -auto remote_server::fuse_getxtimes(const char *path, - remote::file_time & /*bkuptime*/, - remote::file_time & /*crtime*/) - -> packet::error_type { +auto remote_server::fuse_getxtimes( + const char *path, remote::file_time & /*bkuptime*/, + remote::file_time & /*crtime*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_read(const char *path, char *buffer, - const remote::file_size &read_size, - const remote::file_offset &read_offset, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_read( + const char *path, char *buffer, const remote::file_size &read_size, + const remote::file_offset &read_offset, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -487,8 +472,8 @@ auto remote_server::fuse_read(const char *path, char *buffer, return ret; } -auto remote_server::fuse_rename(const char *from, const char *to) - -> packet::error_type { +auto remote_server::fuse_rename(const char *from, + const char *to) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_write(const char *path, const char *buffer, - const remote::file_size &write_size, - const remote::file_offset &write_offset, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_write( + const char *path, const char *buffer, const remote::file_size &write_size, + const remote::file_offset &write_offset, + const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -574,9 +558,8 @@ auto remote_server::fuse_readdir(const char *path, return ret; } -auto remote_server::fuse_release(const char *path, - const remote::file_handle &handle) - -> packet::error_type { +auto remote_server::fuse_release( + const char *path, const remote::file_handle &handle) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -620,9 +603,8 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { return ret; } -auto remote_server::fuse_setattr_x(const char *path, - remote::setattr_x & /*attr*/) - -> packet::error_type { +auto remote_server::fuse_setattr_x( + const char *path, remote::setattr_x & /*attr*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::fuse_truncate(const char *path, - const remote::file_offset &size) - -> packet::error_type { +auto remote_server::fuse_truncate( + const char *path, const remote::file_offset &size) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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, - std::uint64_t op0, std::uint64_t op1) - -> packet::error_type { + std::uint64_t op0, + std::uint64_t op1) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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 -auto remote_server::json_create_directory_snapshot(const std::string &path, - json &json_data) - -> packet::error_type { +auto remote_server::json_create_directory_snapshot( + const std::string &path, json &json_data) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto file_path = construct_path(path); @@ -903,8 +883,8 @@ auto remote_server::json_read_directory_snapshot( } auto remote_server::json_release_directory_snapshot( - const std::string &path, const remote::file_handle & /*handle*/) - -> packet::error_type { + const std::string &path, + const remote::file_handle & /*handle*/) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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*/, - UINT32 flags, BOOLEAN &was_deleted) - -> packet::error_type { + UINT32 flags, + BOOLEAN &was_deleted) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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, UINT64 /*allocation_size*/, PVOID *file_desc, remote::file_info *file_info, - std::string &normalized_name, BOOLEAN &exists) - -> packet::error_type { + std::string &normalized_name, + BOOLEAN &exists) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::winfsp_get_file_info(PVOID file_desc, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_get_file_info( + PVOID file_desc, remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto *handle = reinterpret_cast(file_desc); @@ -1058,11 +1037,9 @@ auto remote_server::winfsp_get_file_info(PVOID file_desc, return ret; } -auto remote_server::winfsp_get_security_by_name(PWSTR file_name, - PUINT32 attributes, - std::uint64_t *descriptor_size, - std::wstring &string_descriptor) - -> packet::error_type { +auto remote_server::winfsp_get_security_by_name( + PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, + std::wstring &string_descriptor) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::winfsp_get_volume_info(UINT64 &total_size, - UINT64 &free_size, - std::string &volume_label) - -> packet::error_type { +auto remote_server::winfsp_get_volume_info( + UINT64 &total_size, UINT64 &free_size, + std::string &volume_label) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options, - UINT32 granted_access, PVOID *file_desc, - remote::file_info *file_info, - std::string &normalized_name) - -> packet::error_type { +auto remote_server::winfsp_open( + PWSTR file_name, UINT32 create_options, UINT32 granted_access, + PVOID *file_desc, remote::file_info *file_info, + std::string &normalized_name) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); 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; } -auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes, - BOOLEAN replace_attributes, - UINT64 /*allocation_size*/, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_overwrite( + PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, + UINT64 /*allocation_size*/, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto *handle = reinterpret_cast(file_desc); @@ -1266,10 +1240,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, return ret; } -auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, - PWSTR new_file_name, - BOOLEAN replace_if_exists) - -> packet::error_type { +auto remote_server::winfsp_rename( + PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, + BOOLEAN replace_if_exists) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto from_path = utils::string::from_utf8(utils::path::combine( @@ -1320,10 +1293,9 @@ auto remote_server::winfsp_set_basic_info( return ret; } -auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size, - BOOLEAN set_allocation_size, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_set_file_size( + PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto *handle = reinterpret_cast(file_desc); @@ -1366,12 +1338,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location) return STATUS_SUCCESS; } -auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, - UINT32 length, BOOLEAN /*write_to_end*/, - BOOLEAN constrained_io, - PUINT32 bytes_transferred, - remote::file_info *file_info) - -> packet::error_type { +auto remote_server::winfsp_write( + PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, + BOOLEAN /*write_to_end*/, BOOLEAN constrained_io, PUINT32 bytes_transferred, + remote::file_info *file_info) -> packet::error_type { REPERTORY_USES_FUNCTION_NAME(); auto *handle = reinterpret_cast(file_desc); diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index 17aa0126..fc29241b 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -49,18 +49,6 @@ #include "utils/utils.hpp" 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) \ if (config_.get_enable_drive_events() && \ (((config_.get_event_level() >= winfsp_event::level) && \ diff --git a/repertory/librepertory/src/file_manager/cache_size_mgr.cpp b/repertory/librepertory/src/file_manager/cache_size_mgr.cpp index c1ab1090..4568019e 100644 --- a/repertory/librepertory/src/file_manager/cache_size_mgr.cpp +++ b/repertory/librepertory/src/file_manager/cache_size_mgr.cpp @@ -28,18 +28,6 @@ #include "utils/file_utils.hpp" 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_{}; 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) { if (last_cache_size != cache_size_) { event_system2::instance().raise(cache_size_, - max_cache_size); + max_cache_size); last_cache_size = cache_size_; } notify_.wait_for(lock, cache_wait_secs);