Patchwork [1/3] Retreive header size from pstore.

login
register
mail settings
Submitter Aruna Balakrishnaiah
Date April 26, 2013, 9:55 a.m.
Message ID <20130426095559.14323.86227.stgit@aruna-ThinkPad-T420>
Download mbox | patch
Permalink /patch/239788/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Aruna Balakrishnaiah - April 26, 2013, 9:55 a.m.
pstore_get_header_size will return the size of the header added by pstore
while logging messages to the registered buffer.

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
 fs/pstore/platform.c   |    7 ++++++-
 include/linux/pstore.h |    6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Patch

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 86d1038..e8260ea 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -49,6 +49,7 @@  MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
 		 "corruption on Oopses)");
 
 static int pstore_new_entry;
+static int hsize;
 
 static void pstore_timefunc(unsigned long);
 static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
@@ -68,6 +69,11 @@  static char *backend;
 /* How much of the console log to snapshot */
 static unsigned long kmsg_bytes = 10240;
 
+int pstore_get_header_size(void)
+{
+	return hsize;
+}
+
 void pstore_set_kmsg_bytes(int bytes)
 {
 	kmsg_bytes = bytes;
@@ -147,7 +153,6 @@  static void pstore_dump(struct kmsg_dumper *dumper,
 	while (total < kmsg_bytes) {
 		char *dst;
 		unsigned long size;
-		int hsize;
 		size_t len;
 
 		dst = psinfo->buf;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 656699f..f43b64f 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -73,6 +73,7 @@  struct pstore_info {
 #ifdef CONFIG_PSTORE
 extern int pstore_register(struct pstore_info *);
 extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
+extern int pstore_get_header_size(void);
 #else
 static inline int
 pstore_register(struct pstore_info *psi)
@@ -84,6 +85,11 @@  pstore_cannot_block_path(enum kmsg_dump_reason reason)
 {
 	return false;
 }
+static inline int
+pstore_get_header_size(void)
+{
+	return 0;
+}
 #endif
 
 #endif /*_LINUX_PSTORE_H*/