refactor proprocessor directives
This commit is contained in:
@ -30,29 +30,29 @@
|
||||
namespace repertory {
|
||||
class app_config final {
|
||||
public:
|
||||
[[nodiscard]] static auto default_agent_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
default_agent_name(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto default_api_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_api_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto default_data_directory(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
default_data_directory(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto default_remote_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_remote_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto default_rpc_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_rpc_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto get_provider_api_password(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
get_provider_api_password(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto get_provider_display_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
get_provider_display_name(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto get_provider_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
get_provider_name(const provider_type &prov) -> std::string;
|
||||
|
||||
public:
|
||||
app_config(const provider_type &prov, const std::string &data_directory = "");
|
||||
@ -71,7 +71,7 @@ private:
|
||||
bool enable_comm_duration_events_;
|
||||
bool enable_drive_events_;
|
||||
bool enable_max_cache_size_;
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
bool enable_mount_manager_;
|
||||
#endif
|
||||
bool enable_remote_mount_;
|
||||
@ -183,7 +183,7 @@ public:
|
||||
return encrypt_config_;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
[[nodiscard]] auto get_enable_mount_manager() const -> bool {
|
||||
return enable_mount_manager_;
|
||||
}
|
||||
@ -337,7 +337,7 @@ public:
|
||||
set_value(enable_max_cache_size_, enable_max_cache_size);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
void set_enable_mount_manager(bool enable_mount_manager) {
|
||||
set_value(enable_mount_manager_, enable_mount_manager);
|
||||
}
|
||||
@ -365,7 +365,7 @@ public:
|
||||
set_value(high_freq_interval_secs_, high_frequency_interval_secs);
|
||||
}
|
||||
|
||||
#ifdef PROJECT_TESTING
|
||||
#if defined(PROJECT_TESTING)
|
||||
void set_host_config(host_config hc) {
|
||||
config_changed_ = true;
|
||||
hc_ = std::move(hc);
|
||||
|
@ -46,10 +46,14 @@
|
||||
#endif // defined(__GNUC__)
|
||||
// clang-format on
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus)
|
||||
REPERTORY_IGNORE_WARNINGS_ENABLE()
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define WINVER 0x0602
|
||||
#define _WIN32_WINNT WINVER
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
@ -69,20 +73,20 @@ REPERTORY_IGNORE_WARNINGS_ENABLE()
|
||||
#include <pwd.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#ifdef HAS_SETXATTR
|
||||
#if defined(HAS_SETXATTR)
|
||||
#include <sys/types.h>
|
||||
#include <sys/xattr.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
#include <libproc.h>
|
||||
#include <sys/attr.h>
|
||||
#include <sys/vnode.h>
|
||||
#endif
|
||||
#if __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
#include <sys/mount.h>
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
@ -134,7 +138,7 @@ template <typename data_type>
|
||||
#include "sqlite3.h"
|
||||
#include "uuid.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#include <sddl.h>
|
||||
#include "winfsp/winfsp.hpp"
|
||||
#else
|
||||
@ -161,7 +165,7 @@ using json = nlohmann::json;
|
||||
#define REPERTORY_MIN_REMOTE_VERSION "2.0.0"
|
||||
#define REPERTORY_W L"repertory"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define REPERTORY_INVALID_HANDLE INVALID_HANDLE_VALUE
|
||||
#define REPERTORY_API_INVALID_HANDLE static_cast<std::uint64_t>(-1)
|
||||
using native_handle = HANDLE;
|
||||
@ -173,20 +177,20 @@ using native_handle = int;
|
||||
|
||||
constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef CreateDirectory
|
||||
#if defined(_WIN32)
|
||||
#if defined(CreateDirectory)
|
||||
#undef CreateDirectory
|
||||
#endif
|
||||
|
||||
#ifdef CreateFile
|
||||
#if defined(CreateFile)
|
||||
#undef CreateFile
|
||||
#endif
|
||||
|
||||
#ifdef DeleteFile
|
||||
#if defined(DeleteFile)
|
||||
#undef DeleteFile
|
||||
#endif
|
||||
|
||||
#ifdef RemoveDirectory
|
||||
#if defined(RemoveDirectory)
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
@ -255,8 +259,8 @@ constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
#define SETATTR_WANTS_FLAGS(attr) ((attr)->valid & (1 << 31))
|
||||
#endif // SETATTR_WANTS_FLAGS
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifdef __APPLE__
|
||||
#if !defined(_WIN32)
|
||||
#if defined(__APPLE__)
|
||||
#define G_PREFIX "org"
|
||||
#define G_KAUTH_FILESEC_XATTR G_PREFIX ".apple.system.Security"
|
||||
#define A_PREFIX "com"
|
||||
@ -295,7 +299,7 @@ constexpr const auto NANOS_PER_SECOND = 1000000000L;
|
||||
|
||||
#define WINFSP_ALLOCATION_UNIT UINT64(4096U)
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define UTIME_NOW ((1l << 30) - 1l)
|
||||
#define UTIME_OMIT ((1l << 30) - 2l)
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) e
|
||||
@ -346,7 +350,7 @@ using WCHAR = wchar_t;
|
||||
#define GENERIC_EXECUTE (0x20000000L)
|
||||
#define GENERIC_ALL (0x10000000L)
|
||||
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace repertory {
|
||||
class directory_iterator final {
|
||||
public:
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
using populate_stat_callback =
|
||||
std::function<void(const std::string &, std::uint64_t,
|
||||
const api_meta_map &, bool, struct stat *)>;
|
||||
@ -46,7 +46,7 @@ private:
|
||||
directory_item_list items_;
|
||||
|
||||
public:
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto fill_buffer(const remote::file_offset &offset,
|
||||
fuse_fill_dir_t filler_function, void *buffer,
|
||||
populate_stat_callback populate_stat) -> int;
|
||||
@ -56,8 +56,8 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_count() const -> std::size_t { return items_.size(); }
|
||||
|
||||
[[nodiscard]] auto get_directory_item(std::size_t offset, directory_item &di)
|
||||
-> api_error;
|
||||
[[nodiscard]] auto get_directory_item(std::size_t offset,
|
||||
directory_item &di) -> api_error;
|
||||
|
||||
[[nodiscard]] auto get_directory_item(const std::string &api_path,
|
||||
directory_item &di) -> api_error;
|
||||
@ -71,8 +71,8 @@ public:
|
||||
auto operator=(const directory_iterator &iterator) noexcept
|
||||
-> directory_iterator &;
|
||||
|
||||
auto operator=(directory_iterator &&iterator) noexcept
|
||||
-> directory_iterator &;
|
||||
auto
|
||||
operator=(directory_iterator &&iterator) noexcept -> directory_iterator &;
|
||||
|
||||
auto operator=(directory_item_list list) noexcept -> directory_iterator &;
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "utils/path_utils.hpp"
|
||||
@ -78,9 +78,9 @@ private:
|
||||
static void execute_void_callback(const std::string &function_name,
|
||||
const std::function<void()> &cb);
|
||||
|
||||
static auto execute_void_pointer_callback(const std::string &function_name,
|
||||
const std::function<void *()> &cb)
|
||||
-> void *;
|
||||
static auto
|
||||
execute_void_pointer_callback(const std::string &function_name,
|
||||
const std::function<void *()> &cb) -> void *;
|
||||
|
||||
void raise_fuse_event(std::string function_name, const std::string &api_path,
|
||||
int ret, bool disable_logging);
|
||||
@ -88,7 +88,7 @@ private:
|
||||
private:
|
||||
[[nodiscard]] static auto access_(const char *path, int mask) -> int;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto chflags_(const char *path, uint32_t flags) -> int;
|
||||
#endif // __APPLE__
|
||||
|
||||
@ -103,8 +103,8 @@ private:
|
||||
[[nodiscard]] static auto chown_(const char *path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#else
|
||||
[[nodiscard]] static auto chown_(const char *path, uid_t uid, gid_t gid)
|
||||
-> int;
|
||||
[[nodiscard]] static auto chown_(const char *path, uid_t uid,
|
||||
gid_t gid) -> int;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] static auto create_(const char *path, mode_t mode,
|
||||
@ -113,15 +113,15 @@ private:
|
||||
static void destroy_(void *ptr);
|
||||
|
||||
[[nodiscard]] static auto fallocate_(const char *path, int mode, off_t offset,
|
||||
off_t length, struct fuse_file_info *fi)
|
||||
-> int;
|
||||
off_t length,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
|
||||
#if FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto fgetattr_(const char *path, struct stat *st,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto fsetattr_x_(const char *path,
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
@ -140,7 +140,7 @@ private:
|
||||
[[nodiscard]] static auto getattr_(const char *path, struct stat *st) -> int;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto getxtimes_(const char *path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime) -> int;
|
||||
@ -155,8 +155,8 @@ private:
|
||||
|
||||
[[nodiscard]] static auto mkdir_(const char *path, mode_t mode) -> int;
|
||||
|
||||
[[nodiscard]] static auto open_(const char *path, struct fuse_file_info *fi)
|
||||
-> int;
|
||||
[[nodiscard]] static auto open_(const char *path,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
|
||||
[[nodiscard]] static auto opendir_(const char *path,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
@ -173,8 +173,8 @@ private:
|
||||
#else
|
||||
[[nodiscard]] static auto readdir_(const char *path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *fi)
|
||||
-> int;
|
||||
off_t offset,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] static auto release_(const char *path,
|
||||
@ -192,8 +192,8 @@ private:
|
||||
|
||||
[[nodiscard]] static auto rmdir_(const char *path) -> int;
|
||||
|
||||
#ifdef HAS_SETXATTR
|
||||
#ifdef __APPLE__
|
||||
#if defined(HAS_SETXATTR)
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto getxattr_(const char *path, const char *name,
|
||||
char *value, size_t size,
|
||||
uint32_t position) -> int;
|
||||
@ -206,28 +206,27 @@ private:
|
||||
[[nodiscard]] static auto listxattr_(const char *path, char *buffer,
|
||||
size_t size) -> int;
|
||||
|
||||
[[nodiscard]] static auto removexattr_(const char *path, const char *name)
|
||||
-> int;
|
||||
[[nodiscard]] static auto removexattr_(const char *path,
|
||||
const char *name) -> int;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto setxattr_(const char *path, const char *name,
|
||||
const char *value, size_t size, int flags,
|
||||
uint32_t position) -> int;
|
||||
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] static auto setxattr_(const char *path, const char *name,
|
||||
const char *value, size_t size, int flags)
|
||||
-> int;
|
||||
const char *value, size_t size,
|
||||
int flags) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // HAS_SETXATTR
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] static auto setattr_x_(const char *path, struct setattr_x *attr)
|
||||
-> int;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto setattr_x_(const char *path,
|
||||
struct setattr_x *attr) -> int;
|
||||
|
||||
[[nodiscard]] static auto setbkuptime_(const char *path,
|
||||
const struct timespec *bkuptime)
|
||||
-> int;
|
||||
[[nodiscard]] static auto
|
||||
setbkuptime_(const char *path, const struct timespec *bkuptime) -> int;
|
||||
|
||||
[[nodiscard]] static auto setchgtime_(const char *path,
|
||||
const struct timespec *chgtime) -> int;
|
||||
@ -237,12 +236,12 @@ private:
|
||||
|
||||
[[nodiscard]] static auto setvolname_(const char *volname) -> int;
|
||||
|
||||
[[nodiscard]] static auto statfs_x_(const char *path, struct statfs *stbuf)
|
||||
-> int;
|
||||
[[nodiscard]] static auto statfs_x_(const char *path,
|
||||
struct statfs *stbuf) -> int;
|
||||
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] static auto statfs_(const char *path, struct statvfs *stbuf)
|
||||
-> int;
|
||||
[[nodiscard]] static auto statfs_(const char *path,
|
||||
struct statvfs *stbuf) -> int;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
@ -268,12 +267,12 @@ private:
|
||||
struct fuse_file_info *fi) -> int;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] virtual auto access_impl(std::string /*api_path*/, int /*mask*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto access_impl(std::string /*api_path*/,
|
||||
int /*mask*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto chflags_impl(std::string /*api_path*/,
|
||||
uint32_t /*flags*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
@ -281,10 +280,9 @@ protected:
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] virtual auto chmod_impl(std::string /*api_path*/,
|
||||
mode_t /*mode*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
chmod_impl(std::string /*api_path*/, mode_t /*mode*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
@ -295,10 +293,9 @@ protected:
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] virtual auto chown_impl(std::string /*api_path*/, uid_t /*uid*/,
|
||||
gid_t /*gid*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
chown_impl(std::string /*api_path*/, uid_t /*uid*/, gid_t /*gid*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
@ -308,10 +305,9 @@ protected:
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] virtual auto create_impl(std::string /*api_path*/,
|
||||
mode_t /*mode*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
create_impl(std::string /*api_path*/, mode_t /*mode*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
@ -319,48 +315,43 @@ protected:
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
fallocate_impl(std::string /*api_path*/, int /*mode*/, off_t /*offset*/,
|
||||
off_t /*length*/, struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
off_t /*length*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto fgetattr_impl(std::string /*api_path*/,
|
||||
struct stat * /*st*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
fgetattr_impl(std::string /*api_path*/, struct stat * /*st*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] virtual auto fsetattr_x_impl(std::string /*api_path*/,
|
||||
struct setattr_x * /*attr*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
fsetattr_x_impl(std::string /*api_path*/, struct setattr_x * /*attr*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
[[nodiscard]] virtual auto fsync_impl(std::string /*api_path*/,
|
||||
int /*datasync*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
fsync_impl(std::string /*api_path*/, int /*datasync*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto ftruncate_impl(std::string /*api_path*/,
|
||||
off_t /*size*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
ftruncate_impl(std::string /*api_path*/, off_t /*size*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] virtual auto getattr_impl(std::string /*api_path*/,
|
||||
struct stat * /*st*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
getattr_impl(std::string /*api_path*/, struct stat * /*st*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
@ -370,18 +361,17 @@ protected:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] virtual auto getxtimes_impl(std::string /*api_path*/,
|
||||
struct timespec * /*bkuptime*/,
|
||||
struct timespec * /*crtime*/)
|
||||
-> api_error {
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
getxtimes_impl(std::string /*api_path*/, struct timespec * /*bkuptime*/,
|
||||
struct timespec * /*crtime*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
virtual auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void *;
|
||||
virtual auto init_impl(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void *;
|
||||
#else
|
||||
virtual auto init_impl(struct fuse_conn_info *conn) -> void *;
|
||||
#endif
|
||||
@ -391,15 +381,15 @@ protected:
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto open_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
open_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto opendir_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
opendir_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
@ -414,8 +404,8 @@ protected:
|
||||
[[nodiscard]] virtual auto
|
||||
readdir_impl(std::string /*api_path*/, void * /*buf*/,
|
||||
fuse_fill_dir_t /*fuse_fill_dir*/, off_t /*offset*/,
|
||||
struct fuse_file_info * /*fi*/, fuse_readdir_flags /*flags*/)
|
||||
-> api_error {
|
||||
struct fuse_file_info * /*fi*/,
|
||||
fuse_readdir_flags /*flags*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
@ -427,15 +417,15 @@ protected:
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] virtual auto release_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
release_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto releasedir_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
releasedir_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
@ -446,9 +436,9 @@ protected:
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
[[nodiscard]] virtual auto rename_impl(std::string /*from_api_path*/,
|
||||
std::string /*to_api_path*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
rename_impl(std::string /*from_api_path*/,
|
||||
std::string /*to_api_path*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
@ -457,8 +447,8 @@ protected:
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#ifdef HAS_SETXATTR
|
||||
#ifdef __APPLE__
|
||||
#if defined(HAS_SETXATTR)
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
getxattr_impl(std::string /*api_path*/, const char * /*name*/,
|
||||
char * /*value*/, size_t /*size*/, uint32_t /*position*/,
|
||||
@ -468,8 +458,8 @@ protected:
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] virtual auto
|
||||
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 api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
@ -480,13 +470,13 @@ protected:
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto removexattr_impl(std::string /*api_path*/,
|
||||
const char * /*name*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
removexattr_impl(std::string /*api_path*/,
|
||||
const char * /*name*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto setxattr_impl(std::string /*api_path*/,
|
||||
const char * /*name*/,
|
||||
const char * /*value*/,
|
||||
@ -495,19 +485,20 @@ protected:
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] virtual auto
|
||||
setxattr_impl(std::string /*api_path*/, const char * /*name*/,
|
||||
const char * /*value*/, size_t /*size*/, int /*flags*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto setxattr_impl(std::string /*api_path*/,
|
||||
const char * /*name*/,
|
||||
const char * /*value*/,
|
||||
size_t /*size*/,
|
||||
int /*flags*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // HAS_SETXATTR
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] virtual auto setattr_x_impl(std::string /*api_path*/,
|
||||
struct setattr_x * /*attr*/)
|
||||
-> api_error {
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
setattr_x_impl(std::string /*api_path*/,
|
||||
struct setattr_x * /*attr*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
@ -518,40 +509,39 @@ protected:
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
setchgtime_impl(std::string /*api_path*/, const struct timespec * /*chgtime*/)
|
||||
-> api_error {
|
||||
setchgtime_impl(std::string /*api_path*/,
|
||||
const struct timespec * /*chgtime*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto setcrtime_impl(std::string /*api_path*/,
|
||||
const struct timespec * /*crtime*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
setcrtime_impl(std::string /*api_path*/,
|
||||
const struct timespec * /*crtime*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto setvolname_impl(const char * /*volname*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
setvolname_impl(const char * /*volname*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual auto statfs_x_impl(std::string /*api_path*/,
|
||||
struct statfs * /*stbuf*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
statfs_x_impl(std::string /*api_path*/,
|
||||
struct statfs * /*stbuf*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] virtual auto statfs_impl(std::string /*api_path*/,
|
||||
struct statvfs * /*stbuf*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
statfs_impl(std::string /*api_path*/,
|
||||
struct statvfs * /*stbuf*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] virtual auto truncate_impl(std::string /*api_path*/,
|
||||
off_t /*size*/,
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
truncate_impl(std::string /*api_path*/, off_t /*size*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
@ -561,22 +551,21 @@ protected:
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] virtual auto unlink_impl(std::string /*api_path*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
unlink_impl(std::string /*api_path*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] virtual auto utimens_impl(std::string /*api_path*/,
|
||||
const struct timespec /*tv*/[2],
|
||||
struct fuse_file_info * /*fi*/)
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
utimens_impl(std::string /*api_path*/, const struct timespec /*tv*/[2],
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
[[nodiscard]] virtual auto utimens_impl(std::string /*api_path*/,
|
||||
const struct timespec /*tv*/[2])
|
||||
-> api_error {
|
||||
[[nodiscard]] virtual auto
|
||||
utimens_impl(std::string /*api_path*/,
|
||||
const struct timespec /*tv*/[2]) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
@ -584,8 +573,8 @@ protected:
|
||||
[[nodiscard]] virtual auto
|
||||
write_impl(std::string /*api_path*/, const char * /*buffer*/,
|
||||
size_t /*write_size*/, off_t /*write_offset*/,
|
||||
struct fuse_file_info * /*fi*/, std::size_t & /*bytes_written*/)
|
||||
-> api_error {
|
||||
struct fuse_file_info * /*fi*/,
|
||||
std::size_t & /*bytes_written*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "drives/fuse/fuse_drive_base.hpp"
|
||||
#include "file_manager/file_manager.hpp"
|
||||
@ -69,96 +69,93 @@ private:
|
||||
void update_accessed_time(const std::string &api_path);
|
||||
|
||||
protected:
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path, uint32_t flags)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path,
|
||||
uint32_t flags) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path,
|
||||
mode_t mode) -> api_error override;
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid,
|
||||
gid_t gid) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
void destroy_impl(void *ptr) override;
|
||||
|
||||
[[nodiscard]] auto fallocate_impl(std::string api_path, int mode,
|
||||
off_t offset, off_t length,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
fallocate_impl(std::string api_path, int mode, off_t offset, off_t length,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto fgetattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
fgetattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto fsetattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
fsetattr_x_impl(std::string api_path, struct setattr_x *attr,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
[[nodiscard]] auto fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
getattr_impl(std::string api_path, struct stat *st,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *st)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path,
|
||||
struct stat *st) -> api_error override;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto getxtimes_impl(std::string api_path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
getxtimes_impl(std::string api_path, struct timespec *bkuptime,
|
||||
struct timespec *crtime) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * override;
|
||||
auto init_impl(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void * override;
|
||||
#else
|
||||
auto init_impl(struct fuse_conn_info *conn) -> void * override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path,
|
||||
mode_t mode) -> api_error override;
|
||||
|
||||
void notify_fuse_main_exit(int &ret) override;
|
||||
|
||||
[[nodiscard]] auto open_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
open_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto read_impl(std::string api_path, char *buffer,
|
||||
size_t read_size, off_t read_offset,
|
||||
@ -166,30 +163,29 @@ protected:
|
||||
std::size_t &bytes_read) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir, off_t offset,
|
||||
struct fuse_file_info *file_info,
|
||||
fuse_readdir_flags flags)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
readdir_impl(std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *file_info,
|
||||
fuse_readdir_flags flags) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir, off_t offset,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
readdir_impl(std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto release_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
release_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path, unsigned int flags)
|
||||
-> api_error override;
|
||||
std::string to_api_path,
|
||||
unsigned int flags) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path) -> api_error override;
|
||||
@ -197,13 +193,13 @@ protected:
|
||||
|
||||
[[nodiscard]] auto rmdir_impl(std::string api_path) -> api_error override;
|
||||
|
||||
#ifdef HAS_SETXATTR
|
||||
#if defined(HAS_SETXATTR)
|
||||
[[nodiscard]] auto getxattr_common(std::string api_path, const char *name,
|
||||
char *value, size_t size,
|
||||
int &attribute_size, uint32_t *position)
|
||||
-> api_error;
|
||||
int &attribute_size,
|
||||
uint32_t *position) -> api_error;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
|
||||
char *value, size_t size, uint32_t position,
|
||||
int &attribute_size) -> api_error override;
|
||||
@ -217,73 +213,71 @@ protected:
|
||||
size_t size, int &required_size,
|
||||
bool &return_size) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto removexattr_impl(std::string api_path, const char *name)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto removexattr_impl(std::string api_path,
|
||||
const char *name) -> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto setxattr_impl(std::string api_path, const char *name,
|
||||
const char *value, size_t size, int flags,
|
||||
uint32_t position) -> api_error override;
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] auto setxattr_impl(std::string api_path, const char *name,
|
||||
const char *value, size_t size, int flags)
|
||||
-> api_error override;
|
||||
const char *value, size_t size,
|
||||
int flags) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // HAS_SETXATTR
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setchgtime_impl(std::string api_path,
|
||||
const struct timespec *chgtime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setchgtime_impl(std::string api_path,
|
||||
const struct timespec *chgtime) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setcrtime_impl(std::string api_path,
|
||||
const struct timespec *crtime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setcrtime_impl(std::string api_path,
|
||||
const struct timespec *crtime) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setvolname_impl(const char *volname) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path, struct statfs *stbuf)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path,
|
||||
struct statfs *stbuf) -> api_error override;
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path,
|
||||
struct statvfs *stbuf) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path,
|
||||
off_t size) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto unlink_impl(std::string api_path) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
utimens_impl(std::string api_path, const struct timespec tv[2],
|
||||
struct fuse_file_info *file_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2])
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2]) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto write_impl(std::string api_path, const char *buffer,
|
||||
size_t write_size, off_t write_offset,
|
||||
struct fuse_file_info *file_info,
|
||||
std::size_t &bytes_written)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
write_impl(std::string api_path, const char *buffer, size_t write_size,
|
||||
off_t write_offset, struct fuse_file_info *file_info,
|
||||
std::size_t &bytes_written) -> api_error override;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||
@ -292,17 +286,16 @@ public:
|
||||
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
|
||||
-> directory_item_list override;
|
||||
|
||||
[[nodiscard]] auto get_file_size(const std::string &api_path) const
|
||||
-> std::uint64_t override;
|
||||
[[nodiscard]] auto
|
||||
get_file_size(const std::string &api_path) const -> std::uint64_t override;
|
||||
|
||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const -> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||
const std::string &name,
|
||||
std::string &value) const
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
get_item_meta(const std::string &api_path, const std::string &name,
|
||||
std::string &value) const -> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
|
||||
|
||||
@ -313,16 +306,16 @@ public:
|
||||
void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) const override;
|
||||
|
||||
[[nodiscard]] auto is_processing(const std::string &api_path) const
|
||||
-> bool override;
|
||||
[[nodiscard]] auto
|
||||
is_processing(const std::string &api_path) const -> bool override;
|
||||
|
||||
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path)
|
||||
-> int override;
|
||||
[[nodiscard]] auto
|
||||
rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path) -> int override;
|
||||
|
||||
[[nodiscard]] auto rename_file(const std::string &from_api_path,
|
||||
const std::string &to_api_path, bool overwrite)
|
||||
-> int override;
|
||||
const std::string &to_api_path,
|
||||
bool overwrite) -> int override;
|
||||
|
||||
void set_item_meta(const std::string &api_path, const std::string &key,
|
||||
const std::string &value) override;
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "drives/fuse/fuse_base.hpp"
|
||||
#include "drives/fuse/i_fuse_drive.hpp"
|
||||
@ -43,17 +43,16 @@ public:
|
||||
auto operator=(fuse_drive_base &&) -> fuse_drive_base & = delete;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] auto access_impl(std::string api_path, int mask)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto access_impl(std::string api_path,
|
||||
int mask) -> api_error override;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] auto check_access(const std::string &api_path, int mask) const
|
||||
-> api_error;
|
||||
[[nodiscard]] auto check_access(const std::string &api_path,
|
||||
int mask) const -> api_error;
|
||||
|
||||
[[nodiscard]] auto
|
||||
check_and_perform(const std::string &api_path, int parent_mask,
|
||||
const std::function<api_error(api_meta_map &meta)> &action)
|
||||
-> api_error;
|
||||
[[nodiscard]] auto check_and_perform(
|
||||
const std::string &api_path, int parent_mask,
|
||||
const std::function<api_error(api_meta_map &meta)> &action) -> api_error;
|
||||
|
||||
[[nodiscard]] auto get_current_gid() const -> gid_t;
|
||||
|
||||
@ -63,62 +62,57 @@ protected:
|
||||
|
||||
[[nodiscard]] auto get_effective_uid() const -> uid_t;
|
||||
|
||||
[[nodiscard]] static auto check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error;
|
||||
[[nodiscard]] static auto
|
||||
check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error) -> api_error;
|
||||
|
||||
[[nodiscard]] auto check_owner(const api_meta_map &meta) const -> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_readable(int flags,
|
||||
const api_error &fail_error)
|
||||
-> api_error;
|
||||
[[nodiscard]] static auto
|
||||
check_readable(int flags, const api_error &fail_error) -> api_error;
|
||||
|
||||
[[nodiscard]] static auto check_writeable(int flags,
|
||||
const api_error &fail_error)
|
||||
-> api_error;
|
||||
[[nodiscard]] static auto
|
||||
check_writeable(int flags, const api_error &fail_error) -> api_error;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] static auto get_flags_from_meta(const api_meta_map &meta)
|
||||
-> __uint32_t;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto
|
||||
get_flags_from_meta(const api_meta_map &meta) -> __uint32_t;
|
||||
#endif // __APPLE__
|
||||
|
||||
[[nodiscard]] static auto get_gid_from_meta(const api_meta_map &meta)
|
||||
-> gid_t;
|
||||
[[nodiscard]] static auto
|
||||
get_gid_from_meta(const api_meta_map &meta) -> gid_t;
|
||||
|
||||
[[nodiscard]] static auto get_mode_from_meta(const api_meta_map &meta)
|
||||
-> mode_t;
|
||||
[[nodiscard]] static auto
|
||||
get_mode_from_meta(const api_meta_map &meta) -> mode_t;
|
||||
|
||||
static void get_timespec_from_meta(const api_meta_map &meta,
|
||||
const std::string &name,
|
||||
struct timespec &ts);
|
||||
|
||||
[[nodiscard]] static auto get_uid_from_meta(const api_meta_map &meta)
|
||||
-> uid_t;
|
||||
[[nodiscard]] static auto
|
||||
get_uid_from_meta(const api_meta_map &meta) -> uid_t;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto parse_xattr_parameters(const char *name,
|
||||
const uint32_t &position,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
parse_xattr_parameters(const char *name, const uint32_t &position,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error;
|
||||
#else
|
||||
[[nodiscard]] auto parse_xattr_parameters(const char *name,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error;
|
||||
[[nodiscard]] auto
|
||||
parse_xattr_parameters(const char *name, std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
parse_xattr_parameters(const char *name, const char *value, size_t size,
|
||||
const uint32_t &position, std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error;
|
||||
#else
|
||||
[[nodiscard]] auto parse_xattr_parameters(const char *name, const char *value,
|
||||
size_t size,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error;
|
||||
[[nodiscard]] auto
|
||||
parse_xattr_parameters(const char *name, const char *value, size_t size,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error;
|
||||
#endif
|
||||
|
||||
static void populate_stat(const std::string &api_path,
|
||||
@ -131,8 +125,8 @@ protected:
|
||||
struct timespec &ts);
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto check_owner(const std::string &api_path) const
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
check_owner(const std::string &api_path) const -> api_error override;
|
||||
|
||||
[[nodiscard]] auto check_parent_access(const std::string &api_path,
|
||||
int mask) const -> api_error override;
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
@ -30,32 +30,29 @@ class i_fuse_drive {
|
||||
INTERFACE_SETUP(i_fuse_drive);
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto check_owner(const std::string &api_path) const
|
||||
-> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto check_parent_access(const std::string &api_path,
|
||||
int mask) const
|
||||
-> api_error = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
check_owner(const std::string &api_path) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
get_directory_item_count(const std::string &api_path) const
|
||||
-> std::uint64_t = 0;
|
||||
check_parent_access(const std::string &api_path,
|
||||
int mask) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_directory_item_count(
|
||||
const std::string &api_path) const -> std::uint64_t = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_directory_items(
|
||||
const std::string &api_path) const -> directory_item_list = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
get_directory_items(const std::string &api_path) const
|
||||
-> directory_item_list = 0;
|
||||
get_file_size(const std::string &api_path) const -> std::uint64_t = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_file_size(const std::string &api_path) const
|
||||
-> std::uint64_t = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const
|
||||
-> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
||||
const std::string &name,
|
||||
std::string &value) const
|
||||
-> api_error = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
get_item_meta(const std::string &api_path, const std::string &name,
|
||||
std::string &value) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_total_drive_space() const -> std::uint64_t = 0;
|
||||
|
||||
@ -66,12 +63,12 @@ public:
|
||||
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) const = 0;
|
||||
|
||||
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const
|
||||
-> bool = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
is_processing(const std::string &api_path) const -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path)
|
||||
-> int = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path) -> int = 0;
|
||||
|
||||
[[nodiscard]] virtual auto rename_file(const std::string &from_api_path,
|
||||
const std::string &to_api_path,
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "drives/fuse/fuse_base.hpp"
|
||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||
@ -57,94 +57,92 @@ private:
|
||||
struct stat &unix_st);
|
||||
|
||||
protected:
|
||||
[[nodiscard]] auto access_impl(std::string api_path, int mask)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto access_impl(std::string api_path,
|
||||
int mask) -> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path, uint32_t flags)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path,
|
||||
uint32_t flags) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path,
|
||||
mode_t mode) -> api_error override;
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid,
|
||||
gid_t gid) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
void destroy_impl(void * /*ptr*/) override;
|
||||
|
||||
[[nodiscard]] auto fgetattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
fgetattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto fsetattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
fsetattr_x_impl(std::string api_path, struct setattr_x *attr,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
[[nodiscard]] auto fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#endif
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path,
|
||||
struct stat *unix_st) -> api_error override;
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto getxtimes_impl(std::string api_path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
getxtimes_impl(std::string api_path, struct timespec *bkuptime,
|
||||
struct timespec *crtime) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * override;
|
||||
auto init_impl(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void * override;
|
||||
#else
|
||||
auto init_impl(struct fuse_conn_info *conn) -> void * override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path,
|
||||
mode_t mode) -> api_error override;
|
||||
|
||||
void notify_fuse_main_exit(int &ret) override;
|
||||
|
||||
[[nodiscard]] auto open_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
open_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto read_impl(std::string api_path, char *buffer,
|
||||
size_t read_size, off_t read_offset,
|
||||
@ -152,30 +150,29 @@ protected:
|
||||
std::size_t &bytes_read) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
#else
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto release_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
release_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path, unsigned int flags)
|
||||
-> api_error override;
|
||||
std::string to_api_path,
|
||||
unsigned int flags) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path) -> api_error override;
|
||||
@ -183,61 +180,59 @@ protected:
|
||||
|
||||
[[nodiscard]] auto rmdir_impl(std::string api_path) -> api_error override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr)
|
||||
-> api_error override;
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto
|
||||
setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setchgtime_impl(std::string api_path,
|
||||
const struct timespec *chgtime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setchgtime_impl(std::string api_path,
|
||||
const struct timespec *chgtime) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto setcrtime_impl(std::string api_path,
|
||||
const struct timespec *crtime)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
setcrtime_impl(std::string api_path,
|
||||
const struct timespec *crtime) -> api_error override;
|
||||
|
||||
[[nodiscard]] virtual auto setvolname_impl(const char *volname)
|
||||
-> api_error override;
|
||||
[[nodiscard]] virtual auto
|
||||
setvolname_impl(const char *volname) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path, struct statfs *stbuf)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path,
|
||||
struct statfs *stbuf) -> api_error override;
|
||||
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path,
|
||||
struct statvfs *stbuf) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path,
|
||||
off_t size) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto unlink_impl(std::string api_path) -> api_error override;
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
utimens_impl(std::string api_path, const struct timespec tv[2],
|
||||
struct fuse_file_info *f_info) -> api_error override;
|
||||
#else
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2])
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2]) -> api_error override;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto write_impl(std::string api_path, const char *buffer,
|
||||
size_t write_size, off_t write_offset,
|
||||
struct fuse_file_info *f_info,
|
||||
std::size_t &bytes_written)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
write_impl(std::string api_path, const char *buffer, size_t write_size,
|
||||
off_t write_offset, struct fuse_file_info *f_info,
|
||||
std::size_t &bytes_written) -> api_error override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "drives/directory_cache.hpp"
|
||||
#include "drives/fuse/i_fuse_drive.hpp"
|
||||
@ -46,9 +46,9 @@ private:
|
||||
|
||||
[[nodiscard]] static auto empty_as_zero(const json &data) -> std::string;
|
||||
|
||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info)
|
||||
-> packet::error_type;
|
||||
[[nodiscard]] auto
|
||||
populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info) -> packet::error_type;
|
||||
|
||||
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
||||
const UINT32 &attributes,
|
||||
@ -72,14 +72,14 @@ public:
|
||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||
|
||||
@ -88,28 +88,25 @@ public:
|
||||
remote::file_offset &length, const remote::file_handle &handle) override
|
||||
;*/
|
||||
|
||||
[[nodiscard]] auto fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto fuse_fgetattr(
|
||||
const char *path, remote::stat &r_stat, bool &directory,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto fuse_fsetattr_x(
|
||||
const char *path, const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto fuse_ftruncate(
|
||||
const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_getattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory) -> packet::error_type override;
|
||||
|
||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||
*name, char *value, const remote::file_size &size) override ;
|
||||
@ -118,10 +115,9 @@ public:
|
||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||
override ;*/
|
||||
|
||||
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||
remote::file_time &bkuptime,
|
||||
remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
||||
remote::file_time &crtime) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||
|
||||
@ -129,30 +125,28 @@ public:
|
||||
*buffer, const remote::file_size &size) override ;*/
|
||||
|
||||
[[nodiscard]] auto
|
||||
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
fuse_mkdir(const char *path,
|
||||
const remote::file_mode &mode) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_open(const char *path,
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
|
||||
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto fuse_rename(const char *from,
|
||||
const char *to) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path)
|
||||
-> packet::error_type override;
|
||||
const remote::file_handle &handle,
|
||||
std::string &item_path) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
@ -166,8 +160,8 @@ public:
|
||||
* char *name) override
|
||||
* ;*/
|
||||
|
||||
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_rmdir(const char *path) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||
-> packet::error_type override;
|
||||
@ -184,8 +178,8 @@ public:
|
||||
const remote::file_time &crtime)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_setvolname(const char *volname) -> packet::error_type override;
|
||||
|
||||
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||
@ -195,70 +189,67 @@ public:
|
||||
char *name, const char *value, const remote::file_size &size, const
|
||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||
|
||||
[[nodiscard]] auto fuse_statfs(const char *path, std::uint64_t frsize,
|
||||
remote::statfs &r_stat)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_statfs(const char *path, std::uint64_t frsize,
|
||||
remote::statfs &r_stat) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
remote::statfs_x &r_stat)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
remote::statfs_x &r_stat) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_truncate(const char *path,
|
||||
const remote::file_offset &size) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_unlink(const char *path) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
||||
std::uint64_t op1) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto 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 override;
|
||||
|
||||
void set_fuse_uid_gid(const remote::user_id &,
|
||||
const remote::group_id &) override {}
|
||||
|
||||
// JSON Layer
|
||||
[[nodiscard]] auto winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
||||
PVOID *& /*ptr*/)
|
||||
-> packet::error_type override {
|
||||
[[nodiscard]] auto
|
||||
winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
||||
PVOID *& /*ptr*/) -> packet::error_type override {
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto json_create_directory_snapshot(
|
||||
const std::string &path, json &json_data) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto json_read_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto json_release_directory_snapshot(
|
||||
const std::string &path,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
// WinFSP Layer
|
||||
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||
UINT32 flags, BOOLEAN &was_closed)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||
BOOLEAN &was_closed) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_close(PVOID file_desc)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
@ -273,63 +264,57 @@ public:
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t * /*security_descriptor_size*/,
|
||||
std::wstring & /*str_descriptor*/) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_get_volume_info(
|
||||
UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t * /*security_descriptor_size*/,
|
||||
std::wstring & /*str_descriptor*/)
|
||||
-> packet::error_type override;
|
||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_get_volume_info(UINT64 &total_size,
|
||||
UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
|
||||
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto 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 override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, PWSTR marker,
|
||||
json &itemList) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
UINT32 length, PUINT32 bytes_transferred)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
PWSTR marker, json &itemList)
|
||||
-> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto 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 override;
|
||||
|
||||
[[nodiscard]] auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
[[nodiscard]] auto
|
||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
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 override;
|
||||
PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
};
|
||||
} // namespace remote_fuse
|
||||
} // namespace repertory
|
||||
|
@ -61,27 +61,27 @@ protected:
|
||||
|
||||
virtual void delete_open_directory(void *dir) = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
[[nodiscard]] auto get_directory_buffer(const native_handle &handle,
|
||||
PVOID *&buffer) -> bool;
|
||||
#endif // _WIN32
|
||||
|
||||
[[nodiscard]] auto get_open_file_path(const native_handle &handle)
|
||||
-> std::string;
|
||||
[[nodiscard]] auto
|
||||
get_open_file_path(const native_handle &handle) -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_open_info(const native_handle &handle, open_info &oi)
|
||||
-> bool;
|
||||
[[nodiscard]] auto get_open_info(const native_handle &handle,
|
||||
open_info &oi) -> bool;
|
||||
|
||||
[[nodiscard]] auto has_open_directory(const std::string &client_id, void *dir)
|
||||
-> bool;
|
||||
[[nodiscard]] auto has_open_directory(const std::string &client_id,
|
||||
void *dir) -> bool;
|
||||
|
||||
[[nodiscard]] auto has_compat_open_info(const remote::file_handle &handle,
|
||||
int error_return) -> int;
|
||||
|
||||
template <typename error_type>
|
||||
[[nodiscard]] auto has_open_info(const native_handle &handle,
|
||||
const error_type &error_return)
|
||||
-> error_type {
|
||||
[[nodiscard]] auto
|
||||
has_open_info(const native_handle &handle,
|
||||
const error_type &error_return) -> error_type {
|
||||
recur_mutex_lock file_lock(file_mutex_);
|
||||
return ((file_lookup_.find(handle) == file_lookup_.end()) ? error_return
|
||||
: 0);
|
||||
@ -106,8 +106,8 @@ protected:
|
||||
void set_open_info(const native_handle &handle, open_info oi);
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_open_file_count(const std::string &file_path) const
|
||||
-> std::size_t;
|
||||
[[nodiscard]] auto
|
||||
get_open_file_count(const std::string &file_path) const -> std::size_t;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
allocation_size, &file_desc, &file_info,
|
||||
normalized_name, exists);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
this->set_client_id(file_desc, client_id);
|
||||
#else
|
||||
this->set_client_id(
|
||||
@ -277,7 +277,7 @@ public:
|
||||
granted_access, &file_desc, &file_info,
|
||||
normalized_name);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
this->set_client_id(file_desc, client_id);
|
||||
#else
|
||||
this->set_client_id(
|
||||
@ -585,7 +585,7 @@ public:
|
||||
remote::file_handle handle{};
|
||||
if ((ret = this->fuse_create(path.data(), mode, flags, handle)) >=
|
||||
0) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
this->set_compat_client_id(handle, client_id);
|
||||
#else
|
||||
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
||||
@ -840,7 +840,7 @@ public:
|
||||
|
||||
remote::file_handle handle;
|
||||
if ((ret = this->fuse_open(&path[0], flags, handle)) >= 0) {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
this->set_compat_client_id(handle, client_id);
|
||||
#else
|
||||
this->set_client_id(static_cast<native_handle>(handle), client_id);
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -31,25 +31,22 @@ class i_winfsp_drive {
|
||||
INTERFACE_SETUP(i_winfsp_drive);
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto
|
||||
get_directory_item_count(const std::string &api_path) const
|
||||
-> std::uint64_t = 0;
|
||||
[[nodiscard]] virtual auto get_directory_item_count(
|
||||
const std::string &api_path) const -> std::uint64_t = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_directory_items(
|
||||
const std::string &api_path) const -> directory_item_list = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
get_directory_items(const std::string &api_path) const
|
||||
-> directory_item_list = 0;
|
||||
get_file_size(const std::string &api_path) const -> std::uint64_t = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_file_size(const std::string &api_path) const
|
||||
-> std::uint64_t = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
get_item_meta(const std::string &api_path, const std::string &name,
|
||||
std::string &value) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
||||
const std::string &name,
|
||||
std::string &value) const
|
||||
-> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const
|
||||
-> api_error = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
@ -65,9 +62,9 @@ public:
|
||||
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) const = 0;
|
||||
|
||||
[[nodiscard]] virtual auto populate_file_info(const std::string &api_path,
|
||||
remote::file_info &fi)
|
||||
-> api_error = 0;
|
||||
[[nodiscard]] virtual auto
|
||||
populate_file_info(const std::string &api_path,
|
||||
remote::file_info &fi) -> api_error = 0;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
packet_client packet_client_;
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define to_handle(x) (x)
|
||||
#else
|
||||
static auto to_handle(PVOID file_desc) -> native_handle;
|
||||
@ -53,17 +53,16 @@ public:
|
||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto json_read_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data)
|
||||
-> packet::error_type override;
|
||||
auto json_read_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||
|
||||
auto json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_can_delete(PVOID file_desc,
|
||||
PWSTR file_name) -> packet::error_type override;
|
||||
|
||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||
BOOLEAN &was_closed) -> packet::error_type override;
|
||||
@ -79,33 +78,32 @@ public:
|
||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_get_dir_buffer(PVOID file_desc,
|
||||
PVOID *&ptr) -> packet::error_type override;
|
||||
|
||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor) -> packet::error_type override;
|
||||
|
||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_mounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name) -> packet::error_type override;
|
||||
|
||||
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||
@ -116,24 +114,23 @@ public:
|
||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto 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 override;
|
||||
|
||||
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
auto winfsp_unmounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto
|
||||
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 override;
|
||||
};
|
||||
} // namespace remote_winfsp
|
||||
} // namespace repertory
|
||||
|
@ -23,7 +23,7 @@
|
||||
// https://github.com/billziss-gh/winfsp/blob/master/tst/passthrough-cpp/passthrough-cpp.cpp
|
||||
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
||||
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "comm/packet/packet.hpp"
|
||||
#include "drives/remote/remote_server_base.hpp"
|
||||
@ -42,23 +42,23 @@ public:
|
||||
private:
|
||||
[[nodiscard]] auto construct_path(std::string path) -> std::string;
|
||||
|
||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info)
|
||||
-> packet::error_type;
|
||||
[[nodiscard]] auto
|
||||
populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info) -> packet::error_type;
|
||||
|
||||
void populate_stat(const char *path, bool directory, remote::stat &r_stat,
|
||||
const struct _stat64 &unix_st);
|
||||
|
||||
public:
|
||||
// FUSE Layer
|
||||
auto fuse_access(const char *path, const std::int32_t &mask)
|
||||
-> packet::error_type override;
|
||||
auto fuse_access(const char *path,
|
||||
const std::int32_t &mask) -> packet::error_type override;
|
||||
|
||||
auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||
-> packet::error_type override;
|
||||
auto fuse_chflags(const char *path,
|
||||
std::uint32_t flags) -> packet::error_type override;
|
||||
|
||||
auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
auto fuse_chmod(const char *path,
|
||||
const remote::file_mode &mode) -> packet::error_type override;
|
||||
|
||||
auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||
const remote::group_id &gid) -> packet::error_type override;
|
||||
@ -77,16 +77,16 @@ public:
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
const remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
auto fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto fuse_getattr(const char *path, remote::stat &r_stat, bool &directory)
|
||||
-> packet::error_type override;
|
||||
auto fuse_getattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory) -> packet::error_type override;
|
||||
|
||||
/*packet::error_type fuse_getxattr(const char *path, const char *name, char
|
||||
*value, const remote::file_size &size) override ;
|
||||
@ -103,43 +103,41 @@ public:
|
||||
const remote::file_size &size) override
|
||||
;*/
|
||||
|
||||
auto fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||
-> packet::error_type override;
|
||||
auto fuse_mkdir(const char *path,
|
||||
const remote::file_mode &mode) -> packet::error_type override;
|
||||
|
||||
auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
auto fuse_opendir(const char *path,
|
||||
remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
auto fuse_create(const char *path, const remote::file_mode &mode,
|
||||
const remote::open_flags &flags, remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
const remote::open_flags &flags,
|
||||
remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
auto fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto
|
||||
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 override;
|
||||
|
||||
auto fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type override;
|
||||
auto fuse_rename(const char *from,
|
||||
const char *to) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto
|
||||
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 override;
|
||||
|
||||
auto 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 override;
|
||||
auto 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 override;
|
||||
|
||||
auto fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||
const remote::file_handle &handle, std::string &item_path)
|
||||
-> packet::error_type override;
|
||||
const remote::file_handle &handle,
|
||||
std::string &item_path) -> packet::error_type override;
|
||||
|
||||
auto fuse_release(const char *path, const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
@ -152,8 +150,8 @@ public:
|
||||
|
||||
auto fuse_rmdir(const char *path) -> packet::error_type override;
|
||||
|
||||
auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||
-> packet::error_type override;
|
||||
auto fuse_setattr_x(const char *path,
|
||||
remote::setattr_x &attr) -> packet::error_type override;
|
||||
|
||||
auto fuse_setbkuptime(const char *path, const remote::file_time &bkuptime)
|
||||
-> packet::error_type override;
|
||||
@ -186,8 +184,8 @@ public:
|
||||
auto fuse_unlink(const char *path) -> packet::error_type override;
|
||||
|
||||
auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type override;
|
||||
std::uint64_t op0,
|
||||
std::uint64_t op1) -> packet::error_type override;
|
||||
|
||||
void set_fuse_uid_gid(const remote::user_id & /* uid */,
|
||||
const remote::group_id & /* gid */) override {}
|
||||
@ -196,18 +194,17 @@ public:
|
||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto json_read_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data)
|
||||
-> packet::error_type override;
|
||||
auto json_read_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle,
|
||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||
|
||||
auto json_release_directory_snapshot(const std::string &path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type override;
|
||||
|
||||
// WinFSP Layer
|
||||
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_can_delete(PVOID file_desc,
|
||||
PWSTR file_name) -> packet::error_type override;
|
||||
|
||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||
BOOLEAN &was_closed) -> packet::error_type override;
|
||||
@ -223,33 +220,32 @@ public:
|
||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_get_dir_buffer(PVOID file_desc,
|
||||
PVOID *&ptr) -> packet::error_type override;
|
||||
|
||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor) -> packet::error_type override;
|
||||
|
||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type override;
|
||||
|
||||
auto winfsp_mounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name) -> packet::error_type override;
|
||||
|
||||
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||
@ -260,24 +256,23 @@ public:
|
||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto 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 override;
|
||||
|
||||
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type override;
|
||||
auto winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type override;
|
||||
|
||||
auto winfsp_unmounted(const std::wstring &location)
|
||||
-> packet::error_type override;
|
||||
auto
|
||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
||||
|
||||
auto 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 override;
|
||||
auto
|
||||
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 override;
|
||||
};
|
||||
} // namespace remote_winfsp
|
||||
} // namespace repertory
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
@ -75,8 +75,8 @@ private:
|
||||
static void set_file_info(FileInfo &dest, const remote::file_info &src);
|
||||
|
||||
public:
|
||||
auto CanDelete(PVOID file_node, PVOID file_desc, PWSTR file_name)
|
||||
-> NTSTATUS override;
|
||||
auto CanDelete(PVOID file_node, PVOID file_desc,
|
||||
PWSTR file_name) -> NTSTATUS override;
|
||||
|
||||
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||
ULONG flags) override;
|
||||
@ -88,11 +88,11 @@ public:
|
||||
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||
|
||||
auto Flush(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
auto Flush(PVOID file_node, PVOID file_desc,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
auto GetFileInfo(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
auto GetFileInfo(PVOID file_node, PVOID file_desc,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
||||
PSECURITY_DESCRIPTOR descriptor,
|
||||
@ -107,8 +107,8 @@ public:
|
||||
auto Mounted(PVOID host) -> NTSTATUS override;
|
||||
|
||||
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_node, PVOID *file_desc, OpenFileInfo *ofi)
|
||||
-> NTSTATUS override;
|
||||
PVOID *file_node, PVOID *file_desc,
|
||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||
|
||||
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
@ -122,8 +122,8 @@ public:
|
||||
PULONG bytes_transferred) -> NTSTATUS override;
|
||||
|
||||
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
||||
-> NTSTATUS override;
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> NTSTATUS override;
|
||||
|
||||
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||
UINT64 creation_time, UINT64 last_access_time,
|
||||
@ -131,15 +131,15 @@ public:
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
BOOLEAN set_allocation_size,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
VOID Unmounted(PVOID host) override;
|
||||
|
||||
auto 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 override;
|
||||
PULONG bytes_transferred,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
void shutdown() { ::GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); }
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
||||
#define INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "drives/eviction.hpp"
|
||||
#include "drives/winfsp/i_winfsp_drive.hpp"
|
||||
@ -75,8 +75,8 @@ private:
|
||||
std::unique_ptr<remote_winfsp::remote_server> remote_server_;
|
||||
|
||||
private:
|
||||
static auto parse_mount_location(const std::wstring &mount_location)
|
||||
-> std::string;
|
||||
static auto
|
||||
parse_mount_location(const std::wstring &mount_location) -> std::string;
|
||||
|
||||
void populate_file_info(const std::string &api_path, std::uint64_t file_size,
|
||||
const api_meta_map &meta,
|
||||
@ -89,8 +89,8 @@ private:
|
||||
const FSP_FSCTL_FILE_INFO &src);
|
||||
|
||||
public:
|
||||
auto CanDelete(PVOID file_node, PVOID file_desc, PWSTR file_name)
|
||||
-> NTSTATUS override;
|
||||
auto CanDelete(PVOID file_node, PVOID file_desc,
|
||||
PWSTR file_name) -> NTSTATUS override;
|
||||
|
||||
VOID Cleanup(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||
ULONG flags) override;
|
||||
@ -102,8 +102,8 @@ public:
|
||||
UINT64 allocation_size, PVOID *file_node, PVOID *file_desc,
|
||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||
|
||||
auto Flush(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
auto Flush(PVOID file_node, PVOID file_desc,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||
-> std::uint64_t override;
|
||||
@ -111,25 +111,24 @@ public:
|
||||
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
|
||||
-> directory_item_list override;
|
||||
|
||||
auto GetFileInfo(PVOID file_node, PVOID file_desc, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
auto GetFileInfo(PVOID file_node, PVOID file_desc,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
[[nodiscard]] auto get_file_size(const std::string &api_path) const
|
||||
-> std::uint64_t override;
|
||||
[[nodiscard]] auto
|
||||
get_file_size(const std::string &api_path) const -> std::uint64_t override;
|
||||
|
||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
get_item_meta(const std::string &api_path,
|
||||
api_meta_map &meta) const -> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_item_meta(const std::string &api_path,
|
||||
const std::string &name,
|
||||
std::string &value) const
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
get_item_meta(const std::string &api_path, const std::string &name,
|
||||
std::string &value) const -> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
PSECURITY_DESCRIPTOR descriptor,
|
||||
std::uint64_t *descriptor_size)
|
||||
-> NTSTATUS override;
|
||||
[[nodiscard]] auto
|
||||
get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||
PSECURITY_DESCRIPTOR descriptor,
|
||||
std::uint64_t *descriptor_size) -> NTSTATUS override;
|
||||
|
||||
auto GetSecurityByName(PWSTR file_name, PUINT32 attributes,
|
||||
PSECURITY_DESCRIPTOR descriptor,
|
||||
@ -153,16 +152,16 @@ public:
|
||||
auto Mounted(PVOID host) -> NTSTATUS override;
|
||||
|
||||
auto Open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_node, PVOID *file_desc, OpenFileInfo *ofi)
|
||||
-> NTSTATUS override;
|
||||
PVOID *file_node, PVOID *file_desc,
|
||||
OpenFileInfo *ofi) -> NTSTATUS override;
|
||||
|
||||
auto Overwrite(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
populate_file_info(const std::string &api_path,
|
||||
remote::file_info &file_info) -> api_error override;
|
||||
|
||||
auto Read(PVOID file_node, PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
ULONG length, PULONG bytes_transferred) -> NTSTATUS override;
|
||||
@ -172,8 +171,8 @@ public:
|
||||
PULONG bytes_transferred) -> NTSTATUS override;
|
||||
|
||||
auto Rename(PVOID file_node, PVOID file_desc, PWSTR file_name,
|
||||
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
||||
-> NTSTATUS override;
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> NTSTATUS override;
|
||||
|
||||
auto SetBasicInfo(PVOID file_node, PVOID file_desc, UINT32 attributes,
|
||||
UINT64 creation_time, UINT64 last_access_time,
|
||||
@ -181,15 +180,15 @@ public:
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
auto SetFileSize(PVOID file_node, PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size, FileInfo *file_info)
|
||||
-> NTSTATUS override;
|
||||
BOOLEAN set_allocation_size,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
VOID Unmounted(PVOID host) override;
|
||||
|
||||
auto 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 override;
|
||||
PULONG bytes_transferred,
|
||||
FileInfo *file_info) -> NTSTATUS override;
|
||||
|
||||
void shutdown();
|
||||
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
|
||||
private:
|
||||
void process_event(const event &e) {
|
||||
#ifdef _WIN32
|
||||
#ifdef _DEBUG
|
||||
#if defined(_WIN32)
|
||||
#if defined(_DEBUG)
|
||||
OutputDebugString((e.get_single_line() + "\n").c_str());
|
||||
#endif
|
||||
#endif
|
||||
|
@ -289,7 +289,7 @@ E_SIMPLE1(service_started, debug, true,
|
||||
);
|
||||
|
||||
E_SIMPLE(unmount_requested, normal, true);
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
E_SIMPLE2(unmount_result, normal, true,
|
||||
std::string, location, loc, E_STRING,
|
||||
std::string, result, res, E_STRING
|
||||
|
@ -57,8 +57,8 @@ public:
|
||||
open_file_base(const open_file_base &) noexcept = delete;
|
||||
open_file_base(open_file_base &&) noexcept = delete;
|
||||
auto operator=(open_file_base &&) noexcept -> open_file_base & = delete;
|
||||
auto operator=(const open_file_base &) noexcept
|
||||
-> open_file_base & = delete;
|
||||
auto
|
||||
operator=(const open_file_base &) noexcept -> open_file_base & = delete;
|
||||
|
||||
public:
|
||||
class download final {
|
||||
@ -168,14 +168,14 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_filesystem_item() const -> filesystem_item override;
|
||||
|
||||
[[nodiscard]] auto get_handles() const
|
||||
-> std::vector<std::uint64_t> override;
|
||||
[[nodiscard]] auto
|
||||
get_handles() const -> std::vector<std::uint64_t> override;
|
||||
|
||||
[[nodiscard]] auto get_open_data() const
|
||||
-> std::map<std::uint64_t, open_file_data> override;
|
||||
[[nodiscard]] auto
|
||||
get_open_data() const -> std::map<std::uint64_t, open_file_data> override;
|
||||
|
||||
[[nodiscard]] auto get_open_data(std::uint64_t handle) const
|
||||
-> open_file_data override;
|
||||
[[nodiscard]] auto
|
||||
get_open_data(std::uint64_t handle) const -> open_file_data override;
|
||||
|
||||
[[nodiscard]] auto get_open_file_count() const -> std::size_t override;
|
||||
|
||||
@ -261,8 +261,8 @@ public:
|
||||
public:
|
||||
auto close() -> bool override;
|
||||
|
||||
[[nodiscard]] auto get_read_state() const
|
||||
-> boost::dynamic_bitset<> override;
|
||||
[[nodiscard]] auto
|
||||
get_read_state() const -> boost::dynamic_bitset<> override;
|
||||
|
||||
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
||||
|
||||
@ -270,20 +270,20 @@ public:
|
||||
|
||||
auto is_write_supported() const -> bool override { return true; }
|
||||
|
||||
[[nodiscard]] auto native_operation(native_operation_callback callback)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
native_operation(native_operation_callback callback) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto native_operation(std::uint64_t new_file_size,
|
||||
native_operation_callback callback)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
native_operation(std::uint64_t new_file_size,
|
||||
native_operation_callback callback) -> api_error override;
|
||||
|
||||
void remove(std::uint64_t handle) override;
|
||||
|
||||
[[nodiscard]] auto read(std::size_t read_size, std::uint64_t read_offset,
|
||||
data_buffer &data) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto resize(std::uint64_t new_file_size)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
resize(std::uint64_t new_file_size) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto write(std::uint64_t write_offset,
|
||||
const data_buffer &data,
|
||||
@ -350,8 +350,8 @@ public:
|
||||
return last_chunk_;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_read_state() const
|
||||
-> boost::dynamic_bitset<> override;
|
||||
[[nodiscard]] auto
|
||||
get_read_state() const -> boost::dynamic_bitset<> override;
|
||||
|
||||
[[nodiscard]] auto get_read_state(std::size_t chunk) const -> bool override;
|
||||
|
||||
@ -363,12 +363,12 @@ public:
|
||||
|
||||
auto is_write_supported() const -> bool override { return false; }
|
||||
|
||||
[[nodiscard]] auto native_operation(native_operation_callback callback)
|
||||
-> api_error override;
|
||||
[[nodiscard]] auto
|
||||
native_operation(native_operation_callback callback) -> api_error override;
|
||||
|
||||
[[nodiscard]] auto native_operation(std::uint64_t,
|
||||
native_operation_callback)
|
||||
-> api_error override {
|
||||
[[nodiscard]] auto
|
||||
native_operation(std::uint64_t,
|
||||
native_operation_callback) -> api_error override {
|
||||
return api_error::not_supported;
|
||||
}
|
||||
|
||||
@ -385,8 +385,8 @@ public:
|
||||
|
||||
void set_api_path(const std::string &api_path) override;
|
||||
|
||||
[[nodiscard]] auto write(std::uint64_t, const data_buffer &, std::size_t &)
|
||||
-> api_error override {
|
||||
[[nodiscard]] auto write(std::uint64_t, const data_buffer &,
|
||||
std::size_t &) -> api_error override {
|
||||
return api_error::not_supported;
|
||||
}
|
||||
};
|
||||
@ -530,10 +530,10 @@ public:
|
||||
|
||||
[[nodiscard]] auto has_no_open_file_handles() const -> bool override;
|
||||
|
||||
[[nodiscard]] auto is_processing(const std::string &api_path) const
|
||||
-> bool override;
|
||||
[[nodiscard]] auto
|
||||
is_processing(const std::string &api_path) const -> bool override;
|
||||
|
||||
#ifdef PROJECT_TESTING
|
||||
#if defined(PROJECT_TESTING)
|
||||
[[nodiscard]] auto open(std::shared_ptr<i_closeable_open_file> of,
|
||||
const open_file_data &ofd, std::uint64_t &handle,
|
||||
std::shared_ptr<i_open_file> &file) -> api_error;
|
||||
@ -544,13 +544,13 @@ public:
|
||||
|
||||
[[nodiscard]] auto remove_file(const std::string &api_path) -> api_error;
|
||||
|
||||
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path)
|
||||
-> api_error;
|
||||
[[nodiscard]] auto
|
||||
rename_directory(const std::string &from_api_path,
|
||||
const std::string &to_api_path) -> api_error;
|
||||
|
||||
[[nodiscard]] auto 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;
|
||||
|
||||
void start();
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||
#define INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
@ -51,9 +51,8 @@ private:
|
||||
[[nodiscard]] auto get_lock_file() -> std::string;
|
||||
|
||||
private:
|
||||
[[nodiscard]] static auto wait_for_lock(int fd,
|
||||
std::uint8_t retry_count = 30u)
|
||||
-> int;
|
||||
[[nodiscard]] static auto
|
||||
wait_for_lock(int fd, std::uint8_t retry_count = 30u) -> int;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_mount_state(json &mount_state) -> bool;
|
||||
@ -61,8 +60,8 @@ public:
|
||||
[[nodiscard]] auto grab_lock(std::uint8_t retry_count = 30u) -> lock_result;
|
||||
|
||||
[[nodiscard]] auto set_mount_state(bool active,
|
||||
const std::string &mount_location, int pid)
|
||||
-> bool;
|
||||
const std::string &mount_location,
|
||||
int pid) -> bool;
|
||||
};
|
||||
|
||||
[[nodiscard]] auto create_meta_attributes(
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||
#define INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -54,8 +54,8 @@ private:
|
||||
DWORD mutex_state_ = WAIT_FAILED;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_mount_state(const provider_type &pt, json &mount_state)
|
||||
-> bool;
|
||||
[[nodiscard]] auto get_mount_state(const provider_type &pt,
|
||||
json &mount_state) -> bool;
|
||||
|
||||
[[nodiscard]] auto get_mount_state(json &mount_state) -> bool;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define PACKET_SERVICE_FUSE 1U
|
||||
#define PACKET_SERVICE_WINFSP 2U
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
#define PACKET_SERVICE_FLAGS PACKET_SERVICE_WINFSP
|
||||
#else
|
||||
#define PACKET_SERVICE_FLAGS PACKET_SERVICE_FUSE
|
||||
@ -65,14 +65,14 @@ enum class open_flags : std::uint32_t {
|
||||
dsync = 131072U,
|
||||
};
|
||||
|
||||
inline auto operator|(const open_flags &flag_1, const open_flags &flag_2)
|
||||
-> open_flags {
|
||||
inline auto operator|(const open_flags &flag_1,
|
||||
const open_flags &flag_2) -> open_flags {
|
||||
using t = std::underlying_type_t<open_flags>;
|
||||
return static_cast<open_flags>(static_cast<t>(flag_1) |
|
||||
static_cast<t>(flag_2));
|
||||
}
|
||||
|
||||
#ifdef __GNUG__
|
||||
#if defined(__GNUG__)
|
||||
__attribute__((unused))
|
||||
#endif
|
||||
inline auto
|
||||
@ -81,7 +81,7 @@ operator|=(open_flags &flag_1, const open_flags &flag_2) -> open_flags & {
|
||||
return flag_1;
|
||||
}
|
||||
|
||||
#ifdef __GNUG__
|
||||
#if defined(__GNUG__)
|
||||
__attribute__((unused))
|
||||
#endif
|
||||
inline auto
|
||||
@ -149,11 +149,11 @@ struct statfs_x : public statfs {
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto create_open_flags(std::uint32_t flags) -> open_flags;
|
||||
|
||||
[[nodiscard]] auto create_os_open_flags(const open_flags &flags)
|
||||
-> std::uint32_t;
|
||||
[[nodiscard]] auto
|
||||
create_os_open_flags(const open_flags &flags) -> std::uint32_t;
|
||||
#endif
|
||||
} // namespace repertory::remote
|
||||
|
||||
|
@ -98,8 +98,8 @@ enum class api_error {
|
||||
|
||||
[[nodiscard]] auto api_error_from_string(std::string_view s) -> api_error;
|
||||
|
||||
[[nodiscard]] auto api_error_to_string(const api_error &error)
|
||||
-> const std::string &;
|
||||
[[nodiscard]] auto
|
||||
api_error_to_string(const api_error &error) -> const std::string &;
|
||||
|
||||
enum class download_type { direct, fallback, ring_buffer };
|
||||
|
||||
@ -145,7 +145,7 @@ enum class provider_type : std::size_t {
|
||||
unknown,
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
struct open_file_data {
|
||||
void *directory_buffer{};
|
||||
};
|
||||
@ -229,7 +229,7 @@ struct host_config {
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __GNUG__
|
||||
#if defined(__GNUG__)
|
||||
__attribute__((unused))
|
||||
#endif
|
||||
static void
|
||||
@ -244,7 +244,7 @@ to_json(json &j, const host_config &hc) {
|
||||
{"TimeoutMs", hc.timeout_ms}};
|
||||
}
|
||||
|
||||
#ifdef __GNUG__
|
||||
#if defined(__GNUG__)
|
||||
__attribute__((unused))
|
||||
#endif
|
||||
static void
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace repertory {
|
||||
namespace utils::aws {
|
||||
#if _WIN32
|
||||
#if defined(_WIN32)
|
||||
[[nodiscard]] inline auto format_time(std::uint64_t t) -> std::uint64_t {
|
||||
FILETIME ft{};
|
||||
utils::unix_time_to_filetime(t, ft);
|
||||
@ -75,7 +75,7 @@ struct head_object_result {
|
||||
if (not date.empty()) {
|
||||
struct tm tm1 {};
|
||||
// Mon, 17 Dec 2012 02:14:10 GMT
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
utils::strptime(date.c_str(), "%a, %d %b %Y %H:%M:%S %Z", &tm1);
|
||||
#else
|
||||
strptime(date.c_str(), "%a, %d %b %Y %H:%M:%S %Z", &tm1);
|
||||
|
@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_COM_INIT_WRAPPER_HPP_
|
||||
#define INCLUDE_UTILS_COM_INIT_WRAPPER_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
namespace repertory {
|
||||
class com_init_wrapper {
|
||||
|
@ -39,12 +39,12 @@ public:
|
||||
return std::shared_ptr<native_file>(new native_file(handle));
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto clone(const native_file_ptr &ptr)
|
||||
-> native_file_ptr;
|
||||
[[nodiscard]] static auto
|
||||
clone(const native_file_ptr &ptr) -> native_file_ptr;
|
||||
|
||||
[[nodiscard]] static auto create_or_open(const std::string &source_path,
|
||||
bool read_only, native_file_ptr &ptr)
|
||||
-> api_error;
|
||||
bool read_only,
|
||||
native_file_ptr &ptr) -> api_error;
|
||||
|
||||
[[nodiscard]] static auto create_or_open(const std::string &source_path,
|
||||
native_file_ptr &ptr) -> api_error;
|
||||
@ -66,7 +66,7 @@ private:
|
||||
|
||||
private:
|
||||
bool auto_close{false};
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
std::recursive_mutex read_write_mutex_;
|
||||
#endif
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_handle() -> native_handle;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
[[nodiscard]] auto read_bytes(char *buffer, std::size_t read_size,
|
||||
std::uint64_t read_offset,
|
||||
std::size_t &bytes_read) -> bool;
|
||||
@ -98,7 +98,7 @@ public:
|
||||
|
||||
[[nodiscard]] auto truncate(std::uint64_t file_size) -> bool;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
[[nodiscard]] auto write_bytes(const char *buffer, std::size_t write_size,
|
||||
std::uint64_t write_offset,
|
||||
std::size_t &bytes_written) -> bool;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define INCLUDE_UTILS_PATH_UTILS_HPP_
|
||||
|
||||
namespace repertory::utils::path {
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
static const std::string directory_seperator = "\\";
|
||||
static const std::string not_directory_seperator = "/";
|
||||
#else
|
||||
@ -34,9 +34,8 @@ static const std::string not_directory_seperator = "\\";
|
||||
// Prototypes
|
||||
[[nodiscard]] auto absolute(std::string path) -> std::string;
|
||||
|
||||
[[nodiscard]] auto combine(std::string path,
|
||||
const std::vector<std::string> &paths)
|
||||
-> std::string;
|
||||
[[nodiscard]] auto
|
||||
combine(std::string path, const std::vector<std::string> &paths) -> std::string;
|
||||
|
||||
[[nodiscard]] auto create_api_path(std::string path) -> std::string;
|
||||
|
||||
@ -47,7 +46,7 @@ auto format_path(std::string &path, const std::string &sep,
|
||||
|
||||
[[nodiscard]] auto get_parent_api_path(const std::string &path) -> std::string;
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto get_parent_directory(std::string path) -> std::string;
|
||||
#endif
|
||||
|
||||
@ -57,7 +56,7 @@ auto format_path(std::string &path, const std::string &sep,
|
||||
|
||||
[[nodiscard]] auto remove_file_name(std::string path) -> std::string;
|
||||
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
[[nodiscard]] auto resolve(std::string path) -> std::string;
|
||||
#endif
|
||||
|
||||
|
@ -21,13 +21,13 @@
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_
|
||||
#define INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_
|
||||
#ifndef _WIN32
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
#if __linux__
|
||||
#if defined(__linux__)
|
||||
inline const std::array<std::string, 4U> attribute_namespaces = {
|
||||
"security",
|
||||
"system",
|
||||
@ -36,7 +36,7 @@ inline const std::array<std::string, 4U> attribute_namespaces = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
template <typename t>
|
||||
[[nodiscard]] auto convert_to_uint64(const t *ptr) -> std::uint64_t;
|
||||
#else
|
||||
@ -49,8 +49,8 @@ template <typename t>
|
||||
|
||||
[[nodiscard]] auto get_thread_id() -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto is_uid_member_of_group(const uid_t &uid, const gid_t &gid)
|
||||
-> bool;
|
||||
[[nodiscard]] auto is_uid_member_of_group(const uid_t &uid,
|
||||
const gid_t &gid) -> bool;
|
||||
|
||||
void set_last_error_code(int error_code);
|
||||
|
||||
@ -58,8 +58,8 @@ void set_last_error_code(int error_code);
|
||||
|
||||
[[nodiscard]] auto unix_error_to_windows(int err) -> std::int32_t;
|
||||
|
||||
[[nodiscard]] auto unix_time_to_windows_time(const remote::file_time &file_time)
|
||||
-> UINT64;
|
||||
[[nodiscard]] auto
|
||||
unix_time_to_windows_time(const remote::file_time &file_time) -> UINT64;
|
||||
|
||||
void use_getpwuid(uid_t uid, std::function<void(struct passwd *pass)> callback);
|
||||
|
||||
@ -67,11 +67,11 @@ void windows_create_to_unix(const UINT32 &create_options,
|
||||
const UINT32 &granted_access, std::uint32_t &flags,
|
||||
remote::file_mode &mode);
|
||||
|
||||
[[nodiscard]] auto windows_time_to_unix_time(std::uint64_t win_time)
|
||||
-> remote::file_time;
|
||||
[[nodiscard]] auto
|
||||
windows_time_to_unix_time(std::uint64_t win_time) -> remote::file_time;
|
||||
|
||||
// template implementations
|
||||
#if __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
template <typename t>
|
||||
[[nodiscard]] auto convert_to_uint64(const t *v) -> std::uint64_t {
|
||||
return static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(v));
|
||||
|
@ -21,30 +21,30 @@
|
||||
*/
|
||||
#ifndef INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_
|
||||
#define INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory::utils {
|
||||
[[nodiscard]] auto filetime_to_unix_time(const FILETIME &ft)
|
||||
-> remote::file_time;
|
||||
[[nodiscard]] auto
|
||||
filetime_to_unix_time(const FILETIME &ft) -> remote::file_time;
|
||||
|
||||
[[nodiscard]] auto get_last_error_code() -> DWORD;
|
||||
|
||||
[[nodiscard]] auto get_local_app_data_directory() -> const std::string &;
|
||||
|
||||
[[nodiscard]] auto get_accessed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_accessed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_changed_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_changed_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_creation_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_creation_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_written_time_from_meta(const api_meta_map &meta)
|
||||
-> std::uint64_t;
|
||||
[[nodiscard]] auto
|
||||
get_written_time_from_meta(const api_meta_map &meta) -> std::uint64_t;
|
||||
|
||||
[[nodiscard]] auto get_thread_id() -> std::uint64_t;
|
||||
|
||||
@ -67,8 +67,8 @@ unix_open_flags_to_flags_and_perms(const remote::file_mode &mode,
|
||||
|
||||
void unix_time_to_filetime(const remote::file_time &ts, FILETIME &ft);
|
||||
|
||||
[[nodiscard]] auto time64_to_unix_time(const __time64_t &t)
|
||||
-> remote::file_time;
|
||||
[[nodiscard]] auto
|
||||
time64_to_unix_time(const __time64_t &t) -> remote::file_time;
|
||||
} // namespace repertory::utils
|
||||
|
||||
#endif // _WIN32
|
||||
|
Reference in New Issue
Block a user