fuse unit tests and fixes
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
parent
5ea9f27645
commit
f2eafe0f14
@ -706,11 +706,8 @@ auto fuse_drive::opendir_impl(std::string api_path,
|
||||
return api_error::directory_not_found;
|
||||
}
|
||||
|
||||
if ((file_info->flags & O_APPEND) == O_APPEND) {
|
||||
return api_error::directory_exists;
|
||||
}
|
||||
|
||||
if ((file_info->flags & O_EXCL) == O_EXCL) {
|
||||
if ((file_info->flags & O_APPEND) == O_APPEND ||
|
||||
(file_info->flags & O_EXCL) == O_EXCL) {
|
||||
return api_error::directory_exists;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory::remote_fuse {
|
||||
auto remote_fuse_drive::access_impl(std::string api_path, int mask)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::access_impl(std::string api_path,
|
||||
int mask) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_access(api_path.c_str(), mask));
|
||||
}
|
||||
@ -59,8 +59,8 @@ auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::chmod_impl(std::string api_path,
|
||||
mode_t mode) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(remote_instance_->fuse_chmod(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
@ -71,8 +71,8 @@ auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid,
|
||||
gid_t gid) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_chown(api_path.c_str(), uid, gid));
|
||||
@ -116,10 +116,9 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
|
||||
fuse_base::destroy_impl(ptr);
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::fgetattr_impl(std::string api_path,
|
||||
struct stat *unix_st,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::fgetattr_impl(
|
||||
std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info) -> api_error {
|
||||
remote::stat r_stat{};
|
||||
auto directory = false;
|
||||
|
||||
@ -180,8 +179,8 @@ auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::getattr_impl(std::string api_path,
|
||||
struct stat *unix_st) -> api_error {
|
||||
#endif
|
||||
bool directory = false;
|
||||
remote::stat r_stat{};
|
||||
@ -264,8 +263,8 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::mkdir_impl(std::string api_path,
|
||||
mode_t mode) -> api_error {
|
||||
return utils::to_api_error(remote_instance_->fuse_mkdir(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
}
|
||||
@ -287,9 +286,12 @@ auto remote_fuse_drive::open_impl(std::string api_path,
|
||||
f_info->fh));
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::opendir_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
if ((f_info->flags & O_APPEND) == O_APPEND ||
|
||||
(f_info->flags & O_EXCL) == O_EXCL) {
|
||||
return api_error::directory_exists;
|
||||
}
|
||||
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_opendir(api_path.c_str(), f_info->fh));
|
||||
@ -378,18 +380,14 @@ auto remote_fuse_drive::read_impl(std::string api_path, char *buffer,
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset,
|
||||
struct fuse_file_info *f_info,
|
||||
fuse_readdir_flags /*flags*/)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::readdir_impl(
|
||||
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *f_info,
|
||||
fuse_readdir_flags /*flags*/) -> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::readdir_impl(
|
||||
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *f_info) -> api_error {
|
||||
#endif
|
||||
std::string item_path;
|
||||
int res = 0;
|
||||
@ -417,16 +415,14 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
return utils::to_api_error(res);
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::release_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::release_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_release(api_path.c_str(), f_info->fh));
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::releasedir_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_releasedir(api_path.c_str(), f_info->fh));
|
||||
}
|
||||
@ -523,8 +519,8 @@ api_error remote_fuse_drive::statfs_x_impl(std::string api_path,
|
||||
return utils::to_api_error(res);
|
||||
}
|
||||
#else // __APPLE__
|
||||
auto remote_fuse_drive::statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::statfs_impl(std::string api_path,
|
||||
struct statvfs *stbuf) -> api_error {
|
||||
auto res = statvfs(config_.get_data_directory().c_str(), stbuf);
|
||||
if (res == 0) {
|
||||
remote::statfs r_stat{};
|
||||
@ -551,8 +547,8 @@ auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::truncate_impl(std::string api_path,
|
||||
off_t size) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(remote_instance_->fuse_truncate(
|
||||
api_path.c_str(), static_cast<remote::file_offset>(size)));
|
||||
@ -563,10 +559,9 @@ auto remote_fuse_drive::unlink_impl(std::string api_path) -> api_error {
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::utimens_impl(
|
||||
std::string api_path, const struct timespec tv[2],
|
||||
struct fuse_file_info * /*f_info*/) -> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2]) -> api_error {
|
||||
|
@ -484,6 +484,9 @@ TYPED_TEST(fuse_test, create_open_fails_if_path_is_directory) {
|
||||
for (auto &&flags : ops) {
|
||||
auto handle = open(dir_path.c_str(), flags);
|
||||
EXPECT_EQ(-1, handle);
|
||||
if (handle != -1) {
|
||||
std::cout << std::oct << flags << std::endl;
|
||||
}
|
||||
EXPECT_EQ(EISDIR, errno);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user