From 7ae46019df1c5369cfd15f99448b94e425eddcc4 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 18 Sep 2019 15:41:13 -0700 Subject: [PATCH] vfs_gpfs: Use update_stat_ex_create_time Make the code a bit easier to read by avoiding direct access to the statex struct. Signed-off-by: Christof Schmitt Reviewed-by: Volker Lendecke Autobuild-User(master): Christof Schmitt Autobuild-Date(master): Tue Nov 19 22:44:53 UTC 2019 on sn-devel-184 --- source3/modules/vfs_gpfs.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index f26cf0b9e6c..558f57c2417 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1647,6 +1647,11 @@ static NTSTATUS vfs_gpfs_get_file_id(struct gpfs_iattr64 *iattr, return NT_STATUS_OK; } +static struct timespec gpfs_timestruc64_to_timespec(struct gpfs_timestruc64 g) +{ + return (struct timespec) { .tv_sec = g.tv_sec, .tv_nsec = g.tv_nsec }; +} + static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle, struct smb_filename *smb_fname, uint32_t *dosmode) @@ -1654,6 +1659,7 @@ static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle, struct gpfs_config_data *config; struct gpfs_iattr64 iattr = { }; unsigned int litemask = 0; + struct timespec ts; uint64_t file_id; NTSTATUS status; int ret; @@ -1697,10 +1703,10 @@ static NTSTATUS vfs_gpfs_get_dos_attributes(struct vfs_handle_struct *handle, return status; } + ts = gpfs_timestruc64_to_timespec(iattr.ia_createtime); + *dosmode |= vfs_gpfs_winattrs_to_dosmode(iattr.ia_winflags); - smb_fname->st.st_ex_iflags &= ~ST_EX_IFLAG_CALCULATED_BTIME; - smb_fname->st.st_ex_btime.tv_sec = iattr.ia_createtime.tv_sec; - smb_fname->st.st_ex_btime.tv_nsec = iattr.ia_createtime.tv_nsec; + update_stat_ex_create_time(&smb_fname->st, ts); update_stat_ex_file_id(&smb_fname->st, file_id); return NT_STATUS_OK; @@ -1713,6 +1719,7 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, struct gpfs_config_data *config; struct gpfs_iattr64 iattr = { }; unsigned int litemask; + struct timespec ts; uint64_t file_id; NTSTATUS status; int ret; @@ -1766,10 +1773,10 @@ static NTSTATUS vfs_gpfs_fget_dos_attributes(struct vfs_handle_struct *handle, return status; } + ts = gpfs_timestruc64_to_timespec(iattr.ia_createtime); + *dosmode |= vfs_gpfs_winattrs_to_dosmode(iattr.ia_winflags); - fsp->fsp_name->st.st_ex_iflags &= ~ST_EX_IFLAG_CALCULATED_BTIME; - fsp->fsp_name->st.st_ex_btime.tv_sec = iattr.ia_createtime.tv_sec; - fsp->fsp_name->st.st_ex_btime.tv_nsec = iattr.ia_createtime.tv_nsec; + update_stat_ex_create_time(&fsp->fsp_name->st, ts); update_stat_ex_file_id(&fsp->fsp_name->st, file_id); return NT_STATUS_OK; -- 2.11.4.GIT