refactor event system
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
2025-01-23 19:21:20 -06:00
parent 1311d665b5
commit 8fa3ccf97c
2 changed files with 5 additions and 11 deletions

View File

@ -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,

View File

@ -126,7 +126,7 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
}
event_system::instance().raise<drive_mount_failed>(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<drive_stop_begin>();
timeout stop_timeout(
[]() {
event_system::instance().raise<drive_stop_timed_out>();
@ -146,8 +144,6 @@ auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
stop_timeout.disable();
event_system::instance().raise<drive_stop_end>();
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<std::string> &drive_args) -> int {
auto ret = svc.Run();
event_system::instance().raise<drive_mount_result>(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<drive_mounted>(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<FileSystemHost *>(host);
auto mount_location = parse_mount_location(file_system_host->MountPoint());
event_system::instance().raise<drive_unmount_pending>(function_name,
mount_location);
mount_location);
stop_all();
event_system::instance().raise<drive_unmounted>(function_name,
mount_location);
mount_location);
config_.save();
}