cleanup
This commit is contained in:
@@ -64,17 +64,14 @@ protected:
|
||||
[[nodiscard]] auto get_effective_uid() const -> uid_t;
|
||||
|
||||
[[nodiscard]] static auto check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error;
|
||||
api_error fail_error) -> api_error;
|
||||
|
||||
[[nodiscard]] auto check_owner(const api_meta_map &meta) const -> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_readable(int flags,
|
||||
const api_error &fail_error)
|
||||
[[nodiscard]] static auto check_readable(int flags, api_error fail_error)
|
||||
-> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_writeable(int flags,
|
||||
const api_error &fail_error)
|
||||
[[nodiscard]] static auto check_writeable(int flags, api_error fail_error)
|
||||
-> api_error;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
std::condition_variable notify_;
|
||||
|
||||
public:
|
||||
void notify(const api_error &err);
|
||||
void notify(api_error err);
|
||||
|
||||
auto wait() -> api_error;
|
||||
};
|
||||
@@ -149,7 +149,7 @@ protected:
|
||||
|
||||
void reset_timeout();
|
||||
|
||||
auto set_api_error(const api_error &err) -> api_error;
|
||||
auto set_api_error(api_error err) -> api_error;
|
||||
|
||||
void set_file_size(std::uint64_t size);
|
||||
|
||||
|
@@ -221,8 +221,7 @@ enum class api_error {
|
||||
|
||||
[[nodiscard]] auto api_error_from_string(std::string_view str) -> api_error;
|
||||
|
||||
[[nodiscard]] auto api_error_to_string(const api_error &error)
|
||||
-> const std::string &;
|
||||
[[nodiscard]] auto api_error_to_string(api_error error) -> const std::string &;
|
||||
|
||||
enum class database_type {
|
||||
rocksdb,
|
||||
|
@@ -27,7 +27,7 @@
|
||||
namespace repertory::utils::error {
|
||||
void raise_error(std::string_view function, std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const std::exception &exception);
|
||||
@@ -41,7 +41,7 @@ void raise_error(std::string_view function, std::int64_t err,
|
||||
void raise_error(std::string_view function, const json &err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view file_path, std::string_view msg);
|
||||
|
||||
void raise_error(std::string_view function, std::int64_t err,
|
||||
@@ -51,7 +51,7 @@ void raise_error(std::string_view function, const std::exception &exception,
|
||||
std::string_view file_path, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const api_error &err, std::string_view msg);
|
||||
api_error err, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const std::exception &exception);
|
||||
@@ -67,7 +67,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const json &err, std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
std::string_view source_path, const api_error &err,
|
||||
std::string_view source_path, api_error err,
|
||||
std::string_view msg);
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
|
@@ -37,7 +37,7 @@ inline const std::array<std::string, 4U> attribute_namespaces = {
|
||||
};
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &err) -> int;
|
||||
[[nodiscard]] auto from_api_error(api_error err) -> int;
|
||||
|
||||
[[nodiscard]] auto to_api_error(int err) -> api_error;
|
||||
|
||||
|
@@ -28,19 +28,19 @@
|
||||
#include "utils/windows.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
[[nodiscard]] auto
|
||||
get_accessed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_accessed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_changed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_changed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_creation_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_creation_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_written_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
[[nodiscard]] auto get_written_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto from_api_error(const api_error &e) -> NTSTATUS;
|
||||
[[nodiscard]] auto from_api_error(api_error e) -> NTSTATUS;
|
||||
|
||||
[[nodiscard]] auto unix_access_mask_to_windows(std::int32_t mask) -> int;
|
||||
|
||||
|
@@ -138,8 +138,7 @@ auto fuse_drive_base::check_and_perform(
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error {
|
||||
api_error fail_error) -> api_error {
|
||||
return (((flags & mask) == 0) ? api_error::success : fail_error);
|
||||
}
|
||||
|
||||
@@ -196,13 +195,13 @@ auto fuse_drive_base::check_parent_access(const std::string &api_path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_readable(int flags, const api_error &fail_error)
|
||||
auto fuse_drive_base::check_readable(int flags, api_error fail_error)
|
||||
-> api_error {
|
||||
auto mode = (flags & O_ACCMODE);
|
||||
return ((mode == O_WRONLY) ? fail_error : api_error::success);
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_writeable(int flags, const api_error &fail_error)
|
||||
auto fuse_drive_base::check_writeable(int flags, api_error fail_error)
|
||||
-> api_error {
|
||||
return (((flags & O_ACCMODE) == 0) ? fail_error : api_error::success);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include "utils/path.hpp"
|
||||
|
||||
namespace repertory {
|
||||
void open_file_base::download::notify(const api_error &err) {
|
||||
void open_file_base::download::notify(api_error err) {
|
||||
complete_ = true;
|
||||
error_ = err;
|
||||
unique_mutex_lock lock(mtx_);
|
||||
@@ -360,7 +360,7 @@ void open_file_base::reset_timeout() {
|
||||
last_access_ = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
auto open_file_base::set_api_error(const api_error &err) -> api_error {
|
||||
auto open_file_base::set_api_error(api_error err) -> api_error {
|
||||
mutex_lock error_lock(error_mtx_);
|
||||
if (error_ == err) {
|
||||
return error_;
|
||||
|
@@ -230,7 +230,7 @@ auto api_error_from_string(std::string_view str) -> api_error {
|
||||
return iter == LOOKUP.end() ? api_error::error : iter->first;
|
||||
}
|
||||
|
||||
auto api_error_to_string(const api_error &error) -> const std::string & {
|
||||
auto api_error_to_string(api_error error) -> const std::string & {
|
||||
if (LOOKUP.size() != static_cast<std::size_t>(api_error::ERROR_COUNT)) {
|
||||
throw startup_exception("undefined api_error strings");
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ void raise_error(std::string_view function, std::string_view msg) {
|
||||
function, static_cast<std::string>(msg));
|
||||
}
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function,
|
||||
@@ -121,7 +121,7 @@ void raise_error(std::string_view function, std::int64_t err,
|
||||
function, static_cast<std::string>(msg) + "|err|" + std::to_string(err));
|
||||
}
|
||||
|
||||
void raise_error(std::string_view function, const api_error &err,
|
||||
void raise_error(std::string_view function, api_error err,
|
||||
std::string_view file_path, std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|sp|" +
|
||||
@@ -147,7 +147,7 @@ void raise_error(std::string_view function, const std::exception &exception,
|
||||
}
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
const api_error &err, std::string_view msg) {
|
||||
api_error err, std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|ap|" +
|
||||
static_cast<std::string>(api_path) + "|err|" +
|
||||
@@ -181,7 +181,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
}
|
||||
|
||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||
std::string_view source_path, const api_error &err,
|
||||
std::string_view source_path, api_error err,
|
||||
std::string_view msg) {
|
||||
event_system::instance().raise<repertory_exception>(
|
||||
function, static_cast<std::string>(msg) + "|ap|" +
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "utils/error_utils.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
auto from_api_error(const api_error &err) -> int {
|
||||
auto from_api_error(api_error err) -> int {
|
||||
switch (err) {
|
||||
case api_error::access_denied:
|
||||
return -EACCES;
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
namespace repertory::utils {
|
||||
auto from_api_error(const api_error &e) -> NTSTATUS {
|
||||
auto from_api_error(api_error e) -> NTSTATUS {
|
||||
switch (e) {
|
||||
case api_error::access_denied:
|
||||
return STATUS_ACCESS_DENIED;
|
||||
|
@@ -66,7 +66,7 @@ protected:
|
||||
std::atomic<std::size_t> open_file_test::inst{0U};
|
||||
|
||||
static void test_closeable_open_file(const open_file &file, bool directory,
|
||||
const api_error &err, std::uint64_t size,
|
||||
api_error err, std::uint64_t size,
|
||||
const std::string &source_path) {
|
||||
EXPECT_EQ(directory, file.is_directory());
|
||||
EXPECT_EQ(err, file.get_api_error());
|
||||
|
Reference in New Issue
Block a user