Blame SOURCES/kexec-tools-2.0.20-Cleanup-remove-the-read_elf_kcore.patch

7a865b
From 545c811050a375f79e0fa0e107cb35b9ae3a1599 Mon Sep 17 00:00:00 2001
7a865b
From: Lianbo Jiang <lijiang@redhat.com>
7a865b
Date: Fri, 23 Aug 2019 20:05:36 +0800
7a865b
Subject: [PATCH 1/5] Cleanup: remove the read_elf_kcore()
7a865b
7a865b
Here, no need to wrap the read_elf() again, lets invoke it directly.
7a865b
So remove the read_elf_kcore() and clean up redundant code.
7a865b
7a865b
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
7a865b
Signed-off-by: Simon Horman <horms@verge.net.au>
7a865b
---
7a865b
 kexec/arch/arm64/kexec-arm64.c |  2 +-
7a865b
 util_lib/elf_info.c            | 15 ++-------------
7a865b
 util_lib/include/elf_info.h    |  2 +-
7a865b
 3 files changed, 4 insertions(+), 15 deletions(-)
7a865b
7a865b
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
7a865b
index eb3a3a37307c..6ad3b0a134b3 100644
7a865b
--- a/kexec/arch/arm64/kexec-arm64.c
7a865b
+++ b/kexec/arch/arm64/kexec-arm64.c
7a865b
@@ -889,7 +889,7 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset)
7a865b
 		return EFAILED;
7a865b
 	}
7a865b
 
7a865b
-	read_elf_kcore(fd);
7a865b
+	read_elf(fd);
7a865b
 
7a865b
 	for (i = 0; get_pt_load(i,
7a865b
 		    &phys_start, NULL, &virt_start, NULL);
7a865b
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
7a865b
index 90a3b21662e7..d9397ecd8626 100644
7a865b
--- a/util_lib/elf_info.c
7a865b
+++ b/util_lib/elf_info.c
7a865b
@@ -764,7 +764,7 @@ static void dump_dmesg(int fd)
7a865b
 		dump_dmesg_legacy(fd);
7a865b
 }
7a865b
 
7a865b
-static int read_elf(int fd)
7a865b
+int read_elf(int fd)
7a865b
 {
7a865b
 	int ret;
7a865b
 
7a865b
@@ -824,24 +824,13 @@ int read_elf_vmcore(int fd)
7a865b
 	return 0;
7a865b
 }
7a865b
 
7a865b
-int read_elf_kcore(int fd)
7a865b
-{
7a865b
-	int ret;
7a865b
-
7a865b
-	ret = read_elf(fd);
7a865b
-	if (ret != 0)
7a865b
-		return ret;
7a865b
-
7a865b
-	return 0;
7a865b
-}
7a865b
-
7a865b
 int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off)
7a865b
 {
7a865b
 	int ret;
7a865b
 
7a865b
 	*phys_off = UINT64_MAX;
7a865b
 
7a865b
-	ret = read_elf_kcore(fd);
7a865b
+	ret = read_elf(fd);
7a865b
 	if (!ret) {
7a865b
 		/* If we have a valid 'PHYS_OFFSET' by now,
7a865b
 		 * return it to the caller now.
7a865b
diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h
7a865b
index 1a4debd2d4ba..c328a1b0ecf2 100644
7a865b
--- a/util_lib/include/elf_info.h
7a865b
+++ b/util_lib/include/elf_info.h
7a865b
@@ -29,7 +29,7 @@ int get_pt_load(int idx,
7a865b
 	unsigned long long *virt_start,
7a865b
 	unsigned long long *virt_end);
7a865b
 int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off);
7a865b
-int read_elf_kcore(int fd);
7a865b
+int read_elf(int fd);
7a865b
 int read_elf_vmcore(int fd);
7a865b
 
7a865b
 #endif /* ELF_INFO_H */
7a865b
-- 
7a865b
2.17.1
7a865b