[prev in list] [next in list] [prev in thread] [next in thread]
List: kexec
Subject: [PATCH v1 2/5] makedumpfile: Add tools for reading and writing from block table
From: Zhou Wenjian <zhouwj-fnst () cn ! fujitsu ! com>
Date: 2014-09-29 7:06:24
Message-ID: 1411974387-10839-3-git-send-email-zhouwj-fnst () cn ! fujitsu ! com
[Download RAW message or body]
The function added in this patch, is used for writing and reading value
from the char array in struct Block.
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
---
makedumpfile.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index 2feda01..a4cb9b6 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5708,6 +5708,29 @@ calculate_entry_size(void){
return entry_size;
}
+void
+write_value_into_block_table(char *block_inner, unsigned long long content)
+{
+ char temp;
+ int i=0;
+ while (i++ < block->entry_size) {
+ temp = content & 0xff;
+ content = content >> BITPERBYTE;
+ *block_inner++ = temp;
+ }
+}
+unsigned long long
+read_value_from_block_table(char *block_inner)
+{
+ unsigned long long ret = 0;
+ int i;
+ for (i = block->entry_size; i > 0; i--) {
+ ret = ret << BITPERBYTE;
+ ret += *(block_inner + i - 1) & 0xff;
+ }
+ return ret;
+}
+
mdf_pfn_t
get_num_dumpable(void)
{
--
1.7.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic