This commit is contained in:
		| @@ -75,21 +75,21 @@ private: | ||||
|  | ||||
|   void put_client(std::shared_ptr<client> &cli); | ||||
|  | ||||
|   [[nodiscard]] auto read_packet(client &cli, packet &response) | ||||
|       -> packet::error_type; | ||||
|   [[nodiscard]] auto read_packet(client &cli, | ||||
|                                  packet &response) -> packet::error_type; | ||||
|  | ||||
|   void resolve(); | ||||
|  | ||||
| public: | ||||
|   [[nodiscard]] auto send(const std::string &method, | ||||
|   [[nodiscard]] auto send(std::string_view method, | ||||
|                           std::uint32_t &service_flags) -> packet::error_type; | ||||
|  | ||||
|   [[nodiscard]] auto send(const std::string &method, packet &request, | ||||
|   [[nodiscard]] auto send(std::string_view method, packet &request, | ||||
|                           std::uint32_t &service_flags) -> packet::error_type; | ||||
|  | ||||
|   [[nodiscard]] auto send(const std::string &method, packet &request, | ||||
|                           packet &response, std::uint32_t &service_flags) | ||||
|       -> packet::error_type; | ||||
|   [[nodiscard]] auto send(std::string_view method, packet &request, | ||||
|                           packet &response, | ||||
|                           std::uint32_t &service_flags) -> packet::error_type; | ||||
| }; | ||||
| } // namespace repertory | ||||
|  | ||||
|   | ||||
| @@ -174,7 +174,7 @@ private: | ||||
|   mutable std::int32_t res_; | ||||
|  | ||||
| private: | ||||
|   void set_res(std::int32_t res, std::string function) const { | ||||
|   void set_res(std::int32_t res, std::string_view function) const { | ||||
|     if (res != SQLITE_OK && res != SQLITE_DONE && res != SQLITE_ROW) { | ||||
|       utils::error::raise_error(function, "failed to step|" + | ||||
|                                               std::to_string(res) + '|' + | ||||
| @@ -194,8 +194,8 @@ public: | ||||
|     return sqlite3_errstr(res_); | ||||
|   } | ||||
|  | ||||
|   [[nodiscard]] auto get_row(std::optional<db_row<context_t>> &row) const | ||||
|       -> bool { | ||||
|   [[nodiscard]] auto | ||||
|   get_row(std::optional<db_row<context_t>> &row) const -> bool { | ||||
|     constexpr const auto *function_name = | ||||
|         static_cast<const char *>(__FUNCTION__); | ||||
|  | ||||
|   | ||||
| @@ -65,25 +65,26 @@ private: | ||||
|  | ||||
| private: | ||||
|   [[nodiscard]] auto execute_callback( | ||||
|       const std::string &function_name, const char *from, const char *to, | ||||
|       std::string_view function_name, const char *from, const char *to, | ||||
|       const std::function<api_error(const std::string &, const std::string &)> | ||||
|           &cb, | ||||
|       bool disable_logging = false) -> int; | ||||
|  | ||||
|   [[nodiscard]] auto | ||||
|   execute_callback(const std::string &function_name, const char *path, | ||||
|   execute_callback(std::string_view function_name, const char *path, | ||||
|                    const std::function<api_error(const std::string &)> &cb, | ||||
|                    bool disable_logging = false) -> int; | ||||
|  | ||||
|   static void execute_void_callback(const std::string &function_name, | ||||
|   static void execute_void_callback(std::string_view function_name, | ||||
|                                     const std::function<void()> &cb); | ||||
|  | ||||
|   static auto | ||||
|   execute_void_pointer_callback(const std::string &function_name, | ||||
|   execute_void_pointer_callback(std::string_view function_name, | ||||
|                                 const std::function<void *()> &cb) -> void *; | ||||
|  | ||||
|   void raise_fuse_event(std::string function_name, const std::string &api_path, | ||||
|                         int ret, bool disable_logging); | ||||
|   void raise_fuse_event(std::string_view function_name, | ||||
|                         const std::string &api_path, int ret, | ||||
|                         bool disable_logging); | ||||
|  | ||||
| private: | ||||
|   [[nodiscard]] static auto access_(const char *path, int mask) -> int; | ||||
|   | ||||
| @@ -362,7 +362,9 @@ auto app_config::get_provider_name(const provider_type &prov) -> std::string { | ||||
| } | ||||
|  | ||||
| auto app_config::get_value_by_name(const std::string &name) -> std::string { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     if (name == "ApiAuth") { | ||||
| @@ -519,7 +521,9 @@ auto app_config::get_value_by_name(const std::string &name) -> std::string { | ||||
| } | ||||
|  | ||||
| auto app_config::load() -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = false; | ||||
|  | ||||
| @@ -685,7 +689,9 @@ auto app_config::load() -> bool { | ||||
| } | ||||
|  | ||||
| void app_config::save() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = get_config_file_path(); | ||||
|   recur_mutex_lock lock(read_write_mutex_); | ||||
| @@ -732,7 +738,9 @@ void app_config::set_is_remote_mount(bool is_remote_mount) { | ||||
|  | ||||
| auto app_config::set_value_by_name(const std::string &name, | ||||
|                                    const std::string &value) -> std::string { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     if (name == "ApiAuth") { | ||||
|   | ||||
| @@ -40,7 +40,9 @@ void client_pool::pool::execute( | ||||
| } | ||||
|  | ||||
| client_pool::pool::pool(std::uint8_t pool_size) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   event_system::instance().raise<service_started>("client_pool"); | ||||
|  | ||||
|   | ||||
| @@ -219,7 +219,9 @@ auto packet::decode(remote::file_info &val) -> packet::error_type { | ||||
| } | ||||
|  | ||||
| auto packet::decode_json(packet &response, json &json_data) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string data; | ||||
|   auto ret = response.decode(data); | ||||
| @@ -237,7 +239,9 @@ auto packet::decode_json(packet &response, json &json_data) -> int { | ||||
| } | ||||
|  | ||||
| auto packet::decrypt(std::string_view token) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = utils::from_api_error(api_error::success); | ||||
|   try { | ||||
| @@ -519,7 +523,9 @@ void packet::encode_top(remote::file_info val) { | ||||
| } | ||||
|  | ||||
| void packet::encrypt(std::string_view token) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     data_buffer result; | ||||
|   | ||||
| @@ -74,7 +74,9 @@ void packet_client::close_all() { | ||||
| } | ||||
|  | ||||
| void packet_client::connect(client &cli) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     resolve(); | ||||
| @@ -157,22 +159,24 @@ void packet_client::resolve() { | ||||
|   } | ||||
| } | ||||
|  | ||||
| auto packet_client::send(const std::string &method, | ||||
| auto packet_client::send(std::string_view method, | ||||
|                          std::uint32_t &service_flags) -> packet::error_type { | ||||
|   packet request; | ||||
|   return send(method, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto packet_client::send(const std::string &method, packet &request, | ||||
| auto packet_client::send(std::string_view method, packet &request, | ||||
|                          std::uint32_t &service_flags) -> packet::error_type { | ||||
|   packet response; | ||||
|   return send(method, request, response, service_flags); | ||||
| } | ||||
|  | ||||
| auto packet_client::send(const std::string &method, packet &request, | ||||
| auto packet_client::send(std::string_view method, packet &request, | ||||
|                          packet &response, | ||||
|                          std::uint32_t &service_flags) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto success = false; | ||||
|   packet::error_type ret = utils::from_api_error(api_error::error); | ||||
|   | ||||
| @@ -67,7 +67,9 @@ void packet_server::add_client(connection &conn, const std::string &client_id) { | ||||
| } | ||||
|  | ||||
| void packet_server::initialize(const uint16_t &port, uint8_t pool_size) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   pool_size = std::max(uint8_t(1U), pool_size); | ||||
|   server_thread_ = std::make_unique<std::thread>([this, port, pool_size]() { | ||||
| @@ -104,7 +106,9 @@ void packet_server::listen_for_connection(tcp::acceptor &acceptor) { | ||||
|  | ||||
| void packet_server::on_accept(std::shared_ptr<connection> conn, | ||||
|                               boost::system::error_code err) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   listen_for_connection(conn->acceptor); | ||||
|   if (err) { | ||||
| @@ -122,7 +126,9 @@ void packet_server::on_accept(std::shared_ptr<connection> conn, | ||||
| } | ||||
|  | ||||
| void packet_server::read_header(std::shared_ptr<connection> conn) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   conn->buffer.resize(sizeof(std::uint32_t)); | ||||
|   boost::asio::async_read( | ||||
| @@ -143,7 +149,9 @@ void packet_server::read_header(std::shared_ptr<connection> conn) { | ||||
|  | ||||
| void packet_server::read_packet(std::shared_ptr<connection> conn, | ||||
|                                 std::uint32_t data_size) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     const auto read_buffer = [&]() { | ||||
| @@ -239,7 +247,9 @@ void packet_server::remove_client(connection &conn) { | ||||
| void packet_server::send_response(std::shared_ptr<connection> conn, | ||||
|                                   const packet::error_type &result, | ||||
|                                   packet &response) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   response.encode_top(result); | ||||
|   response.encode_top(PACKET_SERVICE_FLAGS); | ||||
|   | ||||
| @@ -22,8 +22,8 @@ | ||||
| #include "database/db_insert.hpp" | ||||
|  | ||||
| namespace repertory::db { | ||||
| auto db_insert::column_value(std::string column_name, db_types_t value) | ||||
|     -> db_insert & { | ||||
| auto db_insert::column_value(std::string column_name, | ||||
|                              db_types_t value) -> db_insert & { | ||||
|   context_->values[column_name] = value; | ||||
|   return *this; | ||||
| } | ||||
| @@ -58,7 +58,9 @@ auto db_insert::dump() const -> std::string { | ||||
| } | ||||
|  | ||||
| auto db_insert::go() const -> db_result<context> { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   sqlite3_stmt *stmt_ptr{nullptr}; | ||||
|   auto query_str = dump(); | ||||
|   | ||||
| @@ -32,8 +32,8 @@ auto db_select::column(std::string column_name) -> db_select & { | ||||
|   return *this; | ||||
| } | ||||
|  | ||||
| auto db_select::count(std::string column_name, std::string as_column_name) | ||||
|     -> db_select & { | ||||
| auto db_select::count(std::string column_name, | ||||
|                       std::string as_column_name) -> db_select & { | ||||
|   context_->count_columns[column_name] = as_column_name; | ||||
|   return *this; | ||||
| } | ||||
| @@ -112,7 +112,9 @@ auto db_select::dump() const -> std::string { | ||||
| } | ||||
|  | ||||
| auto db_select::go() const -> db_result<context> { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   sqlite3_stmt *stmt_ptr{nullptr}; | ||||
|   auto query_str = dump(); | ||||
| @@ -159,8 +161,8 @@ auto db_select::limit(std::int32_t value) -> db_select & { | ||||
|   return *this; | ||||
| } | ||||
|  | ||||
| auto db_select::order_by(std::string column_name, bool ascending) | ||||
|     -> db_select & { | ||||
| auto db_select::order_by(std::string column_name, | ||||
|                          bool ascending) -> db_select & { | ||||
|   if (context_->delete_query) { | ||||
|     throw std::runtime_error("order_by may not be specified for delete"); | ||||
|   } | ||||
|   | ||||
| @@ -29,7 +29,9 @@ namespace repertory { | ||||
| auto directory_iterator::fill_buffer( | ||||
|     const remote::file_offset &offset, fuse_fill_dir_t filler_function, | ||||
|     void *buffer, populate_stat_callback populate_stat) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (offset < items_.size()) { | ||||
|     try { | ||||
|   | ||||
| @@ -34,7 +34,9 @@ | ||||
| namespace repertory { | ||||
| auto eviction::check_minimum_requirements(const std::string &file_path) | ||||
|     -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint64_t file_size{}; | ||||
|   if (not utils::file::get_file_size(file_path, file_size)) { | ||||
| @@ -81,7 +83,9 @@ auto eviction::get_filtered_cached_files() -> std::deque<std::string> { | ||||
| } | ||||
|  | ||||
| void eviction::service_function() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto should_evict = true; | ||||
|  | ||||
|   | ||||
| @@ -102,7 +102,9 @@ fuse_base::fuse_base(app_config &config) : config_(config) { | ||||
| fuse_base::~fuse_base() { E_CONSUMER_RELEASE(); } | ||||
|  | ||||
| auto fuse_base::access_(const char *path, int mask) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -112,7 +114,9 @@ auto fuse_base::access_(const char *path, int mask) -> int { | ||||
|  | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::chflags_(const char *path, uint32_t flags) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -124,7 +128,9 @@ auto fuse_base::chflags_(const char *path, uint32_t flags) -> int { | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::chmod_(const char *path, mode_t mode, | ||||
|                        struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -133,7 +139,9 @@ auto fuse_base::chmod_(const char *path, mode_t mode, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::chmod_(const char *path, mode_t mode) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -145,7 +153,9 @@ auto fuse_base::chmod_(const char *path, mode_t mode) -> int { | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::chown_(const char *path, uid_t uid, gid_t gid, | ||||
|                        struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -154,7 +164,9 @@ auto fuse_base::chown_(const char *path, uid_t uid, gid_t gid, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::chown_(const char *path, uid_t uid, gid_t gid) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -165,7 +177,9 @@ auto fuse_base::chown_(const char *path, uid_t uid, gid_t gid) -> int { | ||||
|  | ||||
| auto fuse_base::create_(const char *path, mode_t mode, | ||||
|                         struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -174,7 +188,9 @@ auto fuse_base::create_(const char *path, mode_t mode, | ||||
| } | ||||
|  | ||||
| void fuse_base::destroy_(void *ptr) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   execute_void_callback(function_name, [&]() { instance().destroy_impl(ptr); }); | ||||
| } | ||||
| @@ -207,7 +223,7 @@ void fuse_base::display_version_information(std::vector<const char *> args) { | ||||
| } | ||||
|  | ||||
| auto fuse_base::execute_callback( | ||||
|     const std::string &function_name, const char *from, const char *to, | ||||
|     std::string_view function_name, const char *from, const char *to, | ||||
|     const std::function<api_error(const std::string &from_api_file, | ||||
|                                   const std::string &to_api_path)> &cb, | ||||
|     bool disable_logging) -> int { | ||||
| @@ -221,7 +237,7 @@ auto fuse_base::execute_callback( | ||||
| } | ||||
|  | ||||
| auto fuse_base::execute_callback( | ||||
|     const std::string &function_name, const char *path, | ||||
|     std::string_view function_name, const char *path, | ||||
|     const std::function<api_error(const std::string &api_path)> &cb, | ||||
|     bool disable_logging) -> int { | ||||
|   const auto api_path = utils::path::create_api_path(path ? path : ""); | ||||
| @@ -230,14 +246,14 @@ auto fuse_base::execute_callback( | ||||
|   return res; | ||||
| } | ||||
|  | ||||
| void fuse_base::execute_void_callback(const std::string &function_name, | ||||
| void fuse_base::execute_void_callback(std::string_view function_name, | ||||
|                                       const std::function<void()> &cb) { | ||||
|   cb(); | ||||
|  | ||||
|   instance().raise_fuse_event(function_name, "", 0, false); | ||||
| } | ||||
|  | ||||
| auto fuse_base::execute_void_pointer_callback(const std::string &function_name, | ||||
| auto fuse_base::execute_void_pointer_callback(std::string_view function_name, | ||||
|                                               const std::function<void *()> &cb) | ||||
|     -> void * { | ||||
|   auto *ret = cb(); | ||||
| @@ -249,7 +265,9 @@ auto fuse_base::execute_void_pointer_callback(const std::string &function_name, | ||||
|  | ||||
| auto fuse_base::fallocate_(const char *path, int mode, off_t offset, | ||||
|                            off_t length, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -260,7 +278,9 @@ auto fuse_base::fallocate_(const char *path, int mode, off_t offset, | ||||
| #if FUSE_USE_VERSION < 30 | ||||
| auto fuse_base::fgetattr_(const char *path, struct stat *st, | ||||
|                           struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -272,7 +292,9 @@ auto fuse_base::fgetattr_(const char *path, struct stat *st, | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::fsetattr_x_(const char *path, struct setattr_x *attr, | ||||
|                             struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -283,7 +305,9 @@ auto fuse_base::fsetattr_x_(const char *path, struct setattr_x *attr, | ||||
|  | ||||
| auto fuse_base::fsync_(const char *path, int datasync, | ||||
|                        struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -294,7 +318,9 @@ auto fuse_base::fsync_(const char *path, int datasync, | ||||
| #if FUSE_USE_VERSION < 30 | ||||
| auto fuse_base::ftruncate_(const char *path, off_t size, | ||||
|                            struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -306,7 +332,9 @@ auto fuse_base::ftruncate_(const char *path, off_t size, | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::getattr_(const char *path, struct stat *st, | ||||
|                          struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -315,7 +343,9 @@ auto fuse_base::getattr_(const char *path, struct stat *st, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::getattr_(const char *path, struct stat *st) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -327,7 +357,9 @@ auto fuse_base::getattr_(const char *path, struct stat *st) -> int { | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::getxtimes_(const char *path, struct timespec *bkuptime, | ||||
|                            struct timespec *crtime) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -339,7 +371,9 @@ auto fuse_base::getxtimes_(const char *path, struct timespec *bkuptime, | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::init_(struct fuse_conn_info *conn, | ||||
|                       struct fuse_config *cfg) -> void * { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return execute_void_pointer_callback(function_name, [&]() -> void * { | ||||
|     return instance().init_impl(conn, cfg); | ||||
| @@ -347,7 +381,9 @@ auto fuse_base::init_(struct fuse_conn_info *conn, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::init_(struct fuse_conn_info *conn) -> void * { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return execute_void_pointer_callback( | ||||
|       function_name, [&]() -> void * { return instance().init_impl(conn); }); | ||||
| @@ -360,7 +396,9 @@ auto fuse_base::init_impl([[maybe_unused]] struct fuse_conn_info *conn, | ||||
| #else | ||||
| auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * { | ||||
| #endif | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   utils::file::change_to_process_directory(); | ||||
|   if (not console_enabled_) { | ||||
| @@ -385,7 +423,9 @@ auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * { | ||||
| } | ||||
|  | ||||
| auto fuse_base::mkdir_(const char *path, mode_t mode) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -442,7 +482,9 @@ auto fuse_base::mount(std::vector<std::string> args) -> int { | ||||
| } | ||||
|  | ||||
| auto fuse_base::open_(const char *path, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -451,7 +493,9 @@ auto fuse_base::open_(const char *path, struct fuse_file_info *fi) -> int { | ||||
| } | ||||
|  | ||||
| auto fuse_base::opendir_(const char *path, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -461,7 +505,9 @@ auto fuse_base::opendir_(const char *path, struct fuse_file_info *fi) -> int { | ||||
|  | ||||
| auto fuse_base::read_(const char *path, char *buffer, size_t read_size, | ||||
|                       off_t read_offset, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::size_t bytes_read{}; | ||||
|   const auto res = instance().execute_callback( | ||||
| @@ -479,7 +525,9 @@ auto fuse_base::readdir_(const char *path, void *buf, | ||||
|                          fuse_fill_dir_t fuse_fill_dir, off_t offset, | ||||
|                          struct fuse_file_info *fi, | ||||
|                          fuse_readdir_flags flags) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -491,7 +539,9 @@ auto fuse_base::readdir_(const char *path, void *buf, | ||||
| auto fuse_base::readdir_(const char *path, void *buf, | ||||
|                          fuse_fill_dir_t fuse_fill_dir, off_t offset, | ||||
|                          struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -502,7 +552,9 @@ auto fuse_base::readdir_(const char *path, void *buf, | ||||
| #endif | ||||
|  | ||||
| auto fuse_base::release_(const char *path, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -512,7 +564,9 @@ auto fuse_base::release_(const char *path, struct fuse_file_info *fi) -> int { | ||||
|  | ||||
| auto fuse_base::releasedir_(const char *path, | ||||
|                             struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -523,7 +577,9 @@ auto fuse_base::releasedir_(const char *path, | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::rename_(const char *from, const char *to, | ||||
|                         unsigned int flags) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, from, to, | ||||
| @@ -534,7 +590,9 @@ auto fuse_base::rename_(const char *from, const char *to, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::rename_(const char *from, const char *to) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, from, to, | ||||
| @@ -546,7 +604,9 @@ auto fuse_base::rename_(const char *from, const char *to) -> int { | ||||
| #endif | ||||
|  | ||||
| auto fuse_base::rmdir_(const char *path) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -558,7 +618,9 @@ auto fuse_base::rmdir_(const char *path) -> int { | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::getxattr_(const char *path, const char *name, char *value, | ||||
|                           size_t size, uint32_t position) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   int attribute_size = 0; | ||||
|   const auto res = instance().execute_callback( | ||||
| @@ -572,7 +634,9 @@ auto fuse_base::getxattr_(const char *path, const char *name, char *value, | ||||
| #else  // __APPLE__ | ||||
| auto fuse_base::getxattr_(const char *path, const char *name, char *value, | ||||
|                           size_t size) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   int attribute_size = 0; | ||||
|   const auto res = instance().execute_callback( | ||||
| @@ -586,7 +650,9 @@ auto fuse_base::getxattr_(const char *path, const char *name, char *value, | ||||
| #endif // __APPLE__ | ||||
|  | ||||
| auto fuse_base::listxattr_(const char *path, char *buffer, size_t size) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   int required_size = 0; | ||||
|   bool return_size = false; | ||||
| @@ -686,7 +752,7 @@ auto fuse_base::parse_args(std::vector<std::string> &args) -> int { | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void fuse_base::raise_fuse_event(std::string function_name, | ||||
| void fuse_base::raise_fuse_event(std::string_view function_name, | ||||
|                                  const std::string &api_path, int ret, | ||||
|                                  bool disable_logging) { | ||||
|   if ((ret >= 0) && disable_logging) { | ||||
| @@ -705,7 +771,9 @@ void fuse_base::raise_fuse_event(std::string function_name, | ||||
| } | ||||
|  | ||||
| auto fuse_base::removexattr_(const char *path, const char *name) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -716,7 +784,9 @@ auto fuse_base::removexattr_(const char *path, const char *name) -> int { | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::setxattr_(const char *path, const char *name, const char *value, | ||||
|                           size_t size, int flags, uint32_t position) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto res = instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -732,7 +802,9 @@ auto fuse_base::setxattr_(const char *path, const char *name, const char *value, | ||||
| #else  // __APPLE__ | ||||
| auto fuse_base::setxattr_(const char *path, const char *name, const char *value, | ||||
|                           size_t size, int flags) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto res = instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -755,7 +827,9 @@ void fuse_base::shutdown() { | ||||
|  | ||||
| #if defined(__APPLE__) | ||||
| auto fuse_base::setattr_x_(const char *path, struct setattr_x *attr) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -765,7 +839,9 @@ auto fuse_base::setattr_x_(const char *path, struct setattr_x *attr) -> int { | ||||
|  | ||||
| auto fuse_base::setbkuptime_(const char *path, | ||||
|                              const struct timespec *bkuptime) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -775,7 +851,9 @@ auto fuse_base::setbkuptime_(const char *path, | ||||
|  | ||||
| auto fuse_base::setchgtime_(const char *path, | ||||
|                             const struct timespec *chgtime) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -785,7 +863,9 @@ auto fuse_base::setchgtime_(const char *path, | ||||
|  | ||||
| auto fuse_base::setcrtime_(const char *path, | ||||
|                            const struct timespec *crtime) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -794,7 +874,9 @@ auto fuse_base::setcrtime_(const char *path, | ||||
| } | ||||
|  | ||||
| auto fuse_base::setvolname_(const char *volname) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, volname, [&](const std::string &api_path) -> api_error { | ||||
| @@ -803,7 +885,9 @@ auto fuse_base::setvolname_(const char *volname) -> int { | ||||
| } | ||||
|  | ||||
| auto fuse_base::statfs_x_(const char *path, struct statfs *stbuf) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -812,7 +896,9 @@ auto fuse_base::statfs_x_(const char *path, struct statfs *stbuf) -> int { | ||||
| } | ||||
| #else  // __APPLE__ | ||||
| auto fuse_base::statfs_(const char *path, struct statvfs *stbuf) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -824,7 +910,9 @@ auto fuse_base::statfs_(const char *path, struct statvfs *stbuf) -> int { | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::truncate_(const char *path, off_t size, | ||||
|                           struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -833,7 +921,9 @@ auto fuse_base::truncate_(const char *path, off_t size, | ||||
| } | ||||
| #else | ||||
| auto fuse_base::truncate_(const char *path, off_t size) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -843,7 +933,9 @@ auto fuse_base::truncate_(const char *path, off_t size) -> int { | ||||
| #endif | ||||
|  | ||||
| auto fuse_base::unlink_(const char *path) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -868,7 +960,9 @@ auto fuse_base::unmount(const std::string &mount_location) -> int { | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
| auto fuse_base::utimens_(const char *path, const struct timespec tv[2], | ||||
|                          struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -877,7 +971,9 @@ auto fuse_base::utimens_(const char *path, const struct timespec tv[2], | ||||
| } | ||||
| #else | ||||
| auto fuse_base::utimens_(const char *path, const struct timespec tv[2]) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return instance().execute_callback( | ||||
|       function_name, path, [&](const std::string &api_path) -> api_error { | ||||
| @@ -888,7 +984,9 @@ auto fuse_base::utimens_(const char *path, const struct timespec tv[2]) -> int { | ||||
|  | ||||
| auto fuse_base::write_(const char *path, const char *buffer, size_t write_size, | ||||
|                        off_t write_offset, struct fuse_file_info *fi) -> int { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::size_t bytes_written{}; | ||||
|  | ||||
|   | ||||
| @@ -207,7 +207,9 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode, | ||||
| } | ||||
|  | ||||
| void fuse_drive::destroy_impl(void *ptr) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   event_system::instance().raise<drive_unmount_pending>(get_mount_location()); | ||||
|  | ||||
| @@ -393,7 +395,9 @@ auto fuse_drive::get_directory_item_count(const std::string &api_path) const | ||||
|  | ||||
| auto fuse_drive::get_directory_items(const std::string &api_path) const | ||||
|     -> directory_item_list { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   directory_item_list list{}; | ||||
|   auto res = provider_.get_directory_items(api_path, list); | ||||
| @@ -407,7 +411,9 @@ auto fuse_drive::get_directory_items(const std::string &api_path) const | ||||
|  | ||||
| auto fuse_drive::get_file_size(const std::string &api_path) const | ||||
|     -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint64_t file_size{}; | ||||
|   auto res = provider_.get_file_size(api_path, file_size); | ||||
| @@ -529,7 +535,9 @@ auto fuse_drive::init_impl(struct fuse_conn_info *conn, | ||||
| #else | ||||
| void *fuse_drive::init_impl(struct fuse_conn_info *conn) { | ||||
| #endif | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
|   auto *ret = fuse_drive_base::init_impl(conn, cfg); | ||||
| @@ -598,7 +606,9 @@ auto fuse_drive::is_processing(const std::string &api_path) const -> bool { | ||||
| } | ||||
|  | ||||
| auto fuse_drive::mkdir_impl(std::string api_path, mode_t mode) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto res = check_parent_access(api_path, W_OK | X_OK); | ||||
|   if (res != api_error::success) { | ||||
| @@ -1030,7 +1040,9 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name, | ||||
| void fuse_drive::set_item_meta(const std::string &api_path, | ||||
|                                const std::string &key, | ||||
|                                const std::string &value) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto res = provider_.set_item_meta(api_path, key, value); | ||||
|   if (res != api_error::success) { | ||||
| @@ -1352,7 +1364,9 @@ auto fuse_drive::write_impl(std::string /*api_path*/ | ||||
| } | ||||
|  | ||||
| void fuse_drive::update_accessed_time(const std::string &api_path) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (atime_enabled_) { | ||||
|     auto res = provider_.set_item_meta( | ||||
|   | ||||
| @@ -36,7 +36,9 @@ remote_client::remote_client(const app_config &config) | ||||
|  | ||||
| auto remote_client::fuse_access(const char *path, const std::int32_t &mask) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -46,9 +48,11 @@ auto remote_client::fuse_access(const char *path, const std::int32_t &mask) | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_chflags(const char *path, std::uint32_t flags) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_chflags(const char *path, | ||||
|                                  std::uint32_t flags) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -60,7 +64,9 @@ auto remote_client::fuse_chflags(const char *path, std::uint32_t flags) | ||||
|  | ||||
| auto remote_client::fuse_chmod(const char *path, const remote::file_mode &mode) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -73,7 +79,9 @@ auto remote_client::fuse_chmod(const char *path, const remote::file_mode &mode) | ||||
| auto remote_client::fuse_chown(const char *path, const remote::user_id &uid, | ||||
|                                const remote::group_id &gid) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -85,7 +93,9 @@ auto remote_client::fuse_chown(const char *path, const remote::user_id &uid, | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_destroy() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint32_t service_flags{}; | ||||
|   return packet_client_.send(function_name, service_flags); | ||||
| @@ -104,11 +114,12 @@ std::int32_t &mode, const remote::file_offset &offset, const remote::file_offset | ||||
|   return packetClient_.send(function_name, request, service_flags); | ||||
| }*/ | ||||
|  | ||||
| auto remote_client::fuse_fgetattr(const char *path, remote::stat &st, | ||||
|                                   bool &directory, | ||||
|                                   const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_fgetattr( | ||||
|     const char *path, remote::stat &st, bool &directory, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -132,11 +143,12 @@ auto remote_client::fuse_fgetattr(const char *path, remote::stat &st, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_fsetattr_x(const char *path, | ||||
|                                     const remote::setattr_x &attr, | ||||
|                                     const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_fsetattr_x( | ||||
|     const char *path, const remote::setattr_x &attr, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -150,7 +162,9 @@ auto remote_client::fuse_fsetattr_x(const char *path, | ||||
| auto remote_client::fuse_fsync(const char *path, const std::int32_t &datasync, | ||||
|                                const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -161,11 +175,12 @@ auto remote_client::fuse_fsync(const char *path, const std::int32_t &datasync, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_ftruncate(const char *path, | ||||
|                                    const remote::file_offset &size, | ||||
|                                    const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_ftruncate( | ||||
|     const char *path, const remote::file_offset &size, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -178,7 +193,9 @@ auto remote_client::fuse_ftruncate(const char *path, | ||||
|  | ||||
| auto remote_client::fuse_getattr(const char *path, remote::stat &st, | ||||
|                                  bool &directory) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -245,11 +262,12 @@ response.CurrentPointer(), static_cast<std::size_t>(size2)); | ||||
|   return ret; | ||||
| }*/ | ||||
|  | ||||
| auto remote_client::fuse_getxtimes(const char *path, | ||||
|                                    remote::file_time &bkuptime, | ||||
|                                    remote::file_time &crtime) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_getxtimes( | ||||
|     const char *path, remote::file_time &bkuptime, | ||||
|     remote::file_time &crtime) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -267,7 +285,9 @@ auto remote_client::fuse_getxtimes(const char *path, | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_init() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint32_t service_flags{}; | ||||
|   return packet_client_.send(function_name, service_flags); | ||||
| @@ -296,7 +316,9 @@ static_cast<std::size_t>(size2)); | ||||
|  | ||||
| auto remote_client::fuse_mkdir(const char *path, const remote::file_mode &mode) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -308,7 +330,9 @@ auto remote_client::fuse_mkdir(const char *path, const remote::file_mode &mode) | ||||
|  | ||||
| auto remote_client::fuse_opendir(const char *path, remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -328,7 +352,9 @@ auto remote_client::fuse_create(const char *path, const remote::file_mode &mode, | ||||
|                                 const remote::open_flags &flags, | ||||
|                                 remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -349,7 +375,9 @@ auto remote_client::fuse_create(const char *path, const remote::file_mode &mode, | ||||
| auto remote_client::fuse_open(const char *path, const remote::open_flags &flags, | ||||
|                               remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -366,12 +394,13 @@ auto remote_client::fuse_open(const char *path, const remote::open_flags &flags, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_read(const char *path, char *buffer, | ||||
|                               const remote::file_size &read_size, | ||||
|                               const remote::file_offset &read_offset, | ||||
|                               const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_read( | ||||
|     const char *path, char *buffer, const remote::file_size &read_size, | ||||
|     const remote::file_offset &read_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -390,9 +419,11 @@ auto remote_client::fuse_read(const char *path, char *buffer, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_rename(const char *from, const char *to) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_rename(const char *from, | ||||
|                                 const char *to) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(from); | ||||
| @@ -402,12 +433,13 @@ auto remote_client::fuse_rename(const char *from, const char *to) | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_write(const char *path, const char *buffer, | ||||
|                                const remote::file_size &write_size, | ||||
|                                const remote::file_offset &write_offset, | ||||
|                                const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_write( | ||||
|     const char *path, const char *buffer, const remote::file_size &write_size, | ||||
|     const remote::file_offset &write_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (write_size > std::numeric_limits<std::size_t>::max()) { | ||||
|     return -ERANGE; | ||||
| @@ -424,12 +456,13 @@ auto remote_client::fuse_write(const char *path, const char *buffer, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_write_base64(const char *path, const char *buffer, | ||||
|                                       const remote::file_size &write_size, | ||||
|                                       const remote::file_offset &write_offset, | ||||
|                                       const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_write_base64( | ||||
|     const char *path, const char *buffer, const remote::file_size &write_size, | ||||
|     const remote::file_offset &write_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (write_size > std::numeric_limits<std::size_t>::max()) { | ||||
|     return -ERANGE; | ||||
| @@ -450,7 +483,9 @@ auto remote_client::fuse_readdir(const char *path, | ||||
|                                  const remote::file_offset &offset, | ||||
|                                  const remote::file_handle &handle, | ||||
|                                  std::string &item_path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -468,10 +503,11 @@ auto remote_client::fuse_readdir(const char *path, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_release(const char *path, | ||||
|                                  const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_release( | ||||
|     const char *path, const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -481,10 +517,11 @@ auto remote_client::fuse_release(const char *path, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_releasedir(const char *path, | ||||
|                                     const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_releasedir( | ||||
|     const char *path, const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -503,7 +540,9 @@ request.Encode(name); | ||||
| }*/ | ||||
|  | ||||
| auto remote_client::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -514,7 +553,9 @@ auto remote_client::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|  | ||||
| auto remote_client::fuse_setattr_x(const char *path, remote::setattr_x &attr) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -524,10 +565,11 @@ auto remote_client::fuse_setattr_x(const char *path, remote::setattr_x &attr) | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_setbkuptime(const char *path, | ||||
|                                      const remote::file_time &bkuptime) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_setbkuptime( | ||||
|     const char *path, const remote::file_time &bkuptime) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -537,10 +579,11 @@ auto remote_client::fuse_setbkuptime(const char *path, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_setchgtime(const char *path, | ||||
|                                     const remote::file_time &chgtime) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_setchgtime( | ||||
|     const char *path, const remote::file_time &chgtime) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -550,10 +593,11 @@ auto remote_client::fuse_setchgtime(const char *path, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_setcrtime(const char *path, | ||||
|                                    const remote::file_time &crtime) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_setcrtime( | ||||
|     const char *path, const remote::file_time &crtime) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -564,7 +608,9 @@ auto remote_client::fuse_setcrtime(const char *path, | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_setvolname(const char *volname) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(volname); | ||||
| @@ -605,7 +651,9 @@ request.encode(flags); request.encode(position); | ||||
|  | ||||
| auto remote_client::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
|                                 remote::statfs &st) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -624,7 +672,9 @@ auto remote_client::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
|  | ||||
| auto remote_client::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|                                   remote::statfs_x &st) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -641,10 +691,11 @@ auto remote_client::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_truncate(const char *path, | ||||
|                                   const remote::file_offset &size) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::fuse_truncate( | ||||
|     const char *path, const remote::file_offset &size) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -655,7 +706,9 @@ auto remote_client::fuse_truncate(const char *path, | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_unlink(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -665,9 +718,11 @@ auto remote_client::fuse_unlink(const char *path) -> packet::error_type { | ||||
| } | ||||
|  | ||||
| auto remote_client::fuse_utimens(const char *path, const remote::file_time *tv, | ||||
|                                  std::uint64_t op0, std::uint64_t op1) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|                                  std::uint64_t op0, | ||||
|                                  std::uint64_t op1) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -679,10 +734,11 @@ auto remote_client::fuse_utimens(const char *path, const remote::file_time *tv, | ||||
|   return packet_client_.send(function_name, request, service_flags); | ||||
| } | ||||
|  | ||||
| auto remote_client::json_create_directory_snapshot(const std::string &path, | ||||
|                                                    json &json_data) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto remote_client::json_create_directory_snapshot( | ||||
|     const std::string &path, json &json_data) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -701,7 +757,9 @@ auto remote_client::json_create_directory_snapshot(const std::string &path, | ||||
| auto remote_client::json_read_directory_snapshot( | ||||
|     const std::string &path, const remote::file_handle &handle, | ||||
|     std::uint32_t page, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -720,9 +778,11 @@ auto remote_client::json_read_directory_snapshot( | ||||
| } | ||||
|  | ||||
| auto remote_client::json_release_directory_snapshot( | ||||
|     const std::string &path, const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|     const std::string &path, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
|   | ||||
| @@ -86,7 +86,9 @@ auto remote_fuse_drive::create_impl(std::string api_path, mode_t mode, | ||||
| } | ||||
|  | ||||
| void remote_fuse_drive::destroy_impl(void *ptr) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   event_system::instance().raise<drive_unmount_pending>(get_mount_location()); | ||||
|  | ||||
| @@ -221,7 +223,9 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn, | ||||
| #else | ||||
| auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * { | ||||
| #endif | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
| #if FUSE_USE_VERSION >= 30 | ||||
|   auto *ret = fuse_base::init_impl(conn, cfg); | ||||
|   | ||||
| @@ -114,7 +114,9 @@ void remote_server::populate_file_info(const std::string &api_path, | ||||
|                                        const UINT64 &file_size, | ||||
|                                        const UINT32 &attributes, | ||||
|                                        remote::file_info &file_info) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   api_meta_map meta{}; | ||||
|   const auto res = drive_.get_item_meta(api_path, meta); | ||||
| @@ -184,7 +186,9 @@ void remote_server::populate_stat(const struct stat64 &unix_st, | ||||
|  | ||||
| auto remote_server::fuse_access(const char *path, const std::int32_t &mask) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = access(file_path.c_str(), mask); | ||||
| @@ -195,7 +199,9 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask) | ||||
|  | ||||
| auto remote_server::fuse_chflags(const char *path, | ||||
|                                  std::uint32_t flags) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -215,7 +221,9 @@ auto remote_server::fuse_chflags(const char *path, | ||||
|  | ||||
| auto remote_server::fuse_chmod(const char *path, const remote::file_mode &mode) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = chmod(file_path.c_str(), mode); | ||||
| @@ -227,7 +235,9 @@ auto remote_server::fuse_chmod(const char *path, const remote::file_mode &mode) | ||||
| auto remote_server::fuse_chown(const char *path, const remote::user_id &uid, | ||||
|                                const remote::group_id &gid) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = chown(file_path.c_str(), uid, gid); | ||||
| @@ -240,7 +250,9 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, | ||||
|                                 const remote::open_flags &flags, | ||||
|                                 remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = | ||||
| @@ -257,7 +269,9 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_destroy() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, "", 0); | ||||
|   return 0; | ||||
| @@ -304,7 +318,9 @@ length); ret = ((res < 0) ? -errno : 0); #endif | ||||
| auto remote_server::fuse_fgetattr( | ||||
|     const char *path, remote::stat &r_stat, bool &directory, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   memset(&r_stat, 0, sizeof(remote::stat)); | ||||
| @@ -327,7 +343,9 @@ auto remote_server::fuse_fgetattr( | ||||
| auto remote_server::fuse_fsetattr_x( | ||||
|     const char *path, const remote::setattr_x &attr, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -420,7 +438,9 @@ auto remote_server::fuse_fsetattr_x( | ||||
| auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync, | ||||
|                                const remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -443,7 +463,9 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync, | ||||
| auto remote_server::fuse_ftruncate( | ||||
|     const char *path, const remote::file_offset &size, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -460,7 +482,9 @@ auto remote_server::fuse_ftruncate( | ||||
|  | ||||
| auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat, | ||||
|                                  bool &directory) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(api_path); | ||||
| @@ -537,7 +561,9 @@ file_path, ret); return ret; | ||||
| auto remote_server::fuse_getxtimes( | ||||
|     const char *path, remote::file_time &bkuptime, | ||||
|     remote::file_time &crtime) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -567,7 +593,9 @@ auto remote_server::fuse_getxtimes( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_init() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, "", 0); | ||||
|   return 0; | ||||
| @@ -585,7 +613,9 @@ auto res = listxattr(file_path.c_str(), buffer, size); #endif auto ret = ((res < | ||||
|  | ||||
| auto remote_server::fuse_mkdir(const char *path, const remote::file_mode &mode) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = mkdir(file_path.c_str(), mode); | ||||
| @@ -597,7 +627,9 @@ auto remote_server::fuse_mkdir(const char *path, const remote::file_mode &mode) | ||||
| auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, | ||||
|                               remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = open(file_path.c_str(), | ||||
| @@ -613,7 +645,9 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, | ||||
|  | ||||
| auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -640,7 +674,9 @@ auto remote_server::fuse_read( | ||||
|     const char *path, char *buffer, const remote::file_size &read_size, | ||||
|     const remote::file_offset &read_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto &data = *reinterpret_cast<data_buffer *>(buffer); | ||||
| @@ -662,7 +698,9 @@ auto remote_server::fuse_read( | ||||
|  | ||||
| auto remote_server::fuse_rename(const char *from, | ||||
|                                 const char *to) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto from_path = utils::path::combine(mount_location_, {from}); | ||||
|   const auto to_path = utils::path::combine(mount_location_, {to}); | ||||
| @@ -677,7 +715,9 @@ auto remote_server::fuse_readdir(const char *path, | ||||
|                                  const remote::file_offset &offset, | ||||
|                                  const remote::file_handle &handle, | ||||
|                                  std::string &item_path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto res = 0; | ||||
| @@ -701,7 +741,9 @@ auto remote_server::fuse_readdir(const char *path, | ||||
|  | ||||
| auto remote_server::fuse_release( | ||||
|     const char *path, const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet::error_type ret = 0; | ||||
|  | ||||
| @@ -719,7 +761,9 @@ auto remote_server::fuse_release( | ||||
|  | ||||
| auto remote_server::fuse_releasedir( | ||||
|     const char *path, const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -740,7 +784,9 @@ removexattr(file_path.c_str(), name); #endif auto ret = ((res < 0) ? -errno : | ||||
| }*/ | ||||
|  | ||||
| auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = rmdir(file_path.c_str()); | ||||
| @@ -760,7 +806,9 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|  | ||||
| auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto ret = fuse_fsetattr_x( | ||||
| @@ -771,7 +819,9 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr) | ||||
|  | ||||
| auto remote_server::fuse_setbkuptime( | ||||
|     const char *path, const remote::file_time &bkuptime) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -791,7 +841,9 @@ auto remote_server::fuse_setbkuptime( | ||||
|  | ||||
| auto remote_server::fuse_setchgtime( | ||||
|     const char *path, const remote::file_time &chgtime) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -811,7 +863,9 @@ auto remote_server::fuse_setchgtime( | ||||
|  | ||||
| auto remote_server::fuse_setcrtime( | ||||
|     const char *path, const remote::file_time &crtime) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(path); | ||||
| @@ -830,7 +884,9 @@ auto remote_server::fuse_setcrtime( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, volname, 0); | ||||
|   return 0; | ||||
| @@ -858,7 +914,9 @@ res = setxattr(file_path.c_str(), name, value, size, position, flags); auto ret | ||||
|  | ||||
| auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
|                                 remote::statfs &r_stat) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -879,7 +937,9 @@ auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
| auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|                                   remote::statfs_x &r_stat) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -903,7 +963,9 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|  | ||||
| auto remote_server::fuse_truncate( | ||||
|     const char *path, const remote::file_offset &size) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = truncate(file_path.c_str(), static_cast<off_t>(size)); | ||||
| @@ -913,7 +975,9 @@ auto remote_server::fuse_truncate( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_unlink(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = unlink(file_path.c_str()); | ||||
| @@ -925,7 +989,9 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type { | ||||
| auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, | ||||
|                                  std::uint64_t op0, | ||||
|                                  std::uint64_t op1) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -957,7 +1023,9 @@ auto remote_server::fuse_write( | ||||
|     const char *path, const char *buffer, const remote::file_size &write_size, | ||||
|     const remote::file_offset &write_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -988,7 +1056,9 @@ auto remote_server::fuse_write_base64( | ||||
| // WinFSP Layer | ||||
| auto remote_server::winfsp_can_delete(PVOID file_desc, | ||||
|                                       PWSTR file_name) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto relative_path = utils::string::to_utf8(file_name); | ||||
|   const auto file_path = construct_path(relative_path); | ||||
| @@ -1015,7 +1085,9 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, | ||||
| auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name, | ||||
|                                    UINT32 flags, | ||||
|                                    BOOLEAN &was_closed) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto relative_path = utils::string::to_utf8(file_name); | ||||
|   const auto file_path = construct_path(relative_path); | ||||
| @@ -1072,7 +1144,9 @@ auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name, | ||||
| } | ||||
|  | ||||
| auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string file_path; | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
| @@ -1093,7 +1167,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|                                   remote::file_info *file_info, | ||||
|                                   std::string &normalized_name, | ||||
|                                   BOOLEAN &exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto relative_path = utils::string::to_utf8(file_name); | ||||
|   const auto file_path = construct_path(relative_path); | ||||
| @@ -1141,7 +1217,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|  | ||||
| auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
|   auto ret = static_cast<packet::error_type>( | ||||
| @@ -1162,7 +1240,9 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info) | ||||
|  | ||||
| auto remote_server::winfsp_get_file_info( | ||||
|     PVOID file_desc, remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
|   auto ret = static_cast<packet::error_type>( | ||||
| @@ -1183,7 +1263,9 @@ auto remote_server::winfsp_get_security_by_name( | ||||
|     PWSTR file_name, PUINT32 attributes, | ||||
|     std::uint64_t * /*security_descriptor_size*/, | ||||
|     std::wstring & /*str_descriptor*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = static_cast<packet::error_type>(STATUS_SUCCESS); | ||||
|   const auto file_path = construct_path(file_name); | ||||
| @@ -1207,7 +1289,9 @@ auto remote_server::winfsp_get_security_by_name( | ||||
| auto remote_server::winfsp_get_volume_info( | ||||
|     UINT64 &total_size, UINT64 &free_size, | ||||
|     std::string &volume_label) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   drive_.get_volume_info(total_size, free_size, volume_label); | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, volume_label, STATUS_SUCCESS); | ||||
| @@ -1216,7 +1300,9 @@ auto remote_server::winfsp_get_volume_info( | ||||
|  | ||||
| auto remote_server::winfsp_mounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT( | ||||
|       function_name, utils::string::to_utf8(location), STATUS_SUCCESS); | ||||
| @@ -1227,7 +1313,9 @@ auto remote_server::winfsp_open( | ||||
|     PWSTR file_name, UINT32 create_options, UINT32 granted_access, | ||||
|     PVOID *file_desc, remote::file_info *file_info, | ||||
|     std::string &normalized_name) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto relative_path = utils::string::to_utf8(file_name); | ||||
|   const auto file_path = construct_path(relative_path); | ||||
| @@ -1265,7 +1353,9 @@ auto remote_server::winfsp_overwrite( | ||||
|     PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, | ||||
|     UINT64 /*allocation_size*/, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
|   auto ret = static_cast<packet::error_type>( | ||||
| @@ -1320,7 +1410,9 @@ auto remote_server::winfsp_overwrite( | ||||
| auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
|                                 UINT32 length, PUINT32 bytes_transferred) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   *bytes_transferred = 0; | ||||
|  | ||||
| @@ -1346,7 +1438,9 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
| auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, | ||||
|                                           PWSTR marker, json &item_list) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   item_list.clear(); | ||||
|  | ||||
| @@ -1382,7 +1476,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, | ||||
| auto remote_server::winfsp_rename( | ||||
|     PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, | ||||
|     BOOLEAN replace_if_exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto relative_path = utils::string::to_utf8(file_name); | ||||
|   const auto file_path = construct_path(relative_path); | ||||
| @@ -1410,7 +1506,9 @@ auto remote_server::winfsp_set_basic_info( | ||||
|     PVOID file_desc, UINT32 attributes, UINT64 creation_time, | ||||
|     UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
|   auto ret = static_cast<packet::error_type>( | ||||
| @@ -1473,7 +1571,9 @@ auto remote_server::winfsp_set_basic_info( | ||||
| auto remote_server::winfsp_set_file_size( | ||||
|     PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
|   auto ret = static_cast<packet::error_type>( | ||||
| @@ -1499,7 +1599,9 @@ auto remote_server::winfsp_set_file_size( | ||||
|  | ||||
| auto remote_server::winfsp_unmounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_FUSE_SERVER_EVENT( | ||||
|       function_name, utils::string::to_utf8(location), STATUS_SUCCESS); | ||||
| @@ -1510,7 +1612,9 @@ auto remote_server::winfsp_write( | ||||
|     PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, | ||||
|     BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   *bytes_transferred = 0; | ||||
|   const auto handle = reinterpret_cast<remote::file_handle>(file_desc); | ||||
| @@ -1558,7 +1662,9 @@ auto remote_server::winfsp_write( | ||||
|  | ||||
| auto remote_server::json_create_directory_snapshot( | ||||
|     const std::string &path, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = utils::path::create_api_path(path); | ||||
|   const auto file_path = construct_path(api_path); | ||||
| @@ -1588,7 +1694,9 @@ auto remote_server::json_create_directory_snapshot( | ||||
| auto remote_server::json_read_directory_snapshot( | ||||
|     const std::string &path, const remote::file_handle &handle, | ||||
|     std::uint32_t page, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   int res{-EBADF}; | ||||
|  | ||||
| @@ -1618,7 +1726,9 @@ auto remote_server::json_read_directory_snapshot( | ||||
| auto remote_server::json_release_directory_snapshot( | ||||
|     const std::string &path, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   directory_cache_.remove_directory(handle); | ||||
|   | ||||
| @@ -55,7 +55,9 @@ remote_client::remote_client(const app_config &config) | ||||
|  | ||||
| auto remote_client::winfsp_can_delete(PVOID file_desc, | ||||
|                                       PWSTR file_name) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -71,7 +73,9 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, | ||||
|  | ||||
| auto remote_client::json_create_directory_snapshot( | ||||
|     const std::string &path, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -91,7 +95,9 @@ auto remote_client::json_create_directory_snapshot( | ||||
| auto remote_client::json_read_directory_snapshot( | ||||
|     const std::string &path, const remote::file_handle &handle, | ||||
|     std::uint32_t page, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -113,7 +119,9 @@ auto remote_client::json_read_directory_snapshot( | ||||
| auto remote_client::json_release_directory_snapshot( | ||||
|     const std::string &path, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(path); | ||||
| @@ -129,7 +137,9 @@ auto remote_client::json_release_directory_snapshot( | ||||
| auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, | ||||
|                                    UINT32 flags, | ||||
|                                    BOOLEAN &was_closed) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto handle = to_handle(file_desc); | ||||
|   const auto file_path = get_open_file_path(handle); | ||||
| @@ -153,7 +163,9 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, | ||||
| } | ||||
|  | ||||
| auto remote_client::winfsp_close(PVOID file_desc) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto handle = to_handle(file_desc); | ||||
|   if (has_open_info(handle, STATUS_INVALID_HANDLE) == STATUS_SUCCESS) { | ||||
| @@ -179,7 +191,9 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|                                   remote::file_info *file_info, | ||||
|                                   std::string &normalized_name, | ||||
|                                   BOOLEAN &exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_name); | ||||
| @@ -218,7 +232,9 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|  | ||||
| auto remote_client::winfsp_flush(PVOID file_desc, remote::file_info *file_info) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -247,7 +263,9 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc, | ||||
|  | ||||
| auto remote_client::winfsp_get_file_info( | ||||
|     PVOID file_desc, remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -266,7 +284,9 @@ auto remote_client::winfsp_get_file_info( | ||||
| auto remote_client::winfsp_get_security_by_name( | ||||
|     PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, | ||||
|     std::wstring &string_descriptor) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_name); | ||||
| @@ -297,7 +317,9 @@ auto remote_client::winfsp_get_security_by_name( | ||||
| auto remote_client::winfsp_get_volume_info( | ||||
|     UINT64 &total_size, UINT64 &free_size, | ||||
|     std::string &volume_label) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   packet response; | ||||
| @@ -313,7 +335,9 @@ auto remote_client::winfsp_get_volume_info( | ||||
|  | ||||
| auto remote_client::winfsp_mounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(std::string{project_get_version()}); | ||||
| @@ -332,7 +356,9 @@ auto remote_client::winfsp_open( | ||||
|     PWSTR file_name, UINT32 create_options, UINT32 granted_access, | ||||
|     PVOID *file_desc, remote::file_info *file_info, | ||||
|     std::string &normalized_name) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_name); | ||||
| @@ -366,7 +392,9 @@ auto remote_client::winfsp_overwrite( | ||||
|     PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, | ||||
|     UINT64 allocation_size, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -388,7 +416,9 @@ auto remote_client::winfsp_overwrite( | ||||
| auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
|                                 UINT32 length, PUINT32 bytes_transferred) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -421,7 +451,9 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
| auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern, | ||||
|                                           PWSTR marker, json &item_list) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -444,7 +476,9 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern, | ||||
| auto remote_client::winfsp_rename( | ||||
|     PVOID file_desc, PWSTR file_name, PWSTR new_file_name, | ||||
|     BOOLEAN replace_if_exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -466,7 +500,9 @@ auto remote_client::winfsp_set_basic_info( | ||||
|     PVOID file_desc, UINT32 attributes, UINT64 creation_time, | ||||
|     UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -490,7 +526,9 @@ auto remote_client::winfsp_set_basic_info( | ||||
| auto remote_client::winfsp_set_file_size( | ||||
|     PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
| @@ -510,7 +548,9 @@ auto remote_client::winfsp_set_file_size( | ||||
|  | ||||
| auto remote_client::winfsp_unmounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto mount_location = utils::string::to_utf8(location); | ||||
|   event_system::instance().raise<drive_unmount_pending>(mount_location); | ||||
| @@ -529,7 +569,9 @@ auto remote_client::winfsp_write( | ||||
|     PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, | ||||
|     BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   packet request; | ||||
|   request.encode(file_desc); | ||||
|   | ||||
| @@ -106,7 +106,9 @@ void remote_server::populate_stat(const char *path, bool directory, | ||||
| // FUSE Layer | ||||
| auto remote_server::fuse_access(const char *path, const std::int32_t &mask) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto windows_mask = utils::unix_access_mask_to_windows(mask); | ||||
| @@ -118,7 +120,9 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask) | ||||
|  | ||||
| auto remote_server::fuse_chflags(const char *path, std::uint32_t /*flags*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -129,7 +133,9 @@ auto remote_server::fuse_chflags(const char *path, std::uint32_t /*flags*/) | ||||
| auto remote_server::fuse_chmod(const char *path, | ||||
|                                const remote::file_mode & /*mode*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -140,7 +146,9 @@ auto remote_server::fuse_chmod(const char *path, | ||||
| auto remote_server::fuse_chown( | ||||
|     const char *path, const remote::user_id & /*uid*/, | ||||
|     const remote::group_id & /*gid*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -149,7 +157,9 @@ auto remote_server::fuse_chown( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_destroy() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, "", 0); | ||||
|   return 0; | ||||
| @@ -170,7 +180,9 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res | ||||
| auto remote_server::fuse_fgetattr( | ||||
|     const char *path, remote::stat &r_stat, bool &directory, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   memset(&r_stat, 0, sizeof(remote::stat)); | ||||
| @@ -193,7 +205,9 @@ auto remote_server::fuse_fgetattr( | ||||
| auto remote_server::fuse_fsetattr_x( | ||||
|     const char *path, const remote::setattr_x & /*attr*/, | ||||
|     const remote::file_handle & /*handle*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -204,7 +218,9 @@ auto remote_server::fuse_fsetattr_x( | ||||
| auto remote_server::fuse_fsync( | ||||
|     const char *path, const std::int32_t & /*datasync*/, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -231,7 +247,9 @@ auto remote_server::fuse_fsync( | ||||
| auto remote_server::fuse_ftruncate( | ||||
|     const char *path, const remote::file_offset &size, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -260,7 +278,9 @@ auto remote_server::fuse_ftruncate( | ||||
|  | ||||
| auto remote_server::fuse_getattr(const char *path, remote::stat &r_st, | ||||
|                                  bool &directory) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   memset(&r_st, 0, sizeof(remote::stat)); | ||||
| @@ -294,7 +314,9 @@ file_path, ret); return ret; | ||||
| auto remote_server::fuse_getxtimes( | ||||
|     const char *path, remote::file_time & /*bkuptime*/, | ||||
|     remote::file_time & /*crtime*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -303,7 +325,9 @@ auto remote_server::fuse_getxtimes( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_init() -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, "", 0); | ||||
|   return 0; | ||||
| @@ -319,7 +343,9 @@ construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| auto remote_server::fuse_mkdir(const char *path, | ||||
|                                const remote::file_mode & /*mode*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = _mkdir(file_path.c_str()); | ||||
| @@ -330,7 +356,9 @@ auto remote_server::fuse_mkdir(const char *path, | ||||
|  | ||||
| auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto unicode_file_path = utils::string::from_utf8(file_path); | ||||
| @@ -357,7 +385,9 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, | ||||
|                                 const remote::open_flags &flags, | ||||
|                                 remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = -1; | ||||
|  | ||||
| @@ -393,7 +423,9 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode, | ||||
| auto remote_server::fuse_open(const char *path, const remote::open_flags &flags, | ||||
|                               remote::file_handle &handle) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto res = -1; | ||||
| @@ -425,7 +457,9 @@ auto remote_server::fuse_read( | ||||
|     const char *path, char *buffer, const remote::file_size &read_size, | ||||
|     const remote::file_offset &read_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto &data = *reinterpret_cast<data_buffer *>(buffer); | ||||
| @@ -470,7 +504,9 @@ auto remote_server::fuse_read( | ||||
|  | ||||
| auto remote_server::fuse_rename(const char *from, | ||||
|                                 const char *to) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto from_path = utils::path::combine(mount_location_, {from}); | ||||
|   const auto to_path = utils::path::combine(mount_location_, {to}); | ||||
| @@ -486,7 +522,9 @@ auto remote_server::fuse_write( | ||||
|     const char *path, const char *buffer, const remote::file_size &write_size, | ||||
|     const remote::file_offset &write_offset, | ||||
|     const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   std::size_t bytes_written{}; | ||||
| @@ -534,7 +572,9 @@ auto remote_server::fuse_readdir(const char *path, | ||||
|                                  const remote::file_offset &offset, | ||||
|                                  const remote::file_handle &handle, | ||||
|                                  std::string &item_path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   auto res = 0; | ||||
| @@ -558,7 +598,9 @@ auto remote_server::fuse_readdir(const char *path, | ||||
|  | ||||
| auto remote_server::fuse_release( | ||||
|     const char *path, const remote::file_handle &handle) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -573,7 +615,9 @@ auto remote_server::fuse_release( | ||||
| auto remote_server::fuse_releasedir(const char *path, | ||||
|                                     const remote::file_handle & /*handle*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0); | ||||
| @@ -588,7 +632,9 @@ file_path, ret); return ret; | ||||
| }*/ | ||||
|  | ||||
| auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = _rmdir(file_path.c_str()); | ||||
| @@ -599,7 +645,9 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type { | ||||
|  | ||||
| auto remote_server::fuse_setattr_x( | ||||
|     const char *path, remote::setattr_x & /*attr*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -610,7 +658,9 @@ auto remote_server::fuse_setattr_x( | ||||
| auto remote_server::fuse_setbkuptime(const char *path, | ||||
|                                      const remote::file_time & /*bkuptime*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -621,7 +671,9 @@ auto remote_server::fuse_setbkuptime(const char *path, | ||||
| auto remote_server::fuse_setchgtime(const char *path, | ||||
|                                     const remote::file_time & /*chgtime*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -632,7 +684,9 @@ auto remote_server::fuse_setchgtime(const char *path, | ||||
| auto remote_server::fuse_setcrtime(const char *path, | ||||
|                                    const remote::file_time & /*crtime*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
| @@ -641,7 +695,9 @@ auto remote_server::fuse_setcrtime(const char *path, | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, volname, 0); | ||||
|   return 0; | ||||
| @@ -664,7 +720,9 @@ construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED; | ||||
|  | ||||
| auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
|                                 remote::statfs &r_stat) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -687,7 +745,9 @@ auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize, | ||||
| auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|                                   remote::statfs_x &r_stat) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -712,7 +772,9 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize, | ||||
|  | ||||
| auto remote_server::fuse_truncate( | ||||
|     const char *path, const remote::file_offset &size) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto unicode_file_path = utils::string::from_utf8(file_path); | ||||
| @@ -746,7 +808,9 @@ auto remote_server::fuse_truncate( | ||||
| } | ||||
|  | ||||
| auto remote_server::fuse_unlink(const char *path) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto res = _unlink(file_path.c_str()); | ||||
| @@ -758,7 +822,9 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type { | ||||
| auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, | ||||
|                                  std::uint64_t op0, | ||||
|                                  std::uint64_t op1) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   const auto unicode_file_path = utils::string::from_utf8(file_path); | ||||
| @@ -819,7 +885,9 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, | ||||
| // JSON Layer | ||||
| auto remote_server::json_create_directory_snapshot( | ||||
|     const std::string &path, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -848,7 +916,9 @@ auto remote_server::json_create_directory_snapshot( | ||||
| auto remote_server::json_read_directory_snapshot( | ||||
|     const std::string &path, const remote::file_handle &handle, | ||||
|     std::uint32_t page, json &json_data) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|  | ||||
| @@ -878,7 +948,9 @@ auto remote_server::json_read_directory_snapshot( | ||||
| auto remote_server::json_release_directory_snapshot( | ||||
|     const std::string &path, | ||||
|     const remote::file_handle & /*handle*/) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = construct_path(path); | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0); | ||||
| @@ -889,7 +961,9 @@ auto remote_server::json_release_directory_snapshot( | ||||
| // WinFSP Layer | ||||
| auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|  | ||||
| @@ -910,7 +984,9 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/) | ||||
| auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, | ||||
|                                    UINT32 flags, | ||||
|                                    BOOLEAN &was_closed) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = get_open_file_path(file_desc); | ||||
|   was_closed = FALSE; | ||||
| @@ -928,7 +1004,9 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, | ||||
| } | ||||
|  | ||||
| auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = get_open_file_path(file_desc); | ||||
|  | ||||
| @@ -948,7 +1026,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|                                   remote::file_info *file_info, | ||||
|                                   std::string &normalized_name, | ||||
|                                   BOOLEAN &exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = utils::string::from_utf8(utils::path::combine( | ||||
|       mount_location_, {utils::string::to_utf8(file_name)})); | ||||
| @@ -990,7 +1070,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options, | ||||
|  | ||||
| auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); | ||||
| @@ -1010,7 +1092,9 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info) | ||||
|  | ||||
| auto remote_server::winfsp_get_file_info( | ||||
|     PVOID file_desc, remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); | ||||
| @@ -1026,7 +1110,9 @@ auto remote_server::winfsp_get_file_info( | ||||
| auto remote_server::winfsp_get_security_by_name( | ||||
|     PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, | ||||
|     std::wstring &string_descriptor) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = utils::string::from_utf8(utils::path::combine( | ||||
|       mount_location_, {utils::string::to_utf8(file_name)})); | ||||
| @@ -1066,7 +1152,9 @@ auto remote_server::winfsp_get_security_by_name( | ||||
| auto remote_server::winfsp_get_volume_info( | ||||
|     UINT64 &total_size, UINT64 &free_size, | ||||
|     std::string &volume_label) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   drive_.get_volume_info(total_size, free_size, volume_label); | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, volume_label, STATUS_SUCCESS); | ||||
| @@ -1075,7 +1163,9 @@ auto remote_server::winfsp_get_volume_info( | ||||
|  | ||||
| auto remote_server::winfsp_mounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT( | ||||
|       function_name, utils::string::to_utf8(location), STATUS_SUCCESS); | ||||
| @@ -1086,7 +1176,9 @@ auto remote_server::winfsp_open( | ||||
|     PWSTR file_name, UINT32 create_options, UINT32 granted_access, | ||||
|     PVOID *file_desc, remote::file_info *file_info, | ||||
|     std::string &normalized_name) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto file_path = utils::string::from_utf8(utils::path::combine( | ||||
|       mount_location_, {utils::string::to_utf8(file_name)})); | ||||
| @@ -1121,7 +1213,9 @@ auto remote_server::winfsp_overwrite( | ||||
|     PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, | ||||
|     UINT64 /*allocation_size*/, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); | ||||
| @@ -1176,7 +1270,9 @@ auto remote_server::winfsp_overwrite( | ||||
| auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
|                                 UINT32 length, PUINT32 bytes_transferred) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   *bytes_transferred = 0U; | ||||
|  | ||||
| @@ -1204,7 +1300,9 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, | ||||
| auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, | ||||
|                                           PWSTR marker, json &item_list) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = STATUS_INVALID_HANDLE; | ||||
|   item_list.clear(); | ||||
| @@ -1234,7 +1332,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, | ||||
| auto remote_server::winfsp_rename( | ||||
|     PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, | ||||
|     BOOLEAN replace_if_exists) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto from_path = utils::string::from_utf8(utils::path::combine( | ||||
|       mount_location_, {utils::string::to_utf8(file_name)})); | ||||
| @@ -1256,7 +1356,9 @@ auto remote_server::winfsp_set_basic_info( | ||||
|     PVOID file_desc, UINT32 attributes, UINT64 creation_time, | ||||
|     UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); | ||||
| @@ -1288,7 +1390,9 @@ auto remote_server::winfsp_set_basic_info( | ||||
| auto remote_server::winfsp_set_file_size( | ||||
|     PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   auto ret = has_open_info(handle, STATUS_INVALID_HANDLE); | ||||
| @@ -1323,7 +1427,9 @@ auto remote_server::winfsp_set_file_size( | ||||
|  | ||||
| auto remote_server::winfsp_unmounted(const std::wstring &location) | ||||
|     -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   RAISE_REMOTE_WINFSP_SERVER_EVENT( | ||||
|       function_name, utils::string::to_utf8(location), STATUS_SUCCESS); | ||||
| @@ -1334,7 +1440,9 @@ auto remote_server::winfsp_write( | ||||
|     PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, | ||||
|     BOOLEAN /*write_to_end*/, BOOLEAN constrained_io, PUINT32 bytes_transferred, | ||||
|     remote::file_info *file_info) -> packet::error_type { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *handle = reinterpret_cast<HANDLE>(file_desc); | ||||
|   *bytes_transferred = 0U; | ||||
|   | ||||
| @@ -49,7 +49,9 @@ remote_winfsp_drive::winfsp_service::winfsp_service( | ||||
|       host_(drive) {} | ||||
|  | ||||
| auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto mount_location = utils::string::to_lower( | ||||
|       utils::path::absolute((drive_args_.size() > 1u) ? drive_args_[1u] : "")); | ||||
| @@ -85,7 +87,9 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS { | ||||
| } | ||||
|  | ||||
| auto remote_winfsp_drive::winfsp_service::OnStop() -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   host_.Unmount(); | ||||
|   if (not lock_.set_mount_state(false, "", -1)) { | ||||
| @@ -262,7 +266,9 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args) | ||||
| } | ||||
|  | ||||
| auto remote_winfsp_drive::Mounted(PVOID host) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *file_system_host = reinterpret_cast<FileSystemHost *>(host); | ||||
|   remote_instance_ = factory_(); | ||||
| @@ -452,7 +458,9 @@ auto remote_winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc, | ||||
| } | ||||
|  | ||||
| VOID remote_winfsp_drive::Unmounted(PVOID host) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   server_->stop(); | ||||
|   server_.reset(); | ||||
|   | ||||
| @@ -68,7 +68,9 @@ winfsp_drive::winfsp_service::winfsp_service( | ||||
|  | ||||
| auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, | ||||
|                                            PWSTR * /*Argv*/) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto mount_location = utils::string::to_lower( | ||||
|       utils::path::absolute((drive_args_.size() > 1U) ? drive_args_[1U] : "")); | ||||
| @@ -105,7 +107,9 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, | ||||
| } | ||||
|  | ||||
| auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   host_.Unmount(); | ||||
|  | ||||
| @@ -128,7 +132,9 @@ void winfsp_drive::shutdown() { ::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); } | ||||
|  | ||||
| auto winfsp_drive::CanDelete(PVOID /*file_node*/, PVOID file_desc, | ||||
|                              PWSTR /*file_name*/) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -156,7 +162,9 @@ auto winfsp_drive::CanDelete(PVOID /*file_node*/, PVOID file_desc, | ||||
|  | ||||
| VOID winfsp_drive::Cleanup(PVOID file_node, PVOID file_desc, | ||||
|                            PWSTR /*file_name*/, ULONG flags) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto handle = | ||||
| @@ -254,7 +262,9 @@ VOID winfsp_drive::Cleanup(PVOID file_node, PVOID file_desc, | ||||
| } | ||||
|  | ||||
| VOID winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto handle = | ||||
| @@ -281,7 +291,9 @@ auto winfsp_drive::Create(PWSTR file_name, UINT32 create_options, | ||||
|                           PSECURITY_DESCRIPTOR /*descriptor*/, | ||||
|                           UINT64 /*allocation_size*/, PVOID * /*file_node*/, | ||||
|                           PVOID *file_desc, OpenFileInfo *ofi) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   // TODO Need to revisit this | ||||
|   // (ConvertSecurityDescriptorToStringSecurityDescriptor/ConvertStringSecurityDescriptorToSecurityDescriptor) | ||||
| @@ -334,7 +346,9 @@ auto winfsp_drive::Create(PWSTR file_name, UINT32 create_options, | ||||
|  | ||||
| auto winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc, | ||||
|                          FileInfo *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::success; | ||||
| @@ -373,7 +387,9 @@ auto winfsp_drive::get_directory_item_count(const std::string &api_path) const | ||||
|  | ||||
| auto winfsp_drive::get_directory_items(const std::string &api_path) const | ||||
|     -> directory_item_list { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   directory_item_list list; | ||||
|   auto res = provider_.get_directory_items(api_path, list); | ||||
| @@ -386,7 +402,9 @@ auto winfsp_drive::get_directory_items(const std::string &api_path) const | ||||
|  | ||||
| auto winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc, | ||||
|                                FileInfo *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -411,7 +429,9 @@ auto winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc, | ||||
|  | ||||
| auto winfsp_drive::get_file_size(const std::string &api_path) const | ||||
|     -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint64_t file_size{}; | ||||
|   auto res = provider_.get_file_size(api_path, file_size); | ||||
| @@ -479,7 +499,9 @@ auto winfsp_drive::get_security_by_name( | ||||
| auto winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes, | ||||
|                                      PSECURITY_DESCRIPTOR descriptor, | ||||
|                                      SIZE_T *descriptor_size) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = | ||||
|       utils::path::create_api_path(utils::string::to_utf8(file_name)); | ||||
| @@ -515,7 +537,9 @@ void winfsp_drive::get_volume_info(UINT64 &total_size, UINT64 &free_size, | ||||
| } | ||||
|  | ||||
| auto winfsp_drive::GetVolumeInfo(VolumeInfo *volume_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const std::wstring volume_label = utils::string::from_utf8( | ||||
|       utils::create_volume_label(config_.get_provider_type())); | ||||
| @@ -591,7 +615,9 @@ auto winfsp_drive::mount(const std::vector<std::string> &drive_args) -> int { | ||||
| } | ||||
|  | ||||
| auto winfsp_drive::Mounted(PVOID host) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = STATUS_SUCCESS; | ||||
|   utils::file::change_to_process_directory(); | ||||
| @@ -653,7 +679,9 @@ auto winfsp_drive::Mounted(PVOID host) -> NTSTATUS { | ||||
| auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options, | ||||
|                         UINT32 granted_access, PVOID * /*file_node*/, | ||||
|                         PVOID *file_desc, OpenFileInfo *ofi) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = | ||||
|       utils::path::create_api_path(utils::string::to_utf8(file_name)); | ||||
| @@ -700,7 +728,9 @@ auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc, | ||||
|                              UINT32 attributes, BOOLEAN replace_attributes, | ||||
|                              UINT64 /*allocation_size*/, | ||||
|                              FileInfo *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -809,7 +839,9 @@ void winfsp_drive::populate_file_info(std::uint64_t file_size, | ||||
| auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer, | ||||
|                         UINT64 offset, ULONG length, | ||||
|                         PULONG bytes_transferred) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   *bytes_transferred = 0U; | ||||
|  | ||||
| @@ -861,7 +893,9 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc, | ||||
|                                  PWSTR /*pattern*/, PWSTR marker, PVOID buffer, | ||||
|                                  ULONG buffer_length, | ||||
|                                  PULONG bytes_transferred) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -961,7 +995,9 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc, | ||||
| auto winfsp_drive::Rename(PVOID /*file_node*/, PVOID /*file_desc*/, | ||||
|                           PWSTR file_name, PWSTR new_file_name, | ||||
|                           BOOLEAN replace_if_exists) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto from_api_path = | ||||
|       utils::path::create_api_path(utils::string::to_utf8(file_name)); | ||||
| @@ -993,7 +1029,9 @@ auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc, | ||||
|                                 UINT64 last_access_time, UINT64 last_write_time, | ||||
|                                 UINT64 change_time, | ||||
|                                 FileInfo *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -1065,7 +1103,9 @@ void winfsp_drive::set_file_info(remote::file_info &dest, | ||||
| auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc, | ||||
|                                UINT64 new_size, BOOLEAN set_allocation_size, | ||||
|                                FileInfo *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::string api_path; | ||||
|   auto error = api_error::invalid_handle; | ||||
| @@ -1120,7 +1160,9 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc, | ||||
| } | ||||
|  | ||||
| VOID winfsp_drive::Unmounted(PVOID host) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto *file_system_host = reinterpret_cast<FileSystemHost *>(host); | ||||
|   const auto mount_location = | ||||
| @@ -1152,7 +1194,9 @@ 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 *file_info) -> NTSTATUS { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   *bytes_transferred = 0; | ||||
|  | ||||
|   | ||||
| @@ -201,7 +201,9 @@ auto file_manager::create(const std::string &api_path, api_meta_map &meta, | ||||
| } | ||||
|  | ||||
| auto file_manager::evict_file(const std::string &api_path) -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (provider_.is_direct_only()) { | ||||
|     return false; | ||||
| @@ -252,7 +254,9 @@ auto file_manager::evict_file(const std::string &api_path) -> bool { | ||||
|  | ||||
| auto file_manager::get_directory_items(const std::string &api_path) const | ||||
|     -> directory_item_list { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   directory_item_list list{}; | ||||
|   auto res = provider_.get_directory_items(api_path, list); | ||||
| @@ -341,7 +345,9 @@ auto file_manager::get_open_handle_count() const -> std::size_t { | ||||
| } | ||||
|  | ||||
| auto file_manager::get_stored_downloads() const -> std::vector<json> { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::vector<json> ret; | ||||
|   if (not provider_.is_direct_only()) { | ||||
| @@ -525,7 +531,9 @@ void file_manager::queue_upload(const std::string &api_path, | ||||
| } | ||||
|  | ||||
| auto file_manager::remove_file(const std::string &api_path) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   recur_mutex_lock open_lock(open_file_mtx_); | ||||
|   auto file_iter = open_file_lookup_.find(api_path); | ||||
| @@ -698,7 +706,9 @@ auto file_manager::rename_directory(const std::string &from_api_path, | ||||
| auto file_manager::rename_file(const std::string &from_api_path, | ||||
|                                const std::string &to_api_path, | ||||
|                                bool overwrite) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (not provider_.is_rename_supported()) { | ||||
|     return api_error::not_implemented; | ||||
| @@ -799,7 +809,9 @@ auto file_manager::rename_file(const std::string &from_api_path, | ||||
| } | ||||
|  | ||||
| void file_manager::start() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   polling::instance().set_callback( | ||||
|       {"timed_out_close", polling::frequency::second, | ||||
| @@ -980,7 +992,9 @@ void file_manager::swap_renamed_items(std::string from_api_path, | ||||
| } | ||||
|  | ||||
| void file_manager::upload_completed(const file_upload_completed &evt) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   unique_mutex_lock upload_lock(upload_mtx_); | ||||
|  | ||||
| @@ -1034,7 +1048,9 @@ void file_manager::upload_completed(const file_upload_completed &evt) { | ||||
| } | ||||
|  | ||||
| void file_manager::upload_handler() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   while (not stop_requested_) { | ||||
|     auto should_wait{true}; | ||||
|   | ||||
| @@ -251,7 +251,9 @@ auto file_manager::open_file::native_operation( | ||||
| auto file_manager::open_file::native_operation( | ||||
|     std::uint64_t new_file_size, | ||||
|     i_open_file::native_operation_callback callback) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (fsi_.directory) { | ||||
|     return api_error::invalid_operation; | ||||
| @@ -426,7 +428,9 @@ auto file_manager::open_file::resize(std::uint64_t new_file_size) -> api_error { | ||||
| } | ||||
|  | ||||
| auto file_manager::open_file::close() -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (not fsi_.directory && not stop_requested_) { | ||||
|     stop_requested_ = true; | ||||
| @@ -540,7 +544,9 @@ void file_manager::open_file::update_background_reader(std::size_t read_chunk) { | ||||
| auto file_manager::open_file::write(std::uint64_t write_offset, | ||||
|                                     const data_buffer &data, | ||||
|                                     std::size_t &bytes_written) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   bytes_written = 0U; | ||||
|  | ||||
|   | ||||
| @@ -85,7 +85,9 @@ file_manager::ring_buffer_open_file::ring_buffer_open_file( | ||||
| } | ||||
|  | ||||
| file_manager::ring_buffer_open_file::~ring_buffer_open_file() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   close(); | ||||
|  | ||||
|   | ||||
| @@ -49,7 +49,9 @@ void file_manager::upload::cancel() { | ||||
| void file_manager::upload::stop() { stop_requested_ = true; } | ||||
|  | ||||
| void file_manager::upload::upload_thread() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   error_ = | ||||
|       provider_.upload_file(fsi_.api_path, fsi_.source_path, stop_requested_); | ||||
|   | ||||
| @@ -102,7 +102,9 @@ auto lock_data::get_state_directory() -> std::string { | ||||
| } | ||||
|  | ||||
| auto lock_data::grab_lock(std::uint8_t retry_count) -> lock_result { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (lock_fd_ == -1) { | ||||
|     return lock_result::failure; | ||||
| @@ -124,7 +126,9 @@ auto lock_data::grab_lock(std::uint8_t retry_count) -> lock_result { | ||||
|  | ||||
| auto lock_data::set_mount_state(bool active, const std::string &mount_location, | ||||
|                                 int pid) -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = false; | ||||
|   auto handle = | ||||
|   | ||||
| @@ -73,7 +73,9 @@ auto lock_data::get_mount_state(json &mount_state) -> bool { | ||||
| } | ||||
|  | ||||
| auto lock_data::grab_lock(std::uint8_t retry_count) -> lock_result { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto ret = lock_result::success; | ||||
|   if (mutex_handle_ == INVALID_HANDLE_VALUE) { | ||||
|   | ||||
| @@ -66,7 +66,9 @@ auto base_provider::create_api_file(std::string path, std::uint64_t size, | ||||
| auto base_provider::create_directory_clone_source_meta( | ||||
|     const std::string &source_api_path, | ||||
|     const std::string &api_path) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   bool exists{}; | ||||
|   auto res = is_file(source_api_path, exists); | ||||
| @@ -118,7 +120,9 @@ auto base_provider::create_directory_clone_source_meta( | ||||
|  | ||||
| auto base_provider::create_directory(const std::string &api_path, | ||||
|                                      api_meta_map &meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   bool exists{}; | ||||
|   auto res = is_directory(api_path, exists); | ||||
| @@ -164,7 +168,9 @@ auto base_provider::create_directory(const std::string &api_path, | ||||
|  | ||||
| auto base_provider::create_file(const std::string &api_path, | ||||
|                                 api_meta_map &meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   bool exists{}; | ||||
|   auto res = is_directory(api_path, exists); | ||||
| @@ -222,7 +228,9 @@ auto base_provider::create_file(const std::string &api_path, | ||||
|  | ||||
| auto base_provider::get_api_path_from_source( | ||||
|     const std::string &source_path, std::string &api_path) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (source_path.empty()) { | ||||
|     utils::error::raise_api_path_error(function_name, api_path, | ||||
| @@ -236,7 +244,9 @@ auto base_provider::get_api_path_from_source( | ||||
|  | ||||
| auto base_provider::get_directory_items( | ||||
|     const std::string &api_path, directory_item_list &list) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   bool exists{}; | ||||
|   auto res = is_directory(api_path, exists); | ||||
| @@ -397,7 +407,9 @@ auto base_provider::get_total_item_count() const -> std::uint64_t { | ||||
| } | ||||
|  | ||||
| auto base_provider::get_used_drive_space() const -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     auto used_space = get_used_drive_space_impl(); | ||||
| @@ -423,7 +435,9 @@ auto base_provider::is_file_writeable(const std::string &api_path) const | ||||
| } | ||||
|  | ||||
| void base_provider::remove_deleted_files() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   struct removed_item { | ||||
|     std::string api_path{}; | ||||
| @@ -655,7 +669,9 @@ void base_provider::stop() { | ||||
| auto base_provider::upload_file(const std::string &api_path, | ||||
|                                 const std::string &source_path, | ||||
|                                 stop_type &stop_requested) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   event_system::instance().raise<provider_upload_begin>(api_path, source_path); | ||||
|  | ||||
|   | ||||
| @@ -215,7 +215,9 @@ auto encrypt_provider::do_fs_operation( | ||||
|  | ||||
| auto encrypt_provider::get_api_path_from_source( | ||||
|     const std::string &source_path, std::string &api_path) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     auto result = db::db_select{*db_, file_table} | ||||
| @@ -255,7 +257,9 @@ auto encrypt_provider::get_api_path_from_source( | ||||
|  | ||||
| auto encrypt_provider::get_directory_item_count( | ||||
|     const std::string &api_path) const -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint64_t count{}; | ||||
|   auto res = do_fs_operation( | ||||
| @@ -284,7 +288,9 @@ auto encrypt_provider::get_directory_item_count( | ||||
|  | ||||
| auto encrypt_provider::get_directory_items( | ||||
|     const std::string &api_path, directory_item_list &list) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   return do_fs_operation( | ||||
|       api_path, true, | ||||
| @@ -420,7 +426,9 @@ auto encrypt_provider::get_file(const std::string &api_path, | ||||
| } | ||||
|  | ||||
| auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto cfg = config_.get_encrypt_config(); | ||||
|  | ||||
| @@ -445,7 +453,9 @@ auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error { | ||||
|  | ||||
| auto encrypt_provider::get_file_size( | ||||
|     const std::string &api_path, std::uint64_t &file_size) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     auto result = db::db_select{*db_, source_table} | ||||
| @@ -829,7 +839,9 @@ auto encrypt_provider::read_file_bytes(const std::string &api_path, | ||||
|                                        std::size_t size, std::uint64_t offset, | ||||
|                                        data_buffer &data, | ||||
|                                        stop_type &stop_requested) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto result = db::db_select{*db_, source_table} | ||||
|                     .column("source_path") | ||||
| @@ -1004,7 +1016,9 @@ void encrypt_provider::remove_deleted_files() { | ||||
|  | ||||
| auto encrypt_provider::start(api_item_added_callback /*api_item_added*/, | ||||
|                              i_file_manager * /*mgr*/) -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (not is_online()) { | ||||
|     return false; | ||||
|   | ||||
| @@ -31,7 +31,9 @@ | ||||
|  | ||||
| namespace repertory { | ||||
| meta_db::meta_db(const app_config &cfg) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto db_path = utils::path::combine(cfg.get_data_directory(), {"meta.db3"}); | ||||
|  | ||||
| @@ -103,7 +105,9 @@ auto meta_db::get_api_path_list() -> std::vector<std::string> { | ||||
|  | ||||
| auto meta_db::get_item_meta(const std::string &api_path, | ||||
|                             api_meta_map &meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto result = db::db_select{*db_, table_name} | ||||
|                     .column("*") | ||||
| @@ -141,7 +145,9 @@ auto meta_db::get_item_meta(const std::string &api_path, | ||||
|  | ||||
| auto meta_db::get_item_meta(const std::string &api_path, const std::string &key, | ||||
|                             std::string &value) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto result = db::db_select{*db_, table_name} | ||||
|                     .column("*") | ||||
| @@ -181,7 +187,9 @@ auto meta_db::get_item_meta(const std::string &api_path, const std::string &key, | ||||
| } | ||||
|  | ||||
| auto meta_db::get_pinned_files() const -> std::vector<std::string> { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::vector<std::string> ret{}; | ||||
|  | ||||
| @@ -205,7 +213,9 @@ auto meta_db::get_pinned_files() const -> std::vector<std::string> { | ||||
| } | ||||
|  | ||||
| auto meta_db::get_total_item_count() const -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   std::uint64_t ret{}; | ||||
|  | ||||
| @@ -227,7 +237,9 @@ auto meta_db::get_total_item_count() const -> std::uint64_t { | ||||
| } | ||||
|  | ||||
| void meta_db::remove_api_path(const std::string &api_path) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto result = db::db_select{*db_, table_name} | ||||
|                     .delete_query() | ||||
| @@ -285,7 +297,9 @@ auto meta_db::set_item_meta(const std::string &api_path, | ||||
|  | ||||
| auto meta_db::update_item_meta(const std::string &api_path, | ||||
|                                api_meta_map meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   auto directory = utils::string::to_bool(meta[META_DIRECTORY]); | ||||
|   auto pinned = utils::string::to_bool(meta[META_PINNED]); | ||||
|   | ||||
| @@ -62,7 +62,9 @@ auto s3_provider::add_if_not_found( | ||||
|  | ||||
| auto s3_provider::create_directory_impl(const std::string &api_path, | ||||
|                                         api_meta_map &meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto cfg = get_config().get_s3_config(); | ||||
|   const auto is_encrypted = not cfg.encryption_token.empty(); | ||||
| @@ -115,7 +117,9 @@ auto s3_provider::create_directory_impl(const std::string &api_path, | ||||
|  | ||||
| auto s3_provider::create_file_extra(const std::string &api_path, | ||||
|                                     api_meta_map &meta) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (not get_config().get_s3_config().encryption_token.empty()) { | ||||
|     std::string encrypted_file_path; | ||||
| @@ -199,7 +203,9 @@ auto s3_provider::decrypt_object_name(std::string &object_name) const | ||||
|  | ||||
| auto s3_provider::get_directory_item_count(const std::string &api_path) const | ||||
|     -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     const auto cfg = get_config().get_s3_config(); | ||||
| @@ -374,7 +380,9 @@ auto s3_provider::get_directory_items_impl( | ||||
|  | ||||
| auto s3_provider::get_file(const std::string &api_path, | ||||
|                            api_file &file) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     bool is_encrypted{}; | ||||
| @@ -468,7 +476,9 @@ auto s3_provider::get_file_list(api_file_list &list) const -> api_error { | ||||
| auto s3_provider::get_object_info( | ||||
|     bool directory, const std::string &api_path, bool &is_encrypted, | ||||
|     std::string &object_name, head_object_result &result) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     const auto cfg = get_config().get_s3_config(); | ||||
| @@ -576,7 +586,9 @@ auto s3_provider::get_used_drive_space_impl() const -> std::uint64_t { | ||||
|  | ||||
| auto s3_provider::is_directory(const std::string &api_path, | ||||
|                                bool &exists) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   exists = false; | ||||
|   if (api_path == "/") { | ||||
| @@ -604,7 +616,9 @@ auto s3_provider::is_directory(const std::string &api_path, | ||||
|  | ||||
| auto s3_provider::is_file(const std::string &api_path, | ||||
|                           bool &exists) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   exists = false; | ||||
|   if (api_path == "/") { | ||||
| @@ -637,7 +651,9 @@ auto s3_provider::is_online() const -> bool { | ||||
| auto s3_provider::read_file_bytes(const std::string &api_path, std::size_t size, | ||||
|                                   std::uint64_t offset, data_buffer &data, | ||||
|                                   stop_type &stop_requested) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     const auto cfg = get_config().get_s3_config(); | ||||
| @@ -739,7 +755,9 @@ auto s3_provider::read_file_bytes(const std::string &api_path, std::size_t size, | ||||
|  | ||||
| auto s3_provider::remove_directory_impl(const std::string &api_path) | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto cfg = get_config().get_s3_config(); | ||||
|   const auto is_encrypted = not cfg.encryption_token.empty(); | ||||
| @@ -781,7 +799,9 @@ auto s3_provider::remove_directory_impl(const std::string &api_path) | ||||
| } | ||||
|  | ||||
| auto s3_provider::remove_file_impl(const std::string &api_path) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto cfg = get_config().get_s3_config(); | ||||
|   const auto is_encrypted = not cfg.encryption_token.empty(); | ||||
|   | ||||
| @@ -38,10 +38,11 @@ namespace repertory { | ||||
| sia_provider::sia_provider(app_config &config, i_http_comm &comm) | ||||
|     : base_provider(config, comm) {} | ||||
|  | ||||
| auto sia_provider::create_directory_impl(const std::string &api_path, | ||||
|                                          api_meta_map & /* meta */) | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto sia_provider::create_directory_impl( | ||||
|     const std::string &api_path, api_meta_map & /* meta */) -> api_error { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_put_file put_file{}; | ||||
|   put_file.allow_timeout = true; | ||||
| @@ -67,7 +68,9 @@ auto sia_provider::create_directory_impl(const std::string &api_path, | ||||
|  | ||||
| auto sia_provider::get_directory_item_count(const std::string &api_path) const | ||||
|     -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     json object_list{}; | ||||
| @@ -103,10 +106,11 @@ auto sia_provider::get_directory_item_count(const std::string &api_path) const | ||||
|   return 0U; | ||||
| } | ||||
|  | ||||
| auto sia_provider::get_directory_items_impl(const std::string &api_path, | ||||
|                                             directory_item_list &list) const | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto sia_provider::get_directory_items_impl( | ||||
|     const std::string &api_path, directory_item_list &list) const -> api_error { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   json object_list{}; | ||||
|   if (not get_object_list(api_path, object_list)) { | ||||
| @@ -163,8 +167,8 @@ auto sia_provider::get_directory_items_impl(const std::string &api_path, | ||||
|   return api_error::success; | ||||
| } | ||||
|  | ||||
| auto sia_provider::get_file(const std::string &api_path, api_file &file) const | ||||
|     -> api_error { | ||||
| auto sia_provider::get_file(const std::string &api_path, | ||||
|                             api_file &file) const -> api_error { | ||||
|   json file_data{}; | ||||
|   auto res = get_object_info(api_path, file_data); | ||||
|   if (res != api_error::success) { | ||||
| @@ -191,7 +195,9 @@ auto sia_provider::get_file(const std::string &api_path, api_file &file) const | ||||
| } | ||||
|  | ||||
| auto sia_provider::get_file_list(api_file_list &list) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   using dir_func = std::function<api_error(std::string api_path)>; | ||||
|   const dir_func get_files_in_dir = [&](std::string api_path) -> api_error { | ||||
| @@ -255,7 +261,9 @@ auto sia_provider::get_file_list(api_file_list &list) const -> api_error { | ||||
|  | ||||
| auto sia_provider::get_object_info(const std::string &api_path, | ||||
|                                    json &object_info) const -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     curl::requests::http_get get{}; | ||||
| @@ -296,7 +304,9 @@ auto sia_provider::get_object_info(const std::string &api_path, | ||||
|  | ||||
| auto sia_provider::get_object_list(const std::string &api_path, | ||||
|                                    nlohmann::json &object_list) const -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_get get{}; | ||||
|   get.allow_timeout = true; | ||||
| @@ -328,7 +338,9 @@ auto sia_provider::get_object_list(const std::string &api_path, | ||||
| } | ||||
|  | ||||
| auto sia_provider::get_total_drive_space() const -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     curl::requests::http_get get{}; | ||||
| @@ -365,7 +377,9 @@ auto sia_provider::get_total_drive_space() const -> std::uint64_t { | ||||
| } | ||||
|  | ||||
| auto sia_provider::get_used_drive_space_impl() const -> std::uint64_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_get get{}; | ||||
|   get.allow_timeout = true; | ||||
| @@ -394,9 +408,11 @@ auto sia_provider::get_used_drive_space_impl() const -> std::uint64_t { | ||||
|   return object_data["totalObjectsSize"].get<std::uint64_t>(); | ||||
| } | ||||
|  | ||||
| auto sia_provider::is_directory(const std::string &api_path, bool &exists) const | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto sia_provider::is_directory(const std::string &api_path, | ||||
|                                 bool &exists) const -> api_error { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (api_path == "/") { | ||||
|     exists = true; | ||||
| @@ -427,9 +443,11 @@ auto sia_provider::is_directory(const std::string &api_path, bool &exists) const | ||||
|   return api_error::error; | ||||
| } | ||||
|  | ||||
| auto sia_provider::is_file(const std::string &api_path, bool &exists) const | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
| auto sia_provider::is_file(const std::string &api_path, | ||||
|                            bool &exists) const -> api_error { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   exists = false; | ||||
|   if (api_path == "/") { | ||||
| @@ -458,7 +476,9 @@ auto sia_provider::is_file(const std::string &api_path, bool &exists) const | ||||
| } | ||||
|  | ||||
| auto sia_provider::is_online() const -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   try { | ||||
|     curl::requests::http_get get{}; | ||||
| @@ -502,7 +522,9 @@ auto sia_provider::read_file_bytes(const std::string &api_path, | ||||
|                                    std::size_t size, std::uint64_t offset, | ||||
|                                    data_buffer &buffer, | ||||
|                                    stop_type &stop_requested) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_get get{}; | ||||
|   get.path = "/api/worker/objects" + api_path; | ||||
| @@ -554,7 +576,9 @@ auto sia_provider::read_file_bytes(const std::string &api_path, | ||||
|  | ||||
| auto sia_provider::remove_directory_impl(const std::string &api_path) | ||||
|     -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_delete del{}; | ||||
|   del.allow_timeout = true; | ||||
| @@ -579,7 +603,9 @@ auto sia_provider::remove_directory_impl(const std::string &api_path) | ||||
| } | ||||
|  | ||||
| auto sia_provider::remove_file_impl(const std::string &api_path) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_delete del{}; | ||||
|   del.allow_timeout = true; | ||||
| @@ -606,7 +632,9 @@ auto sia_provider::remove_file_impl(const std::string &api_path) -> api_error { | ||||
|  | ||||
| auto sia_provider::rename_file(const std::string &from_api_path, | ||||
|                                const std::string &to_api_path) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_post post{}; | ||||
|   post.path = "/api/bus/objects/rename"; | ||||
| @@ -651,7 +679,9 @@ void sia_provider::stop() { | ||||
| auto sia_provider::upload_file_impl(const std::string &api_path, | ||||
|                                     const std::string &source_path, | ||||
|                                     stop_type &stop_requested) -> api_error { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   curl::requests::http_put_file put_file{}; | ||||
|   put_file.path = "/api/worker/objects" + api_path; | ||||
|   | ||||
| @@ -89,7 +89,9 @@ void full_server::handle_get_pinned_files(const httplib::Request & /*req*/, | ||||
|  | ||||
| void full_server::handle_get_pinned_status(const httplib::Request &req, | ||||
|                                            httplib::Response &res) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = | ||||
|       utils::path::create_api_path(req.get_param_value("api_path")); | ||||
| @@ -113,7 +115,9 @@ void full_server::handle_get_pinned_status(const httplib::Request &req, | ||||
|  | ||||
| void full_server::handle_pin_file(const httplib::Request &req, | ||||
|                                   httplib::Response &res) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = | ||||
|       utils::path::create_api_path(req.get_param_value("api_path")); | ||||
| @@ -142,7 +146,9 @@ void full_server::handle_pin_file(const httplib::Request &req, | ||||
|  | ||||
| void full_server::handle_unpin_file(const httplib::Request &req, | ||||
|                                     httplib::Response &res) { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto api_path = | ||||
|       utils::path::create_api_path(req.get_param_value("api_path")); | ||||
|   | ||||
| @@ -29,7 +29,9 @@ namespace repertory { | ||||
| server::server(app_config &config) : config_(config) {} | ||||
|  | ||||
| auto server::check_authorization(const httplib::Request &req) -> bool { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   if (config_.get_api_auth().empty() || config_.get_api_user().empty()) { | ||||
|     utils::error::raise_error(function_name, | ||||
| @@ -120,7 +122,9 @@ void server::initialize(httplib::Server &inst) { | ||||
| } | ||||
|  | ||||
| void server::start() { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   mutex_lock lock(start_stop_mutex_); | ||||
|   if (not started_) { | ||||
|   | ||||
| @@ -344,7 +344,9 @@ auto encrypting_reader::create_iostream() const | ||||
|  | ||||
| auto encrypting_reader::reader_function(char *buffer, size_t size, | ||||
|                                         size_t nitems) -> size_t { | ||||
|   constexpr const auto *function_name = static_cast<const char *>(__FUNCTION__); | ||||
|   static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   const auto read_size = static_cast<std::size_t>(std::min( | ||||
|       static_cast<std::uint64_t>(size * nitems), total_size_ - read_offset_)); | ||||
|   | ||||
							
								
								
									
										8
									
								
								support/3rd_party/src/utils/file.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								support/3rd_party/src/utils/file.cpp
									
									
									
									
										vendored
									
									
								
							| @@ -89,7 +89,7 @@ auto file::move_to(std::filesystem::path new_path) -> bool { | ||||
|  | ||||
| auto file::read(unsigned char *data, std::size_t to_read, std::uint64_t offset, | ||||
|                 std::size_t *total_read) -> bool { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|   static static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
| @@ -148,7 +148,7 @@ auto file::truncate(std::size_t size) -> bool { | ||||
| auto file::write(const typename data_buffer::value_type *data, | ||||
|                  std::size_t to_write, std::size_t offset, | ||||
|                  std::size_t *total_written) -> bool { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|   static static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
| @@ -249,7 +249,7 @@ auto read_json_file(std::string_view path, nlohmann::json &data, | ||||
| #else  // !defined(PROJECT_ENABLE_LIBSODIUM) | ||||
| auto read_json_file(std::string_view path, nlohmann::json &data) -> bool { | ||||
| #endif // defined(PROJECT_ENABLE_LIBSODIUM) | ||||
|   static constexpr const std::string_view function_name{ | ||||
|   static static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
| @@ -305,7 +305,7 @@ auto write_json_file(std::string_view path, const nlohmann::json &data, | ||||
| auto write_json_file(std::string_view path, | ||||
|                      const nlohmann::json &data) -> bool { | ||||
| #endif // defined(PROJECT_ENABLE_LIBSODIUM) | ||||
|   static constexpr const std::string_view function_name{ | ||||
|   static static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								support/3rd_party/src/utils/unix.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								support/3rd_party/src/utils/unix.cpp
									
									
									
									
										vendored
									
									
								
							| @@ -56,7 +56,7 @@ auto is_uid_member_of_group(const uid_t &uid, const gid_t &gid) -> bool { | ||||
| } | ||||
|  | ||||
| auto use_getpwuid(uid_t uid, passwd_callback_t callback) -> result { | ||||
|   static constexpr const std::string_view function_name{ | ||||
|   static static constexpr const std::string_view function_name{ | ||||
|       static_cast<const char *>(__FUNCTION__), | ||||
|   }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user