summaryrefslogtreecommitdiff
path: root/include/linux/sunrpc/cache.h
diff options
context:
space:
mode:
authorHarshula Jayasuriya <harshula@redhat.com>2013-08-15 21:46:40 +0400
committerJ. Bruce Fields <bfields@redhat.com>2013-08-19 17:55:01 +0400
commit2f74f972d4cc7d83408ea0c32d424edcb44887bf (patch)
tree628b1b59a5fc41d9c2c28aba2919ce9cc586f7ab /include/linux/sunrpc/cache.h
parentb1948a641daefe8d128749f3d419ed24d529a8ed (diff)
downloadlinux-2f74f972d4cc7d83408ea0c32d424edcb44887bf.tar.xz
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/cache.h')
-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)
return 0;
}
+static inline int get_time(char **bpp, time_t *time)
+{
+ char buf[50];
+ long long ll;
+ int len = qword_get(bpp, buf, sizeof(buf));
+
+ if (len < 0)
+ return -EINVAL;
+ if (len == 0)
+ return -ENOENT;
+
+ if (kstrtoll(buf, 0, &ll))
+ return -EINVAL;
+
+ *time = (time_t)ll;
+ return 0;
+}
+
static inline time_t get_expiry(char **bpp)
{
- int rv;
+ time_t rv;
struct timespec boot;
- if (get_int(bpp, &rv))
+ if (get_time(bpp, &rv))
return 0;
if (rv < 0)
return 0;