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

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Tue Nov 4 20:18:11 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;
>+	}

Did you forget to reflect the HATAYAMA-san's comment ?

>> +	for (i = splitblock->entry_size; i > 0; i--) {
>> +		ret = ret << BITPERBYTE;
>> +		ret += *(splitblock_inner + i - 1) & 0xff;
>
> The & 0xff is necessary? because splitblock_inner is of type char *.


Thanks,
Atsushi Kumagai

>+
>+	return value;
>+}
>+
> mdf_pfn_t
> get_num_dumpable(void)
> {
>--
>1.7.1
>
>
>_______________________________________________
>kexec mailing list
>kexec at lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec



More information about the kexec mailing list