macos fixes
This commit is contained in:
@@ -1222,11 +1222,19 @@ auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
|
|||||||
if (SETATTR_WANTS_MODTIME(attr)) {
|
if (SETATTR_WANTS_MODTIME(attr)) {
|
||||||
struct timespec ts[2];
|
struct timespec ts[2];
|
||||||
if (SETATTR_WANTS_ACCTIME(attr)) {
|
if (SETATTR_WANTS_ACCTIME(attr)) {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->acctime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->modtime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
|
||||||
struct timeval tv{};
|
struct timeval tv{};
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, nullptr);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ auto remote_fuse_drive::access_impl(std::string api_path, int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
api_error remote_fuse_drive::chflags_impl(std::string api_path,
|
auto remote_fuse_drive::chflags_impl(std::string api_path, uint32_t flags)
|
||||||
uint32_t flags) {
|
-> api_error {
|
||||||
return utils::to_api_error(
|
return utils::to_api_error(
|
||||||
remote_instance_->fuse_chflags(api_path.c_str(), flags));
|
remote_instance_->fuse_chflags(api_path.c_str(), flags));
|
||||||
}
|
}
|
||||||
@@ -142,6 +142,18 @@ auto remote_fuse_drive::fsetattr_x_impl(std::string api_path,
|
|||||||
struct setattr_x *attr,
|
struct setattr_x *attr,
|
||||||
struct fuse_file_info *f_info)
|
struct fuse_file_info *f_info)
|
||||||
-> api_error {
|
-> api_error {
|
||||||
|
if (SETATTR_WANTS_MODTIME(attr)) {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->modtime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SETATTR_WANTS_ACCTIME(attr)) {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->acctime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remote::setattr_x attributes{};
|
remote::setattr_x attributes{};
|
||||||
attributes.valid = attr->valid;
|
attributes.valid = attr->valid;
|
||||||
attributes.mode = attr->mode;
|
attributes.mode = attr->mode;
|
||||||
@@ -210,9 +222,9 @@ auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *u_stat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
api_error remote_fuse_drive::getxtimes_impl(std::string api_path,
|
auto remote_fuse_drive::getxtimes_impl(std::string api_path,
|
||||||
struct timespec *bkuptime,
|
struct timespec *bkuptime,
|
||||||
struct timespec *crtime) {
|
struct timespec *crtime) -> api_error {
|
||||||
if (not(bkuptime && crtime)) {
|
if (not(bkuptime && crtime)) {
|
||||||
return utils::to_api_error(-EFAULT);
|
return utils::to_api_error(-EFAULT);
|
||||||
}
|
}
|
||||||
@@ -489,8 +501,20 @@ auto remote_fuse_drive::rmdir_impl(std::string api_path) -> api_error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
api_error remote_fuse_drive::setattr_x_impl(std::string api_path,
|
auto remote_fuse_drive::setattr_x_impl(std::string api_path,
|
||||||
struct setattr_x *attr) {
|
struct setattr_x *attr) -> api_error {
|
||||||
|
if (SETATTR_WANTS_MODTIME(attr)) {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->modtime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SETATTR_WANTS_ACCTIME(attr)) {
|
||||||
|
if (not fuse_drive_base::validate_timespec(attr->acctime)) {
|
||||||
|
return api_error::invalid_operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remote::setattr_x attributes{};
|
remote::setattr_x attributes{};
|
||||||
attributes.valid = attr->valid;
|
attributes.valid = attr->valid;
|
||||||
attributes.mode = attr->mode;
|
attributes.mode = attr->mode;
|
||||||
@@ -518,8 +542,9 @@ api_error remote_fuse_drive::setattr_x_impl(std::string api_path,
|
|||||||
remote_instance_->fuse_setattr_x(api_path.c_str(), attributes));
|
remote_instance_->fuse_setattr_x(api_path.c_str(), attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
api_error remote_fuse_drive::setbkuptime_impl(std::string api_path,
|
auto remote_fuse_drive::setbkuptime_impl(std::string api_path,
|
||||||
const struct timespec *bkuptime) {
|
const struct timespec *bkuptime)
|
||||||
|
-> api_error {
|
||||||
remote::file_time repertory_bkuptime =
|
remote::file_time repertory_bkuptime =
|
||||||
((static_cast<remote::file_time>(bkuptime->tv_sec) *
|
((static_cast<remote::file_time>(bkuptime->tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND) +
|
utils::time::NANOS_PER_SECOND) +
|
||||||
@@ -528,8 +553,9 @@ api_error remote_fuse_drive::setbkuptime_impl(std::string api_path,
|
|||||||
remote_instance_->fuse_setbkuptime(api_path.c_str(), repertory_bkuptime));
|
remote_instance_->fuse_setbkuptime(api_path.c_str(), repertory_bkuptime));
|
||||||
}
|
}
|
||||||
|
|
||||||
api_error remote_fuse_drive::setchgtime_impl(std::string api_path,
|
auto remote_fuse_drive::setchgtime_impl(std::string api_path,
|
||||||
const struct timespec *chgtime) {
|
const struct timespec *chgtime)
|
||||||
|
-> api_error {
|
||||||
remote::file_time repertory_chgtime =
|
remote::file_time repertory_chgtime =
|
||||||
((static_cast<remote::file_time>(chgtime->tv_sec) *
|
((static_cast<remote::file_time>(chgtime->tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND) +
|
utils::time::NANOS_PER_SECOND) +
|
||||||
@@ -538,8 +564,9 @@ api_error remote_fuse_drive::setchgtime_impl(std::string api_path,
|
|||||||
remote_instance_->fuse_setchgtime(api_path.c_str(), repertory_chgtime));
|
remote_instance_->fuse_setchgtime(api_path.c_str(), repertory_chgtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
api_error remote_fuse_drive::setcrtime_impl(std::string api_path,
|
auto remote_fuse_drive::setcrtime_impl(std::string api_path,
|
||||||
const struct timespec *crtime) {
|
const struct timespec *crtime)
|
||||||
|
-> api_error {
|
||||||
remote::file_time repertory_crtime =
|
remote::file_time repertory_crtime =
|
||||||
((static_cast<remote::file_time>(crtime->tv_sec) *
|
((static_cast<remote::file_time>(crtime->tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND) +
|
utils::time::NANOS_PER_SECOND) +
|
||||||
@@ -548,12 +575,12 @@ api_error remote_fuse_drive::setcrtime_impl(std::string api_path,
|
|||||||
remote_instance_->fuse_setcrtime(api_path.c_str(), repertory_crtime));
|
remote_instance_->fuse_setcrtime(api_path.c_str(), repertory_crtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
api_error remote_fuse_drive::setvolname_impl(const char *volname) {
|
auto remote_fuse_drive::setvolname_impl(const char *volname) -> api_error {
|
||||||
return utils::to_api_error(remote_instance_->fuse_setvolname(volname));
|
return utils::to_api_error(remote_instance_->fuse_setvolname(volname));
|
||||||
}
|
}
|
||||||
|
|
||||||
api_error remote_fuse_drive::statfs_x_impl(std::string api_path,
|
auto remote_fuse_drive::statfs_x_impl(std::string api_path,
|
||||||
struct statfs *stbuf) {
|
struct statfs *stbuf) -> api_error {
|
||||||
auto res = statfs(config_.get_data_directory().c_str(), stbuf);
|
auto res = statfs(config_.get_data_directory().c_str(), stbuf);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
remote::statfs_x r_stat{};
|
remote::statfs_x r_stat{};
|
||||||
@@ -624,8 +651,13 @@ auto remote_fuse_drive::utimens_impl(std::string api_path,
|
|||||||
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
||||||
const struct timespec tv[2]) -> api_error {
|
const struct timespec tv[2]) -> api_error {
|
||||||
#endif // FUSE_USE_VERSION >= 30
|
#endif // FUSE_USE_VERSION >= 30
|
||||||
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
if (not fuse_drive_base::validate_timespec(tv[0]) ||
|
if (not fuse_drive_base::validate_timespec(tv[0]) ||
|
||||||
not fuse_drive_base::validate_timespec(tv[1])) {
|
not fuse_drive_base::validate_timespec(tv[1])) {
|
||||||
|
utils::error::handle_info(
|
||||||
|
function_name,
|
||||||
|
fmt::format("failed|{}|{}", tv[0].tv_nsec, tv[1].tv_nsec));
|
||||||
return api_error::invalid_operation;
|
return api_error::invalid_operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
support/3rd_party/icu_configure.sh
vendored
Normal file → Executable file
0
support/3rd_party/icu_configure.sh
vendored
Normal file → Executable file
Reference in New Issue
Block a user