diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2019-07-16 19:28:32 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-16 22:23:23 -0400 |
| commit | 6ced9aa7b56baeb241a715df4539e60d5e3118e2 (patch) | |
| tree | c4dee6c280f6222228737302d2cd1528100b78f0 /include/uapi/linux | |
| parent | 850622136ff2a1296b2c8aa5280a74a6a3aabe4e (diff) | |
coda: stop using 'struct timespec' in user API
We exchange file timestamps with user space using psdev device
read/write operations with a fixed but architecture specific binary
layout.
On 32-bit systems, this uses a 'timespec' structure that is defined by
the C library to contain two 32-bit values for seconds and nanoseconds.
As we get ready for the year 2038 overflow of the 32-bit signed seconds,
the kernel now uses 64-bit timestamps internally, and user space will do
the same change by changing the 'timespec' definition in the future.
Unfortunately, this breaks the layout of the coda_vattr structure, so we
need to redefine that in terms of something that does not change. I'm
introducing a new 'struct vtimespec' structure here that keeps the
existing layout, and the same change has to be done in the coda user
space copy of linux/coda.h before anyone can use that on a 32-bit
architecture with 64-bit time_t.
An open question is what should happen to actual times past y2038, as
they are now truncated to the last valid date when sent to user space,
and interpreted as pre-1970 times when a timestamp with the MSB set is
read back into the kernel. Alternatively, we could change the new
timespec64_to_coda()/coda_to_timespec64() functions to use a different
interpretation and extend the available range further to the future by
disallowing past timestamps. This would require more changes in the
user space side though.
Link: http://lkml.kernel.org/r/562b7324149461743e4fbe2fedbf7c242f7e274a.1558117389.git.jaharkes@cs.cmu.edu
Link: https://patchwork.kernel.org/patch/10474735/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu>
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 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/coda.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h index ed8cb263e482..fc5f7874208a 100644 --- a/include/uapi/linux/coda.h +++ b/include/uapi/linux/coda.h | |||
| @@ -211,6 +211,20 @@ struct CodaFid { | |||
| 211 | */ | 211 | */ |
| 212 | enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; | 212 | enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; |
| 213 | 213 | ||
| 214 | #ifdef __linux__ | ||
| 215 | /* | ||
| 216 | * This matches the traditional Linux 'timespec' structure binary layout, | ||
| 217 | * before using 64-bit time_t everywhere. Overflows in y2038 on 32-bit | ||
| 218 | * architectures. | ||
| 219 | */ | ||
| 220 | struct vtimespec { | ||
| 221 | long tv_sec; /* seconds */ | ||
| 222 | long tv_nsec; /* nanoseconds */ | ||
| 223 | }; | ||
| 224 | #else | ||
| 225 | #define vtimespec timespec | ||
| 226 | #endif | ||
| 227 | |||
| 214 | struct coda_vattr { | 228 | struct coda_vattr { |
| 215 | long va_type; /* vnode type (for create) */ | 229 | long va_type; /* vnode type (for create) */ |
| 216 | u_short va_mode; /* files access mode and type */ | 230 | u_short va_mode; /* files access mode and type */ |
| @@ -220,9 +234,9 @@ struct coda_vattr { | |||
| 220 | long va_fileid; /* file id */ | 234 | long va_fileid; /* file id */ |
| 221 | u_quad_t va_size; /* file size in bytes */ | 235 | u_quad_t va_size; /* file size in bytes */ |
| 222 | long va_blocksize; /* blocksize preferred for i/o */ | 236 | long va_blocksize; /* blocksize preferred for i/o */ |
| 223 | struct timespec va_atime; /* time of last access */ | 237 | struct vtimespec va_atime; /* time of last access */ |
| 224 | struct timespec va_mtime; /* time of last modification */ | 238 | struct vtimespec va_mtime; /* time of last modification */ |
| 225 | struct timespec va_ctime; /* time file changed */ | 239 | struct vtimespec va_ctime; /* time file changed */ |
| 226 | u_long va_gen; /* generation number of file */ | 240 | u_long va_gen; /* generation number of file */ |
| 227 | u_long va_flags; /* flags defined for file */ | 241 | u_long va_flags; /* flags defined for file */ |
| 228 | cdev_t va_rdev; /* device special file represents */ | 242 | cdev_t va_rdev; /* device special file represents */ |
