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

This commit is contained in:
2025-08-04 22:47:47 -05:00
parent 28480b1ee5
commit 48852b00f8
2 changed files with 52 additions and 52 deletions

View File

@@ -72,7 +72,7 @@ auto remote_server::construct_path(std::string path) -> std::string {
auto remote_server::populate_file_info(const std::string &api_path,
remote::file_info &r_info)
-> packet::error_type {
return (drive_.populate_file_info(api_path, &r_info) == api_error::success)
return (drive_.populate_file_info(api_path, r_info) == api_error::success)
? STATUS_SUCCESS
: STATUS_OBJECT_NAME_NOT_FOUND;
}

View File

@@ -70,14 +70,14 @@ winfsp_drive::winfsp_service::winfsp_service(
auto winfsp_drive::handle_error(std::string_view function_name,
const std::string &api_path, api_error error,
FileInfo *f_info, std::uint64_t file_size,
FileInfo *file_info, std::uint64_t file_size,
bool raise_on_failure_only) const -> NTSTATUS {
auto ret = utils::from_api_error(error);
if (not raise_on_failure_only) {
RAISE_WINFSP_EVENT(function_name, api_path, ret);
}
if (f_info == nullptr) {
if (file_info == nullptr) {
return ret;
}
@@ -86,7 +86,7 @@ auto winfsp_drive::handle_error(std::string_view function_name,
return ret;
}
populate_file_info(file_size, meta, *f_info);
populate_file_info(file_size, meta, *file_info);
return ret;
}
@@ -371,15 +371,15 @@ auto winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
return ret;
}
auto winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc, FileInfo *f_info)
-> NTSTATUS {
auto winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc,
FileInfo *file_info) -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U);
};
@@ -418,14 +418,14 @@ auto winfsp_drive::get_directory_items(const std::string &api_path) const
}
auto winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc,
FileInfo *f_info) -> NTSTATUS {
FileInfo *file_info) -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U);
};
@@ -733,15 +733,15 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, FileInfo *f_info)
UINT64 /*allocation_size*/, FileInfo *file_info)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U);
};
@@ -808,14 +808,14 @@ void winfsp_drive::populate_file_info(const std::string &api_path,
}
auto winfsp_drive::populate_file_info(const std::string &api_path,
remote::file_info &r_info) const
remote::file_info &file_info) const
-> api_error {
api_meta_map meta{};
auto ret = provider_.get_item_meta(api_path, meta);
if (ret == api_error::success) {
FSP_FSCTL_FILE_INFO f_info{};
populate_file_info(utils::string::to_uint64(meta[META_SIZE]), meta, f_info);
set_file_info(r_info, f_info);
FSP_FSCTL_FILE_INFO info{};
populate_file_info(utils::string::to_uint64(meta[META_SIZE]), meta, info);
set_file_info(file_info, info);
}
return ret;
@@ -823,20 +823,20 @@ auto winfsp_drive::populate_file_info(const std::string &api_path,
void winfsp_drive::populate_file_info(std::uint64_t file_size,
api_meta_map meta,
FSP_FSCTL_FILE_INFO &f_info) const {
f_info.FileSize = file_size;
f_info.AllocationSize =
FSP_FSCTL_FILE_INFO &file_info) const {
file_info.FileSize = file_size;
file_info.AllocationSize =
utils::divide_with_ceiling(file_size, WINFSP_ALLOCATION_UNIT) *
WINFSP_ALLOCATION_UNIT;
f_info.ChangeTime = utils::get_changed_time_from_meta(meta);
f_info.CreationTime = utils::get_creation_time_from_meta(meta);
f_info.FileAttributes = utils::get_attributes_from_meta(meta);
f_info.HardLinks = 0;
f_info.IndexNumber = 0;
f_info.LastAccessTime = utils::get_accessed_time_from_meta(meta);
f_info.LastWriteTime = utils::get_written_time_from_meta(meta);
f_info.ReparseTag = 0;
f_info.EaSize = 0;
file_info.ChangeTime = utils::get_changed_time_from_meta(meta);
file_info.CreationTime = utils::get_creation_time_from_meta(meta);
file_info.FileAttributes = utils::get_attributes_from_meta(meta);
file_info.HardLinks = 0;
file_info.IndexNumber = 0;
file_info.LastAccessTime = utils::get_accessed_time_from_meta(meta);
file_info.LastWriteTime = utils::get_written_time_from_meta(meta);
file_info.ReparseTag = 0;
file_info.EaSize = 0;
}
auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
@@ -1060,15 +1060,15 @@ auto winfsp_drive::Rename(PVOID /*file_node*/, PVOID /*file_desc*/,
auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT64 creation_time,
UINT64 last_access_time, UINT64 last_write_time,
UINT64 change_time, FileInfo *f_info)
UINT64 change_time, FileInfo *file_info)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U);
};
@@ -1110,31 +1110,31 @@ auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
return handle_error(provider_.set_item_meta(api_path, meta));
}
void winfsp_drive::set_file_info(remote::f_info &r_info,
const FSP_FSCTL_FILE_INFO &f_info) {
r_info.FileAttributes = f_info.FileAttributes;
r_info.ReparseTag = f_info.ReparseTag;
r_info.AllocationSize = f_info.AllocationSize;
r_info.FileSize = f_info.FileSize;
r_info.CreationTime = f_info.CreationTime;
r_info.LastAccessTime = f_info.LastAccessTime;
r_info.LastWriteTime = f_info.LastWriteTime;
r_info.ChangeTime = f_info.ChangeTime;
r_info.IndexNumber = f_info.IndexNumber;
r_info.HardLinks = f_info.HardLinks;
r_info.EaSize = f_info.EaSize;
void winfsp_drive::set_file_info(remote::file_info &dest,
const FSP_FSCTL_FILE_INFO &src) {
dest.FileAttributes = src.FileAttributes;
dest.ReparseTag = src.ReparseTag;
dest.AllocationSize = src.AllocationSize;
dest.FileSize = src.FileSize;
dest.CreationTime = src.CreationTime;
dest.LastAccessTime = src.LastAccessTime;
dest.LastWriteTime = src.LastWriteTime;
dest.ChangeTime = src.ChangeTime;
dest.IndexNumber = src.IndexNumber;
dest.HardLinks = src.HardLinks;
dest.EaSize = src.EaSize;
}
auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
UINT64 new_size, BOOLEAN set_allocation_size,
FileInfo *f_info) -> NTSTATUS {
FileInfo *file_info) -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U);
};
@@ -1233,7 +1233,7 @@ VOID winfsp_drive::Unmounted(PVOID host) {
auto winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
UINT64 offset, ULONG length, BOOLEAN write_to_end,
BOOLEAN constrained_io, PULONG bytes_transferred,
FileInfo *f_info) -> NTSTATUS {
FileInfo *file_info) -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0U;
@@ -1241,8 +1241,8 @@ auto winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
std::string api_path;
std::shared_ptr<i_open_file> file;
const auto handle_error = [this, &api_path, &file,
&f_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, f_info,
&file_info](api_error error) -> NTSTATUS {
return this->handle_error(function_name, api_path, error, file_info,
file ? file->get_file_size() : 0U, true);
};