diff options
author | Kees Cook <keescook@chromium.org> | 2018-05-14 15:50:52 -0700 |
---|---|---|
committer | Deepa Dinamani <deepa.kernel@gmail.com> | 2018-06-05 16:57:31 -0700 |
commit | 7aaa822ed060719bd4ea012609883b6bc6950508 (patch) | |
tree | 222a4c1d6da343c041f790c0263e9b73296e798c /fs | |
parent | 0220eddac66daa2afdd6cf6d7d5198226d2abf0b (diff) | |
download | linux-stable-7aaa822ed060719bd4ea012609883b6bc6950508.tar.gz linux-stable-7aaa822ed060719bd4ea012609883b6bc6950508.tar.bz2 linux-stable-7aaa822ed060719bd4ea012609883b6bc6950508.zip |
pstore: Convert internal records to timespec64
This prepares pstore for converting the VFS layer to timespec64.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/pstore/inode.c | 3 | ||||
-rw-r--r-- | fs/pstore/platform.c | 2 | ||||
-rw-r--r-- | fs/pstore/ram.c | 21 |
3 files changed, 17 insertions, 9 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 5fcb845b9fec..75afe5eb0574 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -392,7 +392,8 @@ int pstore_mkfile(struct dentry *root, struct pstore_record *record) inode->i_private = private; if (record->time.tv_sec) - inode->i_mtime = inode->i_ctime = record->time; + inode->i_mtime = inode->i_ctime = + timespec64_to_timespec(record->time); d_add(dentry, inode); diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index dc720573fd53..c238ab8ba31d 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -328,7 +328,7 @@ void pstore_record_init(struct pstore_record *record, record->psi = psinfo; /* Report zeroed timestamp if called before timekeeping has resumed. */ - record->time = ns_to_timespec(ktime_get_real_fast_ns()); + record->time = ns_to_timespec64(ktime_get_real_fast_ns()); } /* diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 49b2bc114868..69e893076ab7 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -38,6 +38,11 @@ #define RAMOOPS_KERNMSG_HDR "====" #define MIN_MEM_SIZE 4096UL +#if __BITS_PER_LONG == 64 +# define TVSEC_FMT "%ld" +#else +# define TVSEC_FMT "%lld" +#endif static ulong record_size = MIN_MEM_SIZE; module_param(record_size, ulong, 0400); @@ -153,21 +158,23 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, return prz; } -static int ramoops_read_kmsg_hdr(char *buffer, struct timespec *time, +static int ramoops_read_kmsg_hdr(char *buffer, struct timespec64 *time, bool *compressed) { char data_type; int header_length = 0; - if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n%n", &time->tv_sec, - &time->tv_nsec, &data_type, &header_length) == 3) { + if (sscanf(buffer, RAMOOPS_KERNMSG_HDR TVSEC_FMT ".%lu-%c\n%n", + &time->tv_sec, &time->tv_nsec, &data_type, + &header_length) == 3) { if (data_type == 'C') *compressed = true; else *compressed = false; - } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR "%lu.%lu\n%n", - &time->tv_sec, &time->tv_nsec, &header_length) == 2) { - *compressed = false; + } else if (sscanf(buffer, RAMOOPS_KERNMSG_HDR TVSEC_FMT ".%lu\n%n", + &time->tv_sec, &time->tv_nsec, + &header_length) == 2) { + *compressed = false; } else { time->tv_sec = 0; time->tv_nsec = 0; @@ -360,7 +367,7 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz, char *hdr; size_t len; - hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR "%lu.%lu-%c\n", + hdr = kasprintf(GFP_ATOMIC, RAMOOPS_KERNMSG_HDR TVSEC_FMT ".%lu-%c\n", record->time.tv_sec, record->time.tv_nsec / 1000, record->compressed ? 'C' : 'D'); |