refactor
This commit is contained in:
parent
73ec7f2252
commit
1d53cd8e8b
@ -49,9 +49,9 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||||
populate_file_info(const std::string &api_path,
|
remote::file_info &file_info)
|
||||||
remote::file_info &file_info) -> packet::error_type;
|
-> packet::error_type;
|
||||||
|
|
||||||
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
void populate_file_info(const std::string &api_path, const UINT64 &file_size,
|
||||||
const UINT32 &attributes,
|
const UINT32 &attributes,
|
||||||
@ -72,14 +72,14 @@ public:
|
|||||||
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
fuse_chown(const char *path, const remote::user_id &uid,
|
const remote::group_id &gid)
|
||||||
const remote::group_id &gid) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_create(const char *path, const remote::file_mode &mode,
|
fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags,
|
const remote::open_flags &flags, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
[[nodiscard]] auto fuse_destroy() -> packet::error_type override;
|
||||||
|
|
||||||
@ -88,25 +88,28 @@ public:
|
|||||||
remote::file_offset &length, const remote::file_handle &handle) override
|
remote::file_offset &length, const remote::file_handle &handle) override
|
||||||
;*/
|
;*/
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fgetattr(
|
[[nodiscard]] auto fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||||
const char *path, remote::stat &r_stat, bool &directory,
|
bool &directory,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_fsetattr_x(
|
[[nodiscard]] auto fuse_fsetattr_x(const char *path,
|
||||||
const char *path, const remote::setattr_x &attr,
|
const remote::setattr_x &attr,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_ftruncate(
|
[[nodiscard]] auto fuse_ftruncate(const char *path,
|
||||||
const char *path, const remote::file_offset &size,
|
const remote::file_offset &size,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &r_stat,
|
||||||
fuse_getattr(const char *path, remote::stat &r_stat,
|
bool &directory)
|
||||||
bool &directory) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size) override ;
|
*name, char *value, const remote::file_size &size) override ;
|
||||||
@ -115,9 +118,10 @@ public:
|
|||||||
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
*name, char *value, const remote::file_size &size, std::uint32_t position)
|
||||||
override ;*/
|
override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_getxtimes(const char *path,
|
||||||
fuse_getxtimes(const char *path, remote::file_time &bkuptime,
|
remote::file_time &bkuptime,
|
||||||
remote::file_time &crtime) -> packet::error_type override;
|
remote::file_time &crtime)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
[[nodiscard]] auto fuse_init() -> packet::error_type override;
|
||||||
|
|
||||||
@ -125,28 +129,30 @@ public:
|
|||||||
*buffer, const remote::file_size &size) override ;*/
|
*buffer, const remote::file_size &size) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_mkdir(const char *path,
|
fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||||
const remote::file_mode &mode) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_open(const char *path,
|
||||||
fuse_open(const char *path, const remote::open_flags &flags,
|
const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
[[nodiscard]] auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_read(const char *path, char *buffer,
|
||||||
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_rename(const char *from,
|
[[nodiscard]] auto fuse_rename(const char *from, const char *to)
|
||||||
const char *to) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
fuse_readdir(const char *path, const remote::file_offset &offset,
|
fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle,
|
const remote::file_handle &handle, std::string &item_path)
|
||||||
std::string &item_path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_release(const char *path,
|
[[nodiscard]] auto fuse_release(const char *path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
@ -160,8 +166,8 @@ public:
|
|||||||
* char *name) override
|
* char *name) override
|
||||||
* ;*/
|
* ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_rmdir(const char *path)
|
||||||
fuse_rmdir(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -178,8 +184,8 @@ public:
|
|||||||
const remote::file_time &crtime)
|
const remote::file_time &crtime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_setvolname(const char *volname)
|
||||||
fuse_setvolname(const char *volname) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
/*[[nodiscard]] packet::error_type fuse_setxattr(const char *path, const char
|
||||||
*name, const char *value, const remote::file_size &size, const std::int32_t
|
*name, const char *value, const remote::file_size &size, const std::int32_t
|
||||||
@ -189,67 +195,70 @@ public:
|
|||||||
char *name, const char *value, const remote::file_size &size, const
|
char *name, const char *value, const remote::file_size &size, const
|
||||||
std::int32_t &flags, std::uint32_t position) override ;*/
|
std::int32_t &flags, std::uint32_t position) override ;*/
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_statfs(const char *path, std::uint64_t frsize,
|
||||||
fuse_statfs(const char *path, std::uint64_t frsize,
|
remote::statfs &r_stat)
|
||||||
remote::statfs &r_stat) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||||
fuse_statfs_x(const char *path, std::uint64_t bsize,
|
remote::statfs_x &r_stat)
|
||||||
remote::statfs_x &r_stat) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_truncate(const char *path,
|
||||||
fuse_truncate(const char *path,
|
const remote::file_offset &size)
|
||||||
const remote::file_offset &size) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_unlink(const char *path)
|
||||||
fuse_unlink(const char *path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||||
fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
|
std::uint64_t op0, std::uint64_t op1)
|
||||||
std::uint64_t op1) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto fuse_write(const char *path, const char *buffer,
|
||||||
fuse_write(const char *path, const char *buffer,
|
const remote::file_size &write_size,
|
||||||
const remote::file_size &write_size,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto fuse_write_base64(
|
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer,
|
||||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id &,
|
void set_fuse_uid_gid(const remote::user_id &,
|
||||||
const remote::group_id &) override {}
|
const remote::group_id &) override {}
|
||||||
|
|
||||||
// JSON Layer
|
// JSON Layer
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
||||||
winfsp_get_dir_buffer(PVOID /*file_desc*/,
|
PVOID *& /*ptr*/)
|
||||||
PVOID *& /*ptr*/) -> packet::error_type override {
|
-> packet::error_type override {
|
||||||
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
|
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto json_create_directory_snapshot(
|
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
|
||||||
const std::string &path, json &json_data) -> packet::error_type override;
|
json &json_data)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_read_directory_snapshot(
|
[[nodiscard]] auto json_read_directory_snapshot(
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const std::string &path, const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto json_release_directory_snapshot(
|
[[nodiscard]] auto
|
||||||
const std::string &path,
|
json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
// WinFSP Layer
|
// WinFSP Layer
|
||||||
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
[[nodiscard]] auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||||
winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
UINT32 flags, BOOLEAN &was_deleted)
|
||||||
BOOLEAN &was_closed) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_close(PVOID file_desc)
|
||||||
winfsp_close(PVOID file_desc) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
winfsp_create(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||||
@ -264,57 +273,63 @@ public:
|
|||||||
remote::file_info *file_info)
|
remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> 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
|
[[nodiscard]] auto
|
||||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
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
|
[[nodiscard]] auto winfsp_get_volume_info(UINT64 &total_size,
|
||||||
winfsp_open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
UINT64 &free_size,
|
||||||
PVOID *file_desc, remote::file_info *file_info,
|
std::string &volume_label)
|
||||||
std::string &normalized_name) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
|
||||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
-> packet::error_type override;
|
||||||
BOOLEAN replace_attributes, UINT64 /*allocation_size*/,
|
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
remote::file_info *file_info,
|
||||||
|
std::string &normalized_name)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/, PWSTR marker,
|
BOOLEAN replace_attributes,
|
||||||
json &itemList) -> packet::error_type override;
|
UINT64 /*allocation_size*/,
|
||||||
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
winfsp_rename(PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
UINT32 length, PUINT32 bytes_transferred)
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
-> 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_set_basic_info(
|
[[nodiscard]] auto winfsp_set_basic_info(
|
||||||
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
||||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info) -> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto winfsp_set_file_size(
|
[[nodiscard]] auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
|
||||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
PUINT32 bytes_transferred,
|
PUINT32 bytes_transferred, remote::file_info *file_info)
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
};
|
};
|
||||||
} // namespace remote_fuse
|
} // namespace remote_fuse
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -85,10 +85,10 @@ public:
|
|||||||
UINT32 flags{};
|
UINT32 flags{};
|
||||||
DECODE_OR_RETURN(request, flags);
|
DECODE_OR_RETURN(request, flags);
|
||||||
|
|
||||||
BOOLEAN was_closed{};
|
BOOLEAN was_deleted{};
|
||||||
ret = this->winfsp_cleanup(file_desc, file_name.data(), flags,
|
ret = this->winfsp_cleanup(file_desc, file_name.data(), flags,
|
||||||
was_closed);
|
was_deleted);
|
||||||
response.encode(was_closed);
|
response.encode(was_deleted);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}});
|
}});
|
||||||
|
@ -29,11 +29,11 @@ class i_remote_instance : public virtual i_remote_json {
|
|||||||
INTERFACE_SETUP(i_remote_instance);
|
INTERFACE_SETUP(i_remote_instance);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual auto winfsp_can_delete(PVOID file_desc,
|
virtual auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
PWSTR file_name) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_closed) -> packet::error_type = 0;
|
BOOLEAN &was_deleted) -> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_close(PVOID file_desc) -> packet::error_type = 0;
|
virtual auto winfsp_close(PVOID file_desc) -> packet::error_type = 0;
|
||||||
|
|
||||||
@ -41,72 +41,76 @@ public:
|
|||||||
UINT32 granted_access, UINT32 file_attributes,
|
UINT32 granted_access, UINT32 file_attributes,
|
||||||
UINT64 allocation_size, PVOID *file_desc,
|
UINT64 allocation_size, PVOID *file_desc,
|
||||||
remote::file_info *file_info,
|
remote::file_info *file_info,
|
||||||
std::string &normalized_name,
|
std::string &normalized_name, BOOLEAN &exists)
|
||||||
BOOLEAN &exists) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
virtual auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_get_dir_buffer(PVOID file_desc,
|
virtual auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||||
PVOID *&ptr) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
|
virtual auto winfsp_get_file_info(PVOID file_desc,
|
||||||
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto
|
||||||
winfsp_get_file_info(PVOID file_desc,
|
winfsp_get_security_by_name(PWSTR file_name, PUINT32 file_attributes,
|
||||||
remote::file_info *file_info) -> packet::error_type = 0;
|
std::uint64_t *security_descriptor_size,
|
||||||
|
std::wstring &str_descriptor)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_get_security_by_name(
|
virtual auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
PWSTR file_name, PUINT32 file_attributes,
|
std::string &volume_label)
|
||||||
std::uint64_t *security_descriptor_size,
|
-> packet::error_type = 0;
|
||||||
std::wstring &str_descriptor) -> packet::error_type = 0;
|
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_mounted(const std::wstring &location)
|
||||||
winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
-> packet::error_type = 0;
|
||||||
std::string &volume_label) -> packet::error_type = 0;
|
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
winfsp_mounted(const std::wstring &location) -> packet::error_type = 0;
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
|
remote::file_info *file_info,
|
||||||
|
std::string &normalized_name)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_overwrite(PVOID file_desc, UINT32 file_attributes,
|
||||||
winfsp_open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
BOOLEAN replace_file_attributes,
|
||||||
PVOID *file_desc, remote::file_info *file_info,
|
UINT64 allocation_size,
|
||||||
std::string &normalized_name) -> packet::error_type = 0;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type = 0;
|
||||||
virtual auto
|
|
||||||
winfsp_overwrite(PVOID file_desc, UINT32 file_attributes,
|
|
||||||
BOOLEAN replace_file_attributes, UINT64 allocation_size,
|
|
||||||
remote::file_info *file_info) -> packet::error_type = 0;
|
|
||||||
|
|
||||||
virtual auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
virtual auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
UINT32 length,
|
UINT32 length, PUINT32 bytes_transferred)
|
||||||
PUINT32 bytes_transferred) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto winfsp_read_directory(PVOID file_desc, PWSTR pattern,
|
virtual auto winfsp_read_directory(PVOID file_desc, PWSTR pattern,
|
||||||
PWSTR marker,
|
PWSTR marker, json &itemList)
|
||||||
json &itemList) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_rename(PVOID file_desc, PWSTR file_name,
|
||||||
winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
PWSTR new_file_name, BOOLEAN replace_if_exists)
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes,
|
||||||
winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes,
|
UINT64 creation_time,
|
||||||
UINT64 creation_time, UINT64 last_access_time,
|
UINT64 last_access_time,
|
||||||
UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info) -> packet::error_type = 0;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||||
winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
BOOLEAN set_allocation_size,
|
||||||
BOOLEAN set_allocation_size,
|
remote::file_info *file_info)
|
||||||
remote::file_info *file_info) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_unmounted(const std::wstring &location)
|
||||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
|
|
||||||
virtual auto
|
virtual auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
UINT32 length, BOOLEAN write_to_end,
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
BOOLEAN constrained_io, PUINT32 bytes_transferred,
|
||||||
PUINT32 bytes_transferred,
|
remote::file_info *file_info)
|
||||||
remote::file_info *file_info) -> packet::error_type = 0;
|
-> packet::error_type = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using remote_instance_factory =
|
using remote_instance_factory =
|
||||||
|
@ -50,19 +50,20 @@ public:
|
|||||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_read_directory_snapshot(
|
auto json_read_directory_snapshot(const std::string &path,
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_release_directory_snapshot(const std::string &path,
|
auto json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_can_delete(PVOID file_desc,
|
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
PWSTR file_name) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_closed) -> packet::error_type override;
|
BOOLEAN &was_deleted) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||||
|
|
||||||
@ -75,32 +76,33 @@ public:
|
|||||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_dir_buffer(PVOID file_desc,
|
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||||
PVOID *&ptr) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_security_by_name(
|
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
std::uint64_t *descriptor_size,
|
||||||
std::wstring &string_descriptor) -> packet::error_type override;
|
std::wstring &string_descriptor)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
std::string &volume_label)
|
std::string &volume_label)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_mounted(const std::wstring &location)
|
||||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
UINT32 granted_access, PVOID *file_desc,
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
remote::file_info *file_info,
|
remote::file_info *file_info, std::string &normalized_name)
|
||||||
std::string &normalized_name) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
remote::file_info *file_info)
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||||
@ -111,23 +113,24 @@ public:
|
|||||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_basic_info(
|
auto winfsp_set_basic_info(PVOID file_desc, UINT32 attributes,
|
||||||
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
UINT64 creation_time, UINT64 last_access_time,
|
||||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_file_size(
|
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_unmounted(const std::wstring &location)
|
||||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
PUINT32 bytes_transferred, remote::file_info *file_info)
|
||||||
PUINT32 bytes_transferred,
|
-> packet::error_type override;
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
|
||||||
};
|
};
|
||||||
} // namespace remote_winfsp
|
} // namespace remote_winfsp
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -49,23 +49,23 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto populate_file_info(const std::string &api_path,
|
||||||
populate_file_info(const std::string &api_path,
|
remote::file_info &file_info)
|
||||||
remote::file_info &file_info) -> packet::error_type;
|
-> packet::error_type;
|
||||||
|
|
||||||
void populate_stat(const char *path, bool directory, remote::stat &r_stat,
|
void populate_stat(const char *path, bool directory, remote::stat &r_stat,
|
||||||
const struct _stat64 &unix_st);
|
const struct _stat64 &unix_st);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FUSE Layer
|
// FUSE Layer
|
||||||
auto fuse_access(const char *path,
|
auto fuse_access(const char *path, const std::int32_t &mask)
|
||||||
const std::int32_t &mask) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chflags(const char *path,
|
auto fuse_chflags(const char *path, std::uint32_t flags)
|
||||||
std::uint32_t flags) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chmod(const char *path,
|
auto fuse_chmod(const char *path, const remote::file_mode &mode)
|
||||||
const remote::file_mode &mode) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_chown(const char *path, const remote::user_id &uid,
|
auto fuse_chown(const char *path, const remote::user_id &uid,
|
||||||
const remote::group_id &gid) -> packet::error_type override;
|
const remote::group_id &gid) -> packet::error_type override;
|
||||||
@ -84,16 +84,16 @@ public:
|
|||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||||
fuse_fsync(const char *path, const std::int32_t &datasync,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_ftruncate(const char *path, const remote::file_offset &size,
|
auto fuse_ftruncate(const char *path, const remote::file_offset &size,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_getattr(const char *path, remote::stat &r_stat,
|
auto fuse_getattr(const char *path, remote::stat &r_stat, bool &directory)
|
||||||
bool &directory) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
/*packet::error_type fuse_getxattr(const char *path, const char *name, char
|
/*packet::error_type fuse_getxattr(const char *path, const char *name, char
|
||||||
*value, const remote::file_size &size) override ;
|
*value, const remote::file_size &size) override ;
|
||||||
@ -110,41 +110,43 @@ public:
|
|||||||
const remote::file_size &size) override
|
const remote::file_size &size) override
|
||||||
;*/
|
;*/
|
||||||
|
|
||||||
auto fuse_mkdir(const char *path,
|
auto fuse_mkdir(const char *path, const remote::file_mode &mode)
|
||||||
const remote::file_mode &mode) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_opendir(const char *path,
|
auto fuse_opendir(const char *path, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_create(const char *path, const remote::file_mode &mode,
|
auto fuse_create(const char *path, const remote::file_mode &mode,
|
||||||
const remote::open_flags &flags,
|
const remote::open_flags &flags, remote::file_handle &handle)
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_open(const char *path, const remote::open_flags &flags,
|
auto fuse_open(const char *path, const remote::open_flags &flags,
|
||||||
remote::file_handle &handle) -> packet::error_type override;
|
remote::file_handle &handle) -> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto fuse_read(const char *path, char *buffer,
|
||||||
fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
|
const remote::file_size &read_size,
|
||||||
const remote::file_offset &read_offset,
|
const remote::file_offset &read_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_rename(const char *from,
|
auto fuse_rename(const char *from, const char *to)
|
||||||
const char *to) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto fuse_write(const char *path, const char *buffer,
|
||||||
fuse_write(const char *path, const char *buffer,
|
const remote::file_size &write_size,
|
||||||
const remote::file_size &write_size,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_handle &handle)
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_write_base64(
|
auto fuse_write_base64(const char *path, const char *buffer,
|
||||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
const remote::file_size &write_size,
|
||||||
const remote::file_offset &write_offset,
|
const remote::file_offset &write_offset,
|
||||||
const remote::file_handle &handle) -> packet::error_type override;
|
const remote::file_handle &handle)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_readdir(const char *path, const remote::file_offset &offset,
|
auto fuse_readdir(const char *path, const remote::file_offset &offset,
|
||||||
const remote::file_handle &handle,
|
const remote::file_handle &handle, std::string &item_path)
|
||||||
std::string &item_path) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_release(const char *path, const remote::file_handle &handle)
|
auto fuse_release(const char *path, const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -157,8 +159,8 @@ public:
|
|||||||
|
|
||||||
auto fuse_rmdir(const char *path) -> packet::error_type override;
|
auto fuse_rmdir(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_setattr_x(const char *path,
|
auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||||
remote::setattr_x &attr) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_setbkuptime(const char *path, const remote::file_time &bkuptime)
|
auto fuse_setbkuptime(const char *path, const remote::file_time &bkuptime)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
@ -191,8 +193,8 @@ public:
|
|||||||
auto fuse_unlink(const char *path) -> packet::error_type override;
|
auto fuse_unlink(const char *path) -> packet::error_type override;
|
||||||
|
|
||||||
auto fuse_utimens(const char *path, const remote::file_time *tv,
|
auto fuse_utimens(const char *path, const remote::file_time *tv,
|
||||||
std::uint64_t op0,
|
std::uint64_t op0, std::uint64_t op1)
|
||||||
std::uint64_t op1) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
void set_fuse_uid_gid(const remote::user_id & /* uid */,
|
void set_fuse_uid_gid(const remote::user_id & /* uid */,
|
||||||
const remote::group_id & /* gid */) override {}
|
const remote::group_id & /* gid */) override {}
|
||||||
@ -201,20 +203,21 @@ public:
|
|||||||
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
auto json_create_directory_snapshot(const std::string &path, json &json_data)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_read_directory_snapshot(
|
auto json_read_directory_snapshot(const std::string &path,
|
||||||
const std::string &path, const remote::file_handle &handle,
|
const remote::file_handle &handle,
|
||||||
std::uint32_t page, json &json_data) -> packet::error_type override;
|
std::uint32_t page, json &json_data)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto json_release_directory_snapshot(const std::string &path,
|
auto json_release_directory_snapshot(const std::string &path,
|
||||||
const remote::file_handle &handle)
|
const remote::file_handle &handle)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
// WinFSP Layer
|
// WinFSP Layer
|
||||||
auto winfsp_can_delete(PVOID file_desc,
|
auto winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||||
PWSTR file_name) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
|
||||||
BOOLEAN &was_closed) -> packet::error_type override;
|
BOOLEAN &was_deleted) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
auto winfsp_close(PVOID file_desc) -> packet::error_type override;
|
||||||
|
|
||||||
@ -227,32 +230,33 @@ public:
|
|||||||
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_dir_buffer(PVOID file_desc,
|
auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr)
|
||||||
PVOID *&ptr) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_security_by_name(
|
auto winfsp_get_security_by_name(PWSTR file_name, PUINT32 attributes,
|
||||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
std::uint64_t *descriptor_size,
|
||||||
std::wstring &string_descriptor) -> packet::error_type override;
|
std::wstring &string_descriptor)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
|
||||||
std::string &volume_label)
|
std::string &volume_label)
|
||||||
-> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_mounted(const std::wstring &location)
|
||||||
winfsp_mounted(const std::wstring &location) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
auto winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||||
UINT32 granted_access, PVOID *file_desc,
|
UINT32 granted_access, PVOID *file_desc,
|
||||||
remote::file_info *file_info,
|
remote::file_info *file_info, std::string &normalized_name)
|
||||||
std::string &normalized_name) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||||
winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
BOOLEAN replace_attributes, UINT64 allocation_size,
|
||||||
BOOLEAN replace_attributes, UINT64 allocation_size,
|
remote::file_info *file_info)
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
PUINT32 bytes_transferred) -> packet::error_type override;
|
PUINT32 bytes_transferred) -> packet::error_type override;
|
||||||
@ -263,23 +267,24 @@ public:
|
|||||||
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||||
BOOLEAN replace_if_exists) -> packet::error_type override;
|
BOOLEAN replace_if_exists) -> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_basic_info(
|
auto winfsp_set_basic_info(PVOID file_desc, UINT32 attributes,
|
||||||
PVOID file_desc, UINT32 attributes, UINT64 creation_time,
|
UINT64 creation_time, UINT64 last_access_time,
|
||||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
UINT64 last_write_time, UINT64 change_time,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto winfsp_set_file_size(
|
auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
BOOLEAN set_allocation_size,
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
remote::file_info *file_info)
|
||||||
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_unmounted(const std::wstring &location)
|
||||||
winfsp_unmounted(const std::wstring &location) -> packet::error_type override;
|
-> packet::error_type override;
|
||||||
|
|
||||||
auto
|
auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||||
winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
||||||
BOOLEAN write_to_end, BOOLEAN constrained_io,
|
PUINT32 bytes_transferred, remote::file_info *file_info)
|
||||||
PUINT32 bytes_transferred,
|
-> packet::error_type override;
|
||||||
remote::file_info *file_info) -> packet::error_type override;
|
|
||||||
};
|
};
|
||||||
} // namespace remote_winfsp
|
} // namespace remote_winfsp
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -1041,18 +1041,18 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
|
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
|
||||||
UINT32 flags, BOOLEAN &was_closed)
|
UINT32 flags, BOOLEAN &was_deleted)
|
||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto relative_path = utils::string::to_utf8(file_name);
|
const auto relative_path = utils::string::to_utf8(file_name);
|
||||||
const auto file_path = construct_path(relative_path);
|
const auto file_path = construct_path(relative_path);
|
||||||
was_closed = 0;
|
was_deleted = 0U;
|
||||||
|
|
||||||
const auto directory = utils::file::directory(file_path).exists();
|
const auto directory = utils::file::directory(file_path).exists();
|
||||||
if (flags & FileSystemBase::FspCleanupDelete) {
|
if (flags & FileSystemBase::FspCleanupDelete) {
|
||||||
remove_all(file_path);
|
remove_all(file_path);
|
||||||
was_closed = 1;
|
was_deleted = 1U;
|
||||||
|
|
||||||
if (directory) {
|
if (directory) {
|
||||||
rmdir(file_path.c_str());
|
rmdir(file_path.c_str());
|
||||||
|
@ -136,7 +136,7 @@ auto remote_client::json_release_directory_snapshot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||||
UINT32 flags, BOOLEAN &was_closed)
|
UINT32 flags, BOOLEAN &was_deleted)
|
||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
|||||||
get_open_file_path(handle),
|
get_open_file_path(handle),
|
||||||
};
|
};
|
||||||
|
|
||||||
was_closed = 0;
|
was_deleted = 0U;
|
||||||
|
|
||||||
packet request;
|
packet request;
|
||||||
request.encode(file_desc);
|
request.encode(file_desc);
|
||||||
@ -161,8 +161,8 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
|||||||
packet_client_.send(function_name, request, response, service_flags),
|
packet_client_.send(function_name, request, response, service_flags),
|
||||||
};
|
};
|
||||||
|
|
||||||
DECODE_OR_IGNORE(&response, was_closed);
|
DECODE_OR_IGNORE(&response, was_deleted);
|
||||||
if (was_closed != 0U) {
|
if (was_deleted != 0U) {
|
||||||
remove_all(file_path);
|
remove_all(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,18 +936,18 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
|
auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
|
||||||
UINT32 flags, BOOLEAN &was_closed)
|
UINT32 flags, BOOLEAN &was_deleted)
|
||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
auto file_path = get_open_file_path(file_desc);
|
auto file_path = get_open_file_path(file_desc);
|
||||||
was_closed = FALSE;
|
was_deleted = FALSE;
|
||||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||||
if (ret == STATUS_SUCCESS) {
|
if (ret == STATUS_SUCCESS) {
|
||||||
if ((flags & FspCleanupDelete) != 0U) {
|
if ((flags & FspCleanupDelete) != 0U) {
|
||||||
remove_and_close_all(file_desc);
|
remove_and_close_all(file_desc);
|
||||||
was_closed = TRUE;
|
was_deleted = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ auto remote_winfsp_drive::CanDelete(PVOID /*file_node*/, PVOID file_desc,
|
|||||||
|
|
||||||
VOID remote_winfsp_drive::Cleanup(PVOID /*file_node*/, PVOID file_desc,
|
VOID remote_winfsp_drive::Cleanup(PVOID /*file_node*/, PVOID file_desc,
|
||||||
PWSTR file_name, ULONG flags) {
|
PWSTR file_name, ULONG flags) {
|
||||||
BOOLEAN was_closed{};
|
BOOLEAN was_deleted{};
|
||||||
remote_instance_->winfsp_cleanup(file_desc, file_name, flags, was_closed);
|
remote_instance_->winfsp_cleanup(file_desc, file_name, flags, was_deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID remote_winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) {
|
VOID remote_winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) {
|
||||||
|
@ -102,10 +102,10 @@ static void cleanup_test(remote_client &client) {
|
|||||||
normalized_name, exists);
|
normalized_name, exists);
|
||||||
EXPECT_EQ(STATUS_SUCCESS, ret);
|
EXPECT_EQ(STATUS_SUCCESS, ret);
|
||||||
|
|
||||||
BOOLEAN was_closed = 0u;
|
BOOLEAN was_deleted{0U};
|
||||||
EXPECT_EQ(STATUS_SUCCESS,
|
EXPECT_EQ(STATUS_SUCCESS,
|
||||||
client.winfsp_cleanup(file_desc, &api_path[0], 0, was_closed));
|
client.winfsp_cleanup(file_desc, &api_path[0], 0, was_deleted));
|
||||||
EXPECT_FALSE(was_closed);
|
EXPECT_FALSE(was_deleted);
|
||||||
EXPECT_EQ(STATUS_SUCCESS, client.winfsp_close(file_desc));
|
EXPECT_EQ(STATUS_SUCCESS, client.winfsp_close(file_desc));
|
||||||
|
|
||||||
EXPECT_TRUE(utils::file::file(test_file).remove());
|
EXPECT_TRUE(utils::file::file(test_file).remove());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user