Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lianbo Jiang <lijiang@redhat.com>
To: kexec@lists.infradead.org
Cc: kasong@redhat.com, bhe@redhat.com, piliu@redhat.com,
	bhsharma@redhat.com, junw99@yahoo.com, horms@verge.net.au,
	dyoung@redhat.com
Subject: [PATCH 1/4 v2] Cleanup: remove the read_elf_kcore()
Date: Fri, 23 Aug 2019 20:05:36 +0800	[thread overview]
Message-ID: <20190823120539.18330-2-lijiang@redhat.com> (raw)
In-Reply-To: <20190823120539.18330-1-lijiang@redhat.com>

Here, no need to wrap the read_elf() again, lets invoke it directly.
So remove the read_elf_kcore() and clean up redundant code.

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
 kexec/arch/arm64/kexec-arm64.c |  2 +-
 util_lib/elf_info.c            | 15 ++-------------
 util_lib/include/elf_info.h    |  2 +-
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
index eb3a3a37307c..6ad3b0a134b3 100644
--- a/kexec/arch/arm64/kexec-arm64.c
+++ b/kexec/arch/arm64/kexec-arm64.c
@@ -889,7 +889,7 @@ int get_phys_base_from_pt_load(unsigned long *phys_offset)
 		return EFAILED;
 	}
 
-	read_elf_kcore(fd);
+	read_elf(fd);
 
 	for (i = 0; get_pt_load(i,
 		    &phys_start, NULL, &virt_start, NULL);
diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
index 90a3b21662e7..d9397ecd8626 100644
--- a/util_lib/elf_info.c
+++ b/util_lib/elf_info.c
@@ -764,7 +764,7 @@ static void dump_dmesg(int fd)
 		dump_dmesg_legacy(fd);
 }
 
-static int read_elf(int fd)
+int read_elf(int fd)
 {
 	int ret;
 
@@ -824,24 +824,13 @@ int read_elf_vmcore(int fd)
 	return 0;
 }
 
-int read_elf_kcore(int fd)
-{
-	int ret;
-
-	ret = read_elf(fd);
-	if (ret != 0)
-		return ret;
-
-	return 0;
-}
-
 int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off)
 {
 	int ret;
 
 	*phys_off = UINT64_MAX;
 
-	ret = read_elf_kcore(fd);
+	ret = read_elf(fd);
 	if (!ret) {
 		/* If we have a valid 'PHYS_OFFSET' by now,
 		 * return it to the caller now.
diff --git a/util_lib/include/elf_info.h b/util_lib/include/elf_info.h
index 1a4debd2d4ba..c328a1b0ecf2 100644
--- a/util_lib/include/elf_info.h
+++ b/util_lib/include/elf_info.h
@@ -29,7 +29,7 @@ int get_pt_load(int idx,
 	unsigned long long *virt_start,
 	unsigned long long *virt_end);
 int read_phys_offset_elf_kcore(int fd, unsigned long *phys_off);
-int read_elf_kcore(int fd);
+int read_elf(int fd);
 int read_elf_vmcore(int fd);
 
 #endif /* ELF_INFO_H */
-- 
2.17.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2019-08-23 12:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 12:05 [PATCH 0/4 v2] Limit the size of vmcore-dmesg.txt to 2G Lianbo Jiang
2019-08-23 12:05 ` Lianbo Jiang [this message]
2019-08-23 12:05 ` [PATCH 2/4 v2] Fix an error definition about the variable 'fname' Lianbo Jiang
2019-08-23 12:05 ` [PATCH 3/4 v2] Cleanup: move it back from util_lib/elf_info.c Lianbo Jiang
2019-08-23 12:05 ` [PATCH 4/4 v2] Limit the size of vmcore-dmesg.txt to 2G Lianbo Jiang
2019-08-28  9:18 ` [PATCH 0/4 " lijiang
2019-09-03 14:37   ` Simon Horman
2019-09-04 13:29     ` lijiang
2019-09-08 12:40       ` Simon Horman
2019-09-09  1:03         ` lijiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190823120539.18330-2-lijiang@redhat.com \
    --to=lijiang@redhat.com \
    --cc=bhe@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=junw99@yahoo.com \
    --cc=kasong@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=piliu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox