[RFC v2a 05/12] fs: cifs: Use vfs_time_get_real_* time functions

From: Deepa Dinamani
Date: Fri Feb 12 2016 - 04:36:53 EST


The VFS inode timestamps are not y2038 safe as they use
struct timespec. These will be changed to use struct timespec64
instead and that is y2038 safe.
But, since the above data type conversion will break the end
file systems, use vfs_time aliases here to access inode times.

Variables in the patch are passed into functions that also take
inode times as argument. Hence, using vfs_time aliases here is
necessary so that they can change to use 64 bit time along with
vfs.

Signed-off-by: Deepa Dinamani <deepa.kernel@xxxxxxxxx>
---
fs/cifs/cifsencrypt.c | 2 +-
fs/cifs/cifssmb.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index ee1e674..2b606e2 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -485,7 +485,7 @@ find_timestamp(struct cifs_ses *ses)
blobptr += attrsize; /* advance attr value */
}

- ktime_get_real_ts(&ts);
+ vfs_get_real_ts(&ts);
return cpu_to_le64(cifs_UnixTimeToNT(ts));
}

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index b3b3fa4..4c1deae 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -479,11 +479,11 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr)
*/
int val, seconds, remain, result;
struct vfs_time ts;
- unsigned long utc = get_seconds();
+ unsigned long long utc = vfs_get_real_seconds();
ts = cnvrtDosUnixTm(rsp->SrvTime.Date,
rsp->SrvTime.Time, 0);
- cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n",
- (int)ts.tv_sec, (int)utc,
+ cifs_dbg(FYI, "SrvTime %lld sec since 1970 (utc: %lld) diff: %d\n",
+ (long long)ts.tv_sec, (long long)utc,
(int)(utc - ts.tv_sec));
val = (int)(utc - ts.tv_sec);
seconds = abs(val);
--
1.9.1