Skip to content

Commit b3b515b

Browse files
arunabalaegl
authored andcommitted
pstore: Add new argument 'compressed' in pstore write callback
Addition of new argument 'compressed' in the write call back will help the backend to know if the data passed from pstore is compressed or not (In case where compression fails.). If compressed, the backend can add a tag indicating the data is compressed while writing to persistent store. Signed-off-by: Aruna Balakrishnaiah <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Tony Luck <[email protected]>
1 parent a3a5e94 commit b3b515b

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

arch/powerpc/platforms/pseries/nvram.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
554554
* @part: pstore writes data to registered buffer in parts,
555555
* part number will indicate the same.
556556
* @count: Indicates oops count
557-
* @hsize: Size of header added by pstore
557+
* @compressed: Flag to indicate the log is compressed
558558
* @size: number of bytes written to the registered buffer
559559
* @psi: registered pstore_info structure
560560
*
@@ -565,7 +565,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
565565
static int nvram_pstore_write(enum pstore_type_id type,
566566
enum kmsg_dump_reason reason,
567567
u64 *id, unsigned int part, int count,
568-
size_t hsize, size_t size,
568+
bool compressed, size_t size,
569569
struct pstore_info *psi)
570570
{
571571
int rc;

drivers/acpi/apei/erst.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
937937
struct timespec *time, char **buf,
938938
struct pstore_info *psi);
939939
static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
940-
u64 *id, unsigned int part, int count, size_t hsize,
940+
u64 *id, unsigned int part, int count, bool compressed,
941941
size_t size, struct pstore_info *psi);
942942
static int erst_clearer(enum pstore_type_id type, u64 id, int count,
943943
struct timespec time, struct pstore_info *psi);
@@ -1057,7 +1057,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
10571057
}
10581058

10591059
static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
1060-
u64 *id, unsigned int part, int count, size_t hsize,
1060+
u64 *id, unsigned int part, int count, bool compressed,
10611061
size_t size, struct pstore_info *psi)
10621062
{
10631063
struct cper_pstore_record *rcd = (struct cper_pstore_record *)

drivers/firmware/efi/efi-pstore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
103103

104104
static int efi_pstore_write(enum pstore_type_id type,
105105
enum kmsg_dump_reason reason, u64 *id,
106-
unsigned int part, int count, size_t hsize, size_t size,
106+
unsigned int part, int count, bool compressed, size_t size,
107107
struct pstore_info *psi)
108108
{
109109
char name[DUMP_NAME_LEN];

fs/pstore/platform.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
149149
unsigned long size;
150150
int hsize;
151151
size_t len;
152+
bool compressed = false;
152153

153154
dst = psinfo->buf;
154155
hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
@@ -159,7 +160,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
159160
break;
160161

161162
ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
162-
oopscount, hsize, hsize + len, psinfo);
163+
oopscount, compressed, hsize + len, psinfo);
163164
if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
164165
pstore_new_entry = 1;
165166

@@ -221,10 +222,10 @@ static void pstore_register_console(void) {}
221222
static int pstore_write_compat(enum pstore_type_id type,
222223
enum kmsg_dump_reason reason,
223224
u64 *id, unsigned int part, int count,
224-
size_t hsize, size_t size,
225+
bool compressed, size_t size,
225226
struct pstore_info *psi)
226227
{
227-
return psi->write_buf(type, reason, id, part, psinfo->buf, hsize,
228+
return psi->write_buf(type, reason, id, part, psinfo->buf, compressed,
228229
size, psi);
229230
}
230231

fs/pstore/ram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
196196
enum kmsg_dump_reason reason,
197197
u64 *id, unsigned int part,
198198
const char *buf,
199-
size_t hsize, size_t size,
199+
bool compressed, size_t size,
200200
struct pstore_info *psi)
201201
{
202202
struct ramoops_context *cxt = psi->data;

include/linux/pstore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ struct pstore_info {
5858
struct pstore_info *psi);
5959
int (*write)(enum pstore_type_id type,
6060
enum kmsg_dump_reason reason, u64 *id,
61-
unsigned int part, int count, size_t hsize,
61+
unsigned int part, int count, bool compressed,
6262
size_t size, struct pstore_info *psi);
6363
int (*write_buf)(enum pstore_type_id type,
6464
enum kmsg_dump_reason reason, u64 *id,
65-
unsigned int part, const char *buf, size_t hsize,
65+
unsigned int part, const char *buf, bool compressed,
6666
size_t size, struct pstore_info *psi);
6767
int (*erase)(enum pstore_type_id type, u64 id,
6868
int count, struct timespec time,

0 commit comments

Comments
 (0)