summaryrefslogtreecommitdiff
path: root/elf_info.c
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2012-10-31 17:45:49 +0900
committerAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>2012-11-16 11:06:49 +0900
commit4e11405b51f5dbab65f81245145b080493623821 (patch)
treeeeccde49d79ade2bbb9af60eec1c641a19c6d9e4 /elf_info.c
parent6f0e83150a9c37ba31a8dacc4ea3e62aefbe42e6 (diff)
[PATCH v3 3/9] Read the Xen crash ELF note into memory at startup.
Instead of seeking individual fields inside the ELF note, copy the corresponding struct type from the Xen sources, so people can understand why the code does what it does. This is mainly a cleanup patch to improve maintainability, but it also simplifies reusing the crash note data from other places. Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Diffstat (limited to 'elf_info.c')
-rw-r--r--elf_info.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/elf_info.c b/elf_info.c
index cf476a3..b0e45b5 100644
--- a/elf_info.c
+++ b/elf_info.c
@@ -88,7 +88,6 @@ static unsigned long size_eraseinfo;
*/
static off_t offset_xen_crash_info;
static unsigned long size_xen_crash_info;
-static unsigned long xen_p2m_mfn;
/*
@@ -292,8 +291,7 @@ static int
get_pt_note_info(void)
{
int n_type, size_desc;
- unsigned long p2m_mfn;
- off_t offset, offset_desc, off_p2m = 0;
+ off_t offset, offset_desc;
char buf[VMCOREINFO_XEN_NOTE_NAME_BYTES];
char note[MAX_SIZE_NHDR];
@@ -349,21 +347,6 @@ get_pt_note_info(void)
offset_xen_crash_info = offset_desc;
size_xen_crash_info = size_desc;
- off_p2m = offset + offset_next_note(note)
- - sizeof(p2m_mfn);
- if (lseek(fd_memory, off_p2m, SEEK_SET) < 0){
- ERRMSG("Can't seek the dump memory(%s). %s\n",
- name_memory, strerror(errno));
- return FALSE;
- }
- if (read(fd_memory, &p2m_mfn, sizeof(p2m_mfn))
- != sizeof(p2m_mfn)) {
- ERRMSG("Can't read the dump memory(%s). %s\n",
- name_memory, strerror(errno));
- return FALSE;
- }
- xen_p2m_mfn = p2m_mfn;
-
/*
* Check whether a source dumpfile contains eraseinfo.
* /proc/vmcore does not contain eraseinfo, because eraseinfo
@@ -859,9 +842,3 @@ set_eraseinfo(off_t offset, unsigned long size)
size_eraseinfo = size;
}
-unsigned long
-get_xen_p2m_mfn(void)
-{
- return xen_p2m_mfn;
-}
-