aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-06-27 04:32:56 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-07-01 04:10:48 -0400
commit6bbbca735936e15b9431882eceddcf6dff76e03c (patch)
tree480bb28754a7e47fe341530d98299e988b835224
parent74251fe21bfa9310ddba9e0436d1fcf389e602ee (diff)
pstore: Pass header size in the pstore write callback
Header size is needed to distinguish between header and the dump data. Incorporate the addition of new argument (hsize) in the pstore write callback. Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c4
-rw-r--r--drivers/acpi/apei/erst.c4
-rw-r--r--drivers/firmware/efi/efi-pstore.c2
-rw-r--r--fs/pstore/platform.c10
-rw-r--r--fs/pstore/ram.c3
-rw-r--r--include/linux/pstore.h8
6 files changed, 18 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 14cc486709f6..3f0e7d67d747 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -502,6 +502,7 @@ static int nvram_pstore_open(struct pstore_info *psi)
502 * @part: pstore writes data to registered buffer in parts, 502 * @part: pstore writes data to registered buffer in parts,
503 * part number will indicate the same. 503 * part number will indicate the same.
504 * @count: Indicates oops count 504 * @count: Indicates oops count
505 * @hsize: Size of header added by pstore
505 * @size: number of bytes written to the registered buffer 506 * @size: number of bytes written to the registered buffer
506 * @psi: registered pstore_info structure 507 * @psi: registered pstore_info structure
507 * 508 *
@@ -512,7 +513,8 @@ static int nvram_pstore_open(struct pstore_info *psi)
512static int nvram_pstore_write(enum pstore_type_id type, 513static int nvram_pstore_write(enum pstore_type_id type,
513 enum kmsg_dump_reason reason, 514 enum kmsg_dump_reason reason,
514 u64 *id, unsigned int part, int count, 515 u64 *id, unsigned int part, int count,
515 size_t size, struct pstore_info *psi) 516 size_t hsize, size_t size,
517 struct pstore_info *psi)
516{ 518{
517 int rc; 519 int rc;
518 struct oops_log_info *oops_hdr = (struct oops_log_info *) oops_buf; 520 struct oops_log_info *oops_hdr = (struct oops_log_info *) oops_buf;
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 6d894bfd8b8f..a9cf96085f85 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -935,7 +935,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
935 struct timespec *time, char **buf, 935 struct timespec *time, char **buf,
936 struct pstore_info *psi); 936 struct pstore_info *psi);
937static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 937static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
938 u64 *id, unsigned int part, int count, 938 u64 *id, unsigned int part, int count, size_t hsize,
939 size_t size, struct pstore_info *psi); 939 size_t size, struct pstore_info *psi);
940static int erst_clearer(enum pstore_type_id type, u64 id, int count, 940static int erst_clearer(enum pstore_type_id type, u64 id, int count,
941 struct timespec time, struct pstore_info *psi); 941 struct timespec time, struct pstore_info *psi);
@@ -1055,7 +1055,7 @@ out:
1055} 1055}
1056 1056
1057static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 1057static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
1058 u64 *id, unsigned int part, int count, 1058 u64 *id, unsigned int part, int count, size_t hsize,
1059 size_t size, struct pstore_info *psi) 1059 size_t size, struct pstore_info *psi)
1060{ 1060{
1061 struct cper_pstore_record *rcd = (struct cper_pstore_record *) 1061 struct cper_pstore_record *rcd = (struct cper_pstore_record *)
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 202d2c85ba2e..452800e005b6 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -104,7 +104,7 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
104 104
105static int efi_pstore_write(enum pstore_type_id type, 105static int efi_pstore_write(enum pstore_type_id type,
106 enum kmsg_dump_reason reason, u64 *id, 106 enum kmsg_dump_reason reason, u64 *id,
107 unsigned int part, int count, size_t size, 107 unsigned int part, int count, size_t hsize, size_t size,
108 struct pstore_info *psi) 108 struct pstore_info *psi)
109{ 109{
110 char name[DUMP_NAME_LEN]; 110 char name[DUMP_NAME_LEN];
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 86d1038b5a12..4637ec4169cd 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -159,7 +159,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
159 break; 159 break;
160 160
161 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part, 161 ret = psinfo->write(PSTORE_TYPE_DMESG, reason, &id, part,
162 oopscount, hsize + len, psinfo); 162 oopscount, hsize, hsize + len, psinfo);
163 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted()) 163 if (ret == 0 && reason == KMSG_DUMP_OOPS && pstore_is_mounted())
164 pstore_new_entry = 1; 164 pstore_new_entry = 1;
165 165
@@ -196,7 +196,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
196 spin_lock_irqsave(&psinfo->buf_lock, flags); 196 spin_lock_irqsave(&psinfo->buf_lock, flags);
197 } 197 }
198 memcpy(psinfo->buf, s, c); 198 memcpy(psinfo->buf, s, c);
199 psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, c, psinfo); 199 psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
200 spin_unlock_irqrestore(&psinfo->buf_lock, flags); 200 spin_unlock_irqrestore(&psinfo->buf_lock, flags);
201 s += c; 201 s += c;
202 c = e - s; 202 c = e - s;
@@ -221,9 +221,11 @@ static void pstore_register_console(void) {}
221static int pstore_write_compat(enum pstore_type_id type, 221static int pstore_write_compat(enum pstore_type_id type,
222 enum kmsg_dump_reason reason, 222 enum kmsg_dump_reason reason,
223 u64 *id, unsigned int part, int count, 223 u64 *id, unsigned int part, int count,
224 size_t size, struct pstore_info *psi) 224 size_t hsize, size_t size,
225 struct pstore_info *psi)
225{ 226{
226 return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi); 227 return psi->write_buf(type, reason, id, part, psinfo->buf, hsize,
228 size, psi);
227} 229}
228 230
229/* 231/*
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 1376e5a8f0d6..c6bb77ca35b5 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -195,7 +195,8 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
195static int notrace ramoops_pstore_write_buf(enum pstore_type_id type, 195static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
196 enum kmsg_dump_reason reason, 196 enum kmsg_dump_reason reason,
197 u64 *id, unsigned int part, 197 u64 *id, unsigned int part,
198 const char *buf, size_t size, 198 const char *buf,
199 size_t hsize, size_t size,
199 struct pstore_info *psi) 200 struct pstore_info *psi)
200{ 201{
201 struct ramoops_context *cxt = psi->data; 202 struct ramoops_context *cxt = psi->data;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 656699fcc7d7..4aa80ba830a2 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -58,12 +58,12 @@ struct pstore_info {
58 struct pstore_info *psi); 58 struct pstore_info *psi);
59 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, int count, size_t size, 61 unsigned int part, int count, size_t hsize,
62 struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
63 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
64 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
65 unsigned int part, const char *buf, size_t size, 65 unsigned int part, const char *buf, size_t hsize,
66 struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
67 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
68 int count, struct timespec time, 68 int count, struct timespec time,
69 struct pstore_info *psi); 69 struct pstore_info *psi);