windows fixes
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
Scott E. Graves 2024-10-25 17:42:32 -05:00
parent 4b68e5e4b7
commit b508d98dd7
11 changed files with 193 additions and 181 deletions

View File

@ -81,8 +81,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
gid_t gid) -> api_error { -> api_error {
#endif #endif
return check_and_perform( return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error { api_path, X_OK, [&](api_meta_map &meta) -> api_error {
@ -185,9 +185,8 @@ auto fuse_drive::create_impl(std::string api_path, mode_t mode,
#endif // defined(__APPLE__) #endif // defined(__APPLE__)
auto meta = create_meta_attributes( auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now, now, now, FILE_ATTRIBUTE_ARCHIVE, now, now, is_directory_op,
is_directory_op, get_effective_gid(), "", mode, now, 0U, osx_flags, get_effective_gid(), "", mode, now, 0U, osx_flags, 0U,
0U,
utils::path::combine(config_.get_cache_directory(), utils::path::combine(config_.get_cache_directory(),
{utils::create_uuid_string()}), {utils::create_uuid_string()}),
get_effective_uid(), now); get_effective_uid(), now);
@ -454,8 +453,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *st,
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::getattr_impl(std::string api_path, auto fuse_drive::getattr_impl(std::string api_path, struct stat *st)
struct stat *st) -> api_error { -> api_error {
#endif #endif
const auto parent = utils::path::get_parent_api_path(api_path); const auto parent = utils::path::get_parent_api_path(api_path);
@ -537,8 +536,8 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
#endif // __APPLE__ #endif // __APPLE__
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_drive::init_impl(struct fuse_conn_info *conn, auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
struct fuse_config *cfg) -> void * { -> void * {
#else #else
void *fuse_drive::init_impl(struct fuse_conn_info *conn) { void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
#endif #endif
@ -763,8 +762,9 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
return api_error::success; return api_error::success;
} }
auto fuse_drive::releasedir_impl( auto fuse_drive::releasedir_impl(std::string /*api_path*/,
std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error { struct fuse_file_info *file_info)
-> api_error {
auto iter = directory_cache_->get_directory(file_info->fh); auto iter = directory_cache_->get_directory(file_info->fh);
if (iter == nullptr) { if (iter == nullptr) {
return api_error::invalid_handle; return api_error::invalid_handle;
@ -782,8 +782,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
} }
auto fuse_drive::rename_file(const std::string &from_api_path, auto fuse_drive::rename_file(const std::string &from_api_path,
const std::string &to_api_path, const std::string &to_api_path, bool overwrite)
bool overwrite) -> int { -> int {
const auto res = fm_->rename_file(from_api_path, to_api_path, overwrite); const auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
errno = std::abs(utils::from_api_error(res)); errno = std::abs(utils::from_api_error(res));
return (res == api_error::success) ? 0 : -1; return (res == api_error::success) ? 0 : -1;
@ -793,8 +793,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path, auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
unsigned int /*flags*/) -> api_error { unsigned int /*flags*/) -> api_error {
#else #else
auto fuse_drive::rename_impl(std::string from_api_path, auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path)
std::string to_api_path) -> api_error { -> api_error {
#endif #endif
auto res = check_parent_access(to_api_path, W_OK | X_OK); auto res = check_parent_access(to_api_path, W_OK | X_OK);
if (res != api_error::success) { if (res != api_error::success) {
@ -901,15 +901,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
} }
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::getxattr_impl(std::string api_path, const char *name, auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
char *value, size_t size, char *value, size_t size, int &attribute_size)
int &attribute_size) -> api_error { -> api_error {
return getxattr_common(api_path, name, value, size, attribute_size, nullptr); return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
} }
#endif // __APPLE__ #endif // __APPLE__
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size, auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
int &required_size, int &required_size, bool &return_size)
bool &return_size) -> api_error { -> api_error {
const auto check_size = (size == 0); const auto check_size = (size == 0);
auto res = check_parent_access(api_path, X_OK); auto res = check_parent_access(api_path, X_OK);
@ -948,8 +948,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
return res; return res;
} }
auto fuse_drive::removexattr_impl(std::string api_path, auto fuse_drive::removexattr_impl(std::string api_path, const char *name)
const char *name) -> api_error { -> api_error {
std::string attribute_name; std::string attribute_name;
#if defined(__APPLE__) #if defined(__APPLE__)
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path); auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
@ -977,8 +977,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
uint32_t position) -> api_error { uint32_t position) -> api_error {
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::setxattr_impl(std::string api_path, const char *name, auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size, const char *value, size_t size, int flags)
int flags) -> api_error { -> api_error {
#endif #endif
std::string attribute_name; std::string attribute_name;
#if defined(__APPLE__) #if defined(__APPLE__)
@ -1053,8 +1053,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
} }
#if defined(__APPLE__) #if defined(__APPLE__)
auto fuse_drive::setattr_x_impl(std::string api_path, auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
struct setattr_x *attr) -> api_error { -> api_error {
bool exists{}; bool exists{};
auto res = provider_.is_file(api_path, exists); auto res = provider_.is_file(api_path, exists);
if (res != api_error::success) { if (res != api_error::success) {
@ -1108,7 +1108,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
ts[0].tv_sec = attr->acctime.tv_sec; ts[0].tv_sec = attr->acctime.tv_sec;
ts[0].tv_nsec = attr->acctime.tv_nsec; ts[0].tv_nsec = attr->acctime.tv_nsec;
} else { } else {
struct timeval tv {}; struct timeval tv{};
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ts[0].tv_sec = tv.tv_sec; ts[0].tv_sec = tv.tv_sec;
ts[0].tv_nsec = tv.tv_usec * 1000; ts[0].tv_nsec = tv.tv_usec * 1000;
@ -1153,8 +1153,9 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
return api_error::success; return api_error::success;
} }
auto fuse_drive::setbkuptime_impl( auto fuse_drive::setbkuptime_impl(std::string api_path,
std::string api_path, const struct timespec *bkuptime) -> api_error { const struct timespec *bkuptime)
-> api_error {
return check_and_perform( return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error { api_path, X_OK, [&](api_meta_map &meta) -> api_error {
const auto nanos = bkuptime->tv_nsec + const auto nanos = bkuptime->tv_nsec +
@ -1190,8 +1191,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
return api_error::success; return api_error::success;
} }
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
struct statfs *stbuf) -> api_error { -> api_error {
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) { if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
return api_error::os_error; return api_error::os_error;
} }
@ -1216,8 +1217,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
return api_error::success; return api_error::success;
} }
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::statfs_impl(std::string /*api_path*/, auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf)
struct statvfs *stbuf) -> api_error { -> api_error {
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) { if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
return api_error::os_error; return api_error::os_error;
} }
@ -1298,8 +1299,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::utimens_impl(std::string api_path, auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2])
const struct timespec tv[2]) -> api_error { -> api_error {
#endif #endif
api_meta_map meta; api_meta_map meta;
auto res = provider_.get_item_meta(api_path, meta); auto res = provider_.get_item_meta(api_path, meta);

View File

@ -96,7 +96,7 @@ auto remote_server::populate_file_info(const std::string &api_path,
meta_attributes = meta_attributes =
utils::file::directory(construct_path(api_path)).exists() utils::file::directory(construct_path(api_path)).exists()
? std::to_string(FILE_ATTRIBUTE_DIRECTORY) ? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_NORMAL); : std::to_string(FILE_ATTRIBUTE_ARCHIVE);
drive_.set_item_meta(api_path, META_ATTRIBUTES, meta_attributes); drive_.set_item_meta(api_path, META_ATTRIBUTES, meta_attributes);
} }
const auto attributes = utils::string::to_uint32(meta_attributes); const auto attributes = utils::string::to_uint32(meta_attributes);
@ -208,8 +208,8 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask)
return ret; return ret;
} }
auto remote_server::fuse_chflags(const char *path, auto remote_server::fuse_chflags(const char *path, std::uint32_t flags)
std::uint32_t flags) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -316,9 +316,10 @@ length); ret = ((res < 0) ? -errno : 0); #endif
return ret; return ret;
}*/ }*/
auto remote_server::fuse_fgetattr( auto remote_server::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 { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
r_stat = {}; r_stat = {};
@ -328,7 +329,7 @@ auto remote_server::fuse_fgetattr(
auto res = has_open_info(static_cast<native_handle>(handle), EBADF); auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
if (res == 0) { if (res == 0) {
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {}; struct stat64 unix_st{};
res = fstat64(static_cast<native_handle>(handle), &unix_st); res = fstat64(static_cast<native_handle>(handle), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -340,9 +341,10 @@ auto remote_server::fuse_fgetattr(
return ret; return ret;
} }
auto remote_server::fuse_fsetattr_x( auto remote_server::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 { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -458,9 +460,10 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
return ret; return ret;
} }
auto remote_server::fuse_ftruncate( auto remote_server::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 { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -488,7 +491,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {}; struct stat64 unix_st{};
auto res = stat64(file_path.c_str(), &unix_st); auto res = stat64(file_path.c_str(), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -553,9 +556,10 @@ STATUS_NOT_IMPLEMENTED; #endif RAISE_REMOTE_FUSE_SERVER_EVENT(function_name,
file_path, ret); return ret; file_path, ret); return ret;
}*/ }*/
auto remote_server::fuse_getxtimes( auto remote_server::fuse_getxtimes(const char *path,
const char *path, remote::file_time &bkuptime, remote::file_time &bkuptime,
remote::file_time &crtime) -> packet::error_type { remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -655,10 +659,11 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
return ret; return ret;
} }
auto remote_server::fuse_read( auto remote_server::fuse_read(const char *path, char *buffer,
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 { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -679,8 +684,8 @@ auto remote_server::fuse_read(
return static_cast<packet::error_type>(ret); return static_cast<packet::error_type>(ret);
} }
auto remote_server::fuse_rename(const char *from, auto remote_server::fuse_rename(const char *from, const char *to)
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}); const auto from_path = utils::path::combine(mount_location_, {from});
@ -718,8 +723,9 @@ auto remote_server::fuse_readdir(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_release( auto remote_server::fuse_release(const char *path,
const char *path, const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet::error_type ret = 0; packet::error_type ret = 0;
@ -736,8 +742,9 @@ auto remote_server::fuse_release(
return ret; return ret;
} }
auto remote_server::fuse_releasedir( auto remote_server::fuse_releasedir(const char *path,
const char *path, const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -788,8 +795,9 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr)
return ret; return ret;
} }
auto remote_server::fuse_setbkuptime( auto remote_server::fuse_setbkuptime(const char *path,
const char *path, const remote::file_time &bkuptime) -> packet::error_type { const remote::file_time &bkuptime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -808,8 +816,9 @@ auto remote_server::fuse_setbkuptime(
return ret; return ret;
} }
auto remote_server::fuse_setchgtime( auto remote_server::fuse_setchgtime(const char *path,
const char *path, const remote::file_time &chgtime) -> packet::error_type { const remote::file_time &chgtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -828,8 +837,9 @@ auto remote_server::fuse_setchgtime(
return ret; return ret;
} }
auto remote_server::fuse_setcrtime( auto remote_server::fuse_setcrtime(const char *path,
const char *path, const remote::file_time &crtime) -> packet::error_type { const remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -920,8 +930,9 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0; return 0;
} }
auto remote_server::fuse_truncate( auto remote_server::fuse_truncate(const char *path,
const char *path, const remote::file_offset &size) -> packet::error_type { const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -942,8 +953,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
} }
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, auto remote_server::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 { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -970,10 +981,11 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
return ret; return ret;
} }
auto remote_server::fuse_write( auto remote_server::fuse_write(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 { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -1003,8 +1015,8 @@ auto remote_server::fuse_write_base64(
} }
// WinFSP Layer // WinFSP Layer
auto remote_server::winfsp_can_delete(PVOID file_desc, auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
PWSTR file_name) -> 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);
@ -1030,8 +1042,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc,
} }
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name, auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
UINT32 flags, UINT32 flags, BOOLEAN &was_closed)
BOOLEAN &was_closed) -> 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);
@ -1108,8 +1120,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 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 { -> 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);
@ -1120,14 +1132,11 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
attributes |= FILE_ATTRIBUTE_DIRECTORY; attributes |= FILE_ATTRIBUTE_DIRECTORY;
} else { } else {
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY); attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY);
attributes |= FILE_ATTRIBUTE_ARCHIVE;
} }
if (not attributes) { remote::file_mode mode{0U};
attributes = FILE_ATTRIBUTE_NORMAL; std::uint32_t flags{0U};
}
remote::file_mode mode = 0;
std::uint32_t flags = 0;
utils::windows_create_to_unix(create_options, granted_access, flags, mode); utils::windows_create_to_unix(create_options, granted_access, flags, mode);
int res = 0; int res = 0;
@ -1179,8 +1188,9 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret; return ret;
} }
auto remote_server::winfsp_get_file_info( auto remote_server::winfsp_get_file_info(PVOID file_desc,
PVOID file_desc, remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1223,9 +1233,10 @@ auto remote_server::winfsp_get_security_by_name(
return ret; return ret;
} }
auto remote_server::winfsp_get_volume_info( auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &total_size, UINT64 &free_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type { std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label); drive_.get_volume_info(total_size, free_size, volume_label);
@ -1242,10 +1253,11 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_open( auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 granted_access, PVOID *file_desc,
PVOID *file_desc, remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name) -> packet::error_type { std::string &normalized_name)
-> 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);
@ -1281,10 +1293,11 @@ auto remote_server::winfsp_open(
return ret; return ret;
} }
auto remote_server::winfsp_overwrite( auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1315,10 +1328,9 @@ auto remote_server::winfsp_overwrite(
} }
if (set_attributes) { if (set_attributes) {
attributes &= static_cast<UINT32>( attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_NORMAL);
~(FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_NORMAL));
if (attributes == 0U) { if (attributes == 0U) {
attributes = FILE_ATTRIBUTE_NORMAL; attributes = FILE_ATTRIBUTE_ARCHIVE;
} }
drive_.set_item_meta(api_path, META_ATTRIBUTES, drive_.set_item_meta(api_path, META_ATTRIBUTES,
std::to_string(attributes)); std::to_string(attributes));
@ -1401,9 +1413,10 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret; return ret;
} }
auto remote_server::winfsp_rename( auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type { BOOLEAN replace_if_exists)
-> 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);
@ -1447,15 +1460,15 @@ auto remote_server::winfsp_set_basic_info(
} else if (attributes == 0) { } else if (attributes == 0) {
attributes = utils::file::directory(file_path).exists() attributes = utils::file::directory(file_path).exists()
? FILE_ATTRIBUTE_DIRECTORY ? FILE_ATTRIBUTE_DIRECTORY
: FILE_ATTRIBUTE_NORMAL; : FILE_ATTRIBUTE_ARCHIVE;
} }
const auto api_path = construct_api_path(file_path); const auto api_path = construct_api_path(file_path);
api_meta_map meta; api_meta_map meta;
if (attributes != 0U) { if (attributes != 0U) {
if (((attributes & FILE_ATTRIBUTE_NORMAL) != 0U) && attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_NORMAL);
(attributes != FILE_ATTRIBUTE_NORMAL)) { if (attributes == = 0U) {
attributes &= static_cast<UINT32>(~(FILE_ATTRIBUTE_NORMAL)); attributes |= static_cast<UINT32>(FILE_ATTRIBUTE_ARCHIVE);
} }
drive_.set_item_meta(api_path, META_ATTRIBUTES, drive_.set_item_meta(api_path, META_ATTRIBUTES,
std::to_string(attributes)); std::to_string(attributes));
@ -1497,9 +1510,10 @@ auto remote_server::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_server::winfsp_set_file_size( auto remote_server::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 { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1535,10 +1549,12 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_write( auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, UINT32 length, BOOLEAN write_to_end,
BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, BOOLEAN constrained_io,
remote::file_info *file_info) -> packet::error_type { PUINT32 bytes_transferred,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0; *bytes_transferred = 0;
@ -1586,8 +1602,9 @@ auto remote_server::winfsp_write(
return ret; return ret;
} }
auto remote_server::json_create_directory_snapshot( auto remote_server::json_create_directory_snapshot(const std::string &path,
const std::string &path, json &json_data) -> packet::error_type { json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -1646,8 +1663,8 @@ auto remote_server::json_read_directory_snapshot(
} }
auto remote_server::json_release_directory_snapshot( auto remote_server::json_release_directory_snapshot(
const std::string &path, const std::string &path, const remote::file_handle &handle)
const 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); const auto file_path = construct_path(path);
@ -1677,7 +1694,7 @@ auto remote_server::update_to_windows_format(json &item) -> json & {
if (item["meta"][META_ATTRIBUTES].empty()) { if (item["meta"][META_ATTRIBUTES].empty()) {
item["meta"][META_ATTRIBUTES] = item["meta"][META_ATTRIBUTES] =
item["directory"].get<bool>() ? std::to_string(FILE_ATTRIBUTE_DIRECTORY) item["directory"].get<bool>() ? std::to_string(FILE_ATTRIBUTE_DIRECTORY)
: std::to_string(FILE_ATTRIBUTE_NORMAL); : std::to_string(FILE_ATTRIBUTE_ARCHIVE);
drive_.set_item_meta(api_path, META_ATTRIBUTES, drive_.set_item_meta(api_path, META_ATTRIBUTES,
item["meta"][META_ATTRIBUTES].get<std::string>()); item["meta"][META_ATTRIBUTES].get<std::string>());
} }

View File

@ -991,11 +991,9 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
create_flags |= FILE_FLAG_POSIX_SEMANTICS; create_flags |= FILE_FLAG_POSIX_SEMANTICS;
attributes |= FILE_ATTRIBUTE_DIRECTORY; attributes |= FILE_ATTRIBUTE_DIRECTORY;
} else { } else {
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY); attributes &= static_cast<UINT32>(
} ~(FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_NORMAL));
attributes |= FILE_ATTRIBUTE_ARCHIVE;
if (attributes == 0U) {
attributes = FILE_ATTRIBUTE_NORMAL;
} }
auto *handle = ::CreateFileW( auto *handle = ::CreateFileW(
@ -1165,8 +1163,9 @@ auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
if (replace_attributes != 0U) { if (replace_attributes != 0U) {
if (attributes == 0U) { if (attributes == 0U) {
attributes = FILE_ATTRIBUTE_NORMAL; attributes = FILE_ATTRIBUTE_ARCHIVE;
} }
FILE_BASIC_INFO basic_info{}; FILE_BASIC_INFO basic_info{};
basic_info.FileAttributes = attributes; basic_info.FileAttributes = attributes;
if (::SetFileInformationByHandle(handle, FileBasicInfo, &basic_info, if (::SetFileInformationByHandle(handle, FileBasicInfo, &basic_info,

View File

@ -301,11 +301,9 @@ auto winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
if ((create_options & FILE_DIRECTORY_FILE) != 0U) { if ((create_options & FILE_DIRECTORY_FILE) != 0U) {
attributes |= FILE_ATTRIBUTE_DIRECTORY; attributes |= FILE_ATTRIBUTE_DIRECTORY;
} else { } else {
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_DIRECTORY); attributes &= static_cast<UINT32>(
} ~(FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_NORMAL));
attributes |= FILE_ATTRIBUTE_ARCHIVE;
if (attributes == 0U) {
attributes = FILE_ATTRIBUTE_NORMAL;
} }
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
@ -567,6 +565,7 @@ auto winfsp_drive::Init(PVOID host) -> NTSTATUS {
file_system_host->SetCasePreservedNames(TRUE); file_system_host->SetCasePreservedNames(TRUE);
file_system_host->SetNamedStreams(FALSE); file_system_host->SetNamedStreams(FALSE);
file_system_host->SetUnicodeOnDisk(TRUE); file_system_host->SetUnicodeOnDisk(TRUE);
file_system_host->SetMaxComponentLength(4096U);
file_system_host->SetPersistentAcls(FALSE); file_system_host->SetPersistentAcls(FALSE);
file_system_host->SetPostCleanupWhenModifiedOnly(TRUE); file_system_host->SetPostCleanupWhenModifiedOnly(TRUE);
file_system_host->SetPassQueryDirectoryPattern(FALSE); file_system_host->SetPassQueryDirectoryPattern(FALSE);
@ -745,7 +744,7 @@ auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
// Handle replace attributes // Handle replace attributes
if (replace_attributes != 0U) { if (replace_attributes != 0U) {
if (attributes == 0U) { if (attributes == 0U) {
attributes = FILE_ATTRIBUTE_NORMAL; attributes = FILE_ATTRIBUTE_ARCHIVE;
} }
meta[META_ATTRIBUTES] = std::to_string(attributes); meta[META_ATTRIBUTES] = std::to_string(attributes);
error = provider_.set_item_meta(api_path, meta); error = provider_.set_item_meta(api_path, meta);
@ -813,9 +812,7 @@ void winfsp_drive::populate_file_info(std::uint64_t file_size,
FSP_FSCTL_FILE_INFO &file_info) { FSP_FSCTL_FILE_INFO &file_info) {
file_info.FileSize = file_size; file_info.FileSize = file_size;
file_info.AllocationSize = file_info.AllocationSize =
utils::divide_with_ceiling(file_size == 0U ? WINFSP_ALLOCATION_UNIT utils::divide_with_ceiling(file_size, WINFSP_ALLOCATION_UNIT) *
: file_size,
WINFSP_ALLOCATION_UNIT) *
WINFSP_ALLOCATION_UNIT; WINFSP_ALLOCATION_UNIT;
file_info.ChangeTime = utils::get_changed_time_from_meta(meta); file_info.ChangeTime = utils::get_changed_time_from_meta(meta);
file_info.CreationTime = utils::get_creation_time_from_meta(meta); file_info.CreationTime = utils::get_creation_time_from_meta(meta);
@ -1025,19 +1022,20 @@ auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
if (fm_->get_open_file(handle, false, file)) { if (fm_->get_open_file(handle, false, file)) {
api_path = file->get_api_path(); api_path = file->get_api_path();
if (attributes == INVALID_FILE_ATTRIBUTES) { if (attributes == INVALID_FILE_ATTRIBUTES) {
attributes = 0; attributes = 0U;
} else if (attributes == 0) { } else if (attributes == 0U) {
attributes = file->is_directory() ? FILE_ATTRIBUTE_DIRECTORY attributes = file->is_directory() ? FILE_ATTRIBUTE_DIRECTORY
: FILE_ATTRIBUTE_NORMAL; : FILE_ATTRIBUTE_ARCHIVE;
} }
api_meta_map meta; api_meta_map meta;
if (attributes != 0U) { if (attributes != 0U) {
if (((attributes & FILE_ATTRIBUTE_NORMAL) != 0U) && auto next_attributes =
(attributes != FILE_ATTRIBUTE_NORMAL)) { attributes & static_cast<UINT32>(~FILE_ATTRIBUTE_NORMAL);
attributes &= static_cast<UINT32>(~FILE_ATTRIBUTE_NORMAL); if (next_attributes == 0U) {
next_attributes = attributes;
} }
meta[META_ATTRIBUTES] = std::to_string(attributes); meta[META_ATTRIBUTES] = std::to_string(next_attributes);
} }
if ((creation_time != 0U) && (creation_time != max_time)) { if ((creation_time != 0U) && (creation_time != max_time)) {
meta[META_CREATION] = std::to_string( meta[META_CREATION] = std::to_string(

View File

@ -225,8 +225,7 @@ auto provider_meta_handler(i_provider &provider, bool directory,
const api_file &file) -> api_error { const api_file &file) -> api_error {
const auto meta = create_meta_attributes( const auto meta = create_meta_attributes(
file.accessed_date, file.accessed_date,
directory ? FILE_ATTRIBUTE_DIRECTORY directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_ARCHIVE,
: FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE,
file.changed_date, file.creation_date, directory, getgid(), file.key, file.changed_date, file.creation_date, directory, getgid(), file.key,
directory ? S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR directory ? S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR
: S_IFREG | S_IRUSR | S_IWUSR, : S_IFREG | S_IRUSR | S_IWUSR,

View File

@ -196,8 +196,7 @@ auto provider_meta_handler(i_provider &provider, bool directory,
const api_file &file) -> api_error { const api_file &file) -> api_error {
const auto meta = create_meta_attributes( const auto meta = create_meta_attributes(
file.accessed_date, file.accessed_date,
directory ? FILE_ATTRIBUTE_DIRECTORY directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_ARCHIVE,
: FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE,
file.changed_date, file.creation_date, directory, 0u, file.key, file.changed_date, file.creation_date, directory, 0u, file.key,
directory ? S_IFDIR : S_IFREG, file.modified_date, 0u, 0u, file.file_size, directory ? S_IFDIR : S_IFREG, file.modified_date, 0u, 0u, file.file_size,
file.source_path, 0u, file.modified_date); file.source_path, 0u, file.modified_date);

View File

@ -37,8 +37,7 @@ void calculate_allocation_size(bool directory, std::uint64_t file_size,
if (file_size > allocation_size) { if (file_size > allocation_size) {
allocation_size = file_size; allocation_size = file_size;
} }
allocation_size =
((allocation_size == 0U) ? WINFSP_ALLOCATION_UNIT : allocation_size);
allocation_size = allocation_size =
utils::divide_with_ceiling(allocation_size, WINFSP_ALLOCATION_UNIT) * utils::divide_with_ceiling(allocation_size, WINFSP_ALLOCATION_UNIT) *
WINFSP_ALLOCATION_UNIT; WINFSP_ALLOCATION_UNIT;

View File

@ -140,8 +140,8 @@ protected:
} }
public: public:
[[nodiscard]] static auto [[nodiscard]] static auto create_directory_and_test(std::string &dir_name)
create_directory_and_test(std::string &dir_name) -> std::string { -> std::string {
dir_name += std::to_string(++idx); dir_name += std::to_string(++idx);
auto api_path = utils::path::create_api_path(dir_name); auto api_path = utils::path::create_api_path(dir_name);
auto dir_path = utils::path::combine(mount_location, {dir_name}); auto dir_path = utils::path::combine(mount_location, {dir_name});
@ -152,8 +152,8 @@ public:
return dir_path; return dir_path;
} }
[[nodiscard]] static auto [[nodiscard]] static auto create_file_and_test(std::string &file_name)
create_file_and_test(std::string &file_name) -> std::string { -> std::string {
file_name += std::to_string(++idx); file_name += std::to_string(++idx);
auto api_path = utils::path::create_api_path(file_name); auto api_path = utils::path::create_api_path(file_name);
auto file_path = utils::path::combine(mount_location, {file_name}); auto file_path = utils::path::combine(mount_location, {file_name});
@ -173,7 +173,7 @@ public:
std::string attr; std::string attr;
EXPECT_EQ(api_error::success, EXPECT_EQ(api_error::success,
provider->get_item_meta(api_path, META_ATTRIBUTES, attr)); provider->get_item_meta(api_path, META_ATTRIBUTES, attr));
EXPECT_EQ(FILE_ATTRIBUTE_NORMAL, utils::string::to_uint32(attr)); EXPECT_EQ(FILE_ATTRIBUTE_ARCHIVE, utils::string::to_uint32(attr));
return file_path; return file_path;
} }

View File

@ -141,7 +141,7 @@ public:
auto directory = utils::file::directory(file_path).exists(); auto directory = utils::file::directory(file_path).exists();
auto attributes = auto attributes =
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_BACKUP_SEMANTICS |
(directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL); (directory ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_ARCHIVE);
auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE; auto share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
auto handle = ::CreateFileA( auto handle = ::CreateFileA(
file_path.c_str(), GENERIC_READ, static_cast<DWORD>(share_mode), file_path.c_str(), GENERIC_READ, static_cast<DWORD>(share_mode),

View File

@ -130,9 +130,9 @@ TEST_F(file_manager_test, can_create_and_close_file) {
std::shared_ptr<i_open_file> f; std::shared_ptr<i_open_file> f;
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "key", 2, now + 3u,
false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10, now + 4u); 3u, 4u, 0u, source_path, 10, now + 4u);
EXPECT_CALL(mp, create_file("/test_create.txt", meta)) EXPECT_CALL(mp, create_file("/test_create.txt", meta))
.WillOnce(Return(api_error::success)); .WillOnce(Return(api_error::success));
@ -235,9 +235,9 @@ TEST_F(file_manager_test, can_open_and_close_file) {
{ {
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "key", 2, now + 3u,
false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10, now + 4u); 3u, 4u, 0u, source_path, 10, now + 4u);
EXPECT_CALL(mp, create_file).Times(0u); EXPECT_CALL(mp, create_file).Times(0u);
@ -330,9 +330,9 @@ TEST_F(file_manager_test, can_open_and_close_multiple_handles_for_same_file) {
cfg->get_cache_directory(), {utils::create_uuid_string()}); cfg->get_cache_directory(), {utils::create_uuid_string()});
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "key", 2, now + 3u,
false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10, now + 4u); 3u, 4u, 0u, source_path, 10, now + 4u);
EXPECT_CALL(mp, create_file).Times(0u); EXPECT_CALL(mp, create_file).Times(0u);
@ -404,8 +404,8 @@ TEST_F(file_manager_test,
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now, FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, false, 1, "key", 2,
false, 1, "key", 2, now + 3u, 3u, 4u, now + 3u, 3u, 4u,
utils::encryption::encrypting_reader::get_data_chunk_size() * 4u, utils::encryption::encrypting_reader::get_data_chunk_size() * 4u,
source_path, 10, now + 4u); source_path, 10, now + 4u);
auto &nf = auto &nf =
@ -558,8 +558,8 @@ TEST_F(file_manager_test, upload_occurs_after_write_if_fully_downloaded) {
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now, FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, false, 1, "key", 2,
false, 1, "key", 2, now + 3u, 3u, 4u, now + 3u, 3u, 4u,
utils::encryption::encrypting_reader::get_data_chunk_size() * 4u, utils::encryption::encrypting_reader::get_data_chunk_size() * 4u,
source_path, 10, now + 4u); source_path, 10, now + 4u);
auto &nf = auto &nf =
@ -657,9 +657,9 @@ TEST_F(file_manager_test, can_evict_file) {
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "key", 2, now + 3u, 3u,
false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10, now + 4u); 4u, 0u, source_path, 10, now + 4u);
std::uint64_t handle{}; std::uint64_t handle{};
{ {
std::shared_ptr<i_open_file> f; std::shared_ptr<i_open_file> f;
@ -859,9 +859,9 @@ TEST_F(file_manager_test, evict_file_fails_if_file_is_uploading) {
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "", 2, now + 3u, 3u,
false, 1, "", 2, now + 3u, 3u, 4u, 0u, source_path, 10, now + 4u); 4u, 0u, source_path, 10, now + 4u);
std::uint64_t handle{}; std::uint64_t handle{};
{ {
std::shared_ptr<i_open_file> f; std::shared_ptr<i_open_file> f;
@ -1040,9 +1040,9 @@ TEST_F(file_manager_test, file_is_not_opened_if_provider_create_file_fails) {
EXPECT_CALL(mp, is_read_only()).WillRepeatedly(Return(false)); EXPECT_CALL(mp, is_read_only()).WillRepeatedly(Return(false));
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(now, FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now + 2u, false, 1, "", 2, now + 3u, 3u,
false, 1, "", 2, now + 3u, 3u, 4u, 0u, "/test_create.src", 10, now + 4u); 4u, 0u, "/test_create.src", 10, now + 4u);
file_manager fm(*cfg, mp); file_manager fm(*cfg, mp);
EXPECT_CALL(mp, create_file("/test_create.txt", meta)) EXPECT_CALL(mp, create_file("/test_create.txt", meta))
@ -1431,8 +1431,8 @@ TEST_F(file_manager_test, file_is_closed_after_download_timeout) {
const auto now = utils::time::get_time_now(); const auto now = utils::time::get_time_now();
auto meta = create_meta_attributes( auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, now, FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u, false, 1, "key", 2,
false, 1, "key", 2, now + 3u, 3u, 4u, now + 3u, 3u, 4u,
utils::encryption::encrypting_reader::get_data_chunk_size() * 4u, utils::encryption::encrypting_reader::get_data_chunk_size() * 4u,
source_path, 10, now + 4u); source_path, 10, now + 4u);

View File

@ -179,7 +179,7 @@ static void get_security_by_name_test(remote_client &client) {
ret = client.winfsp_get_security_by_name( ret = client.winfsp_get_security_by_name(
&api_path[0], &attributes, &security_descriptor_size, str_descriptor); &api_path[0], &attributes, &security_descriptor_size, str_descriptor);
EXPECT_EQ(STATUS_SUCCESS, ret); EXPECT_EQ(STATUS_SUCCESS, ret);
EXPECT_EQ(static_cast<UINT32>(FILE_ATTRIBUTE_NORMAL), attributes); EXPECT_EQ(static_cast<UINT32>(FILE_ATTRIBUTE_ARCHIVE), attributes);
EXPECT_FALSE(str_descriptor.empty()); EXPECT_FALSE(str_descriptor.empty());
EXPECT_TRUE(utils::file::file(test_file).remove()); EXPECT_TRUE(utils::file::file(test_file).remove());