mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
added utimens
This commit is contained in:
parent
37f07e79b9
commit
4a2dd3e609
@ -190,6 +190,25 @@ int filesystem::fsync(std::string const & path, bool is_datasync, uint64_t handl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int filesystem::utimens(std::string const &path, struct timespec tv[2], uint64_t handle)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
messagewriter req(message_type::utimens_req);
|
||||||
|
req.write_str(path);
|
||||||
|
req.write_time(tv[0]);
|
||||||
|
req.write_time(tv[1]);
|
||||||
|
req.write_u64(handle);
|
||||||
|
auto reader = proxy.perform(std::move(req));
|
||||||
|
return reader.read_result();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return fallback.utimens(path, tv, handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int filesystem::open(std::string const & path, int flags, uint64_t & handle)
|
int filesystem::open(std::string const & path, int flags, uint64_t & handle)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
int chown(std::string const & path, uid_t uid, gid_t gid) override;
|
int chown(std::string const & path, uid_t uid, gid_t gid) override;
|
||||||
int truncate(std::string const & path, uint64_t size, uint64_t handle) override;
|
int truncate(std::string const & path, uint64_t size, uint64_t handle) override;
|
||||||
int fsync(std::string const & path, bool is_datasync, uint64_t handle) override;
|
int fsync(std::string const & path, bool is_datasync, uint64_t handle) override;
|
||||||
|
int utimens(std::string const &path, struct timespec tv[2], uint64_t handle) override;
|
||||||
|
|
||||||
int open(std::string const & path, int flags, uint64_t & handle) override;
|
int open(std::string const & path, int flags, uint64_t & handle) override;
|
||||||
int mknod(std::string const & path, mode_t mode, dev_t rdev) override;
|
int mknod(std::string const & path, mode_t mode, dev_t rdev) override;
|
||||||
|
@ -71,6 +71,11 @@ int empty_filesystem::fsync(std::string const & path, bool is_datasync, uint64_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int empty_filesystem::utimens(std::string const &path, struct timespec tv[2], uint64_t handle)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
int empty_filesystem::open(std::string const & path, int flags, uint64_t & handle)
|
int empty_filesystem::open(std::string const & path, int flags, uint64_t & handle)
|
||||||
{
|
{
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
int chown(std::string const & path, uid_t uid, gid_t gid) override;
|
int chown(std::string const & path, uid_t uid, gid_t gid) override;
|
||||||
int truncate(std::string const & path, uint64_t size, uint64_t handle) override;
|
int truncate(std::string const & path, uint64_t size, uint64_t handle) override;
|
||||||
int fsync(std::string const & path, bool is_datasync, uint64_t handle) override;
|
int fsync(std::string const & path, bool is_datasync, uint64_t handle) override;
|
||||||
|
int utimens(std::string const &path, struct timespec tv[2], uint64_t handle) override;
|
||||||
|
|
||||||
int open(std::string const & path, int flags, uint64_t & handle) override;
|
int open(std::string const & path, int flags, uint64_t & handle) override;
|
||||||
int mknod(std::string const & path, mode_t mode, dev_t rdev) override;
|
int mknod(std::string const & path, mode_t mode, dev_t rdev) override;
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
virtual int chown(std::string const & path, uid_t uid, gid_t gid) = 0;
|
virtual int chown(std::string const & path, uid_t uid, gid_t gid) = 0;
|
||||||
virtual int truncate(std::string const & path, uint64_t size, uint64_t handle) = 0;
|
virtual int truncate(std::string const & path, uint64_t size, uint64_t handle) = 0;
|
||||||
virtual int fsync(std::string const & path, bool is_datasync, uint64_t handle) = 0;
|
virtual int fsync(std::string const & path, bool is_datasync, uint64_t handle) = 0;
|
||||||
|
virtual int utimens(std::string const &path, struct timespec tv[2], uint64_t handle) = 0;
|
||||||
|
|
||||||
virtual int open(std::string const & path, int flags, uint64_t & handle) = 0;
|
virtual int open(std::string const & path, int flags, uint64_t & handle) = 0;
|
||||||
virtual int mknod(std::string const & path, mode_t mode, dev_t rdev) = 0;
|
virtual int mknod(std::string const & path, mode_t mode, dev_t rdev) = 0;
|
||||||
|
@ -28,7 +28,8 @@ enum class message_type: uint8_t
|
|||||||
mkdir_req = 0x12,
|
mkdir_req = 0x12,
|
||||||
readdir_req = 0x13,
|
readdir_req = 0x13,
|
||||||
rmdir_req = 0x14,
|
rmdir_req = 0x14,
|
||||||
statfs_req = 0x15
|
statfs_req = 0x15,
|
||||||
|
utimens_req = 0x16
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,6 +161,12 @@ void messagewriter::write_openflags(int value)
|
|||||||
write_i32(flags);
|
write_i32(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void messagewriter::write_time(timespec const & value)
|
||||||
|
{
|
||||||
|
write_u64(static_cast<uint64_t>(value.tv_sec));
|
||||||
|
write_u32(static_cast<uint32_t>(value.tv_nsec));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned char * messagewriter::get_data(size_t &size)
|
unsigned char * messagewriter::get_data(size_t &size)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
void write_uid(uid_t value);
|
void write_uid(uid_t value);
|
||||||
void write_gid(gid_t value);
|
void write_gid(gid_t value);
|
||||||
void write_openflags(int value);
|
void write_openflags(int value);
|
||||||
|
void write_time(timespec const & value);
|
||||||
|
|
||||||
unsigned char * get_data(size_t &size);
|
unsigned char * get_data(size_t &size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user