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

This commit is contained in:
Scott E. Graves 2024-11-11 14:15:00 -06:00
parent fe0fef2f21
commit 54b70f99cc
2 changed files with 20 additions and 19 deletions

View File

@ -103,7 +103,7 @@ protected:
struct fuse_file_info *file_info) -> api_error override; struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto [[nodiscard]] auto
fgetattr_impl(std::string api_path, struct stat *st, fgetattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info) -> api_error override; struct fuse_file_info *file_info) -> api_error override;
#if defined(__APPLE__) #if defined(__APPLE__)
@ -124,11 +124,11 @@ protected:
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
[[nodiscard]] auto [[nodiscard]] auto
getattr_impl(std::string api_path, struct stat *st, getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info) -> api_error override; struct fuse_file_info *file_info) -> api_error override;
#else #else
[[nodiscard]] auto getattr_impl(std::string api_path, [[nodiscard]] auto getattr_impl(std::string api_path,
struct stat *st) -> api_error override; struct stat *unix_st) -> api_error override;
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)

View File

@ -337,7 +337,7 @@ auto fuse_drive::fallocate_impl(std::string /*api_path*/, int mode,
static_cast<std::uint64_t>(offset + length), allocator); static_cast<std::uint64_t>(offset + length), allocator);
} }
auto fuse_drive::fgetattr_impl(std::string api_path, struct stat *st, auto fuse_drive::fgetattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info) -> api_error { struct fuse_file_info *file_info) -> api_error {
std::shared_ptr<i_open_file> open_file; std::shared_ptr<i_open_file> open_file;
if (not fm_->get_open_file(file_info->fh, false, open_file)) { if (not fm_->get_open_file(file_info->fh, false, open_file)) {
@ -356,7 +356,7 @@ auto fuse_drive::fgetattr_impl(std::string api_path, struct stat *st,
return res; return res;
} }
fuse_drive_base::populate_stat(api_path, open_file->get_file_size(), meta, fuse_drive_base::populate_stat(api_path, open_file->get_file_size(), meta,
directory, provider_, st); directory, provider_, unix_st);
return api_error::success; return api_error::success;
} }
@ -464,12 +464,12 @@ auto fuse_drive::get_item_meta(const std::string &api_path,
} }
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_drive::getattr_impl(std::string api_path, struct stat *st, auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::getattr_impl(std::string api_path, auto fuse_drive::getattr_impl(std::string api_path,
struct stat *st) -> api_error { struct stat *unix_st) -> api_error {
#endif #endif
auto parent = utils::path::get_parent_api_path(api_path); auto parent = utils::path::get_parent_api_path(api_path);
@ -484,7 +484,7 @@ auto fuse_drive::getattr_impl(std::string api_path,
found = (iter.get_directory_item(api_path, dir_item) == api_error::success); found = (iter.get_directory_item(api_path, dir_item) == api_error::success);
if (found) { if (found) {
fuse_drive_base::populate_stat(api_path, dir_item.size, dir_item.meta, fuse_drive_base::populate_stat(api_path, dir_item.size, dir_item.meta,
dir_item.directory, provider_, st); dir_item.directory, provider_, unix_st);
} }
}); });
@ -502,7 +502,7 @@ auto fuse_drive::getattr_impl(std::string api_path,
} }
fuse_drive_base::populate_stat(api_path, fuse_drive_base::populate_stat(api_path,
utils::string::to_uint64(meta[META_SIZE]), utils::string::to_uint64(meta[META_SIZE]),
meta, directory, provider_, st); meta, directory, provider_, unix_st);
} }
return api_error::success; return api_error::success;
@ -753,16 +753,17 @@ auto fuse_drive::readdir_impl(std::string api_path, void *buf,
} }
while (res == api_error::success) { while (res == api_error::success) {
res = (iter->fill_buffer( res =
static_cast<remote::file_offset>(offset++), fuse_fill_dir, buf, (iter->fill_buffer(
[this](const std::string &cur_api_path, static_cast<remote::file_offset>(offset++), fuse_fill_dir, buf,
std::uint64_t cur_file_size, const api_meta_map &meta, [this](const std::string &cur_api_path,
bool directory, struct stat *st) { std::uint64_t cur_file_size, const api_meta_map &meta,
fuse_drive_base::populate_stat(cur_api_path, cur_file_size, bool directory, struct stat *unix_st) {
meta, directory, provider_, st); fuse_drive_base::populate_stat(cur_api_path, cur_file_size, meta,
}) == 0) directory, provider_, unix_st);
? api_error::success }) == 0)
: api_error::os_error; ? api_error::success
: api_error::os_error;
} }
if ((res == api_error::os_error) && ((errno == 120) || (errno == ENOMEM))) { if ((res == api_error::os_error) && ((errno == 120) || (errno == ENOMEM))) {