From 8fa3ccf97c73604e7e341959f52bdc12806eec67 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 23 Jan 2025 19:21:20 -0600 Subject: [PATCH] refactor event system --- repertory/librepertory/include/events/events.hpp | 2 -- .../src/drives/winfsp/winfsp_drive.cpp | 14 +++++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/repertory/librepertory/include/events/events.hpp b/repertory/librepertory/include/events/events.hpp index 22fde19a..bd532931 100644 --- a/repertory/librepertory/include/events/events.hpp +++ b/repertory/librepertory/include/events/events.hpp @@ -101,8 +101,6 @@ E_SIMPLE3(winfsp_event, debug, 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, diff --git a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp index 85082984..d75e1ac4 100644 --- a/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp +++ b/repertory/librepertory/src/drives/winfsp/winfsp_drive.cpp @@ -126,7 +126,7 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, } event_system::instance().raise(function_name, - mount_location, ret); + mount_location, ret); return ret; } @@ -134,8 +134,6 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS { REPERTORY_USES_FUNCTION_NAME(); - event_system::instance().raise(); - timeout stop_timeout( []() { event_system::instance().raise(); @@ -146,8 +144,6 @@ auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS { stop_timeout.disable(); - event_system::instance().raise(); - if (not lock_.set_mount_state(false, "", -1)) { utils::error::raise_error(function_name, "failed to set mount state"); } @@ -621,7 +617,7 @@ auto winfsp_drive::mount(const std::vector &drive_args) -> int { auto ret = svc.Run(); event_system::instance().raise(function_name, "", - std::to_string(ret)); + std::to_string(ret)); event_system::instance().stop(); cons.reset(); @@ -675,7 +671,7 @@ auto winfsp_drive::Mounted(PVOID host) -> NTSTATUS { } event_system::instance().raise(function_name, - mount_location); + mount_location); return STATUS_SUCCESS; } catch (const std::exception &e) { utils::error::raise_error(function_name, e, "exception occurred"); @@ -1214,12 +1210,12 @@ VOID winfsp_drive::Unmounted(PVOID host) { auto *file_system_host = reinterpret_cast(host); auto mount_location = parse_mount_location(file_system_host->MountPoint()); event_system::instance().raise(function_name, - mount_location); + mount_location); stop_all(); event_system::instance().raise(function_name, - mount_location); + mount_location); config_.save(); }