aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorHarshula Jayasuriya <harshula@redhat.com>2013-08-15 13:46:40 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-08-19 09:55:01 -0400
commit2f74f972d4cc7d83408ea0c32d424edcb44887bf (patch)
tree628b1b59a5fc41d9c2c28aba2919ce9cc586f7ab /include/linux/sunrpc
parentb1948a641daefe8d128749f3d419ed24d529a8ed (diff)
sunrpc: prepare NFS for 2038
1) The kernel sunrpc code needs to handle seconds since epoch greater than 2147483647. This means functions that parse time as an int need to handle it as time_t. 2) The kernel changes must be accompanied by userspace changes in nfs-utils. Signed-off-by: Harshula Jayasuriya <harshula@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/cache.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6ce690de447f..437ddb6c4aef 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -264,12 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint)
264 return 0; 264 return 0;
265} 265}
266 266
267static inline int get_time(char **bpp, time_t *time)
268{
269 char buf[50];
270 long long ll;
271 int len = qword_get(bpp, buf, sizeof(buf));
272
273 if (len < 0)
274 return -EINVAL;
275 if (len == 0)
276 return -ENOENT;
277
278 if (kstrtoll(buf, 0, &ll))
279 return -EINVAL;
280
281 *time = (time_t)ll;
282 return 0;
283}
284
267static inline time_t get_expiry(char **bpp) 285static inline time_t get_expiry(char **bpp)
268{ 286{
269 int rv; 287 time_t rv;
270 struct timespec boot; 288 struct timespec boot;
271 289
272 if (get_int(bpp, &rv)) 290 if (get_time(bpp, &rv))
273 return 0; 291 return 0;
274 if (rv < 0) 292 if (rv < 0)
275 return 0; 293 return 0;