summaryrefslogtreecommitdiffstats
path: root/fs/pstore/platform.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-05-19 15:29:10 -0700
committerKees Cook <keescook@chromium.org>2017-05-31 10:13:44 -0700
commitc7f3c595f6ff7a1cfbf7ac782722bf5173e27775 (patch)
tree7adaa468343cb5d9a45ce738d1fee91ca22dc489 /fs/pstore/platform.c
parente581ca813a40a4ee53c862d8f6303f486c4b4c34 (diff)
downloadop-kernel-dev-c7f3c595f6ff7a1cfbf7ac782722bf5173e27775.zip
op-kernel-dev-c7f3c595f6ff7a1cfbf7ac782722bf5173e27775.tar.gz
pstore: Populate pstore record->time field
The current time will be initially available in the record->time field for all pstore_read() and pstore_write() calls. Backends can either update the field during read(), or use the field during write() instead of fetching time themselves. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore/platform.c')
-rw-r--r--fs/pstore/platform.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 7798041..96fbff7 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -480,6 +480,12 @@ void pstore_record_init(struct pstore_record *record,
memset(record, 0, sizeof(*record));
record->psi = psinfo;
+
+ /* Report zeroed timestamp if called before timekeeping has resumed. */
+ if (__getnstimeofday(&record->time)) {
+ record->time.tv_sec = 0;
+ record->time.tv_nsec = 0;
+ }
}
/*
OpenPOWER on IntegriCloud