summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Harkes <jaharkes@cs.cmu.edu>2019-07-16 19:28:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-16 22:23:23 -0400
commit5e7c31dfe74703f428220384b2863525957cc160 (patch)
tree83b0eef7ab15394a95a96f90d66e1a002e9539df /fs
parent6ced9aa7b56baeb241a715df4539e60d5e3118e2 (diff)
coda: change Coda's user api to use 64-bit time_t in timespec
Move the 32-bit time_t problems to userspace. Link: http://lkml.kernel.org/r/8d089068823bfb292a4020f773922fbd82ffad39.1558117389.git.jaharkes@cs.cmu.edu Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Colin Ian King <colin.king@canonical.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: David Howells <dhowells@redhat.com> Cc: Fabian Frederick <fabf@skynet.be> Cc: Mikko Rapeli <mikko.rapeli@iki.fi> Cc: Sam Protsenko <semen.protsenko@linaro.org> Cc: Yann Droneaud <ydroneaud@opteya.com> Cc: Zhouyang Jia <jiazhouyang09@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/coda/coda_linux.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c
index 8addcd166908..e4b5f02f0dd4 100644
--- a/fs/coda/coda_linux.c
+++ b/fs/coda/coda_linux.c
@@ -66,13 +66,8 @@ unsigned short coda_flags_to_cflags(unsigned short flags)
66 return coda_flags; 66 return coda_flags;
67} 67}
68 68
69static struct timespec64 coda_to_timespec64(struct vtimespec ts) 69static struct timespec64 coda_to_timespec64(struct coda_timespec ts)
70{ 70{
71 /*
72 * We interpret incoming timestamps as 'signed' to match traditional
73 * usage and support pre-1970 timestamps, but this breaks in y2038
74 * on 32-bit machines.
75 */
76 struct timespec64 ts64 = { 71 struct timespec64 ts64 = {
77 .tv_sec = ts.tv_sec, 72 .tv_sec = ts.tv_sec,
78 .tv_nsec = ts.tv_nsec, 73 .tv_nsec = ts.tv_nsec,
@@ -81,12 +76,10 @@ static struct timespec64 coda_to_timespec64(struct vtimespec ts)
81 return ts64; 76 return ts64;
82} 77}
83 78
84static struct vtimespec timespec64_to_coda(struct timespec64 ts64) 79static struct coda_timespec timespec64_to_coda(struct timespec64 ts64)
85{ 80{
86 /* clamp the timestamps to the maximum range rather than wrapping */ 81 struct coda_timespec ts = {
87 struct vtimespec ts = { 82 .tv_sec = ts64.tv_sec,
88 .tv_sec = lower_32_bits(clamp_t(time64_t, ts64.tv_sec,
89 LONG_MIN, LONG_MAX)),
90 .tv_nsec = ts64.tv_nsec, 83 .tv_nsec = ts64.tv_nsec,
91 }; 84 };
92 85
@@ -156,11 +149,11 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr)
156 vattr->va_uid = (vuid_t) -1; 149 vattr->va_uid = (vuid_t) -1;
157 vattr->va_gid = (vgid_t) -1; 150 vattr->va_gid = (vgid_t) -1;
158 vattr->va_size = (off_t) -1; 151 vattr->va_size = (off_t) -1;
159 vattr->va_atime.tv_sec = (long) -1; 152 vattr->va_atime.tv_sec = (int64_t) -1;
160 vattr->va_atime.tv_nsec = (long) -1; 153 vattr->va_atime.tv_nsec = (long) -1;
161 vattr->va_mtime.tv_sec = (long) -1; 154 vattr->va_mtime.tv_sec = (int64_t) -1;
162 vattr->va_mtime.tv_nsec = (long) -1; 155 vattr->va_mtime.tv_nsec = (long) -1;
163 vattr->va_ctime.tv_sec = (long) -1; 156 vattr->va_ctime.tv_sec = (int64_t) -1;
164 vattr->va_ctime.tv_nsec = (long) -1; 157 vattr->va_ctime.tv_nsec = (long) -1;
165 vattr->va_type = C_VNON; 158 vattr->va_type = C_VNON;
166 vattr->va_fileid = -1; 159 vattr->va_fileid = -1;