nfsv4: add support for utime()

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2018-01-10 17:09:14 +10:00
parent 50068b8432
commit 4dda1f87a4
3 changed files with 19 additions and 0 deletions

View File

@ -544,6 +544,8 @@ int nfs4_truncate_async(struct nfs_context *nfs, const char *path,
uint64_t length, nfs_cb cb, void *private_data);
int nfs4_unlink_async(struct nfs_context *nfs, const char *path, nfs_cb cb,
void *private_data);
int nfs4_utime_async(struct nfs_context *nfs, const char *path,
struct utimbuf *times, nfs_cb cb, void *private_data);
int nfs4_utimes_async_internal(struct nfs_context *nfs, const char *path,
int no_follow, struct timeval *times,
nfs_cb cb, void *private_data);

View File

@ -1571,6 +1571,8 @@ nfs_utime_async(struct nfs_context *nfs, const char *path,
switch (nfs->version) {
case NFS_V3:
return nfs3_utime_async(nfs, path, times, cb, private_data);
case NFS_V4:
return nfs4_utime_async(nfs, path, times, cb, private_data);
default:
nfs_set_error(nfs, "%s does not support NFSv4",
__FUNCTION__);

View File

@ -4850,3 +4850,18 @@ nfs4_utimes_async_internal(struct nfs_context *nfs, const char *path,
return 0;
}
int
nfs4_utime_async(struct nfs_context *nfs, const char *path,
struct utimbuf *times, nfs_cb cb, void *private_data)
{
struct timeval new_times[2];
new_times[0].tv_sec = times->actime;
new_times[0].tv_usec = 0;
new_times[1].tv_sec = times->modtime;
new_times[1].tv_usec = 0;
return nfs4_utimes_async_internal(nfs, path, 0, new_times,
cb, private_data);
}