Skip to contentSkip to conversation

vmcore-dmesg: Handle struct log to struct printk_log renaming

PATCH Applied Vivek Goyal 2 participants 5 messages May 22, 2014 – May 28, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmcore-dmesg: Handle struct log to struct printk_log renaming

vmcore-dmesg has been failing for me for quite some time as struct log was renamed to struct printk_log.

62e32ac printk: rename struct log to struct printk_log

This patch has been sitting in mailing list for quite some time. It is time to repost the patch.

I took original patch of Lubomir and modified a bit to take care of concern of hardcoded string length.

---

Changes for v2:
* Clarified printk_log vs. log in some comments.

 vmcore-dmesg/vmcore-dmesg.c |   53 +++++++++++++++++++++++++++++++-------------
 1 file changed, 38 insertions(+), 15 deletions(-)
vmcore-dmesg/vmcore-dmesg.c +38 -15
Index: kexec-tools/vmcore-dmesg/vmcore-dmesg.c
===================================================================
@@ -35,10 +35,10 @@ static loff_t logged_chars_vaddr;
 static loff_t log_first_idx_vaddr;
 static loff_t log_next_idx_vaddr;
 
-/* struct log size */
+/* struct printk_log (or older log) size */
 static uint64_t log_sz;
 
-/* struct log field offsets */
+/* struct printk_log (or older log) field offsets */
 static uint64_t log_offset_ts_nsec = UINT64_MAX;
 static uint16_t log_offset_len = UINT16_MAX;
 static uint16_t log_offset_text_len = UINT16_MAX;
@@ -255,6 +255,7 @@ static void scan_vmcoreinfo(char *start,
 	char *pos, *eol;
 	char temp_buf[1024];
 	bool last_line = false;
+	char *str;
 
 #define SYMBOL(sym) {					\
 	.str = "SYMBOL(" #sym  ")=",			\
@@ -325,19 +326,41 @@ static void scan_vmcoreinfo(char *start,
 			*symbol[i].vaddr = vaddr;
 		}
 
-		/* Check for "SIZE(log)=" */
-		if (memcmp("SIZE(log)=", pos, 10) == 0)
-			log_sz = strtoull(pos + 10, NULL, 10);
-
-		/* Check for struct log field offsets */
-		if (memcmp("OFFSET(log.ts_nsec)=", pos, 20) == 0)
-			log_offset_ts_nsec = strtoull(pos + 20, NULL, 10);
-
-		if (memcmp("OFFSET(log.len)=", pos, 16) == 0)
-			log_offset_len = strtoul(pos + 16, NULL, 10);
-
-		if (memcmp("OFFSET(log.text_len)=", pos, 21) == 0)
-			log_offset_text_len = strtoul(pos + 21, NULL, 10);
+		/* Check for "SIZE(printk_log)" or older "SIZE(log)=" */
+		str = "SIZE(log)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_sz = strtoull(pos + strlen(str), NULL, 10);
+
+		str = "SIZE(printk_log)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_sz = strtoull(pos + strlen(str), NULL, 10);
+
+		/* Check for struct printk_log (or older log) field offsets */
+		str = "OFFSET(log.ts_nsec)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_ts_nsec = strtoull(pos + strlen(str), NULL,
+							10);
+		str = "OFFSET(printk_log.ts_nsec)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_ts_nsec = strtoull(pos + strlen(str), NULL,
+							10);
+
+		str = "OFFSET(log.len)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_len = strtoul(pos + strlen(str), NULL, 10);
+
+		str = "OFFSET(printk_log.len)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_len = strtoul(pos + strlen(str), NULL, 10);
+
+		str = "OFFSET(log.text_len)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_text_len = strtoul(pos + strlen(str), NULL,
+							10);
+		str = "OFFSET(printk_log.text_len)=";
+		if (memcmp(str, pos, strlen(str)) == 0)
+			log_offset_text_len = strtoul(pos + strlen(str), NULL,
+							10);
 
 		if (last_line)
 			break;

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#1 lore raw
Quoted 11 lines · Vivek Goyal

vmcore-dmesg has been failing for me for quite some time as struct log was renamed to struct printk_log.

62e32ac printk: rename struct log to struct printk_log

This patch has been sitting in mailing list for quite some time. It is time to repost the patch.

I took original patch of Lubomir and modified a bit to take care of concern of hardcoded string length.

Quoted 6 lines

---

Changes for v2:
* Clarified printk_log vs. log in some comments.

Thanks, applied.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 12 lines · Simon Horman
Quoted 11 lines · Vivek Goyal

vmcore-dmesg has been failing for me for quite some time as struct log was renamed to struct printk_log.

62e32ac printk: rename struct log to struct printk_log

This patch has been sitting in mailing list for quite some time. It is time to repost the patch.

I took original patch of Lubomir and modified a bit to take care of concern of hardcoded string length.

Quoted 8 lines
Quoted 6 lines

---

Changes for v2:
* Clarified printk_log vs. log in some comments.

Thanks, applied.

Thanks Simon. "git pull" did not result in anything. Have you pushed it out yet?

Thanks
Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 17 lines · Vivek Goyal
Quoted 16 lines · Simon Horman
Quoted 15 lines · Vivek Goyal

vmcore-dmesg has been failing for me for quite some time as struct log was renamed to struct printk_log.

62e32ac printk: rename struct log to struct printk_log

This patch has been sitting in mailing list for quite some time. It is time to repost the patch.

I took original patch of Lubomir and modified a bit to take care of concern of hardcoded string length.

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Changes for v2:
* Clarified printk_log vs. log in some comments.

Thanks, applied.

Thanks Simon. "git pull" did not result in anything. Have you pushed it out yet?

Sorry about that, I have pushed it now.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 21 lines · Simon Horman
Quoted 20 lines · Vivek Goyal
Quoted 19 lines · Simon Horman
Quoted 17 lines · Vivek Goyal

vmcore-dmesg has been failing for me for quite some time as struct log was renamed to struct printk_log.

62e32ac printk: rename struct log to struct printk_log

This patch has been sitting in mailing list for quite some time. It is time to repost the patch.

I took original patch of Lubomir and modified a bit to take care of concern of hardcoded string length.

---

Changes for v2:
* Clarified printk_log vs. log in some comments.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Thanks, applied.

Thanks Simon. "git pull" did not result in anything. Have you pushed it out yet?

Sorry about that, I have pushed it now.

Thanks Simon. It works now.

Vivek

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec