[PATCH V5 2/5] Add tools for reading and writing from splitblock table
Zhou Wenjian
zhouwj-fnst at cn.fujitsu.com
Thu Nov 6 00:49:25 PST 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 | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index 7017943..f86dfd2 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5716,6 +5716,35 @@ calculate_entry_size(void)
return entry_size;
}
+void
+write_into_splitblock_table(char *entry,
+ unsigned long long value)
+{
+ char temp;
+ int i = 0;
+
+ while (i++ < splitblock->entry_size) {
+ temp = value & 0xff;
+ value = value >> BITPERBYTE;
+ *entry = temp;
+ entry++;
+ }
+}
+
+unsigned long long
+read_from_splitblock_table(char *entry)
+{
+ unsigned long long value = 0;
+ int i;
+
+ for (i = splitblock->entry_size; i > 0; i--) {
+ value = value << BITPERBYTE;
+ value += *(entry + i - 1) & 0xff;
+ }
+
+ return value;
+}
+
mdf_pfn_t
get_num_dumpable(void)
{
--
1.7.1
More information about the kexec
mailing list