refactor proprocessor directives

This commit is contained in:
2024-07-15 12:20:15 -05:00
parent c1eb6b94ed
commit 6a984ac84c
73 changed files with 1450 additions and 1583 deletions

View File

@@ -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 &;
};

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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); }

View File

@@ -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();