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

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