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

This commit is contained in:
Scott E. Graves 2024-07-27 09:00:11 -05:00
parent 4de4386142
commit 42b67a7b61
2 changed files with 10 additions and 12 deletions

View File

@ -620,8 +620,8 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
errno = ENOENT; errno = ENOENT;
if (utils::file::is_directory(file_path)) { if (utils::file::is_directory(file_path)) {
auto list = drive_.get_directory_items(utils::path::create_api_path(path)); auto iter = std::make_shared<directory_iterator>(
auto iter = std::make_shared<directory_iterator>(std::move(list)); drive_.get_directory_items(utils::path::create_api_path(path)));
handle = get_next_handle(); handle = get_next_handle();
directory_cache_.set_directory(path, handle, iter); directory_cache_.set_directory(path, handle, iter);
@ -1355,8 +1355,7 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
const auto api_path = construct_api_path( const auto api_path = construct_api_path(
get_open_file_path(static_cast<native_handle>(handle))); get_open_file_path(static_cast<native_handle>(handle)));
auto list = drive_.get_directory_items(api_path); directory_iterator iterator(drive_.get_directory_items(api_path));
directory_iterator iterator(std::move(list));
auto offset = marker == nullptr auto offset = marker == nullptr
? 0 ? 0
: iterator.get_next_directory_offset( : iterator.get_next_directory_offset(
@ -1567,8 +1566,8 @@ auto remote_server::json_create_directory_snapshot(
errno = ENOENT; errno = ENOENT;
if (utils::file::is_directory(file_path)) { if (utils::file::is_directory(file_path)) {
auto list = drive_.get_directory_items(api_path); auto iter = std::make_shared<directory_iterator>(
auto iter = std::make_shared<directory_iterator>(std::move(list)); drive_.get_directory_items(api_path));
auto handle = get_next_handle(); auto handle = get_next_handle();
directory_cache_.set_directory(api_path, handle, iter); directory_cache_.set_directory(api_path, handle, iter);

View File

@ -338,8 +338,8 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
errno = ENOENT; errno = ENOENT;
if (::PathIsDirectoryW(unicode_file_path.c_str()) != 0) { if (::PathIsDirectoryW(unicode_file_path.c_str()) != 0) {
auto list = drive_.get_directory_items(utils::path::create_api_path(path)); auto iter = std::make_shared<directory_iterator>(
auto iter = std::make_shared<directory_iterator>(std::move(list)); drive_.get_directory_items(utils::path::create_api_path(path)));
handle = get_next_handle(); handle = get_next_handle();
directory_cache_.set_directory(path, handle, iter); directory_cache_.set_directory(path, handle, iter);
@ -827,8 +827,8 @@ auto remote_server::json_create_directory_snapshot(
errno = ENOENT; errno = ENOENT;
if (utils::file::is_directory(file_path)) { if (utils::file::is_directory(file_path)) {
auto list = drive_.get_directory_items(utils::path::create_api_path(path)); auto iter = std::make_shared<directory_iterator>(
auto iter = std::make_shared<directory_iterator>(std::move(list)); drive_.get_directory_items(utils::path::create_api_path(path)));
auto handle = get_next_handle(); auto handle = get_next_handle();
directory_cache_.set_directory(path, handle, iter); directory_cache_.set_directory(path, handle, iter);
@ -1213,8 +1213,7 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
if (get_open_info(file_desc, ofi)) { if (get_open_info(file_desc, ofi)) {
const auto api_path = const auto api_path =
utils::path::create_api_path(ofi.path.substr(mount_location_.size())); utils::path::create_api_path(ofi.path.substr(mount_location_.size()));
auto items = drive_.get_directory_items(api_path); directory_iterator iter(drive_.get_directory_items(api_path));
directory_iterator iter(std::move(items));
auto offset = marker == nullptr auto offset = marker == nullptr
? 0 ? 0
: iter.get_next_directory_offset( : iter.get_next_directory_offset(