Blob Blame History Raw
Return-Path: yishimat@redhat.com
Received: from zmta05.collab.prod.int.phx2.redhat.com (LHLO
 zmta05.collab.prod.int.phx2.redhat.com) (10.5.81.12) by
 zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:08:13
 -0400 (EDT)
Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
	by zmta05.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7D03B17C114;
	Thu,  2 Jul 2015 01:08:13 -0400 (EDT)
Received: from [10.3.112.13] ([10.3.112.13])
	by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6258AD6015893;
	Thu, 2 Jul 2015 01:08:11 -0400
Subject: [RHEL7.2 PATCH resend v3 2/5] Add tools for reading and writing from
 splitblock table.
To: kexec-kdump-list@redhat.com
References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com>
Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com
From: Yasuaki Ishimatsu <yishimat@redhat.com>
Message-ID: <5594C73A.6080509@redhat.com>
Date: Thu, 2 Jul 2015 01:08:10 -0400
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
 Thunderbird/38.0.1
MIME-Version: 1.0
In-Reply-To: <5594C62C.3030407@redhat.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
Content-Length: 1602

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379

The patch is back ported directory from the following upstream commit:

commit 11dcbfe2ebd1dec37c3a00dc8ee522504c7ed35c
Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
Date:   Fri Nov 7 09:42:25 2014 +0900

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

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

    Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
    Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>

Resolves: rhbz#1182379
Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com>

---
 makedumpfile-1.5.7/makedumpfile.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c
index a4c3eee..4d2f077 100644
--- a/makedumpfile-1.5.7/makedumpfile.c
+++ b/makedumpfile-1.5.7/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