[PATCH v2 2/5] Add tools for reading and writing from splitblock table

Zhou Wenjian zhouwj-fnst at cn.fujitsu.com
Mon Oct 13 02:34:23 PDT 2014


The function added in this patch, is used for writing and reading value
from the char array in struct SplitBlock.

Signed-off-by: Qiao Nuohan <qiaonuohan at cn.fujitsu.com>
Signed-off-by: Zhou Wenjian <zhouwj-fnst at cn.fujitsu.com>
---
 makedumpfile.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 95d553c..a8d86f6 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5708,6 +5708,29 @@ calculate_entry_size(void){
 	return entry_size;
 }
 
+void
+write_value_into_splitblock_table(char *splitblock_inner, unsigned long long content)
+{
+	char temp;
+	int i=0;
+	while (i++ < splitblock->entry_size) {
+		temp = content & 0xff;
+		content = content >> BITPERBYTE;
+		*splitblock_inner++ = temp;
+	}
+}
+unsigned long long
+read_value_from_splitblock_table(char *splitblock_inner)
+{
+	unsigned long long ret = 0;
+	int i;
+	for (i = splitblock->entry_size; i > 0; i--) {
+		ret = ret << BITPERBYTE;
+		ret += *(splitblock_inner + i - 1) & 0xff;
+	}
+	return ret;
+}
+
 mdf_pfn_t
 get_num_dumpable(void)
 {
-- 
1.7.1




More information about the kexec mailing list