refactor
This commit is contained in:
parent
a031f9d867
commit
4ce7d76500
@ -31,6 +31,7 @@ cxxstd
|
|||||||
d_largefile64_source
|
d_largefile64_source
|
||||||
d_largefile_source
|
d_largefile_source
|
||||||
d_ndebug
|
d_ndebug
|
||||||
|
dacl_security_information
|
||||||
dbackward_shared
|
dbackward_shared
|
||||||
dbghelp
|
dbghelp
|
||||||
dboost_root
|
dboost_root
|
||||||
@ -136,6 +137,8 @@ libuuid
|
|||||||
libuuid_include_dirs
|
libuuid_include_dirs
|
||||||
libvlc
|
libvlc
|
||||||
linkflags
|
linkflags
|
||||||
|
lptr
|
||||||
|
lpwstr
|
||||||
markdownlint
|
markdownlint
|
||||||
mbig
|
mbig
|
||||||
msvc
|
msvc
|
||||||
|
@ -133,8 +133,8 @@ auto remote_server::fuse_chflags(const char *path, std::uint32_t /*flags*/)
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -144,8 +144,8 @@ auto remote_server::fuse_chmod(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -156,8 +156,8 @@ auto remote_server::fuse_chown(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -171,12 +171,12 @@ auto remote_server::fuse_destroy() -> packet::error_type {
|
|||||||
|
|
||||||
/*packet::error_type remote_server::fuse_fallocate(const char *path, const
|
/*packet::error_type remote_server::fuse_fallocate(const char *path, const
|
||||||
std::int32_t &mode, const remote::file_offset &offset, const remote::file_offset
|
std::int32_t &mode, const remote::file_offset &offset, const remote::file_offset
|
||||||
&length, const remote::file_handle &handle) { const auto file_path =
|
&length, const remote::file_handle &handle) { auto file_path =
|
||||||
construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
|
construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
|
||||||
== 0) { res = _chsize_s(static_cast<int>(handle), offset + length);
|
== 0) { res = _chsize_s(static_cast<int>(handle), offset + length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}*/
|
}*/
|
||||||
@ -189,7 +189,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
|||||||
|
|
||||||
r_stat = {};
|
r_stat = {};
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
auto res{
|
auto res{
|
||||||
has_compat_open_info(handle, EBADF),
|
has_compat_open_info(handle, EBADF),
|
||||||
@ -203,7 +203,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -214,8 +214,8 @@ auto remote_server::fuse_fsetattr_x(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ auto remote_server::fuse_fsync(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
auto res{
|
auto res{
|
||||||
has_compat_open_info(handle, EBADF),
|
has_compat_open_info(handle, EBADF),
|
||||||
@ -245,7 +245,7 @@ auto remote_server::fuse_fsync(const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ auto remote_server::fuse_ftruncate(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
auto res{
|
auto res{
|
||||||
has_compat_open_info(handle, EBADF),
|
has_compat_open_info(handle, EBADF),
|
||||||
@ -278,7 +278,7 @@ auto remote_server::fuse_ftruncate(const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
|
|||||||
|
|
||||||
r_st = {};
|
r_st = {};
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
directory = utils::file::directory(file_path).exists();
|
directory = utils::file::directory(file_path).exists();
|
||||||
|
|
||||||
@ -301,20 +301,20 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
|
|||||||
populate_stat(path, directory, r_st, st1);
|
populate_stat(path, directory, r_st, st1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*packet::error_type remote_server::fuse_getxattr(const char *path, const char
|
/*packet::error_type remote_server::fuse_getxattr(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size) { const auto file_path =
|
*name, char *value, const remote::file_size &size) { auto file_path =
|
||||||
construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED;
|
construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret;
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret); return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet::error_type remote_server::fuse_getxattr_osx(const char *path, const char
|
packet::error_type remote_server::fuse_getxattr_osx(const char *path, const char
|
||||||
*name, char *value, const remote::file_size &size, std::uint32_t position) {
|
*name, char *value, const remote::file_size &size, std::uint32_t position) {
|
||||||
const auto file_path = construct_path(path); const auto ret =
|
auto file_path = construct_path(path); auto ret =
|
||||||
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
||||||
file_path, ret); return ret;
|
file_path, ret); return ret;
|
||||||
}*/
|
}*/
|
||||||
@ -325,8 +325,8 @@ auto remote_server::fuse_getxtimes(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -339,8 +339,8 @@ auto remote_server::fuse_init() -> packet::error_type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*packet::error_type remote_server::fuse_listxattr(const char *path, char
|
/*packet::error_type remote_server::fuse_listxattr(const char *path, char
|
||||||
*buffer, const remote::file_size &size) { const auto file_path =
|
*buffer, const remote::file_size &size) { auto file_path =
|
||||||
construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED;
|
construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}*/
|
}*/
|
||||||
@ -350,11 +350,11 @@ auto remote_server::fuse_mkdir(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto res{
|
auto res{
|
||||||
_mkdir(file_path.c_str()),
|
_mkdir(file_path.c_str()),
|
||||||
};
|
};
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -363,8 +363,8 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto unicode_file_path = utils::string::from_utf8(file_path);
|
auto unicode_file_path = utils::string::from_utf8(file_path);
|
||||||
auto res{-1};
|
auto res{-1};
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -392,13 +392,13 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode,
|
|||||||
|
|
||||||
auto ret = -1;
|
auto ret = -1;
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto directory_op = ((flags & remote::open_flags::directory) ==
|
auto directory_op = ((flags & remote::open_flags::directory) ==
|
||||||
remote::open_flags::directory);
|
remote::open_flags::directory);
|
||||||
std::int32_t perms = 0;
|
std::int32_t perms = 0;
|
||||||
const auto open_flags =
|
auto open_flags =
|
||||||
utils::unix_open_flags_to_flags_and_perms(mode, flags, perms);
|
utils::unix_open_flags_to_flags_and_perms(mode, flags, perms);
|
||||||
const auto create_op = (open_flags & _O_CREAT);
|
auto create_op = (open_flags & _O_CREAT);
|
||||||
|
|
||||||
if ((create_op != 0) && directory_op) {
|
if ((create_op != 0) && directory_op) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
@ -427,7 +427,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto res{-1};
|
auto res{-1};
|
||||||
|
|
||||||
if ((flags & remote::open_flags::directory) ==
|
if ((flags & remote::open_flags::directory) ==
|
||||||
@ -435,7 +435,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
|
|||||||
errno = EACCES;
|
errno = EACCES;
|
||||||
} else {
|
} else {
|
||||||
std::int32_t perms = 0;
|
std::int32_t perms = 0;
|
||||||
const auto open_flags =
|
auto open_flags =
|
||||||
utils::unix_open_flags_to_flags_and_perms(0, flags, perms) &
|
utils::unix_open_flags_to_flags_and_perms(0, flags, perms) &
|
||||||
(~_O_CREAT);
|
(~_O_CREAT);
|
||||||
int file = -1;
|
int file = -1;
|
||||||
@ -448,7 +448,7 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto &data = *reinterpret_cast<data_buffer *>(buffer);
|
auto &data = *reinterpret_cast<data_buffer *>(buffer);
|
||||||
auto res{0};
|
auto res{0};
|
||||||
if (read_size > std::numeric_limits<std::size_t>::max()) {
|
if (read_size > std::numeric_limits<std::size_t>::max()) {
|
||||||
@ -481,7 +481,7 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : static_cast<int>(data.size()));
|
auto ret = ((res < 0) ? -errno : static_cast<int>(data.size()));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
}
|
}
|
||||||
@ -492,13 +492,13 @@ auto remote_server::fuse_rename(const char *from, const char *to)
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto from_path = utils::path::combine(mount_location_, {from});
|
auto from_path = utils::path::combine(mount_location_, {from});
|
||||||
const auto to_path = utils::path::combine(mount_location_, {to});
|
auto to_path = utils::path::combine(mount_location_, {to});
|
||||||
auto res{
|
auto res{
|
||||||
rename(from_path.c_str(), to_path.c_str()),
|
rename(from_path.c_str(), to_path.c_str()),
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, from + std::string("|") + to,
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, from + std::string("|") + to,
|
||||||
ret);
|
ret);
|
||||||
return ret;
|
return ret;
|
||||||
@ -511,7 +511,7 @@ auto remote_server::fuse_write(const char *path, const char *buffer,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
std::size_t bytes_written{};
|
std::size_t bytes_written{};
|
||||||
auto res{0};
|
auto res{0};
|
||||||
if (write_size > std::numeric_limits<std::size_t>::max()) {
|
if (write_size > std::numeric_limits<std::size_t>::max()) {
|
||||||
@ -533,7 +533,7 @@ auto remote_server::fuse_write(const char *path, const char *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : static_cast<int>(bytes_written));
|
auto ret = ((res < 0) ? -errno : static_cast<int>(bytes_written));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ auto remote_server::fuse_readdir(const char *path,
|
|||||||
std::string &item_path) -> packet::error_type {
|
std::string &item_path) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto res{0};
|
auto res{0};
|
||||||
if (offset > std::numeric_limits<std::size_t>::max()) {
|
if (offset > std::numeric_limits<std::size_t>::max()) {
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
@ -570,7 +570,7 @@ auto remote_server::fuse_readdir(const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -580,14 +580,14 @@ auto remote_server::fuse_release(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
remove_compat_open_info(handle);
|
remove_compat_open_info(handle);
|
||||||
auto res{
|
auto res{
|
||||||
_close(static_cast<int>(handle)),
|
_close(static_cast<int>(handle)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -597,14 +597,14 @@ auto remote_server::fuse_releasedir(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*packet::error_type remote_server::fuse_removexattr(const char *path, const
|
/*packet::error_type remote_server::fuse_removexattr(const char *path, const
|
||||||
char *name) { const auto file_path = construct_path(path); const auto ret =
|
char *name) { auto file_path = construct_path(path); auto ret =
|
||||||
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
||||||
file_path, ret); return ret;
|
file_path, ret); return ret;
|
||||||
}*/
|
}*/
|
||||||
@ -612,11 +612,11 @@ file_path, ret); return ret;
|
|||||||
auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
|
auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto res{
|
auto res{
|
||||||
_rmdir(file_path.c_str()),
|
_rmdir(file_path.c_str()),
|
||||||
};
|
};
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -626,8 +626,8 @@ auto remote_server::fuse_setattr_x(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -637,8 +637,8 @@ auto remote_server::fuse_setbkuptime(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -648,8 +648,8 @@ auto remote_server::fuse_setchgtime(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -659,8 +659,8 @@ auto remote_server::fuse_setcrtime(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto ret = STATUS_NOT_IMPLEMENTED;
|
auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -674,15 +674,15 @@ auto remote_server::fuse_setvolname(const char *volname) -> packet::error_type {
|
|||||||
|
|
||||||
/*packet::error_type remote_server::fuse_setxattr(const char *path, const char
|
/*packet::error_type remote_server::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
|
||||||
&flags) { const auto file_path = construct_path(path); const auto ret =
|
&flags) { auto file_path = construct_path(path); auto ret =
|
||||||
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
||||||
file_path, ret); return ret;
|
file_path, ret); return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet::error_type remote_server::fuse_setxattr_osx(const char *path, const char
|
packet::error_type remote_server::fuse_setxattr_osx(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
|
||||||
&flags, const std::uint32_t &position) { const auto file_path =
|
&flags, const std::uint32_t &position) { auto file_path =
|
||||||
construct_path(path); const auto ret = STATUS_NOT_IMPLEMENTED;
|
construct_path(path); auto ret = STATUS_NOT_IMPLEMENTED;
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}*/
|
}*/
|
||||||
@ -691,11 +691,11 @@ auto remote_server::fuse_statfs(const char *path, std::uint64_t frsize,
|
|||||||
remote::statfs &r_stat) -> packet::error_type {
|
remote::statfs &r_stat) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
const auto total_bytes = drive_.get_total_drive_space();
|
auto total_bytes = drive_.get_total_drive_space();
|
||||||
const auto total_used = drive_.get_used_drive_space();
|
auto total_used = drive_.get_used_drive_space();
|
||||||
const auto used_blocks = utils::divide_with_ceiling(
|
auto used_blocks = utils::divide_with_ceiling(
|
||||||
total_used, static_cast<std::uint64_t>(frsize));
|
total_used, static_cast<std::uint64_t>(frsize));
|
||||||
r_stat.f_files = 4294967295;
|
r_stat.f_files = 4294967295;
|
||||||
r_stat.f_blocks = utils::divide_with_ceiling(
|
r_stat.f_blocks = utils::divide_with_ceiling(
|
||||||
@ -714,11 +714,11 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
const auto total_bytes = drive_.get_total_drive_space();
|
auto total_bytes = drive_.get_total_drive_space();
|
||||||
const auto total_used = drive_.get_used_drive_space();
|
auto total_used = drive_.get_used_drive_space();
|
||||||
const auto used_blocks =
|
auto used_blocks =
|
||||||
utils::divide_with_ceiling(total_used, static_cast<std::uint64_t>(bsize));
|
utils::divide_with_ceiling(total_used, static_cast<std::uint64_t>(bsize));
|
||||||
r_stat.f_blocks = utils::divide_with_ceiling(
|
r_stat.f_blocks = utils::divide_with_ceiling(
|
||||||
total_bytes, static_cast<std::uint64_t>(bsize));
|
total_bytes, static_cast<std::uint64_t>(bsize));
|
||||||
@ -740,12 +740,12 @@ auto remote_server::fuse_truncate(const char *path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto unicode_file_path = utils::string::from_utf8(file_path);
|
auto unicode_file_path = utils::string::from_utf8(file_path);
|
||||||
auto res{-1};
|
auto res{-1};
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
|
||||||
const auto flags_and_attributes =
|
auto flags_and_attributes =
|
||||||
FILE_FLAG_BACKUP_SEMANTICS |
|
FILE_FLAG_BACKUP_SEMANTICS |
|
||||||
(::PathIsDirectoryW(unicode_file_path.c_str()) != 0
|
(::PathIsDirectoryW(unicode_file_path.c_str()) != 0
|
||||||
? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS
|
? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS
|
||||||
@ -766,7 +766,7 @@ auto remote_server::fuse_truncate(const char *path,
|
|||||||
::CloseHandle(os_handle);
|
::CloseHandle(os_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -774,11 +774,11 @@ auto remote_server::fuse_truncate(const char *path,
|
|||||||
auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
|
auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
auto res{
|
auto res{
|
||||||
_unlink(file_path.c_str()),
|
_unlink(file_path.c_str()),
|
||||||
};
|
};
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -788,13 +788,13 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
const auto unicode_file_path = utils::string::from_utf8(file_path);
|
auto unicode_file_path = utils::string::from_utf8(file_path);
|
||||||
|
|
||||||
auto res{-1};
|
auto res{-1};
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
|
|
||||||
const auto flags_and_attributes =
|
auto flags_and_attributes =
|
||||||
FILE_FLAG_BACKUP_SEMANTICS |
|
FILE_FLAG_BACKUP_SEMANTICS |
|
||||||
(::PathIsDirectoryW(unicode_file_path.c_str()) != 0
|
(::PathIsDirectoryW(unicode_file_path.c_str()) != 0
|
||||||
? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS
|
? FILE_ATTRIBUTE_DIRECTORY | FILE_FLAG_POSIX_SEMANTICS
|
||||||
@ -838,7 +838,7 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
|||||||
::CloseHandle(os_handle);
|
::CloseHandle(os_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -849,7 +849,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
auto res{-1};
|
auto res{-1};
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
@ -868,7 +868,7 @@ auto remote_server::json_create_directory_snapshot(const std::string &path,
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -878,7 +878,7 @@ auto remote_server::json_read_directory_snapshot(
|
|||||||
std::uint32_t page, json &json_data) -> packet::error_type {
|
std::uint32_t page, json &json_data) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
|
|
||||||
int res{-EBADF};
|
int res{-EBADF};
|
||||||
auto iter = directory_cache_.get_directory(handle);
|
auto iter = directory_cache_.get_directory(handle);
|
||||||
@ -898,7 +898,7 @@ auto remote_server::json_read_directory_snapshot(
|
|||||||
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
iter->get_count(), REPERTORY_DIRECTORY_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret = ((res < 0) ? -errno : 0);
|
auto ret = ((res < 0) ? -errno : 0);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -908,7 +908,7 @@ auto remote_server::json_release_directory_snapshot(
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = construct_path(path);
|
auto file_path = construct_path(path);
|
||||||
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
|
RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name, file_path, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -940,10 +940,10 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = get_open_file_path(file_desc);
|
auto file_path = get_open_file_path(file_desc);
|
||||||
was_closed = FALSE;
|
was_closed = FALSE;
|
||||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||||
const 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 & FileSystemBase::CleanupDelete) != 0U) {
|
if ((flags & FileSystemBase::CleanupDelete) != 0U) {
|
||||||
::CloseHandle(handle);
|
::CloseHandle(handle);
|
||||||
@ -958,7 +958,7 @@ auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
|
|||||||
auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
|
auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = get_open_file_path(file_desc);
|
auto file_path = get_open_file_path(file_desc);
|
||||||
|
|
||||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||||
if (has_open_info(handle, STATUS_INVALID_HANDLE) == STATUS_SUCCESS) {
|
if (has_open_info(handle, STATUS_INVALID_HANDLE) == STATUS_SUCCESS) {
|
||||||
@ -978,7 +978,7 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = utils::string::from_utf8(utils::path::combine(
|
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||||
exists = static_cast<BOOLEAN>(
|
exists = static_cast<BOOLEAN>(
|
||||||
utils::file::file(
|
utils::file::file(
|
||||||
@ -1009,7 +1009,7 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
|||||||
open_info{0, "", nullptr, utils::string::to_utf8(file_path)});
|
open_info{0, "", nullptr, utils::string::to_utf8(file_path)});
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret =
|
auto ret =
|
||||||
(handle == INVALID_HANDLE_VALUE)
|
(handle == INVALID_HANDLE_VALUE)
|
||||||
? FspNtStatusFromWin32(::GetLastError())
|
? FspNtStatusFromWin32(::GetLastError())
|
||||||
: populate_file_info(construct_api_path(get_open_file_path(handle)),
|
: populate_file_info(construct_api_path(get_open_file_path(handle)),
|
||||||
@ -1062,7 +1062,7 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = utils::string::from_utf8(utils::path::combine(
|
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||||
|
|
||||||
auto ret = STATUS_BUFFER_OVERFLOW;
|
auto ret = STATUS_BUFFER_OVERFLOW;
|
||||||
@ -1076,13 +1076,14 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
|
|||||||
descriptor_size);
|
descriptor_size);
|
||||||
if ((ret == STATUS_SUCCESS) && (descriptor_size != nullptr)) {
|
if ((ret == STATUS_SUCCESS) && (descriptor_size != nullptr)) {
|
||||||
ULONG str_size{};
|
ULONG str_size{};
|
||||||
const auto security_info =
|
auto security_info =
|
||||||
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
|
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
|
||||||
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
|
DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
|
||||||
LPWSTR str{};
|
LPWSTR str{};
|
||||||
if (::ConvertSecurityDescriptorToStringSecurityDescriptorW(
|
if (::ConvertSecurityDescriptorToStringSecurityDescriptorW(
|
||||||
descriptor, SDDL_REVISION_1, security_info, &str, &str_size) !=
|
descriptor, SDDL_REVISION_1,
|
||||||
0) {
|
static_cast<SECURITY_INFORMATION>(security_info), &str,
|
||||||
|
&str_size) != 0) {
|
||||||
string_descriptor = std::wstring(str, wcslen(str));
|
string_descriptor = std::wstring(str, wcslen(str));
|
||||||
::LocalFree(str);
|
::LocalFree(str);
|
||||||
} else {
|
} else {
|
||||||
@ -1124,7 +1125,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto file_path = utils::string::from_utf8(utils::path::combine(
|
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||||
|
|
||||||
auto create_flags = FILE_FLAG_BACKUP_SEMANTICS;
|
auto create_flags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||||
@ -1143,7 +1144,7 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
|||||||
open_info{0, "", nullptr, utils::string::to_utf8(file_path)});
|
open_info{0, "", nullptr, utils::string::to_utf8(file_path)});
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ret =
|
auto ret =
|
||||||
(handle == INVALID_HANDLE_VALUE)
|
(handle == INVALID_HANDLE_VALUE)
|
||||||
? FspNtStatusFromWin32(::GetLastError())
|
? FspNtStatusFromWin32(::GetLastError())
|
||||||
: populate_file_info(construct_api_path(get_open_file_path(handle)),
|
: populate_file_info(construct_api_path(get_open_file_path(handle)),
|
||||||
@ -1238,7 +1239,7 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
|||||||
|
|
||||||
open_info ofi{};
|
open_info ofi{};
|
||||||
if (get_open_info(file_desc, ofi)) {
|
if (get_open_info(file_desc, ofi)) {
|
||||||
const auto api_path =
|
auto api_path =
|
||||||
utils::path::create_api_path(ofi.path.substr(mount_location_.size()));
|
utils::path::create_api_path(ofi.path.substr(mount_location_.size()));
|
||||||
directory_iterator iter(drive_.get_directory_items(api_path));
|
directory_iterator iter(drive_.get_directory_items(api_path));
|
||||||
auto offset = marker == nullptr
|
auto offset = marker == nullptr
|
||||||
@ -1264,14 +1265,13 @@ auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
|||||||
-> packet::error_type {
|
-> packet::error_type {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
const auto from_path = utils::string::from_utf8(utils::path::combine(
|
auto from_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(file_name)}));
|
mount_location_, {utils::string::to_utf8(file_name)}));
|
||||||
const auto to_path = utils::string::from_utf8(utils::path::combine(
|
auto to_path = utils::string::from_utf8(utils::path::combine(
|
||||||
mount_location_, {utils::string::to_utf8(new_file_name)}));
|
mount_location_, {utils::string::to_utf8(new_file_name)}));
|
||||||
const auto ret =
|
auto ret = ::MoveFileExW(
|
||||||
::MoveFileExW(from_path.c_str(), to_path.c_str(),
|
from_path.c_str(), to_path.c_str(),
|
||||||
replace_if_exists == 0U ? 0 : MOVEFILE_REPLACE_EXISTING) !=
|
replace_if_exists == 0U ? 0 : MOVEFILE_REPLACE_EXISTING) != 0
|
||||||
0
|
|
||||||
? STATUS_SUCCESS
|
? STATUS_SUCCESS
|
||||||
: FspNtStatusFromWin32(::GetLastError());
|
: FspNtStatusFromWin32(::GetLastError());
|
||||||
|
|
||||||
|
@ -194,6 +194,7 @@ TYPED_TEST(winfsp_test, delete_can_delete_after_mapping) {
|
|||||||
|
|
||||||
EXPECT_TRUE(::DeleteFileA(file_path.c_str()));
|
EXPECT_TRUE(::DeleteFileA(file_path.c_str()));
|
||||||
EXPECT_TRUE(::DeleteFileA(file_path2.c_str()));
|
EXPECT_TRUE(::DeleteFileA(file_path2.c_str()));
|
||||||
|
std::this_thread::sleep_for(2s);
|
||||||
|
|
||||||
EXPECT_TRUE(::RemoveDirectoryA(dir_path.c_str()));
|
EXPECT_TRUE(::RemoveDirectoryA(dir_path.c_str()));
|
||||||
EXPECT_FALSE(::RemoveDirectoryA(dir_path.c_str()));
|
EXPECT_FALSE(::RemoveDirectoryA(dir_path.c_str()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user