debug
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-04-17 08:35:26 -05:00
parent e01ed2c1b8
commit 3e09adaba3
3 changed files with 18 additions and 2 deletions

View File

@ -30,6 +30,7 @@
#include "drives/remote/remote_open_file_table.hpp" #include "drives/remote/remote_open_file_table.hpp"
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp" #include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/service_start_begin.hpp" #include "events/types/service_start_begin.hpp"
#include "events/types/service_start_end.hpp" #include "events/types/service_start_end.hpp"
#include "events/types/service_stop_begin.hpp" #include "events/types/service_stop_begin.hpp"
@ -352,6 +353,11 @@ public:
response.encode(bytes_transferred); response.encode(bytes_transferred);
buffer.resize(bytes_transferred); buffer.resize(bytes_transferred);
event_system::instance().raise<debug_log>(
function_name,
fmt::format("read|offset|{}|len|{}|ret|{}|tx|{}", offset, length,
ret, bytes_transferred));
if ((ret == STATUS_SUCCESS) && (bytes_transferred != 0U)) { if ((ret == STATUS_SUCCESS) && (bytes_transferred != 0U)) {
response.encode(buffer.data(), bytes_transferred); response.encode(buffer.data(), bytes_transferred);
} }

View File

@ -28,6 +28,7 @@
#include "drives/directory_iterator.hpp" #include "drives/directory_iterator.hpp"
#include "drives/remote/remote_open_file_table.hpp" #include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/debug_log.hpp"
#include "events/types/remote_server_event.hpp" #include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/remote.hpp" #include "types/remote.hpp"
@ -1370,7 +1371,7 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
-> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0; *bytes_transferred = 0U;
auto handle = reinterpret_cast<remote::file_handle>(file_desc); auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>( auto ret = static_cast<packet::error_type>(
@ -1378,12 +1379,18 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
auto res = pread64(static_cast<native_handle>(handle), buffer, length, auto res = pread64(static_cast<native_handle>(handle), buffer, length,
static_cast<off_t>(offset)); static_cast<off_t>(offset));
event_system::instance().raise<debug_log>(
function_name,
fmt::format("read|offset|{}|len|{}|res|{}", offset, length, res));
if (res >= 0) { if (res >= 0) {
*bytes_transferred = static_cast<UINT32>(res); *bytes_transferred = static_cast<UINT32>(res);
} else { } else {
ret = ret =
static_cast<packet::error_type>(utils::unix_error_to_windows(errno)); static_cast<packet::error_type>(utils::unix_error_to_windows(errno));
} }
event_system::instance().raise<debug_log>(
function_name, fmt::format("read|offset|{}|len|{}|res|{}|tx|{}", offset,
length, res, *bytes_transferred));
} }
RAISE_REMOTE_FUSE_SERVER_EVENT( RAISE_REMOTE_FUSE_SERVER_EVENT(
@ -1586,7 +1593,8 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
-> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0; *bytes_transferred = 0U;
auto handle = reinterpret_cast<remote::file_handle>(file_desc); auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>( auto ret = static_cast<packet::error_type>(
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE)); has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE));

View File

@ -342,6 +342,8 @@ static void test_overlapped_file(auto &&mount_location, auto &&file_path,
overlapped.Offset = 3U * bytes_per_sector; overlapped.Offset = 3U * bytes_per_sector;
ret = ::ReadFile(handle, read_buffer.data(), bytes_per_sector, &bytes_read, ret = ::ReadFile(handle, read_buffer.data(), bytes_per_sector, &bytes_read,
&overlapped); &overlapped);
fmt::println("size|{}|offset|{}|read|{}|ret|{}|err|{}", size.QuadPart,
overlapped.Offset, bytes_read, ret, ::GetLastError());
EXPECT_TRUE(ret || ERROR_IO_PENDING == ::GetLastError() || EXPECT_TRUE(ret || ERROR_IO_PENDING == ::GetLastError() ||
ERROR_HANDLE_EOF == ::GetLastError()); ERROR_HANDLE_EOF == ::GetLastError());
if (ERROR_HANDLE_EOF != ::GetLastError()) { if (ERROR_HANDLE_EOF != ::GetLastError()) {