updated build system

This commit is contained in:
Scott E. Graves 2024-10-17 11:18:08 -05:00
parent 0bd7070ec5
commit d192904f8c
42 changed files with 975 additions and 1670 deletions

View File

@ -357,9 +357,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (name == "ApiAuth") {
@ -516,9 +514,7 @@ auto app_config::get_value_by_name(const std::string &name) -> std::string {
}
auto app_config::load() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret{false};
@ -684,9 +680,7 @@ auto app_config::load() -> bool {
}
void app_config::save() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = get_config_file_path();
recur_mutex_lock lock(read_write_mutex_);
@ -733,9 +727,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (name == "ApiAuth") {

View File

@ -41,9 +41,7 @@ void client_pool::pool::execute(
}
client_pool::pool::pool(std::uint8_t pool_size) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_started>("client_pool");

View File

@ -219,9 +219,7 @@ auto packet::decode(remote::file_info &val) -> packet::error_type {
}
auto packet::decode_json(packet &response, json &json_data) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string data;
auto ret = response.decode(data);
@ -239,9 +237,7 @@ auto packet::decode_json(packet &response, json &json_data) -> int {
}
auto packet::decrypt(std::string_view token) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = utils::from_api_error(api_error::success);
try {
@ -523,9 +519,7 @@ void packet::encode_top(remote::file_info val) {
}
void packet::encrypt(std::string_view token) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
data_buffer result;

View File

@ -76,9 +76,7 @@ void packet_client::close_all() {
}
void packet_client::connect(client &cli) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
resolve();
@ -122,8 +120,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
}
}
auto packet_client::read_packet(client &cli,
packet &response) -> packet::error_type {
auto packet_client::read_packet(client &cli, packet &response)
-> packet::error_type {
data_buffer buffer(sizeof(std::uint32_t));
const auto read_buffer = [&]() {
std::uint32_t offset{};
@ -161,8 +159,8 @@ void packet_client::resolve() {
}
}
auto packet_client::send(std::string_view method,
std::uint32_t &service_flags) -> packet::error_type {
auto packet_client::send(std::string_view method, std::uint32_t &service_flags)
-> packet::error_type {
packet request;
return send(method, request, service_flags);
}
@ -174,11 +172,9 @@ auto packet_client::send(std::string_view method, packet &request,
}
auto packet_client::send(std::string_view method, packet &request,
packet &response,
std::uint32_t &service_flags) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
packet &response, std::uint32_t &service_flags)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
auto success = false;
packet::error_type ret = utils::from_api_error(api_error::error);

View File

@ -66,9 +66,7 @@ void packet_server::add_client(connection &conn, const std::string &client_id) {
}
void packet_server::initialize(const uint16_t &port, uint8_t pool_size) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
pool_size = std::max(uint8_t(1U), pool_size);
server_thread_ = std::make_unique<std::thread>([this, port, pool_size]() {
@ -105,9 +103,7 @@ void packet_server::listen_for_connection(tcp::acceptor &acceptor) {
void packet_server::on_accept(std::shared_ptr<connection> conn,
boost::system::error_code err) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
listen_for_connection(conn->acceptor);
if (err) {
@ -125,9 +121,7 @@ void packet_server::on_accept(std::shared_ptr<connection> conn,
}
void packet_server::read_header(std::shared_ptr<connection> conn) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
conn->buffer.resize(sizeof(std::uint32_t));
boost::asio::async_read(
@ -148,9 +142,7 @@ 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) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
const auto read_buffer = [&]() {
@ -246,9 +238,7 @@ void packet_server::remove_client(connection &conn) {
void packet_server::send_response(std::shared_ptr<connection> conn,
const packet::error_type &result,
packet &response) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
response.encode_top(result);
response.encode_top(PACKET_SERVICE_FLAGS);

View File

@ -26,17 +26,17 @@
namespace repertory {
#if !defined(_WIN32)
auto directory_iterator::fill_buffer(
const remote::file_offset &offset, fuse_fill_dir_t filler_function,
void *buffer, populate_stat_callback populate_stat) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto directory_iterator::fill_buffer(const remote::file_offset &offset,
fuse_fill_dir_t filler_function,
void *buffer,
populate_stat_callback populate_stat)
-> int {
REPERTORY_USES_FUNCTION_NAME();
if (offset < items_.size()) {
try {
std::string item_name;
struct stat st {};
struct stat st{};
struct stat *pst = nullptr;
switch (offset) {
case 0: {

View File

@ -34,9 +34,7 @@
namespace repertory {
auto eviction::check_minimum_requirements(const std::string &file_path)
-> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto opt_size = utils::file::file{file_path}.size();
if (not opt_size.has_value()) {
@ -77,9 +75,7 @@ auto eviction::get_filtered_cached_files() -> std::deque<std::string> {
}
void eviction::service_function() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto should_evict = true;

View File

@ -101,9 +101,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -113,9 +111,7 @@ auto fuse_base::access_(const char *path, int mask) -> int {
#if defined(__APPLE__)
auto fuse_base::chflags_(const char *path, uint32_t flags) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -125,11 +121,9 @@ auto fuse_base::chflags_(const char *path, uint32_t flags) -> int {
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto fuse_base::chmod_(const char *path, mode_t mode,
struct fuse_file_info *fi) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::chmod_(const char *path, mode_t mode, struct fuse_file_info *fi)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -138,9 +132,7 @@ auto fuse_base::chmod_(const char *path, mode_t mode,
}
#else
auto fuse_base::chmod_(const char *path, mode_t mode) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -152,9 +144,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -163,9 +153,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -176,9 +164,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -187,9 +173,7 @@ auto fuse_base::create_(const char *path, mode_t mode,
}
void fuse_base::destroy_(void *ptr) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
execute_void_callback(function_name, [&]() { instance().destroy_impl(ptr); });
}
@ -205,7 +189,7 @@ void fuse_base::display_options(
#if FUSE_USE_VERSION >= 30
fuse_cmdline_help();
#else
struct fuse_operations fuse_ops {};
struct fuse_operations fuse_ops{};
fuse_main(args.size(),
reinterpret_cast<char **>(const_cast<char **>(args.data())),
&fuse_ops, nullptr);
@ -215,7 +199,7 @@ void fuse_base::display_options(
}
void fuse_base::display_version_information(std::vector<const char *> args) {
struct fuse_operations fuse_ops {};
struct fuse_operations fuse_ops{};
fuse_main(static_cast<int>(args.size()),
reinterpret_cast<char **>(const_cast<char **>(args.data())),
&fuse_ops, nullptr);
@ -264,9 +248,7 @@ auto fuse_base::execute_void_pointer_callback(std::string_view function_name,
auto fuse_base::fallocate_(const char *path, int mode, off_t offset,
off_t length, struct fuse_file_info *fi) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -278,9 +260,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -292,9 +272,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -305,9 +283,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -318,9 +294,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -332,9 +306,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -343,9 +315,7 @@ auto fuse_base::getattr_(const char *path, struct stat *st,
}
#else
auto fuse_base::getattr_(const char *path, struct stat *st) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -357,9 +327,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -369,11 +337,9 @@ auto fuse_base::getxtimes_(const char *path, struct timespec *bkuptime,
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto fuse_base::init_(struct fuse_conn_info *conn,
struct fuse_config *cfg) -> void * {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::init_(struct fuse_conn_info *conn, struct fuse_config *cfg)
-> void * {
REPERTORY_USES_FUNCTION_NAME();
return execute_void_pointer_callback(function_name, [&]() -> void * {
return instance().init_impl(conn, cfg);
@ -381,9 +347,7 @@ auto fuse_base::init_(struct fuse_conn_info *conn,
}
#else
auto fuse_base::init_(struct fuse_conn_info *conn) -> void * {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return execute_void_pointer_callback(
function_name, [&]() -> void * { return instance().init_impl(conn); });
@ -396,9 +360,7 @@ auto fuse_base::init_impl([[maybe_unused]] struct fuse_conn_info *conn,
#else // FUSE_USE_VERSION < 30
auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * {
#endif // FUSE_USE_VERSION >= 30
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
#if defined(__APPLE__)
conn->want |= FUSE_CAP_VOL_RENAME;
@ -426,9 +388,7 @@ auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * {
}
auto fuse_base::mkdir_(const char *path, mode_t mode) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -451,7 +411,7 @@ auto fuse_base::mount(std::vector<std::string> args) -> int {
char *mount_location{nullptr};
#if FUSE_USE_VERSION >= 30
struct fuse_cmdline_opts opts {};
struct fuse_cmdline_opts opts{};
fuse_parse_cmdline(&fa, &opts);
mount_location = opts.mountpoint;
#else
@ -485,9 +445,7 @@ auto fuse_base::mount(std::vector<std::string> args) -> int {
}
auto fuse_base::open_(const char *path, struct fuse_file_info *fi) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -496,9 +454,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -508,9 +464,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::size_t bytes_read{};
const auto res = instance().execute_callback(
@ -526,11 +480,9 @@ auto fuse_base::read_(const char *path, char *buffer, size_t read_size,
#if FUSE_USE_VERSION >= 30
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
struct fuse_file_info *fi, fuse_readdir_flags flags)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -542,9 +494,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -555,9 +505,7 @@ auto fuse_base::readdir_(const char *path, void *buf,
#endif
auto fuse_base::release_(const char *path, struct fuse_file_info *fi) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -565,11 +513,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::releasedir_(const char *path, struct fuse_file_info *fi)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -578,11 +524,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::rename_(const char *from, const char *to, unsigned int flags)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, from, to,
@ -593,9 +537,7 @@ auto fuse_base::rename_(const char *from, const char *to,
}
#else
auto fuse_base::rename_(const char *from, const char *to) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, from, to,
@ -607,9 +549,7 @@ auto fuse_base::rename_(const char *from, const char *to) -> int {
#endif
auto fuse_base::rmdir_(const char *path) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -621,9 +561,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
int attribute_size = 0;
const auto res = instance().execute_callback(
@ -637,9 +575,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
int attribute_size = 0;
const auto res = instance().execute_callback(
@ -653,9 +589,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
int required_size = 0;
bool return_size = false;
@ -775,9 +709,7 @@ void fuse_base::raise_fuse_event(std::string_view function_name,
}
auto fuse_base::removexattr_(const char *path, const char *name) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -788,9 +720,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto res = instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -806,9 +736,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto res = instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -832,9 +760,7 @@ void fuse_base::shutdown() {
#if defined(__APPLE__)
auto fuse_base::setattr_x_(const char *path, struct setattr_x *attr) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -842,11 +768,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::setbkuptime_(const char *path, const struct timespec *bkuptime)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -854,11 +778,9 @@ auto fuse_base::setbkuptime_(const char *path,
});
}
auto fuse_base::setchgtime_(const char *path,
const struct timespec *chgtime) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::setchgtime_(const char *path, const struct timespec *chgtime)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -866,11 +788,9 @@ auto fuse_base::setchgtime_(const char *path,
});
}
auto fuse_base::setcrtime_(const char *path,
const struct timespec *crtime) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto fuse_base::setcrtime_(const char *path, const struct timespec *crtime)
-> int {
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -879,9 +799,7 @@ auto fuse_base::setcrtime_(const char *path,
}
auto fuse_base::setvolname_(const char *volname) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, volname, [&](std::string api_path) -> api_error {
@ -890,9 +808,7 @@ auto fuse_base::setvolname_(const char *volname) -> int {
}
auto fuse_base::statfs_x_(const char *path, struct statfs *stbuf) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -901,9 +817,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -915,9 +829,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -926,9 +838,7 @@ auto fuse_base::truncate_(const char *path, off_t size,
}
#else
auto fuse_base::truncate_(const char *path, off_t size) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -938,9 +848,7 @@ auto fuse_base::truncate_(const char *path, off_t size) -> int {
#endif
auto fuse_base::unlink_(const char *path) -> int {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -965,9 +873,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -976,9 +882,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback(
function_name, path, [&](std::string api_path) -> api_error {
@ -989,9 +893,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::size_t bytes_written{};

View File

@ -76,8 +76,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::chown_impl(std::string api_path, uid_t uid,
gid_t gid) -> api_error {
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
-> api_error {
#endif
return check_and_perform(api_path, X_OK,
[&](api_meta_map &meta) -> api_error {
@ -206,9 +206,7 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode,
}
void fuse_drive::destroy_impl(void *ptr) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_unmount_pending>(get_mount_location());
@ -394,9 +392,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
directory_item_list list{};
auto res = provider_.get_directory_items(api_path, list);
@ -410,9 +406,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint64_t file_size{};
auto res = provider_.get_file_size(api_path, file_size);
@ -446,8 +440,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *st,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::getattr_impl(std::string api_path,
struct stat *st) -> api_error {
auto fuse_drive::getattr_impl(std::string api_path, struct stat *st)
-> api_error {
#endif
const auto parent = utils::path::get_parent_api_path(api_path);
@ -529,14 +523,12 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto fuse_drive::init_impl(struct fuse_conn_info *conn,
struct fuse_config *cfg) -> void * {
auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
-> void * {
#else
void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
#endif
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
#if FUSE_USE_VERSION >= 30
auto *ret = fuse_drive_base::init_impl(conn, cfg);
@ -605,9 +597,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto res = check_parent_access(api_path, W_OK | X_OK);
if (res != api_error::success) {
@ -759,8 +749,9 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
return api_error::success;
}
auto fuse_drive::releasedir_impl(
std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error {
auto fuse_drive::releasedir_impl(std::string /*api_path*/,
struct fuse_file_info *file_info)
-> api_error {
auto iter = directory_cache_->get_directory(file_info->fh);
if (iter == nullptr) {
return api_error::invalid_handle;
@ -778,8 +769,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
}
auto fuse_drive::rename_file(const std::string &from_api_path,
const std::string &to_api_path,
bool overwrite) -> int {
const std::string &to_api_path, bool overwrite)
-> int {
const auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
errno = std::abs(utils::from_api_error(res));
return (res == api_error::success) ? 0 : -1;
@ -789,8 +780,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
unsigned int /*flags*/) -> api_error {
#else
auto fuse_drive::rename_impl(std::string from_api_path,
std::string to_api_path) -> api_error {
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path)
-> api_error {
#endif
auto res = check_parent_access(to_api_path, W_OK | X_OK);
if (res != api_error::success) {
@ -897,15 +888,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
}
#else // __APPLE__
auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
char *value, size_t size,
int &attribute_size) -> api_error {
char *value, size_t size, int &attribute_size)
-> api_error {
return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
}
#endif // __APPLE__
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
int &required_size,
bool &return_size) -> api_error {
int &required_size, bool &return_size)
-> api_error {
const auto check_size = (size == 0);
auto res = check_parent_access(api_path, X_OK);
@ -944,8 +935,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
return res;
}
auto fuse_drive::removexattr_impl(std::string api_path,
const char *name) -> api_error {
auto fuse_drive::removexattr_impl(std::string api_path, const char *name)
-> api_error {
std::string attribute_name;
#if defined(__APPLE__)
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
@ -973,8 +964,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
uint32_t position) -> api_error {
#else // __APPLE__
auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size,
int flags) -> api_error {
const char *value, size_t size, int flags)
-> api_error {
#endif
std::string attribute_name;
#if defined(__APPLE__)
@ -1039,9 +1030,7 @@ 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) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto res = provider_.set_item_meta(api_path, key, value);
if (res != api_error::success) {
@ -1051,8 +1040,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
}
#if defined(__APPLE__)
auto fuse_drive::setattr_x_impl(std::string api_path,
struct setattr_x *attr) -> api_error {
auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
-> api_error {
bool exists{};
auto res = provider_.is_file(api_path, exists);
if (res != api_error::success) {
@ -1106,7 +1095,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
ts[0].tv_sec = attr->acctime.tv_sec;
ts[0].tv_nsec = attr->acctime.tv_nsec;
} else {
struct timeval tv {};
struct timeval tv{};
gettimeofday(&tv, NULL);
ts[0].tv_sec = tv.tv_sec;
ts[0].tv_nsec = tv.tv_usec * 1000;
@ -1151,8 +1140,9 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
return api_error::success;
}
auto fuse_drive::setbkuptime_impl(
std::string api_path, const struct timespec *bkuptime) -> api_error {
auto fuse_drive::setbkuptime_impl(std::string api_path,
const struct timespec *bkuptime)
-> api_error {
return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
const auto nanos = bkuptime->tv_nsec +
@ -1188,8 +1178,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
return api_error::success;
}
auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
struct statfs *stbuf) -> api_error {
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
-> api_error {
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
return api_error::os_error;
}
@ -1214,8 +1204,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
return api_error::success;
}
#else // __APPLE__
auto fuse_drive::statfs_impl(std::string /*api_path*/,
struct statvfs *stbuf) -> api_error {
auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf)
-> api_error {
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
return api_error::os_error;
}
@ -1296,8 +1286,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::utimens_impl(std::string api_path,
const struct timespec tv[2]) -> api_error {
auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2])
-> api_error {
#endif
api_meta_map meta;
auto res = provider_.get_item_meta(api_path, meta);
@ -1368,9 +1358,7 @@ auto fuse_drive::write_impl(std::string /*api_path*/
}
void fuse_drive::update_accessed_time(const std::string &api_path) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (atime_enabled_) {
auto res = provider_.set_item_meta(

View File

@ -36,9 +36,7 @@ remote_client::remote_client(const app_config &config)
auto remote_client::fuse_access(const char *path, const std::int32_t &mask)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -48,11 +46,9 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_chflags(const char *path, std::uint32_t flags)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -64,9 +60,7 @@ auto remote_client::fuse_chflags(const char *path,
auto remote_client::fuse_chmod(const char *path, const remote::file_mode &mode)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -79,9 +73,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -93,9 +85,7 @@ auto remote_client::fuse_chown(const char *path, const remote::user_id &uid,
}
auto remote_client::fuse_destroy() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint32_t service_flags{};
return packet_client_.send(function_name, service_flags);
@ -114,12 +104,11 @@ 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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -143,12 +132,11 @@ auto remote_client::fuse_fgetattr(
return ret;
}
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__),
};
auto remote_client::fuse_fsetattr_x(const char *path,
const remote::setattr_x &attr,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -162,9 +150,7 @@ auto remote_client::fuse_fsetattr_x(
auto remote_client::fuse_fsync(const char *path, const std::int32_t &datasync,
const remote::file_handle &handle)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -175,12 +161,11 @@ 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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -193,9 +178,7 @@ auto remote_client::fuse_ftruncate(
auto remote_client::fuse_getattr(const char *path, remote::stat &st,
bool &directory) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -262,12 +245,11 @@ 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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -285,9 +267,7 @@ auto remote_client::fuse_getxtimes(
}
auto remote_client::fuse_init() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint32_t service_flags{};
return packet_client_.send(function_name, service_flags);
@ -316,9 +296,7 @@ static_cast<std::size_t>(size2));
auto remote_client::fuse_mkdir(const char *path, const remote::file_mode &mode)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -330,9 +308,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -352,9 +328,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -375,9 +349,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -394,13 +366,12 @@ 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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -419,11 +390,9 @@ auto remote_client::fuse_read(
return ret;
}
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__),
};
auto remote_client::fuse_rename(const char *from, const char *to)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(from);
@ -433,13 +402,12 @@ auto remote_client::fuse_rename(const char *from,
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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
if (write_size > std::numeric_limits<std::size_t>::max()) {
return -ERANGE;
@ -456,13 +424,12 @@ auto remote_client::fuse_write(
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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
if (write_size > std::numeric_limits<std::size_t>::max()) {
return -ERANGE;
@ -483,9 +450,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -503,11 +468,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_release(const char *path,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -517,11 +481,10 @@ auto remote_client::fuse_release(
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_releasedir(const char *path,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -540,9 +503,7 @@ request.Encode(name);
}*/
auto remote_client::fuse_rmdir(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -553,9 +514,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -565,11 +524,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_setbkuptime(const char *path,
const remote::file_time &bkuptime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -579,11 +537,10 @@ auto remote_client::fuse_setbkuptime(
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_setchgtime(const char *path,
const remote::file_time &chgtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -593,11 +550,10 @@ auto remote_client::fuse_setchgtime(
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_setcrtime(const char *path,
const remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -608,9 +564,7 @@ auto remote_client::fuse_setcrtime(
}
auto remote_client::fuse_setvolname(const char *volname) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(volname);
@ -651,9 +605,7 @@ request.encode(flags); request.encode(position);
auto remote_client::fuse_statfs(const char *path, std::uint64_t frsize,
remote::statfs &st) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -672,9 +624,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -691,11 +641,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::fuse_truncate(const char *path,
const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -706,9 +655,7 @@ auto remote_client::fuse_truncate(
}
auto remote_client::fuse_unlink(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -718,11 +665,9 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::uint64_t op0, std::uint64_t op1)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -734,11 +679,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::json_create_directory_snapshot(const std::string &path,
json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -757,9 +701,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -778,11 +720,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
const std::string &path, const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);

View File

@ -40,8 +40,8 @@
#include "utils/utils.hpp"
namespace repertory::remote_fuse {
auto remote_fuse_drive::access_impl(std::string api_path,
int mask) -> api_error {
auto remote_fuse_drive::access_impl(std::string api_path, int mask)
-> api_error {
return utils::to_api_error(
remote_instance_->fuse_access(api_path.c_str(), mask));
}
@ -59,8 +59,8 @@ auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode,
struct fuse_file_info * /*f_info*/)
-> api_error {
#else
auto remote_fuse_drive::chmod_impl(std::string api_path,
mode_t mode) -> api_error {
auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode)
-> api_error {
#endif
return utils::to_api_error(remote_instance_->fuse_chmod(
api_path.c_str(), static_cast<remote::file_mode>(mode)));
@ -71,8 +71,8 @@ auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*f_info*/)
-> api_error {
#else
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid,
gid_t gid) -> api_error {
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
-> api_error {
#endif
return utils::to_api_error(
remote_instance_->fuse_chown(api_path.c_str(), uid, gid));
@ -88,9 +88,7 @@ auto remote_fuse_drive::create_impl(std::string api_path, mode_t mode,
}
void remote_fuse_drive::destroy_impl(void *ptr) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_unmount_pending>(get_mount_location());
@ -118,9 +116,10 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
fuse_base::destroy_impl(ptr);
}
auto remote_fuse_drive::fgetattr_impl(
std::string api_path, struct stat *unix_st,
struct fuse_file_info *f_info) -> api_error {
auto remote_fuse_drive::fgetattr_impl(std::string api_path,
struct stat *unix_st,
struct fuse_file_info *f_info)
-> api_error {
remote::stat r_stat{};
auto directory = false;
@ -181,8 +180,8 @@ auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info * /*f_info*/)
-> api_error {
#else
auto remote_fuse_drive::getattr_impl(std::string api_path,
struct stat *unix_st) -> api_error {
auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
-> api_error {
#endif
bool directory = false;
remote::stat r_stat{};
@ -227,9 +226,7 @@ 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
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
#if FUSE_USE_VERSION >= 30
auto *ret = fuse_base::init_impl(conn, cfg);
@ -267,8 +264,8 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
return ret;
}
auto remote_fuse_drive::mkdir_impl(std::string api_path,
mode_t mode) -> api_error {
auto remote_fuse_drive::mkdir_impl(std::string api_path, mode_t mode)
-> api_error {
return utils::to_api_error(remote_instance_->fuse_mkdir(
api_path.c_str(), static_cast<remote::file_mode>(mode)));
}
@ -290,8 +287,9 @@ auto remote_fuse_drive::open_impl(std::string api_path,
f_info->fh));
}
auto remote_fuse_drive::opendir_impl(
std::string api_path, struct fuse_file_info *f_info) -> api_error {
auto remote_fuse_drive::opendir_impl(std::string api_path,
struct fuse_file_info *f_info)
-> api_error {
return utils::to_api_error(
remote_instance_->fuse_opendir(api_path.c_str(), f_info->fh));
@ -380,14 +378,18 @@ auto remote_fuse_drive::read_impl(std::string api_path, char *buffer,
}
#if FUSE_USE_VERSION >= 30
auto remote_fuse_drive::readdir_impl(
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
off_t offset, struct fuse_file_info *f_info,
fuse_readdir_flags /*flags*/) -> api_error {
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
fuse_fill_dir_t fuse_fill_dir,
off_t offset,
struct fuse_file_info *f_info,
fuse_readdir_flags /*flags*/)
-> api_error {
#else
auto remote_fuse_drive::readdir_impl(
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
off_t offset, struct fuse_file_info *f_info) -> api_error {
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
fuse_fill_dir_t fuse_fill_dir,
off_t offset,
struct fuse_file_info *f_info)
-> api_error {
#endif
std::string item_path;
int res = 0;
@ -415,14 +417,16 @@ auto remote_fuse_drive::readdir_impl(
return utils::to_api_error(res);
}
auto remote_fuse_drive::release_impl(
std::string api_path, struct fuse_file_info *f_info) -> api_error {
auto remote_fuse_drive::release_impl(std::string api_path,
struct fuse_file_info *f_info)
-> api_error {
return utils::to_api_error(
remote_instance_->fuse_release(api_path.c_str(), f_info->fh));
}
auto remote_fuse_drive::releasedir_impl(
std::string api_path, struct fuse_file_info *f_info) -> api_error {
auto remote_fuse_drive::releasedir_impl(std::string api_path,
struct fuse_file_info *f_info)
-> api_error {
return utils::to_api_error(
remote_instance_->fuse_releasedir(api_path.c_str(), f_info->fh));
}
@ -519,8 +523,8 @@ api_error remote_fuse_drive::statfs_x_impl(std::string api_path,
return utils::to_api_error(res);
}
#else // __APPLE__
auto remote_fuse_drive::statfs_impl(std::string api_path,
struct statvfs *stbuf) -> api_error {
auto remote_fuse_drive::statfs_impl(std::string api_path, struct statvfs *stbuf)
-> api_error {
auto res = statvfs(config_.get_data_directory().c_str(), stbuf);
if (res == 0) {
remote::statfs r_stat{};
@ -547,8 +551,8 @@ auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size,
struct fuse_file_info * /*f_info*/)
-> api_error {
#else
auto remote_fuse_drive::truncate_impl(std::string api_path,
off_t size) -> api_error {
auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size)
-> api_error {
#endif
return utils::to_api_error(remote_instance_->fuse_truncate(
api_path.c_str(), static_cast<remote::file_offset>(size)));
@ -559,9 +563,10 @@ auto remote_fuse_drive::unlink_impl(std::string api_path) -> api_error {
}
#if FUSE_USE_VERSION >= 30
auto remote_fuse_drive::utimens_impl(
std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*f_info*/) -> api_error {
auto remote_fuse_drive::utimens_impl(std::string api_path,
const struct timespec tv[2],
struct fuse_file_info * /*f_info*/)
-> api_error {
#else
auto remote_fuse_drive::utimens_impl(std::string api_path,
const struct timespec tv[2]) -> api_error {

View File

@ -112,9 +112,7 @@ void remote_server::populate_file_info(const std::string &api_path,
const UINT64 &file_size,
const UINT32 &attributes,
remote::file_info &file_info) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
api_meta_map meta{};
const auto res = drive_.get_item_meta(api_path, meta);
@ -199,22 +197,17 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = access(file_path.c_str(), mask);
auto ret = ((res < 0) ? -errno : 0);
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, file_path, ret);
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_chflags(const char *path, std::uint32_t flags)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -234,9 +227,7 @@ auto remote_server::fuse_chflags(const char *path,
auto remote_server::fuse_chmod(const char *path, const remote::file_mode &mode)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = chmod(file_path.c_str(), mode);
@ -248,9 +239,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = chown(file_path.c_str(), uid, gid);
@ -263,9 +252,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res =
@ -282,9 +269,7 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode,
}
auto remote_server::fuse_destroy() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, "", 0);
return 0;
@ -328,12 +313,11 @@ length); ret = ((res < 0) ? -errno : 0); #endif
return ret;
}*/
auto remote_server::fuse_fgetattr(
const char *path, remote::stat &r_stat, bool &directory,
const remote::file_handle &handle) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
bool &directory,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
r_stat = {};
@ -342,7 +326,7 @@ auto remote_server::fuse_fgetattr(
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
if (res == 0) {
directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {};
struct stat64 unix_st{};
res = fstat64(static_cast<native_handle>(handle), &unix_st);
if (res == 0) {
populate_stat(unix_st, r_stat);
@ -354,12 +338,11 @@ auto remote_server::fuse_fgetattr(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_fsetattr_x(const char *path,
const remote::setattr_x &attr,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -454,9 +437,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -476,12 +457,11 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_ftruncate(const char *path,
const remote::file_offset &size,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -498,9 +478,7 @@ auto remote_server::fuse_ftruncate(
auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
bool &directory) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(api_path);
@ -510,7 +488,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {};
struct stat64 unix_st{};
auto res = stat64(file_path.c_str(), &unix_st);
if (res == 0) {
populate_stat(unix_st, r_stat);
@ -575,12 +553,11 @@ STATUS_NOT_IMPLEMENTED; #endif RAISE_REMOTE_FUSE_SERVER_EVENT(function_name,
file_path, ret); return ret;
}*/
auto remote_server::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__),
};
auto remote_server::fuse_getxtimes(const char *path,
remote::file_time &bkuptime,
remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -610,9 +587,7 @@ auto remote_server::fuse_getxtimes(
}
auto remote_server::fuse_init() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, "", 0);
return 0;
@ -630,9 +605,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = mkdir(file_path.c_str(), mode);
@ -644,9 +617,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = open(file_path.c_str(),
@ -662,9 +633,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -687,13 +656,12 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto &data = *reinterpret_cast<data_buffer *>(buffer);
@ -713,11 +681,9 @@ auto remote_server::fuse_read(
return static_cast<packet::error_type>(ret);
}
auto remote_server::fuse_rename(const char *from,
const char *to) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_rename(const char *from, const char *to)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto from_path = utils::path::combine(mount_location_, {from});
const auto to_path = utils::path::combine(mount_location_, {to});
@ -732,9 +698,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res = 0;
@ -756,11 +720,10 @@ auto remote_server::fuse_readdir(const char *path,
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_release(const char *path,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet::error_type ret = 0;
@ -776,11 +739,10 @@ auto remote_server::fuse_release(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_releasedir(const char *path,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -801,9 +763,7 @@ removexattr(file_path.c_str(), name); #endif auto ret = ((res < 0) ? -errno :
}*/
auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = rmdir(file_path.c_str());
@ -823,9 +783,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto ret = fuse_fsetattr_x(
@ -834,11 +792,10 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr)
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_setbkuptime(const char *path,
const remote::file_time &bkuptime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -856,11 +813,10 @@ auto remote_server::fuse_setbkuptime(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_setchgtime(const char *path,
const remote::file_time &chgtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -878,11 +834,10 @@ auto remote_server::fuse_setchgtime(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_setcrtime(const char *path,
const remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(path);
@ -901,9 +856,7 @@ auto remote_server::fuse_setcrtime(
}
auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, volname, 0);
return 0;
@ -931,9 +884,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -954,9 +905,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -978,11 +927,10 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0;
}
auto remote_server::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__),
};
auto remote_server::fuse_truncate(const char *path,
const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = truncate(file_path.c_str(), static_cast<off_t>(size));
@ -992,9 +940,7 @@ auto remote_server::fuse_truncate(
}
auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto res = unlink(file_path.c_str());
@ -1004,11 +950,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::uint64_t op0, std::uint64_t op1)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -1034,13 +978,12 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -1069,11 +1012,9 @@ auto remote_server::fuse_write_base64(
}
// WinFSP Layer
auto remote_server::winfsp_can_delete(PVOID file_desc,
PWSTR file_name) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
@ -1098,11 +1039,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT32 flags, BOOLEAN &was_closed)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
@ -1159,9 +1098,7 @@ auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
}
auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string file_path;
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1180,11 +1117,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info,
std::string &normalized_name,
BOOLEAN &exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::string &normalized_name, BOOLEAN &exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
@ -1233,9 +1168,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
@ -1255,11 +1188,10 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret;
}
auto remote_server::winfsp_get_file_info(
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_get_file_info(PVOID file_desc,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
@ -1280,9 +1212,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = static_cast<packet::error_type>(STATUS_SUCCESS);
const auto file_path = construct_path(file_name);
@ -1303,12 +1233,11 @@ auto remote_server::winfsp_get_security_by_name(
return ret;
}
auto remote_server::winfsp_get_volume_info(
UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &free_size,
std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label);
RAISE_REMOTE_FUSE_SERVER_EVENT(function_name, volume_label, STATUS_SUCCESS);
@ -1317,22 +1246,19 @@ auto remote_server::winfsp_get_volume_info(
auto remote_server::winfsp_mounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_FUSE_SERVER_EVENT(
function_name, utils::string::to_utf8(location), STATUS_SUCCESS);
return STATUS_SUCCESS;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
@ -1367,13 +1293,12 @@ auto remote_server::winfsp_open(
return ret;
}
auto remote_server::winfsp_overwrite(
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/,
remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
BOOLEAN replace_attributes,
UINT64 /*allocation_size*/,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
@ -1429,9 +1354,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0;
@ -1458,9 +1381,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
item_list.clear();
@ -1493,12 +1414,11 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret;
}
auto remote_server::winfsp_rename(
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
PWSTR new_file_name,
BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name);
const auto file_path = construct_path(relative_path);
@ -1528,9 +1448,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
@ -1593,12 +1511,11 @@ auto remote_server::winfsp_set_basic_info(
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
auto ret = static_cast<packet::error_type>(
@ -1626,22 +1543,20 @@ auto remote_server::winfsp_set_file_size(
auto remote_server::winfsp_unmounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_FUSE_SERVER_EVENT(
function_name, utils::string::to_utf8(location), STATUS_SUCCESS);
return STATUS_SUCCESS;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0;
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1688,11 +1603,10 @@ auto remote_server::winfsp_write(
return ret;
}
auto remote_server::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__),
};
auto remote_server::json_create_directory_snapshot(const std::string &path,
json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path);
const auto file_path = construct_path(api_path);
@ -1722,9 +1636,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
int res{-EBADF};
@ -1752,11 +1664,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
const std::string &path, const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
directory_cache_.remove_directory(handle);

View File

@ -54,11 +54,9 @@ remote_client::remote_client(const app_config &config)
config.get_remote_receive_timeout_secs(),
config.get_remote_send_timeout_secs(), config.get_remote_token()) {}
auto remote_client::winfsp_can_delete(PVOID file_desc,
PWSTR file_name) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -75,11 +73,10 @@ auto remote_client::winfsp_can_delete(PVOID file_desc,
return ret;
}
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__),
};
auto remote_client::json_create_directory_snapshot(const std::string &path,
json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -100,9 +97,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -123,11 +118,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
const std::string &path, const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(path);
@ -143,11 +136,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT32 flags, BOOLEAN &was_closed)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
auto handle{
to_handle(file_desc),
@ -178,9 +169,7 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
}
auto remote_client::winfsp_close(PVOID file_desc) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto handle{
to_handle(file_desc),
@ -211,11 +200,9 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes,
UINT64 allocation_size, PVOID *file_desc,
remote::file_info *file_info,
std::string &normalized_name,
BOOLEAN &exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::string &normalized_name, BOOLEAN &exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_name);
@ -255,9 +242,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -285,11 +270,10 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc,
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
}
auto remote_client::winfsp_get_file_info(
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::winfsp_get_file_info(PVOID file_desc,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -306,12 +290,12 @@ auto remote_client::winfsp_get_file_info(
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_name);
@ -340,12 +324,11 @@ auto remote_client::winfsp_get_security_by_name(
return ret;
}
auto remote_client::winfsp_get_volume_info(
UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &free_size,
std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
packet response;
@ -362,9 +345,7 @@ auto remote_client::winfsp_get_volume_info(
auto remote_client::winfsp_mounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(std::string{project_get_version()});
@ -384,13 +365,12 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_name);
@ -421,13 +401,12 @@ auto remote_client::winfsp_open(
return ret;
}
auto remote_client::winfsp_overwrite(
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 allocation_size,
remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
BOOLEAN replace_attributes,
UINT64 allocation_size,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -450,9 +429,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -469,7 +446,7 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
ret = response.decode(buffer, *bytes_transferred);
#if defined(_WIN32)
if ((ret == STATUS_SUCCESS) &&
(not *bytes_transferred || (*bytes_transferred != length))) {
(not*bytes_transferred || (*bytes_transferred != length))) {
::SetLastError(ERROR_HANDLE_EOF);
}
#endif
@ -486,9 +463,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -509,12 +484,11 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
return ret;
}
auto remote_client::winfsp_rename(
PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name,
PWSTR new_file_name,
BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -539,9 +513,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -563,12 +535,11 @@ auto remote_client::winfsp_set_basic_info(
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);
@ -589,9 +560,7 @@ auto remote_client::winfsp_set_file_size(
auto remote_client::winfsp_unmounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto mount_location{
utils::string::to_utf8(location),
@ -610,13 +579,13 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
packet request;
request.encode(file_desc);

View File

@ -107,9 +107,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto file_path{
construct_path(path),
@ -133,9 +131,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -146,9 +142,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -156,12 +150,11 @@ auto remote_server::fuse_chmod(const char *path,
return ret;
}
auto remote_server::fuse_chown(
const char *path, const remote::user_id & /*uid*/,
const remote::group_id & /*gid*/) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_chown(const char *path,
const remote::user_id & /*uid*/,
const remote::group_id & /*gid*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -170,9 +163,7 @@ auto remote_server::fuse_chown(
}
auto remote_server::fuse_destroy() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, "", 0);
return 0;
@ -190,12 +181,11 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
return ret;
}*/
auto remote_server::fuse_fgetattr(
const char *path, remote::stat &r_stat, bool &directory,
const remote::file_handle &handle) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
bool &directory,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
r_stat = {};
@ -206,7 +196,7 @@ auto remote_server::fuse_fgetattr(
};
if (res == 0) {
directory = utils::file::directory(file_path).exists();
struct _stat64 unix_st {};
struct _stat64 unix_st{};
res = _fstat64(static_cast<int>(handle), &unix_st);
if (res == 0) {
populate_stat(path, directory, r_stat, unix_st);
@ -218,12 +208,11 @@ auto remote_server::fuse_fgetattr(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_fsetattr_x(const char *path,
const remote::setattr_x & /*attr*/,
const remote::file_handle & /*handle*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -231,12 +220,11 @@ auto remote_server::fuse_fsetattr_x(
return ret;
}
auto remote_server::fuse_fsync(
const char *path, const std::int32_t & /*datasync*/,
const remote::file_handle &handle) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_fsync(const char *path,
const std::int32_t & /*datasync*/,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -262,12 +250,11 @@ auto remote_server::fuse_fsync(
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_ftruncate(const char *path,
const remote::file_offset &size,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -298,9 +285,7 @@ auto remote_server::fuse_ftruncate(
auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
bool &directory) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
r_st = {};
@ -308,7 +293,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
directory = utils::file::directory(file_path).exists();
struct _stat64 st1 {};
struct _stat64 st1{};
auto res{
_stat64(file_path.c_str(), &st1),
};
@ -334,12 +319,11 @@ STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
file_path, ret); return ret;
}*/
auto remote_server::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__),
};
auto remote_server::fuse_getxtimes(const char *path,
remote::file_time & /*bkuptime*/,
remote::file_time & /*crtime*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -348,9 +332,7 @@ auto remote_server::fuse_getxtimes(
}
auto remote_server::fuse_init() -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, "", 0);
return 0;
@ -366,9 +348,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res{
@ -381,9 +361,7 @@ auto remote_server::fuse_mkdir(const char *path,
auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto unicode_file_path = utils::string::from_utf8(file_path);
@ -410,9 +388,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = -1;
@ -449,9 +425,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res{-1};
@ -479,13 +453,12 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto &data = *reinterpret_cast<data_buffer *>(buffer);
@ -515,11 +488,9 @@ auto remote_server::fuse_read(
return ret;
}
auto remote_server::fuse_rename(const char *from,
const char *to) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_rename(const char *from, const char *to)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto from_path = utils::path::combine(mount_location_, {from});
const auto to_path = utils::path::combine(mount_location_, {to});
@ -533,13 +504,12 @@ auto remote_server::fuse_rename(const char *from,
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
std::size_t bytes_written{};
@ -583,9 +553,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res{0};
@ -607,11 +575,10 @@ auto remote_server::fuse_readdir(const char *path,
return ret;
}
auto remote_server::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__),
};
auto remote_server::fuse_release(const char *path,
const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -628,9 +595,7 @@ auto remote_server::fuse_release(
auto remote_server::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__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
@ -645,9 +610,7 @@ file_path, ret); return ret;
}*/
auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res{
@ -658,11 +621,10 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
return ret;
}
auto remote_server::fuse_setattr_x(
const char *path, remote::setattr_x & /*attr*/) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::fuse_setattr_x(const char *path,
remote::setattr_x & /*attr*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -673,9 +635,7 @@ auto remote_server::fuse_setattr_x(
auto remote_server::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__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -686,9 +646,7 @@ auto remote_server::fuse_setbkuptime(const char *path,
auto remote_server::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__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -699,9 +657,7 @@ auto remote_server::fuse_setchgtime(const char *path,
auto remote_server::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__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto ret = STATUS_NOT_IMPLEMENTED;
@ -710,9 +666,7 @@ auto remote_server::fuse_setcrtime(const char *path,
}
auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, volname, 0);
return 0;
@ -735,9 +689,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -760,9 +712,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -785,11 +735,10 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0;
}
auto remote_server::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__),
};
auto remote_server::fuse_truncate(const char *path,
const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto unicode_file_path = utils::string::from_utf8(file_path);
@ -823,9 +772,7 @@ auto remote_server::fuse_truncate(
}
auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
auto res{
@ -837,11 +784,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::uint64_t op0, std::uint64_t op1)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
const auto unicode_file_path = utils::string::from_utf8(file_path);
@ -899,11 +844,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::json_create_directory_snapshot(const std::string &path,
json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -932,9 +876,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
@ -962,11 +904,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
const std::string &path, const remote::file_handle & /*handle*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path);
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
@ -977,9 +917,7 @@ auto remote_server::json_release_directory_snapshot(
// WinFSP Layer
auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -998,11 +936,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT32 flags, BOOLEAN &was_closed)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = get_open_file_path(file_desc);
was_closed = FALSE;
@ -1020,9 +956,7 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
}
auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = get_open_file_path(file_desc);
@ -1040,11 +974,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info,
std::string &normalized_name,
BOOLEAN &exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
std::string &normalized_name, BOOLEAN &exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = utils::string::from_utf8(utils::path::combine(
mount_location_, {utils::string::to_utf8(file_name)}));
@ -1089,9 +1021,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
@ -1109,11 +1039,10 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret;
}
auto remote_server::winfsp_get_file_info(
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_get_file_info(PVOID file_desc,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
@ -1126,12 +1055,12 @@ auto remote_server::winfsp_get_file_info(
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = utils::string::from_utf8(utils::path::combine(
mount_location_, {utils::string::to_utf8(file_name)}));
@ -1168,12 +1097,11 @@ auto remote_server::winfsp_get_security_by_name(
return ret;
}
auto remote_server::winfsp_get_volume_info(
UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &free_size,
std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label);
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, volume_label, STATUS_SUCCESS);
@ -1182,22 +1110,19 @@ auto remote_server::winfsp_get_volume_info(
auto remote_server::winfsp_mounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_WINFSP_SERVER_EVENT(
function_name, utils::string::to_utf8(location), STATUS_SUCCESS);
return STATUS_SUCCESS;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
const auto file_path = utils::string::from_utf8(utils::path::combine(
mount_location_, {utils::string::to_utf8(file_name)}));
@ -1228,13 +1153,12 @@ auto remote_server::winfsp_open(
return ret;
}
auto remote_server::winfsp_overwrite(
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/,
remote::file_info *file_info) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
BOOLEAN replace_attributes,
UINT64 /*allocation_size*/,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
@ -1289,9 +1213,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0U;
@ -1319,9 +1241,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = STATUS_INVALID_HANDLE;
item_list.clear();
@ -1348,12 +1268,11 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret;
}
auto remote_server::winfsp_rename(
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
PWSTR new_file_name,
BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME();
const auto from_path = utils::string::from_utf8(utils::path::combine(
mount_location_, {utils::string::to_utf8(file_name)}));
@ -1375,9 +1294,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
@ -1406,12 +1323,11 @@ auto remote_server::winfsp_set_basic_info(
return ret;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
@ -1446,22 +1362,20 @@ auto remote_server::winfsp_set_file_size(
auto remote_server::winfsp_unmounted(const std::wstring &location)
-> packet::error_type {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
RAISE_REMOTE_WINFSP_SERVER_EVENT(
function_name, utils::string::to_utf8(location), STATUS_SUCCESS);
return STATUS_SUCCESS;
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc);
*bytes_transferred = 0U;

View File

@ -50,9 +50,7 @@ remote_winfsp_drive::winfsp_service::winfsp_service(
host_(drive) {}
auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto mount_location = utils::string::to_lower(utils::path::absolute(
(drive_args_.size() > 1U) ? drive_args_.at(1U) : ""));
@ -88,9 +86,7 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS {
}
auto remote_winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
host_.Unmount();
if (not lock_.set_mount_state(false, "", -1)) {
@ -131,8 +127,8 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes,
PSECURITY_DESCRIPTOR /*descriptor*/,
UINT64 allocation_size, PVOID * /*file_node*/,
PVOID *file_desc,
OpenFileInfo *ofi) -> NTSTATUS {
PVOID *file_desc, OpenFileInfo *ofi)
-> NTSTATUS {
remote::file_info fi{};
std::string normalized_name;
BOOLEAN exists = 0;
@ -166,9 +162,10 @@ auto remote_winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc,
return ret;
}
auto remote_winfsp_drive::GetSecurityByName(
PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size) -> NTSTATUS {
auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size)
-> NTSTATUS {
std::wstring string_descriptor;
std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
auto ret = remote_instance_->winfsp_get_security_by_name(
@ -266,9 +263,7 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args)
}
auto remote_winfsp_drive::Mounted(PVOID host) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *file_system_host = reinterpret_cast<FileSystemHost *>(host);
remote_instance_ = factory_();
@ -285,8 +280,8 @@ auto remote_winfsp_drive::Mounted(PVOID host) -> NTSTATUS {
auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, PVOID * /*file_node*/,
PVOID *file_desc,
OpenFileInfo *ofi) -> NTSTATUS {
PVOID *file_desc, OpenFileInfo *ofi)
-> NTSTATUS {
remote::file_info fi{};
std::string normalize_name;
auto ret =
@ -306,8 +301,8 @@ auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
auto remote_winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes,
BOOLEAN replace_attributes,
UINT64 allocation_size,
FileInfo *file_info) -> NTSTATUS {
UINT64 allocation_size, FileInfo *file_info)
-> NTSTATUS {
remote::file_info fi{};
auto ret = remote_instance_->winfsp_overwrite(
file_desc, attributes, replace_attributes, allocation_size, &fi);
@ -423,8 +418,8 @@ auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT64 creation_time,
UINT64 last_access_time,
UINT64 last_write_time,
UINT64 change_time,
FileInfo *file_info) -> NTSTATUS {
UINT64 change_time, FileInfo *file_info)
-> NTSTATUS {
remote::file_info fi{};
auto ret = remote_instance_->winfsp_set_basic_info(
file_desc, attributes, creation_time, last_access_time, last_write_time,
@ -460,9 +455,7 @@ auto remote_winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
}
VOID remote_winfsp_drive::Unmounted(PVOID host) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
server_->stop();
server_.reset();
@ -478,8 +471,8 @@ VOID remote_winfsp_drive::Unmounted(PVOID host) {
auto remote_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 {
PULONG bytes_transferred, FileInfo *file_info)
-> NTSTATUS {
remote::file_info fi{};
auto ret = remote_instance_->winfsp_write(
file_desc, buffer, offset, length, write_to_end, constrained_io,

View File

@ -67,11 +67,9 @@ winfsp_drive::winfsp_service::winfsp_service(
host_(drive),
config_(config) {}
auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
PWSTR * /*Argv*/) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
const auto mount_location = utils::string::to_lower(
utils::path::absolute((drive_args_.size() > 1U) ? drive_args_[1U] : ""));
@ -108,9 +106,7 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
}
auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
host_.Unmount();
@ -133,9 +129,7 @@ void winfsp_drive::shutdown() { ::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); }
auto winfsp_drive::CanDelete(PVOID /*file_node*/, PVOID file_desc,
PWSTR /*file_name*/) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -163,9 +157,7 @@ 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) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto handle =
@ -265,9 +257,7 @@ VOID winfsp_drive::Cleanup(PVOID file_node, PVOID file_desc,
}
VOID winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto handle =
@ -295,9 +285,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
// TODO Need to revisit this
// (ConvertSecurityDescriptorToStringSecurityDescriptor/ConvertStringSecurityDescriptorToSecurityDescriptor)
@ -350,9 +338,7 @@ auto winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
auto winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc,
FileInfo *file_info) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::success;
@ -391,9 +377,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
directory_item_list list;
auto res = provider_.get_directory_items(api_path, list);
@ -406,9 +390,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -433,9 +415,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint64_t file_size{};
auto res = provider_.get_file_size(api_path, file_size);
@ -464,9 +444,10 @@ auto winfsp_drive::get_item_meta(const std::string &api_path,
return ret;
}
auto winfsp_drive::get_security_by_name(
PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor,
std::uint64_t *descriptor_size) -> NTSTATUS {
auto winfsp_drive::get_security_by_name(PWSTR file_name, PUINT32 attributes,
PSECURITY_DESCRIPTOR descriptor,
std::uint64_t *descriptor_size)
-> NTSTATUS {
const auto api_path =
utils::path::create_api_path(utils::string::to_utf8(file_name));
@ -502,9 +483,7 @@ auto winfsp_drive::get_security_by_name(
auto winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path =
utils::path::create_api_path(utils::string::to_utf8(file_name));
@ -541,9 +520,7 @@ void winfsp_drive::get_volume_info(UINT64 &total_size, UINT64 &free_size,
}
auto winfsp_drive::GetVolumeInfo(VolumeInfo *volume_info) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const std::wstring volume_label = utils::string::from_utf8(
utils::create_volume_label(config_.get_provider_type()));
@ -619,9 +596,7 @@ auto winfsp_drive::mount(const std::vector<std::string> &drive_args) -> int {
}
auto winfsp_drive::Mounted(PVOID host) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret{STATUS_SUCCESS};
if (not utils::file::change_to_process_directory()) {
@ -687,9 +662,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path =
utils::path::create_api_path(utils::string::to_utf8(file_name));
@ -734,11 +707,9 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/,
FileInfo *file_info) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT64 /*allocation_size*/, FileInfo *file_info)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -811,8 +782,9 @@ void winfsp_drive::populate_file_info(const std::string &api_path,
populate_file_info(file_size, meta, ofi.FileInfo);
}
auto winfsp_drive::populate_file_info(
const std::string &api_path, remote::file_info &file_info) -> api_error {
auto winfsp_drive::populate_file_info(const std::string &api_path,
remote::file_info &file_info)
-> api_error {
api_meta_map meta{};
auto ret = provider_.get_item_meta(api_path, meta);
if (ret == api_error::success) {
@ -845,11 +817,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT64 offset, ULONG length, PULONG bytes_transferred)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0U;
@ -899,11 +869,9 @@ auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
PWSTR /*pattern*/, PWSTR marker, PVOID buffer,
ULONG buffer_length,
PULONG bytes_transferred) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
ULONG buffer_length, PULONG bytes_transferred)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -1002,9 +970,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto from_api_path =
utils::path::create_api_path(utils::string::to_utf8(file_name));
@ -1034,11 +1000,9 @@ auto winfsp_drive::Rename(PVOID /*file_node*/, PVOID /*file_desc*/,
auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT64 creation_time,
UINT64 last_access_time, UINT64 last_write_time,
UINT64 change_time,
FileInfo *file_info) -> NTSTATUS {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
UINT64 change_time, FileInfo *file_info)
-> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -1115,9 +1079,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::string api_path;
auto error = api_error::invalid_handle;
@ -1172,9 +1134,7 @@ auto winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
}
VOID winfsp_drive::Unmounted(PVOID host) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *file_system_host = reinterpret_cast<FileSystemHost *>(host);
const auto mount_location =
@ -1206,9 +1166,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0;

View File

@ -40,8 +40,8 @@
#include "utils/time.hpp"
namespace {
[[nodiscard]] auto
create_resume_entry(const repertory::i_open_file &file) -> json {
[[nodiscard]] auto create_resume_entry(const repertory::i_open_file &file)
-> json {
return {
{"chunk_size", file.get_chunk_size()},
{"path", file.get_api_path()},
@ -207,9 +207,7 @@ auto file_manager::create(const std::string &api_path, api_meta_map &meta,
}
auto file_manager::evict_file(const std::string &api_path) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (provider_.is_direct_only()) {
return false;
@ -260,9 +258,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
directory_item_list list{};
auto res = provider_.get_directory_items(api_path, list);
@ -351,9 +347,7 @@ auto file_manager::get_open_handle_count() const -> std::size_t {
}
auto file_manager::get_stored_downloads() const -> std::vector<json> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::vector<json> ret;
if (not provider_.is_direct_only()) {
@ -461,10 +455,11 @@ auto file_manager::open(const std::string &api_path, bool directory,
return open(api_path, directory, ofd, handle, file, nullptr);
}
auto file_manager::open(
const std::string &api_path, bool directory, const open_file_data &ofd,
std::uint64_t &handle, std::shared_ptr<i_open_file> &file,
std::shared_ptr<i_closeable_open_file> closeable_file) -> api_error {
auto file_manager::open(const std::string &api_path, bool directory,
const open_file_data &ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &file,
std::shared_ptr<i_closeable_open_file> closeable_file)
-> api_error {
const auto create_and_add_handle =
[&](std::shared_ptr<i_closeable_open_file> cur_file) {
handle = get_next_handle();
@ -546,9 +541,7 @@ void file_manager::queue_upload(const std::string &api_path,
}
auto file_manager::remove_file(const std::string &api_path) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
recur_mutex_lock open_lock(open_file_mtx_);
@ -603,9 +596,7 @@ void file_manager::remove_upload(const std::string &api_path) {
}
void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (provider_.is_direct_only()) {
return;
@ -727,8 +718,8 @@ 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 {
const std::string &to_api_path, bool overwrite)
-> api_error {
if (not provider_.is_rename_supported()) {
return api_error::not_implemented;
}
@ -800,9 +791,7 @@ auto file_manager::rename_file(const std::string &from_api_path,
}
void file_manager::start() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
polling::instance().set_callback(
{"timed_out_close", polling::frequency::second,
@ -980,9 +969,7 @@ void file_manager::store_resume(const i_open_file &file) {
void file_manager::swap_renamed_items(std::string from_api_path,
std::string to_api_path, bool directory) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto file_iter = open_file_lookup_.find(from_api_path);
if (file_iter != open_file_lookup_.end()) {
@ -1009,9 +996,7 @@ void file_manager::swap_renamed_items(std::string from_api_path,
}
void file_manager::upload_completed(const file_upload_completed &evt) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
unique_mutex_lock upload_lock(upload_mtx_);
@ -1053,9 +1038,7 @@ void file_manager::upload_completed(const file_upload_completed &evt) {
}
void file_manager::upload_handler() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
while (not stop_requested_) {
auto should_wait{true};

View File

@ -248,9 +248,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (fsi_.directory) {
return api_error::invalid_operation;
@ -339,8 +337,8 @@ auto file_manager::open_file::native_operation(
}
auto file_manager::open_file::read(std::size_t read_size,
std::uint64_t read_offset,
data_buffer &data) -> api_error {
std::uint64_t read_offset, data_buffer &data)
-> api_error {
if (fsi_.directory) {
return api_error::invalid_operation;
}
@ -418,9 +416,7 @@ auto file_manager::open_file::resize(std::uint64_t new_file_size) -> api_error {
}
auto file_manager::open_file::close() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (not fsi_.directory && not stop_requested_) {
stop_requested_ = true;
@ -533,9 +529,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
bytes_written = 0U;

View File

@ -73,7 +73,7 @@ file_manager::ring_buffer_open_file::ring_buffer_open_file(
fsi_.source_path =
utils::path::combine(buffer_directory, {utils::create_uuid_string()});
nf_ = utils::file::file::open_or_create_file(fsi_.source_path);
if (not *nf_) {
if (not*nf_) {
throw std::runtime_error("failed to create buffer file|err|" +
std::to_string(utils::get_last_error_code()));
}
@ -86,9 +86,7 @@ file_manager::ring_buffer_open_file::ring_buffer_open_file(
}
file_manager::ring_buffer_open_file::~ring_buffer_open_file() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
close();

View File

@ -49,9 +49,7 @@ void file_manager::upload::cancel() {
void file_manager::upload::stop() { stop_requested_ = true; }
void file_manager::upload::upload_thread() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
error_ =
provider_.upload_file(fsi_.api_path, fsi_.source_path, stop_requested_);

View File

@ -102,9 +102,7 @@ auto lock_data::get_state_directory() -> std::string {
}
auto lock_data::grab_lock(std::uint8_t retry_count) -> lock_result {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (lock_fd_ == -1) {
return lock_result::failure;
@ -126,9 +124,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = false;
auto handle =

View File

@ -27,8 +27,8 @@
#include "utils/error_utils.hpp"
namespace repertory {
auto lock_data::get_mount_state(const provider_type & /*pt*/,
json &mount_state) -> bool {
auto lock_data::get_mount_state(const provider_type & /*pt*/, json &mount_state)
-> bool {
const auto ret = get_mount_state(mount_state);
if (ret) {
const auto mount_id =
@ -73,9 +73,7 @@ auto lock_data::get_mount_state(json &mount_state) -> bool {
}
auto lock_data::grab_lock(std::uint8_t retry_count) -> lock_result {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto ret = lock_result::success;
if (mutex_handle_ == INVALID_HANDLE_VALUE) {

View File

@ -33,8 +33,8 @@
namespace repertory {
auto base_provider::create_api_file(std::string path, std::string key,
std::uint64_t size,
std::uint64_t file_time) -> api_file {
std::uint64_t size, std::uint64_t file_time)
-> api_file {
api_file file{};
file.api_path = utils::path::create_api_path(path);
file.api_parent = utils::path::get_parent_api_path(file.api_path);
@ -66,11 +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 std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
const std::string &source_api_path, const std::string &api_path)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
bool exists{};
auto res = is_file(source_api_path, exists);
@ -122,9 +120,7 @@ auto base_provider::create_directory_clone_source_meta(
auto base_provider::create_directory(const std::string &api_path,
api_meta_map &meta) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
bool exists{};
auto res = is_directory(api_path, exists);
@ -168,11 +164,9 @@ auto base_provider::create_directory(const std::string &api_path,
return set_item_meta(api_path, meta);
}
auto base_provider::create_file(const std::string &api_path,
api_meta_map &meta) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto base_provider::create_file(const std::string &api_path, api_meta_map &meta)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
bool exists{};
auto res = is_directory(api_path, exists);
@ -228,11 +222,10 @@ auto base_provider::create_file(const std::string &api_path,
return api_error::error;
}
auto base_provider::get_api_path_from_source(
const std::string &source_path, std::string &api_path) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto base_provider::get_api_path_from_source(const std::string &source_path,
std::string &api_path) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
if (source_path.empty()) {
utils::error::raise_api_path_error(function_name, api_path,
@ -244,11 +237,10 @@ auto base_provider::get_api_path_from_source(
return db3_->get_api_path(source_path, api_path);
}
auto base_provider::get_directory_items(
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__),
};
auto base_provider::get_directory_items(const std::string &api_path,
directory_item_list &list) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
bool exists{};
auto res = is_directory(api_path, exists);
@ -311,9 +303,10 @@ auto base_provider::get_file_size(const std::string &api_path,
return api_error::success;
}
auto base_provider::get_filesystem_item(
const std::string &api_path, bool directory,
filesystem_item &fsi) const -> api_error {
auto base_provider::get_filesystem_item(const std::string &api_path,
bool directory,
filesystem_item &fsi) const
-> api_error {
bool exists{};
auto res = is_directory(api_path, exists);
if (res != api_error::success) {
@ -346,9 +339,10 @@ auto base_provider::get_filesystem_item(
return api_error::success;
}
auto base_provider::get_filesystem_item_and_file(
const std::string &api_path, api_file &file,
filesystem_item &fsi) const -> api_error {
auto base_provider::get_filesystem_item_and_file(const std::string &api_path,
api_file &file,
filesystem_item &fsi) const
-> api_error {
auto res = get_file(api_path, file);
if (res != api_error::success) {
return res;
@ -409,9 +403,7 @@ auto base_provider::get_total_item_count() const -> std::uint64_t {
}
auto base_provider::get_used_drive_space() const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto used_space = get_used_drive_space_impl();
@ -437,9 +429,7 @@ auto base_provider::is_file_writeable(const std::string &api_path) const
}
void base_provider::remove_deleted_files(bool source_only) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (not is_direct_only()) {
auto source_list =
@ -734,9 +724,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<provider_upload_begin>(api_path, source_path);

View File

@ -69,9 +69,10 @@ const std::map<std::string, std::string> sql_create_tables = {
namespace repertory {
encrypt_provider::encrypt_provider(app_config &config) : config_(config) {}
auto encrypt_provider::create_api_file(
const std::string &api_path, bool directory,
const std::string &source_path) -> api_file {
auto encrypt_provider::create_api_file(const std::string &api_path,
bool directory,
const std::string &source_path)
-> api_file {
auto times = utils::file::get_times(source_path);
if (not times.has_value()) {
throw std::runtime_error("failed to get file times");
@ -97,10 +98,10 @@ auto encrypt_provider::create_api_file(
void encrypt_provider::create_item_meta(api_meta_map &meta, bool directory,
const api_file &file) {
#if defined(_WIN32)
struct _stat64 buf {};
struct _stat64 buf{};
_stat64(file.source_path.c_str(), &buf);
#else // !defined(_WIN32)
struct stat buf {};
struct stat buf{};
stat(file.source_path.c_str(), &buf);
#endif // defined(_WIN32)
@ -187,11 +188,10 @@ auto encrypt_provider::do_fs_operation(
return callback(cfg, source_path);
}
auto encrypt_provider::get_api_path_from_source(
const std::string &source_path, std::string &api_path) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto encrypt_provider::get_api_path_from_source(const std::string &source_path,
std::string &api_path) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
auto result = utils::db::sqlite::db_select{*db_, file_table}
@ -231,9 +231,7 @@ auto encrypt_provider::get_api_path_from_source(
auto encrypt_provider::get_directory_item_count(
const std::string &api_path) const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint64_t count{};
auto res = do_fs_operation(
@ -257,11 +255,10 @@ auto encrypt_provider::get_directory_item_count(
return count;
}
auto encrypt_provider::get_directory_items(
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__),
};
auto encrypt_provider::get_directory_items(const std::string &api_path,
directory_item_list &list) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
return do_fs_operation(
api_path, true,
@ -374,9 +371,7 @@ auto encrypt_provider::get_directory_items(
auto encrypt_provider::get_file(const std::string &api_path,
api_file &file) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
bool exists{};
@ -411,9 +406,7 @@ auto encrypt_provider::get_file(const std::string &api_path,
}
auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto cfg = config_.get_encrypt_config();
event_system::instance().raise<debug_log>(std::string{function_name},
@ -437,11 +430,10 @@ auto encrypt_provider::get_file_list(api_file_list &list) const -> api_error {
return api_error::error;
}
auto encrypt_provider::get_file_size(
const std::string &api_path, std::uint64_t &file_size) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto encrypt_provider::get_file_size(const std::string &api_path,
std::uint64_t &file_size) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
auto result = utils::db::sqlite::db_select{*db_, source_table}
@ -466,9 +458,10 @@ auto encrypt_provider::get_file_size(
return api_error::error;
}
auto encrypt_provider::get_filesystem_item(
const std::string &api_path, bool directory,
filesystem_item &fsi) const -> api_error {
auto encrypt_provider::get_filesystem_item(const std::string &api_path,
bool directory,
filesystem_item &fsi) const
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path")
.where("api_path")
@ -544,12 +537,11 @@ auto encrypt_provider::get_filesystem_item_from_source_path(
return get_filesystem_item(api_path, false, fsi);
}
auto encrypt_provider::get_filesystem_item_and_file(
const std::string &api_path, api_file &file,
filesystem_item &fsi) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto encrypt_provider::get_filesystem_item_and_file(const std::string &api_path,
api_file &file,
filesystem_item &fsi) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
bool exists{};
@ -582,9 +574,7 @@ auto encrypt_provider::get_pinned_files() const -> std::vector<std::string> {
auto encrypt_provider::get_item_meta(const std::string &api_path,
api_meta_map &meta) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto result = utils::db::sqlite::db_select{*db_, source_table}
@ -677,8 +667,8 @@ auto encrypt_provider::is_directory(const std::string &api_path,
return api_error::success;
}
auto encrypt_provider::is_file(const std::string &api_path,
bool &exists) const -> api_error {
auto encrypt_provider::is_file(const std::string &api_path, bool &exists) const
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path")
.where("api_path")
@ -863,9 +853,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path")
@ -1037,9 +1025,7 @@ void encrypt_provider::remove_deleted_files() {
auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
i_file_manager * /*mgr*/) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (not is_online()) {
return false;

View File

@ -32,9 +32,7 @@
namespace repertory {
meta_db::meta_db(const app_config &cfg) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto db_path = utils::path::combine(cfg.get_data_directory(), {"meta.db3"});
@ -110,11 +108,9 @@ auto meta_db::get_api_path_list() -> std::vector<std::string> {
return ret;
}
auto meta_db::get_item_meta(const std::string &api_path,
api_meta_map &meta) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto meta_db::get_item_meta(const std::string &api_path, api_meta_map &meta)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("*")
@ -153,9 +149,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("*")
@ -196,9 +190,7 @@ 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> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::vector<std::string> ret{};
@ -222,9 +214,7 @@ auto meta_db::get_pinned_files() const -> std::vector<std::string> {
}
auto meta_db::get_total_item_count() const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
std::uint64_t ret{};
@ -247,9 +237,7 @@ auto meta_db::get_total_item_count() const -> std::uint64_t {
}
void meta_db::remove_api_path(const std::string &api_path) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto result = utils::db::sqlite::db_delete{*db_, table_name}
.where("api_path")
@ -304,11 +292,9 @@ auto meta_db::set_item_meta(const std::string &api_path,
return update_item_meta(api_path, existing_meta);
}
auto meta_db::update_item_meta(const std::string &api_path,
api_meta_map meta) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto meta_db::update_item_meta(const std::string &api_path, api_meta_map meta)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
auto directory = utils::string::to_bool(meta[META_DIRECTORY]);
auto pinned = utils::string::to_bool(meta[META_PINNED]);

View File

@ -43,8 +43,9 @@ s3_provider::s3_provider(app_config &config, i_http_comm &comm)
get_comm().enable_s3_path_style(config.get_s3_config().use_path_style);
}
auto s3_provider::add_if_not_found(
api_file &file, const std::string &object_name) const -> api_error {
auto s3_provider::add_if_not_found(api_file &file,
const std::string &object_name) const
-> api_error {
api_meta_map meta{};
if (get_item_meta(file.api_path, meta) == api_error::item_not_found) {
auto err = create_path_directories(
@ -70,7 +71,7 @@ auto s3_provider::convert_api_date(std::string_view date) -> std::uint64_t {
utils::string::split(date_parts.at(1U), 'Z', true).at(0U)) *
1000000UL;
struct tm tm1 {};
struct tm tm1{};
#if defined(_WIN32)
utils::time::strptime(date_time.c_str(), "%Y-%m-%dT%T", &tm1);
return nanos + utils::time::windows_time_t_to_unix_time(_mkgmtime(&tm1));
@ -83,9 +84,7 @@ auto s3_provider::convert_api_date(std::string_view date) -> std::uint64_t {
auto s3_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__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto cfg = get_config().get_s3_config();
const auto is_encrypted = not cfg.encryption_token.empty();
@ -138,9 +137,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (not get_config().get_s3_config().encryption_token.empty()) {
std::string encrypted_file_path;
@ -165,8 +162,9 @@ auto s3_provider::create_file_extra(const std::string &api_path,
return api_error::success;
}
auto s3_provider::create_path_directories(
const std::string &api_path, const std::string &key) const -> api_error {
auto s3_provider::create_path_directories(const std::string &api_path,
const std::string &key) const
-> api_error {
if (api_path == "/") {
return api_error::success;
}
@ -224,9 +222,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
const auto cfg = get_config().get_s3_config();
@ -284,8 +280,9 @@ auto s3_provider::get_directory_item_count(const std::string &api_path) const
return 0U;
}
auto s3_provider::get_directory_items_impl(
const std::string &api_path, directory_item_list &list) const -> api_error {
auto s3_provider::get_directory_items_impl(const std::string &api_path,
directory_item_list &list) const
-> api_error {
const auto cfg = get_config().get_s3_config();
const auto is_encrypted = not cfg.encryption_token.empty();
@ -400,11 +397,9 @@ auto s3_provider::get_directory_items_impl(
return ret;
}
auto s3_provider::get_file(const std::string &api_path,
api_file &file) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto s3_provider::get_file(const std::string &api_path, api_file &file) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
try {
bool is_encrypted{};
@ -494,8 +489,9 @@ auto s3_provider::get_file_list(api_file_list &list) const -> api_error {
return api_error::success;
}
auto s3_provider::get_last_modified(
bool directory, const std::string &api_path) const -> std::uint64_t {
auto s3_provider::get_last_modified(bool directory,
const std::string &api_path) const
-> std::uint64_t {
bool is_encrypted{};
std::string object_name;
head_object_result result{};
@ -505,12 +501,11 @@ auto s3_provider::get_last_modified(
: utils::time::get_time_now();
}
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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
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 {
REPERTORY_USES_FUNCTION_NAME();
try {
const auto cfg = get_config().get_s3_config();
@ -556,10 +551,11 @@ auto s3_provider::get_object_info(
return api_error::error;
}
auto s3_provider::get_object_list(
std::string &response_data, long &response_code,
std::optional<std::string> delimiter,
std::optional<std::string> prefix) const -> bool {
auto s3_provider::get_object_list(std::string &response_data,
long &response_code,
std::optional<std::string> delimiter,
std::optional<std::string> prefix) const
-> bool {
curl::requests::http_get get{};
get.allow_timeout = true;
get.aws_service = "aws:amz:" + get_config().get_s3_config().region + ":s3";
@ -616,11 +612,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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto s3_provider::is_directory(const std::string &api_path, bool &exists) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
exists = false;
if (api_path == "/") {
@ -646,11 +640,9 @@ auto s3_provider::is_directory(const std::string &api_path,
return api_error::error;
}
auto s3_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__),
};
auto s3_provider::is_file(const std::string &api_path, bool &exists) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
exists = false;
if (api_path == "/") {
@ -683,9 +675,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
const auto cfg = get_config().get_s3_config();
@ -791,9 +781,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto cfg = get_config().get_s3_config();
const auto is_encrypted = not cfg.encryption_token.empty();
@ -835,9 +823,7 @@ auto s3_provider::remove_directory_impl(const std::string &api_path)
}
auto s3_provider::remove_file_impl(const std::string &api_path) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto cfg = get_config().get_s3_config();
const auto is_encrypted = not cfg.encryption_token.empty();

View File

@ -45,8 +45,8 @@ namespace {
return cfg.bucket;
}
[[nodiscard]] auto
get_last_modified(const nlohmann::json &obj) -> std::uint64_t {
[[nodiscard]] auto get_last_modified(const nlohmann::json &obj)
-> std::uint64_t {
try {
return repertory::s3_provider::convert_api_date(
obj["modTime"].get<std::string>());
@ -60,11 +60,10 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto sia_provider::create_directory_impl(const std::string &api_path,
api_meta_map & /* meta */)
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_put_file put_file{};
put_file.allow_timeout = true;
@ -91,9 +90,7 @@ auto sia_provider::create_directory_impl(
auto sia_provider::get_directory_item_count(const std::string &api_path) const
-> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
json object_list{};
@ -129,11 +126,10 @@ 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 {
static constexpr const std::string_view 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 {
REPERTORY_USES_FUNCTION_NAME();
json object_list{};
if (not get_object_list(api_path, object_list)) {
@ -190,8 +186,8 @@ auto sia_provider::get_directory_items_impl(
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) {
@ -219,9 +215,7 @@ auto sia_provider::get_file(const std::string &api_path,
}
auto sia_provider::get_file_list(api_file_list &list) const -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
using dir_func = std::function<api_error(std::string api_path)>;
const dir_func get_files_in_dir = [&](std::string api_path) -> api_error {
@ -287,9 +281,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
curl::requests::http_get get{};
@ -331,9 +323,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_get get{};
get.allow_timeout = true;
@ -366,9 +356,7 @@ auto sia_provider::get_object_list(const std::string &api_path,
}
auto sia_provider::get_total_drive_space() const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
curl::requests::http_get get{};
@ -406,9 +394,7 @@ auto sia_provider::get_total_drive_space() const -> std::uint64_t {
}
auto sia_provider::get_used_drive_space_impl() const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_get get{};
get.allow_timeout = true;
@ -438,11 +424,9 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
auto sia_provider::is_directory(const std::string &api_path, bool &exists) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
if (api_path == "/") {
exists = true;
@ -473,11 +457,9 @@ auto sia_provider::is_directory(const std::string &api_path,
return api_error::error;
}
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__),
};
auto sia_provider::is_file(const std::string &api_path, bool &exists) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
exists = false;
if (api_path == "/") {
@ -506,9 +488,7 @@ auto sia_provider::is_file(const std::string &api_path,
}
auto sia_provider::is_online() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
curl::requests::http_get get{};
@ -551,9 +531,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_get get{};
get.path = "/api/worker/objects" + api_path;
@ -607,9 +585,7 @@ auto sia_provider::read_file_bytes(const std::string &api_path,
auto sia_provider::remove_directory_impl(const std::string &api_path)
-> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_delete del{};
del.allow_timeout = true;
@ -635,9 +611,7 @@ auto sia_provider::remove_directory_impl(const std::string &api_path)
}
auto sia_provider::remove_file_impl(const std::string &api_path) -> api_error {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_delete del{};
del.allow_timeout = true;
@ -665,9 +639,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_post post{};
post.json = nlohmann::json({
@ -713,9 +685,7 @@ 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 {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
curl::requests::http_put_file put_file{};
put_file.path = "/api/worker/objects" + api_path;

View File

@ -88,9 +88,7 @@ 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) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path =
utils::path::create_api_path(req.get_param_value("api_path"));
@ -114,9 +112,7 @@ void full_server::handle_get_pinned_status(const httplib::Request &req,
void full_server::handle_pin_file(const httplib::Request &req,
httplib::Response &res) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path =
utils::path::create_api_path(req.get_param_value("api_path"));
@ -145,9 +141,7 @@ void full_server::handle_pin_file(const httplib::Request &req,
void full_server::handle_unpin_file(const httplib::Request &req,
httplib::Response &res) {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto api_path =
utils::path::create_api_path(req.get_param_value("api_path"));

View File

@ -29,9 +29,7 @@ namespace repertory {
server::server(app_config &config) : config_(config) {}
auto server::check_authorization(const httplib::Request &req) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (config_.get_api_auth().empty() || config_.get_api_user().empty()) {
utils::error::raise_error(function_name,
@ -134,9 +132,7 @@ void server::initialize(httplib::Server &inst) {
}
void server::start() {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
mutex_lock lock(start_stop_mutex_);
if (not started_) {

View File

@ -30,9 +30,7 @@
namespace repertory::utils::file {
auto get_directory_files(std::string_view path, bool oldest_first,
bool recursive) -> std::deque<std::string> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto abs_path = utils::path::absolute(path);
std::deque<std::string> ret;
@ -96,7 +94,7 @@ auto get_directory_files(std::string_view path, bool oldest_first,
const auto add_to_lookup = [&](const std::string &lookup_path) {
if (lookup.find(lookup_path) == lookup.end()) {
struct stat st {};
struct stat st{};
stat(lookup_path.c_str(), &st);
#if defined(__APPLE__)
lookup[lookup_path] =

View File

@ -73,11 +73,9 @@ inline auto includes(const col_t &collection,
template <typename val_t>
[[nodiscard]] inline auto from_hex_string_t(std::string_view str,
val_t &val) -> bool {
static constexpr const auto base16{16};
REPERTORY_USES_FUNCTION_NAME();
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
static constexpr const auto base16{16};
try {
val.clear();

View File

@ -26,20 +26,27 @@
#include "utils/config.hpp"
namespace repertory::utils {
class com_init_wrapper {
public:
struct com_init_wrapper final {
com_init_wrapper()
: uninit_(
: initialized_(
SUCCEEDED(::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) {}
com_init_wrapper(const com_init_wrapper &) = delete;
com_init_wrapper(com_init_wrapper &&) = delete;
~com_init_wrapper() {
if (uninit_) {
if (initialized_) {
::CoUninitialize();
}
}
auto operator=(const com_init_wrapper &) -> com_init_wrapper & = delete;
auto operator=(com_init_wrapper &&) -> com_init_wrapper & = delete;
[[nodiscard]] auto is_initialized() const -> bool { return initialized_; }
private:
BOOL uninit_;
BOOL initialized_;
};
} // namespace repertory::utils

View File

@ -38,7 +38,9 @@
#endif // defined(PROJECT_ENABLE_WINFSP)
#include <direct.h>
#if !defined(__cplusplus)
#include <errno.h>
#endif // !defined(__cplusplus)
#include <fcntl.h>
#include <io.h>
#include <iphlpapi.h>
@ -49,10 +51,14 @@
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#if !defined(__cplusplus)
#include <stdio.h>
#endif // !defined(__cplusplus)
#include <sys/stat.h>
#include <sys/types.h>
#if !defined(__cplusplus)
#include <time.h>
#endif // !defined(__cplusplus)
#else // !defined(_WIN32)
#include <arpa/inet.h>
#include <dirent.h>
@ -65,9 +71,9 @@
#include <sys/socket.h>
#if defined(__LFS64__)
#include <sys/stat64.h>
#else
#else // !defined(__LFS64__)
#include <sys/stat.h>
#endif
#endif // defined(__LFS64__)
#if defined(__linux__)
#include <sys/statfs.h>
@ -98,6 +104,7 @@
#include <array>
#include <atomic>
#include <bit>
#include <cerrno>
#include <chrono>
#include <ciso646>
#include <climits>
@ -105,9 +112,11 @@
#include <condition_variable>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ctime>
#include <deque>
#include <filesystem>
#include <fstream>
@ -466,4 +475,9 @@ using http_ranges = std::vector<http_range>;
} // namespace repertory
#endif // defined(__cplusplus)
#define REPERTORY_USES_FUNCTION_NAME() \
static constexpr const std::string_view function_name{ \
static_cast<const char *>(__FUNCTION__), \
}
#endif // REPERTORY_INCLUDE_UTILS_CONFIG_HPP_

View File

@ -153,9 +153,7 @@ auto get_next_available_port(std::uint16_t first_port,
auto retry_action(retryable_action_t action, std::size_t retry_count,
std::chrono::milliseconds retry_wait) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
for (std::size_t idx = 0U; idx < retry_count; ++idx) {

View File

@ -352,9 +352,7 @@ auto encrypting_reader::create_iostream() const
auto encrypting_reader::reader_function(char *buffer, size_t size,
size_t nitems) -> size_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
const auto read_size = static_cast<std::size_t>(std::min(
static_cast<std::uint64_t>(size * nitems), total_size_ - read_offset_));

View File

@ -32,9 +32,7 @@
namespace repertory::utils::file {
auto change_to_process_directory() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
#if defined(_WIN32)
@ -100,9 +98,7 @@ auto create_temp_name(std::wstring_view file_part) -> std::wstring {
auto get_free_drive_space(std::string_view path)
-> std::optional<std::uint64_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
#if defined(_WIN32)
@ -168,9 +164,7 @@ auto get_time(std::wstring_view path,
}
auto get_times(std::string_view path) -> std::optional<file_times> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
file_times ret{};
@ -244,9 +238,7 @@ auto get_times(std::wstring_view path) -> std::optional<file_times> {
auto get_total_drive_space(std::string_view path)
-> std::optional<std::uint64_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
#if defined(_WIN32)
@ -337,9 +329,7 @@ auto read_json_file(std::string_view path, nlohmann::json &data,
#else // !defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
auto read_json_file(std::string_view path, nlohmann::json &data) -> bool {
#endif // defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto abs_path = utils::path::absolute(path);
@ -395,9 +385,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) && defined(PROJECT_ENABLE_BOOST)
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto file = file::open_or_create_file(path);

View File

@ -96,9 +96,7 @@ auto traverse_directory(
namespace repertory::utils::file {
auto directory::copy_to(std::string_view new_path,
bool overwrite) const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
throw std::runtime_error("failed to copy directory|" + path_ + '|' +
@ -114,9 +112,7 @@ auto directory::copy_to(std::string_view new_path,
}
auto directory::count(bool recursive) const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
std::uint64_t ret{0U};
@ -149,9 +145,7 @@ auto directory::count(bool recursive) const -> std::uint64_t {
auto directory::create_directory(std::string_view path) const
-> fs_directory_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto abs_path = utils::path::combine(path_, {path});
@ -208,9 +202,7 @@ auto directory::exists() const -> bool {
}
auto directory::get_directory(std::string_view path) const -> fs_directory_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto dir_path = utils::path::combine(path_, {path});
@ -229,9 +221,7 @@ auto directory::get_directory(std::string_view path) const -> fs_directory_t {
}
auto directory::get_directories() const -> std::vector<fs_directory_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
std::vector<fs_directory_t> ret{};
@ -259,9 +249,7 @@ auto directory::get_directories() const -> std::vector<fs_directory_t> {
auto directory::create_file(std::string_view file_name,
bool read_only) const -> fs_file_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto file_path = utils::path::combine(path_, {file_name});
@ -276,9 +264,7 @@ auto directory::create_file(std::string_view file_name,
}
auto directory::get_file(std::string_view path) const -> fs_file_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto file_path = utils::path::combine(path_, {path});
@ -295,9 +281,7 @@ auto directory::get_file(std::string_view path) const -> fs_file_t {
}
auto directory::get_files() const -> std::vector<fs_file_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
std::vector<fs_file_t> ret{};
@ -323,9 +307,7 @@ auto directory::get_files() const -> std::vector<fs_file_t> {
}
auto directory::get_items() const -> std::vector<fs_item_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
std::vector<fs_item_t> ret{};
@ -361,9 +343,7 @@ auto directory::is_stop_requested() const -> bool {
}
auto directory::is_symlink() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
return std::filesystem::is_symlink(path_);
@ -377,9 +357,7 @@ auto directory::is_symlink() const -> bool {
}
auto directory::move_to(std::string_view new_path) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
throw std::runtime_error("failed to move directory|" + path_ + '|' +
@ -394,9 +372,7 @@ auto directory::move_to(std::string_view new_path) -> bool {
}
auto directory::remove() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (not exists()) {
return true;
@ -420,9 +396,7 @@ auto directory::remove() -> bool {
}
auto directory::remove_recursively() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not exists()) {
@ -448,9 +422,7 @@ auto directory::remove_recursively() -> bool {
}
auto directory::size(bool recursive) const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
std::uint64_t ret{0U};

View File

@ -64,9 +64,7 @@ namespace {
namespace repertory::utils::file {
// auto file::attach_file(native_handle handle,
// bool read_only) -> fs_file_t {
// static constexpr const std::string_view function_name{
// static_cast<const char *>(__FUNCTION__),
// };
// REPERTORY_USES_FUNCTION_NAME();
//
// try {
// std::string path;
@ -132,9 +130,7 @@ void file::open() {
}
auto file::open_file(std::string_view path, bool read_only) -> fs_file_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto *ptr = new file{
nullptr,
@ -188,9 +184,7 @@ auto file::open_or_create_file(std::string_view path, bool read_only)
void file::close() { file_.reset(); }
auto file::copy_to(std::string_view new_path, bool overwrite) const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
auto to_path = utils::path::absolute(new_path);
@ -238,9 +232,7 @@ auto file::get_handle() const -> native_handle {
}
auto file::is_symlink() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
return std::filesystem::is_symlink(path_);
@ -254,9 +246,7 @@ auto file::is_symlink() const -> bool {
}
auto file::move_to(std::string_view path) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto abs_path = utils::path::absolute(path);
@ -296,9 +286,7 @@ auto file::move_to(std::string_view 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_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (total_read != nullptr) {
(*total_read) = 0U;
@ -345,9 +333,7 @@ auto file::read(unsigned char *data, std::size_t to_read, std::uint64_t offset,
#if defined(PROJECT_ENABLE_LIBSODIUM)
auto file::sha256() -> std::optional<std::string> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto should_close{false};
auto read_only{read_only_};
@ -428,9 +414,7 @@ auto file::remove() -> bool {
}
auto file::truncate(std::size_t size) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
auto reopen{false};
if (file_) {
@ -460,9 +444,7 @@ auto file::truncate(std::size_t size) -> bool {
auto file::write(const unsigned char *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_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
if (total_written != nullptr) {
(*total_written) = 0U;
@ -510,9 +492,7 @@ auto file::write(const unsigned char *data, std::size_t to_write,
}
auto file::size() const -> std::optional<std::uint64_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (file_) {

View File

@ -30,9 +30,7 @@ namespace repertory::utils::file {
auto smb_directory::open(std::string_view host, std::string_view user,
std::string_view password, std::string_view path,
stop_type *stop_requested) -> smb_directory_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
smb_session_t session{
@ -113,9 +111,7 @@ auto smb_directory::open(std::wstring_view host, std::wstring_view user,
auto smb_directory::copy_to(std::string_view new_path,
bool overwrite) const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -136,9 +132,7 @@ auto smb_directory::copy_to(std::string_view new_path,
}
auto smb_directory::count(bool recursive) const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -168,9 +162,7 @@ auto smb_directory::count(bool recursive) const -> std::uint64_t {
auto smb_directory::create_directory(std::string_view path) const
-> fs_directory_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -202,9 +194,7 @@ auto smb_directory::create_directory(std::string_view path) const
auto smb_directory::create_file(std::string_view file_name,
bool read_only) const -> fs_file_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -249,9 +239,7 @@ auto smb_directory::create_file(std::string_view file_name,
return nullptr;
}
auto smb_directory::exists() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -279,9 +267,7 @@ auto smb_directory::exists() const -> bool {
auto smb_directory::get_directory(std::string_view path) const
-> fs_directory_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -321,9 +307,7 @@ auto smb_directory::get_directory(std::string_view path) const
}
auto smb_directory::get_directories() const -> std::vector<fs_directory_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -382,9 +366,7 @@ auto smb_directory::get_directories() const -> std::vector<fs_directory_t> {
}
auto smb_directory::get_file(std::string_view path) const -> fs_file_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -418,9 +400,7 @@ auto smb_directory::get_file(std::string_view path) const -> fs_file_t {
}
auto smb_directory::get_files() const -> std::vector<fs_file_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -469,9 +449,7 @@ auto smb_directory::get_files() const -> std::vector<fs_file_t> {
}
auto smb_directory::get_items() const -> std::vector<fs_item_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -548,9 +526,7 @@ auto smb_directory::is_stop_requested() const -> bool {
}
auto smb_directory::is_symlink() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -567,9 +543,7 @@ auto smb_directory::is_symlink() const -> bool {
}
auto smb_directory::move_to(std::string_view new_path) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -588,9 +562,7 @@ auto smb_directory::move_to(std::string_view new_path) -> bool {
}
auto smb_directory::remove() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -629,9 +601,7 @@ auto smb_directory::remove() -> bool {
}
auto smb_directory::remove_recursively() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -654,9 +624,7 @@ auto smb_directory::remove_recursively() -> bool {
}
auto smb_directory::size(bool /* recursive */) const -> std::uint64_t {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {

View File

@ -37,9 +37,7 @@ void smb_file::close() {
auto smb_file::copy_to(std::string_view new_path,
bool overwrite) const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -61,9 +59,7 @@ auto smb_file::copy_to(std::string_view new_path,
}
auto smb_file::exists() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -90,9 +86,7 @@ auto smb_file::exists() const -> bool {
}
void smb_file::flush() const {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
throw std::runtime_error("failed to flush file|" + path_ +
@ -106,9 +100,7 @@ void smb_file::flush() const {
auto smb_file::get_time(smb_session *session, smb_tid tid, std::string path,
time_type type) -> std::optional<std::uint64_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (session == nullptr) {
@ -147,9 +139,7 @@ auto smb_file::get_time(smb_session *session, smb_tid tid, std::string path,
}
auto smb_file::is_symlink() const -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -166,9 +156,7 @@ auto smb_file::is_symlink() const -> bool {
}
auto smb_file::move_to(std::string_view new_path) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (utils::string::begins_with(new_path, "//")) {
@ -218,9 +206,7 @@ auto smb_file::move_to(std::string_view new_path) -> bool {
}
auto smb_file::open(bool read_only) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (fd_.has_value()) {
@ -263,9 +249,7 @@ auto smb_file::open(bool read_only) -> bool {
auto smb_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_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (total_read != nullptr) {
@ -317,9 +301,7 @@ auto smb_file::read(unsigned char *data, std::size_t to_read,
}
auto smb_file::remove() -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not exists()) {
@ -364,9 +346,7 @@ auto smb_file::remove() -> bool {
}
auto smb_file::size() const -> std::optional<std::uint64_t> {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (not session_) {
@ -393,9 +373,7 @@ auto smb_file::size() const -> std::optional<std::uint64_t> {
}
auto smb_file::truncate(std::size_t size) -> bool {
static constexpr const std::string_view function_name{
static_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
throw std::runtime_error("failed to truncate file|" + path_ + '|' +
@ -411,9 +389,7 @@ auto smb_file::truncate(std::size_t size) -> bool {
auto smb_file::write(const unsigned char *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_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
try {
if (total_written != nullptr) {

View File

@ -56,9 +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_cast<const char *>(__FUNCTION__),
};
REPERTORY_USES_FUNCTION_NAME();
static std::mutex mtx{};
mutex_lock lock{mtx};

View File

@ -394,18 +394,10 @@ TEST(utils_path, absolute_can_resolve_path_variables) {
std::string home{};
#if defined(_WIN32)
home.resize(repertory::max_path_length + 1U);
auto size = ::GetEnvironmentVariableA("USERPROFILE", home.data(), 0U);
home.resize(size);
::GetEnvironmentVariableA("USERPROFILE", home.data(),
static_cast<DWORD>(home.size()));
home = utils::path::absolute(home);
auto home = utils::path::absolute(utils::get_environment_variable("USERPROFILE"));
EXPECT_STREQ(home.c_str(), utils::path::absolute("%USERPROFILE%").c_str());
#else // !defined(_WIN32)
home = std::getenv("HOME");
home = utils::path::absolute(home);
auto home = utils::path::absolute(utils::get_environment_variable("HOME"));
#endif // defined(_WIN32)
auto expanded_str = utils::path::absolute("~\\");