Commit 9a4e1398 authored by Aruna Balakrishnaiah's avatar Aruna Balakrishnaiah Committed by Tony Luck

pstore: Introduce new argument 'compressed' in the read callback

Backends will set the flag 'compressed' after reading the log from
persistent store to indicate the data being returned to pstore is
compressed or not.
Signed-off-by: default avatarAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent b0aad7a9
...@@ -598,7 +598,7 @@ static int nvram_pstore_write(enum pstore_type_id type, ...@@ -598,7 +598,7 @@ static int nvram_pstore_write(enum pstore_type_id type,
*/ */
static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
int *count, struct timespec *time, char **buf, int *count, struct timespec *time, char **buf,
struct pstore_info *psi) bool *compressed, struct pstore_info *psi)
{ {
struct oops_log_info *oops_hdr; struct oops_log_info *oops_hdr;
unsigned int err_type, id_no, size = 0; unsigned int err_type, id_no, size = 0;
......
...@@ -935,7 +935,7 @@ static int erst_open_pstore(struct pstore_info *psi); ...@@ -935,7 +935,7 @@ static int erst_open_pstore(struct pstore_info *psi);
static int erst_close_pstore(struct pstore_info *psi); static int erst_close_pstore(struct pstore_info *psi);
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
struct timespec *time, char **buf, struct timespec *time, char **buf,
struct pstore_info *psi); bool *compressed, struct pstore_info *psi);
static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
u64 *id, unsigned int part, int count, bool compressed, u64 *id, unsigned int part, int count, bool compressed,
size_t size, struct pstore_info *psi); size_t size, struct pstore_info *psi);
...@@ -991,7 +991,7 @@ static int erst_close_pstore(struct pstore_info *psi) ...@@ -991,7 +991,7 @@ static int erst_close_pstore(struct pstore_info *psi)
static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count, static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
struct timespec *time, char **buf, struct timespec *time, char **buf,
struct pstore_info *psi) bool *compressed, struct pstore_info *psi)
{ {
int rc; int rc;
ssize_t len = 0; ssize_t len = 0;
......
...@@ -87,7 +87,8 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) ...@@ -87,7 +87,8 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
int *count, struct timespec *timespec, int *count, struct timespec *timespec,
char **buf, struct pstore_info *psi) char **buf, bool *compressed,
struct pstore_info *psi)
{ {
struct pstore_read_data data; struct pstore_read_data data;
......
...@@ -428,6 +428,7 @@ void pstore_get_records(int quiet) ...@@ -428,6 +428,7 @@ void pstore_get_records(int quiet)
enum pstore_type_id type; enum pstore_type_id type;
struct timespec time; struct timespec time;
int failed = 0, rc; int failed = 0, rc;
bool compressed;
if (!psi) if (!psi)
return; return;
...@@ -436,7 +437,8 @@ void pstore_get_records(int quiet) ...@@ -436,7 +437,8 @@ void pstore_get_records(int quiet)
if (psi->open && psi->open(psi)) if (psi->open && psi->open(psi))
goto out; goto out;
while ((size = psi->read(&id, &type, &count, &time, &buf, psi)) > 0) { while ((size = psi->read(&id, &type, &count, &time, &buf, &compressed,
psi)) > 0) {
rc = pstore_mkfile(type, psi->name, id, count, buf, rc = pstore_mkfile(type, psi->name, id, count, buf,
(size_t)size, time, psi); (size_t)size, time, psi);
kfree(buf); kfree(buf);
......
...@@ -133,7 +133,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max, ...@@ -133,7 +133,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
int *count, struct timespec *time, int *count, struct timespec *time,
char **buf, struct pstore_info *psi) char **buf, bool *compressed,
struct pstore_info *psi)
{ {
ssize_t size; ssize_t size;
ssize_t ecc_notice_size; ssize_t ecc_notice_size;
......
...@@ -55,7 +55,7 @@ struct pstore_info { ...@@ -55,7 +55,7 @@ struct pstore_info {
int (*close)(struct pstore_info *psi); int (*close)(struct pstore_info *psi);
ssize_t (*read)(u64 *id, enum pstore_type_id *type, ssize_t (*read)(u64 *id, enum pstore_type_id *type,
int *count, struct timespec *time, char **buf, int *count, struct timespec *time, char **buf,
struct pstore_info *psi); bool *compressed, struct pstore_info *psi);
int (*write)(enum pstore_type_id type, int (*write)(enum pstore_type_id type,
enum kmsg_dump_reason reason, u64 *id, enum kmsg_dump_reason reason, u64 *id,
unsigned int part, int count, bool compressed, unsigned int part, int count, bool compressed,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment