Compare commits
12 Commits
4e418c8969
...
7784284097
Author | SHA1 | Date | |
---|---|---|---|
7784284097 | |||
09208e53a2 | |||
61d8b6d054 | |||
9398f17b76 | |||
f4251fcc97 | |||
add21a5608 | |||
bcccc5c4b8 | |||
ef8b16077b | |||
25007b4242 | |||
e1690509e1 | |||
92d6633f44 | |||
528fd595ab |
@ -61,7 +61,7 @@ private:
|
||||
static auto instance() -> fuse_base &;
|
||||
|
||||
private:
|
||||
struct fuse_operations fuse_ops_ {};
|
||||
struct fuse_operations fuse_ops_{};
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto
|
||||
@ -78,9 +78,9 @@ private:
|
||||
static void execute_void_callback(std::string_view function_name,
|
||||
const std::function<void()> &cb);
|
||||
|
||||
static auto
|
||||
execute_void_pointer_callback(std::string_view function_name,
|
||||
const std::function<void *()> &cb) -> void *;
|
||||
static auto execute_void_pointer_callback(std::string_view function_name,
|
||||
const std::function<void *()> &cb)
|
||||
-> void *;
|
||||
|
||||
void raise_fuse_event(std::string_view function_name,
|
||||
std::string_view api_path, int ret,
|
||||
@ -91,22 +91,22 @@ private:
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto chflags_(const char *path, uint32_t flags) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] static auto chmod_(const char *path, mode_t mode,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto chmod_(const char *path, mode_t mode) -> int;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[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;
|
||||
#endif
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto chown_(const char *path, uid_t uid, gid_t gid)
|
||||
-> int;
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] static auto create_(const char *path, mode_t mode,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
@ -114,19 +114,19 @@ 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
|
||||
#endif // FUSE_USE_VERSION < 30
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto fsetattr_x_(const char *path,
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
[[nodiscard]] static auto fsync_(const char *path, int datasync,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
@ -137,27 +137,27 @@ private:
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] static auto getattr_(const char *path, struct stat *st,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto getattr_(const char *path, struct stat *st) -> int;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto getxtimes_(const char *path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] static auto init_(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void *;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto init_(struct fuse_conn_info *conn) -> void *;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[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;
|
||||
@ -171,12 +171,12 @@ private:
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *fi,
|
||||
fuse_readdir_flags flags) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[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;
|
||||
#endif
|
||||
off_t offset, struct fuse_file_info *fi)
|
||||
-> int;
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] static auto release_(const char *path,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
@ -187,9 +187,9 @@ private:
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] static auto rename_(const char *from, const char *to,
|
||||
unsigned int flags) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto rename_(const char *from, const char *to) -> int;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] static auto rmdir_(const char *path) -> int;
|
||||
|
||||
@ -199,35 +199,36 @@ private:
|
||||
char *value, size_t size,
|
||||
uint32_t position) -> int;
|
||||
|
||||
#else // __APPLE__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] static auto getxattr_(const char *path, const char *name,
|
||||
char *value, size_t size) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
[[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;
|
||||
|
||||
#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__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] static auto setxattr_(const char *path, const char *name,
|
||||
const char *value, size_t size,
|
||||
int flags) -> int;
|
||||
#endif // __APPLE__
|
||||
#endif // HAS_SETXATTR
|
||||
const char *value, size_t size, int flags)
|
||||
-> int;
|
||||
#endif // defined(__APPLE__)
|
||||
#endif // defined(HAS_SETXATTR)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto setattr_x_(const char *path,
|
||||
struct setattr_x *attr) -> int;
|
||||
[[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,20 +238,20 @@ 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;
|
||||
#endif // __APPLE__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] static auto statfs_(const char *path, struct statvfs *stbuf)
|
||||
-> int;
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] static auto truncate_(const char *path, off_t size,
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto truncate_(const char *path, off_t size) -> int;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] static auto unlink_(const char *path) -> int;
|
||||
|
||||
@ -258,18 +259,18 @@ private:
|
||||
[[nodiscard]] static auto utimens_(const char *path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info *fi) -> int;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] static auto utimens_(const char *path,
|
||||
const struct timespec tv[2]) -> int;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] static auto write_(const char *path, const char *buffer,
|
||||
size_t write_size, off_t write_offset,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -278,37 +279,40 @@ protected:
|
||||
uint32_t /*flags*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__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
|
||||
#else //FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto chmod_impl(std::string /*api_path*/,
|
||||
mode_t /*mode*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#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
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto chown_impl(std::string /*api_path*/, uid_t /*uid*/,
|
||||
gid_t /*gid*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[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;
|
||||
}
|
||||
|
||||
@ -316,81 +320,87 @@ 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;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
fsetattr_x_impl(std::string /*api_path*/, struct setattr_x * /*attr*/,
|
||||
struct fuse_file_info * /*fi*/) -> api_error {
|
||||
[[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__
|
||||
#endif // defined(__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
|
||||
#endif // FUSE_USE_VERSION < 30
|
||||
|
||||
#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
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto getattr_impl(std::string /*api_path*/,
|
||||
struct stat * /*st*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
getxtimes_impl(std::string /*api_path*/, struct timespec * /*bkuptime*/,
|
||||
struct timespec * /*crtime*/) -> api_error {
|
||||
[[nodiscard]] virtual auto getxtimes_impl(std::string /*api_path*/,
|
||||
struct timespec * /*bkuptime*/,
|
||||
struct timespec * /*crtime*/)
|
||||
-> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
virtual auto init_impl(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void *;
|
||||
#else
|
||||
virtual auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void *;
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
virtual auto init_impl(struct fuse_conn_info *conn) -> void *;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] virtual auto mkdir_impl(std::string /*api_path*/,
|
||||
mode_t /*mode*/) -> api_error {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -405,28 +415,28 @@ 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
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[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*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[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;
|
||||
}
|
||||
|
||||
@ -436,13 +446,13 @@ protected:
|
||||
unsigned int /*flags*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else
|
||||
[[nodiscard]] virtual auto
|
||||
rename_impl(std::string /*from_api_path*/,
|
||||
std::string /*to_api_path*/) -> api_error {
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto rename_impl(std::string /*from_api_path*/,
|
||||
std::string /*to_api_path*/)
|
||||
-> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] virtual auto rmdir_impl(std::string /*api_path*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
@ -456,14 +466,14 @@ protected:
|
||||
int & /*attribute_size*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#else // __APPLE__
|
||||
#else // !defined(__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__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
listxattr_impl(std::string /*api_path*/, char * /*buffer*/, size_t /*size*/,
|
||||
@ -471,9 +481,9 @@ 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;
|
||||
}
|
||||
|
||||
@ -485,21 +495,20 @@ protected:
|
||||
uint32_t /*position*/) -> api_error {
|
||||
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 {
|
||||
#else // !defined (__APPLE__)
|
||||
[[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
|
||||
#endif // defined (__APPLE__)
|
||||
#endif // defined(HAS_SETXATTR)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto
|
||||
setattr_x_impl(std::string /*api_path*/,
|
||||
struct setattr_x * /*attr*/) -> api_error {
|
||||
[[nodiscard]] virtual auto setattr_x_impl(std::string /*api_path*/,
|
||||
struct setattr_x * /*attr*/)
|
||||
-> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
|
||||
@ -510,72 +519,74 @@ 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 {
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] virtual auto statfs_impl(std::string /*api_path*/,
|
||||
struct statvfs * /*stbuf*/)
|
||||
-> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__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
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto truncate_impl(std::string /*api_path*/,
|
||||
off_t /*size*/) -> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[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 {
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] virtual auto utimens_impl(std::string /*api_path*/,
|
||||
const struct timespec /*tv*/[2])
|
||||
-> api_error {
|
||||
return api_error::not_implemented;
|
||||
}
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[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;
|
||||
}
|
||||
|
||||
@ -603,5 +614,5 @@ public:
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // !defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||
|
@ -75,25 +75,25 @@ protected:
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path, uint32_t flags)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__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;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#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;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *file_info)
|
||||
@ -115,7 +115,7 @@ protected:
|
||||
struct setattr_x *attr,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
[[nodiscard]] auto fsync_impl(std::string api_path, int datasync,
|
||||
struct fuse_file_info *file_info)
|
||||
@ -125,30 +125,30 @@ protected:
|
||||
[[nodiscard]] auto ftruncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION < 30
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto getxtimes_impl(std::string api_path,
|
||||
struct timespec *bkuptime,
|
||||
struct timespec *crtime)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * override;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
auto init_impl(struct fuse_conn_info *conn) -> void * override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error override;
|
||||
@ -174,12 +174,12 @@ protected:
|
||||
struct fuse_file_info *file_info,
|
||||
fuse_readdir_flags flags)
|
||||
-> api_error override;
|
||||
#else
|
||||
#else // 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)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto release_impl(std::string api_path,
|
||||
struct fuse_file_info *file_info)
|
||||
@ -193,10 +193,10 @@ protected:
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path, unsigned int flags)
|
||||
-> api_error override;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto rename_impl(std::string from_api_path,
|
||||
std::string to_api_path) -> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto rmdir_impl(std::string api_path) -> api_error override;
|
||||
|
||||
@ -210,11 +210,11 @@ protected:
|
||||
[[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;
|
||||
#else // __APPLE__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
|
||||
char *value, size_t size,
|
||||
int &attribute_size) -> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__APPLE__)
|
||||
|
||||
[[nodiscard]] auto listxattr_impl(std::string api_path, char *buffer,
|
||||
size_t size, int &required_size,
|
||||
@ -227,12 +227,12 @@ protected:
|
||||
[[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__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] auto setxattr_impl(std::string api_path, const char *name,
|
||||
const char *value, size_t size, int flags)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // HAS_SETXATTR
|
||||
#endif // defined(__APPLE__)
|
||||
#endif // defined(HAS_SETXATTR{}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto setattr_x_impl(std::string api_path,
|
||||
@ -255,19 +255,19 @@ protected:
|
||||
|
||||
[[nodiscard]] auto statfs_x_impl(std::string api_path, struct statfs *stbuf)
|
||||
-> api_error override;
|
||||
#else // __APPLE__
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] auto statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error override;
|
||||
#endif // __APPLE__
|
||||
#endif // defined(__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;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto unlink_impl(std::string api_path) -> api_error override;
|
||||
|
||||
@ -276,11 +276,11 @@ protected:
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error override;
|
||||
#else
|
||||
#else // FUSE_USE_VERSION < 30
|
||||
[[nodiscard]] auto utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2])
|
||||
-> api_error override;
|
||||
#endif
|
||||
#endif // FUSE_USE_VERSION >= 30
|
||||
|
||||
[[nodiscard]] auto write_impl(std::string api_path, const char *buffer,
|
||||
size_t write_size, off_t write_offset,
|
||||
@ -335,5 +335,5 @@ public:
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // !defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
|
||||
|
@ -43,16 +43,17 @@ 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;
|
||||
|
||||
@ -62,58 +63,63 @@ 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;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] static auto
|
||||
get_flags_from_meta(const api_meta_map &meta) -> __uint32_t;
|
||||
#endif // __APPLE__
|
||||
[[nodiscard]] static auto get_flags_from_meta(const api_meta_map &meta)
|
||||
-> __uint32_t;
|
||||
#endif // defined(__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;
|
||||
|
||||
#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;
|
||||
#endif
|
||||
[[nodiscard]] auto parse_xattr_parameters(const char *name,
|
||||
const uint32_t &position,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error;
|
||||
#else // !defined(__APPLE__)
|
||||
[[nodiscard]] auto parse_xattr_parameters(const char *name,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error;
|
||||
#endif // defined(__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;
|
||||
#endif
|
||||
#else // !defined(__APPLE__)
|
||||
[[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 // defined(__APPLE__)
|
||||
|
||||
static void populate_stat(const std::string &api_path,
|
||||
std::uint64_t size_or_count,
|
||||
@ -125,13 +131,13 @@ 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;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // !defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
|
||||
|
@ -86,5 +86,5 @@ public:
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif
|
||||
#endif // !defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@ inline constexpr const auto PACKET_SERVICE_FLAGS{PACKET_SERVICE_WINFSP};
|
||||
inline constexpr const auto PACKET_SERVICE_FLAGS{PACKET_SERVICE_FUSE};
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
constexpr const auto default_remote_directory_page_size{std::size_t(100U)};
|
||||
constexpr const auto default_remote_client_pool_size{20U};
|
||||
constexpr const auto default_remote_max_connections{20U};
|
||||
constexpr const auto default_remote_receive_timeout_ms{120U * 1000U};
|
||||
@ -217,8 +218,8 @@ struct statfs_x final : public statfs {
|
||||
#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 // !defined(_WIN32)
|
||||
} // namespace repertory::remote
|
||||
|
||||
|
@ -50,15 +50,15 @@ using list_objects_result = std::vector<directory_item>;
|
||||
|
||||
struct head_object_result {
|
||||
std::uint64_t content_length{};
|
||||
std::string content_type{};
|
||||
std::uint64_t last_modified{};
|
||||
std::string content_type;
|
||||
std::uint64_t last_modified;
|
||||
|
||||
inline auto from_headers(http_headers headers) -> head_object_result & {
|
||||
auto from_headers(http_headers headers) -> head_object_result & {
|
||||
content_length = utils::string::to_uint64(headers["content-length"]);
|
||||
content_type = headers["content-type"];
|
||||
auto date = headers["last-modified"];
|
||||
if (not date.empty()) {
|
||||
struct tm tm1 {};
|
||||
struct tm tm1{};
|
||||
// Mon, 17 Dec 2012 02:14:10 GMT
|
||||
#if defined(_WIN32)
|
||||
utils::time::strptime(date.c_str(), "%a, %d %b %Y %H:%M:%S %Z", &tm1);
|
||||
|
@ -1655,7 +1655,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path,
|
||||
json_data["handle"] = handle;
|
||||
json_data["path"] = path;
|
||||
json_data["page_count"] = utils::divide_with_ceiling(
|
||||
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
||||
iter->get_count(), default_remote_directory_page_size);
|
||||
res = 0;
|
||||
errno = 0;
|
||||
}
|
||||
@ -1677,17 +1677,18 @@ auto remote_server::json_read_directory_snapshot(
|
||||
if (iter != nullptr) {
|
||||
std::size_t offset{};
|
||||
json item_json;
|
||||
while (
|
||||
(json_data["directory_list"].size() < REPERTORY_DIRECTORY_PAGE_SIZE) &&
|
||||
(res = iter->get_json((page * REPERTORY_DIRECTORY_PAGE_SIZE) + offset++,
|
||||
item_json)) == 0) {
|
||||
while ((json_data["directory_list"].size() <
|
||||
default_remote_directory_page_size) &&
|
||||
(res = iter->get_json((page * default_remote_directory_page_size) +
|
||||
offset++,
|
||||
item_json)) == 0) {
|
||||
json_data["directory_list"].emplace_back(item_json);
|
||||
}
|
||||
json_data["handle"] = handle;
|
||||
json_data["path"] = path;
|
||||
json_data["page"] = page;
|
||||
json_data["page_count"] = utils::divide_with_ceiling(
|
||||
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
||||
iter->get_count(), default_remote_directory_page_size);
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : 0);
|
||||
|
@ -855,7 +855,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path,
|
||||
json_data["path"] = path;
|
||||
json_data["handle"] = handle;
|
||||
json_data["page_count"] = utils::divide_with_ceiling(
|
||||
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
||||
iter->get_count(), default_remote_directory_page_size);
|
||||
res = 0;
|
||||
errno = 0;
|
||||
}
|
||||
@ -877,17 +877,18 @@ auto remote_server::json_read_directory_snapshot(
|
||||
if (iter != nullptr) {
|
||||
std::size_t offset{};
|
||||
json item_json;
|
||||
while (
|
||||
(json_data["directory_list"].size() < REPERTORY_DIRECTORY_PAGE_SIZE) &&
|
||||
(res = iter->get_json((page * REPERTORY_DIRECTORY_PAGE_SIZE) + offset++,
|
||||
item_json)) == 0) {
|
||||
while ((json_data["directory_list"].size() <
|
||||
default_remote_directory_page_size) &&
|
||||
(res = iter->get_json((page * default_remote_directory_page_size) +
|
||||
offset++,
|
||||
item_json)) == 0) {
|
||||
json_data["directory_list"].emplace_back(item_json);
|
||||
}
|
||||
json_data["handle"] = handle;
|
||||
json_data["path"] = path;
|
||||
json_data["page"] = page;
|
||||
json_data["page_count"] = utils::divide_with_ceiling(
|
||||
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
||||
iter->get_count(), default_remote_directory_page_size);
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : 0);
|
||||
|
@ -22,10 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "comm/curl/curl_comm.hpp"
|
||||
#include "providers/sia/sia_provider.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto check_version(std::vector<const char *> /* args */,
|
||||
|
60
repertory/repertory/include/cli/common.hpp
Normal file
60
repertory/repertory/include/cli/common.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_CLI_COMMON_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_COMMON_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "comm/curl/curl_comm.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "providers/provider.hpp"
|
||||
#include "providers/sia/sia_provider.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/remote_winfsp_drive.hpp"
|
||||
#include "drives/winfsp/winfsp_drive.hpp"
|
||||
#include "utils/com_init_wrapper.hpp"
|
||||
|
||||
using repertory_drive = repertory::winfsp_drive;
|
||||
using remote_client = repertory::remote_winfsp::remote_client;
|
||||
using remote_drive = repertory::remote_winfsp::remote_winfsp_drive;
|
||||
using remote_instance = repertory::remote_winfsp::i_remote_instance;
|
||||
#else // !defined(_WIN32)
|
||||
#include "drives/fuse/fuse_drive.hpp"
|
||||
#include "drives/fuse/remotefuse/remote_client.hpp"
|
||||
#include "drives/fuse/remotefuse/remote_fuse_drive.hpp"
|
||||
|
||||
using repertory_drive = repertory::fuse_drive;
|
||||
using remote_client = repertory::remote_fuse::remote_client;
|
||||
using remote_drive = repertory::remote_fuse::remote_fuse_drive;
|
||||
using remote_instance = repertory::remote_fuse::i_remote_instance;
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#endif // REPERTORY_INCLUDE_CLI_COMMON_HPP_
|
@ -22,12 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto display_config(std::vector<const char *> /* args */,
|
||||
|
@ -22,12 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,12 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_GET_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_GET_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto get(std::vector<const char *> args,
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto get_directory_items(
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto get_pinned_files(std::vector<const char *> /* args */,
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_VERSION_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_VERSION_HPP_
|
||||
|
||||
#include "version.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
template <typename drive> inline void version(std::vector<const char *> args) {
|
||||
|
@ -22,6 +22,8 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_HELP_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_HELP_HPP_
|
||||
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
template <typename drive> inline void help(std::vector<const char *> args) {
|
||||
drive::display_options(args);
|
||||
|
@ -22,34 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_MOUNT_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_MOUNT_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "providers/provider.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "utils/file.hpp"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/remote_winfsp_drive.hpp"
|
||||
#include "drives/winfsp/winfsp_drive.hpp"
|
||||
#include "utils/com_init_wrapper.hpp"
|
||||
|
||||
using repertory_drive = repertory::winfsp_drive;
|
||||
using remote_client = repertory::remote_winfsp::remote_client;
|
||||
using remote_drive = repertory::remote_winfsp::remote_winfsp_drive;
|
||||
using remote_instance = repertory::remote_winfsp::i_remote_instance;
|
||||
#else // !defined(_WIN32)
|
||||
#include "drives/fuse/fuse_drive.hpp"
|
||||
#include "drives/fuse/remotefuse/remote_client.hpp"
|
||||
#include "drives/fuse/remotefuse/remote_fuse_drive.hpp"
|
||||
|
||||
using repertory_drive = repertory::fuse_drive;
|
||||
using remote_client = repertory::remote_fuse::remote_client;
|
||||
using remote_drive = repertory::remote_fuse::remote_fuse_drive;
|
||||
using remote_instance = repertory::remote_fuse::i_remote_instance;
|
||||
#endif // defined(_WIN32)
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,20 +22,14 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto open_files(std::vector<const char *> /* args */,
|
||||
const std::string &data_directory,
|
||||
const provider_type &prov,
|
||||
const std::string &unique_id,
|
||||
std::string user,
|
||||
std::string password) -> exit_code {
|
||||
[[nodiscard]] inline auto
|
||||
open_files(std::vector<const char *> /* args */,
|
||||
const std::string &data_directory, const provider_type &prov,
|
||||
const std::string &unique_id, std::string user, std::string password)
|
||||
-> exit_code {
|
||||
auto ret = exit_code::success;
|
||||
lock_data lock(prov, unique_id);
|
||||
const auto res = lock.grab_lock(1U);
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,12 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_SET_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_SET_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto set(std::vector<const char *> args,
|
||||
|
@ -22,8 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_STATUS_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_STATUS_HPP_
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto status(std::vector<const char *> /* args */,
|
||||
|
@ -22,12 +22,9 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_UI_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_UI_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "cli/common.hpp"
|
||||
#include "ui/handlers.hpp"
|
||||
#include "ui/mgmt_app_config.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_UNMOUNT_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_UNMOUNT_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
@ -22,11 +22,7 @@
|
||||
#ifndef REPERTORY_INCLUDE_CLI_UNPIN_FILE_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_UNPIN_FILE_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "rpc/client/client.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "types/rpc.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "cli/common.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
|
Loading…
x
Reference in New Issue
Block a user