fix
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@@ -510,14 +510,10 @@ auto winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
|||||||
std::uint64_t sds = descriptor_size == nullptr ? 0U : *descriptor_size;
|
std::uint64_t sds = descriptor_size == nullptr ? 0U : *descriptor_size;
|
||||||
auto ret = get_security_by_name(file_name, attributes, descriptor,
|
auto ret = get_security_by_name(file_name, attributes, descriptor,
|
||||||
sds > 0U ? &sds : nullptr);
|
sds > 0U ? &sds : nullptr);
|
||||||
if (attributes != nullptr) {
|
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path,
|
|
||||||
std::to_string(*attributes & FILE_ATTRIBUTE_DIRECTORY));
|
|
||||||
}
|
|
||||||
if (sds != 0U) {
|
if (sds != 0U) {
|
||||||
*descriptor_size = static_cast<SIZE_T>(sds);
|
*descriptor_size = static_cast<SIZE_T>(sds);
|
||||||
}
|
}
|
||||||
|
|
||||||
RAISE_WINFSP_EVENT(function_name, api_path, ret);
|
RAISE_WINFSP_EVENT(function_name, api_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -713,8 +709,6 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
|
|||||||
std::uint64_t handle{};
|
std::uint64_t handle{};
|
||||||
std::shared_ptr<i_open_file> file;
|
std::shared_ptr<i_open_file> file;
|
||||||
error = fm_->open(api_path, directory, ofd, handle, file);
|
error = fm_->open(api_path, directory, ofd, handle, file);
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path, std::to_string(handle));
|
|
||||||
if (error == api_error::success) {
|
if (error == api_error::success) {
|
||||||
api_meta_map meta;
|
api_meta_map meta;
|
||||||
error = provider_.get_item_meta(api_path, meta);
|
error = provider_.get_item_meta(api_path, meta);
|
||||||
@@ -905,7 +899,6 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
static constexpr const std::string_view function_name{
|
static constexpr const std::string_view function_name{
|
||||||
static_cast<const char *>(__FUNCTION__),
|
static_cast<const char *>(__FUNCTION__),
|
||||||
};
|
};
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name}, "", "");
|
|
||||||
|
|
||||||
std::string api_path;
|
std::string api_path;
|
||||||
auto error = api_error::invalid_handle;
|
auto error = api_error::invalid_handle;
|
||||||
|
@@ -78,10 +78,7 @@ auto encrypt_provider::create_api_file(
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat64 buf {};
|
struct _stat64 buf {};
|
||||||
auto res = _stat64(source_path.c_str(), &buf);
|
_stat64(source_path.c_str(), &buf);
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, source_path,
|
|
||||||
std::to_string(res) + ':' + std::to_string(directory));
|
|
||||||
#else
|
#else
|
||||||
struct stat buf {};
|
struct stat buf {};
|
||||||
stat(source_path.c_str(), &buf);
|
stat(source_path.c_str(), &buf);
|
||||||
@@ -137,15 +134,9 @@ auto encrypt_provider::create_api_file(
|
|||||||
|
|
||||||
void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
|
void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
|
||||||
const api_file &file) {
|
const api_file &file) {
|
||||||
static constexpr const std::string_view function_name{
|
|
||||||
static_cast<const char *>(__FUNCTION__),
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat64 buf {};
|
struct _stat64 buf {};
|
||||||
auto res = _stat64(file.source_path.c_str(), &buf);
|
_stat64(file.source_path.c_str(), &buf);
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, file.source_path, std::to_string(res));
|
|
||||||
#else
|
#else
|
||||||
struct stat buf {};
|
struct stat buf {};
|
||||||
stat(file.source_path.c_str(), &buf);
|
stat(file.source_path.c_str(), &buf);
|
||||||
@@ -153,12 +144,21 @@ void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
|
|||||||
|
|
||||||
meta[META_ACCESSED] = std::to_string(file.accessed_date);
|
meta[META_ACCESSED] = std::to_string(file.accessed_date);
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
meta[META_ATTRIBUTES] =
|
meta[META_ATTRIBUTES] = std::to_string(
|
||||||
std::to_string(::GetFileAttributesA(file.source_path.c_str()));
|
::GetFileAttributesA(file.source_path.c_str()) &
|
||||||
#endif
|
~(FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED |
|
||||||
|
FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_TEMPORARY |
|
||||||
|
FILE_ATTRIBUTE_SPARSE_FILE | FILE_ATTRIBUTE_OFFLINE |
|
||||||
|
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_ENCRYPTED |
|
||||||
|
FILE_ATTRIBUTE_INTEGRITY_STREAM | FILE_ATTRIBUTE_VIRTUAL |
|
||||||
|
FILE_ATTRIBUTE_NO_SCRUB_DATA | FILE_ATTRIBUTE_EA |
|
||||||
|
FILE_ATTRIBUTE_PINNED | FILE_ATTRIBUTE_UNPINNED |
|
||||||
|
FILE_ATTRIBUTE_RECALL_ON_OPEN | FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS));
|
||||||
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
meta[META_BACKUP];
|
meta[META_BACKUP];
|
||||||
#endif
|
#endif // defined(__APPLE__)
|
||||||
meta[META_CHANGED] = std::to_string(file.changed_date);
|
meta[META_CHANGED] = std::to_string(file.changed_date);
|
||||||
meta[META_CREATION] = std::to_string(file.creation_date);
|
meta[META_CREATION] = std::to_string(file.creation_date);
|
||||||
meta[META_DIRECTORY] = utils::string::from_bool(directory);
|
meta[META_DIRECTORY] = utils::string::from_bool(directory);
|
||||||
@@ -167,7 +167,7 @@ void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
|
|||||||
meta[META_MODIFIED] = std::to_string(file.modified_date);
|
meta[META_MODIFIED] = std::to_string(file.modified_date);
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
meta[META_OSXFLAGS];
|
meta[META_OSXFLAGS];
|
||||||
#endif
|
#endif // defined(__APPLE__)
|
||||||
meta[META_SIZE] = std::to_string(file.file_size);
|
meta[META_SIZE] = std::to_string(file.file_size);
|
||||||
meta[META_SOURCE] = file.source_path;
|
meta[META_SOURCE] = file.source_path;
|
||||||
meta[META_UID] = std::to_string(buf.st_uid);
|
meta[META_UID] = std::to_string(buf.st_uid);
|
||||||
@@ -448,13 +448,9 @@ auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const auto cfg = config_.get_encrypt_config();
|
const auto cfg = config_.get_encrypt_config();
|
||||||
event_system::instance().raise<debug_log>(std::string{function_name},
|
|
||||||
cfg.path, "");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (auto &&dir_entry : utils::file::directory{cfg.path}.get_items()) {
|
for (auto &&dir_entry : utils::file::directory{cfg.path}.get_items()) {
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, cfg.path, dir_entry->get_path());
|
|
||||||
std::string api_path{};
|
std::string api_path{};
|
||||||
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
|
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
|
||||||
list.emplace_back(create_api_file(
|
list.emplace_back(create_api_file(
|
||||||
@@ -503,10 +499,6 @@ auto encrypt_provider::get_file_size(
|
|||||||
auto encrypt_provider::get_filesystem_item(
|
auto encrypt_provider::get_filesystem_item(
|
||||||
const std::string &api_path, bool directory,
|
const std::string &api_path, bool directory,
|
||||||
filesystem_item &fsi) const -> api_error {
|
filesystem_item &fsi) const -> api_error {
|
||||||
static constexpr const std::string_view function_name{
|
|
||||||
static_cast<const char *>(__FUNCTION__),
|
|
||||||
};
|
|
||||||
|
|
||||||
auto result = db::db_select{*db_, source_table}
|
auto result = db::db_select{*db_, source_table}
|
||||||
.column("source_path")
|
.column("source_path")
|
||||||
.where("api_path")
|
.where("api_path")
|
||||||
@@ -519,9 +511,6 @@ auto encrypt_provider::get_filesystem_item(
|
|||||||
|
|
||||||
auto source_path = row->get_column("source_path").get_value<std::string>();
|
auto source_path = row->get_column("source_path").get_value<std::string>();
|
||||||
|
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, source_path, std::to_string(directory));
|
|
||||||
|
|
||||||
if (directory) {
|
if (directory) {
|
||||||
result = db::db_select{*db_, directory_table}
|
result = db::db_select{*db_, directory_table}
|
||||||
.column("api_path")
|
.column("api_path")
|
||||||
@@ -612,10 +601,6 @@ auto encrypt_provider::get_pinned_files() const -> std::vector<std::string> {
|
|||||||
|
|
||||||
auto encrypt_provider::get_item_meta(const std::string &api_path,
|
auto encrypt_provider::get_item_meta(const std::string &api_path,
|
||||||
api_meta_map &meta) const -> api_error {
|
api_meta_map &meta) const -> api_error {
|
||||||
static constexpr const std::string_view function_name{
|
|
||||||
static_cast<const char *>(__FUNCTION__),
|
|
||||||
};
|
|
||||||
|
|
||||||
auto result = db::db_select{*db_, source_table}
|
auto result = db::db_select{*db_, source_table}
|
||||||
.column("source_path")
|
.column("source_path")
|
||||||
.where("api_path")
|
.where("api_path")
|
||||||
@@ -635,8 +620,6 @@ auto encrypt_provider::get_item_meta(const std::string &api_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto file = create_api_file(api_path, exists, source_path);
|
auto file = create_api_file(api_path, exists, source_path);
|
||||||
event_system::instance().raise<debug_log>(
|
|
||||||
std::string{function_name}, api_path, exists ? "true" : "false");
|
|
||||||
create_item_meta(meta, exists, file);
|
create_item_meta(meta, exists, file);
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ static void root_creation_test(const std::string &mount_point) {
|
|||||||
TEST_HEADER(__FUNCTION__);
|
TEST_HEADER(__FUNCTION__);
|
||||||
WIN32_FILE_ATTRIBUTE_DATA ad{};
|
WIN32_FILE_ATTRIBUTE_DATA ad{};
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
::GetFileAttributesEx(&mount_point[0], GetFileExInfoStandard, &ad));
|
::GetFileAttributesEx(mount_point.c_str(), GetFileExInfoStandard, &ad));
|
||||||
EXPECT_EQ(FILE_ATTRIBUTE_DIRECTORY, ad.dwFileAttributes);
|
EXPECT_EQ(FILE_ATTRIBUTE_DIRECTORY, ad.dwFileAttributes);
|
||||||
EXPECT_EQ(0, ad.nFileSizeHigh);
|
EXPECT_EQ(0, ad.nFileSizeHigh);
|
||||||
EXPECT_EQ(0, ad.nFileSizeLow);
|
EXPECT_EQ(0, ad.nFileSizeLow);
|
||||||
|
Reference in New Issue
Block a user