diff options
author | Magnus Damm <magnus@valinux.co.jp> | 2006-11-17 19:56:41 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2006-11-27 12:25:12 +0900 |
commit | fb8731448cbeedb0044b1293b1c778d5653f0dd5 (patch) | |
tree | 0f93fee78fc71d8ee993c32068748d2a197d99d0 | |
parent | 93bd94e000e78e81982d03db0e1ce54a54dad859 (diff) |
kexec-tools: Use get_crash_notes_per_cpu() (ia64)
kexec-tools: Use get_crash_notes_per_cpu() (ia64)
Use get_crash_notes_per_cpu() on ia64 to avoid code duplication.
Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
Remove trailing whitespace
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ia64/crashdump-ia64.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c index 0d67806..eadc975 100644 --- a/kexec/arch/ia64/crashdump-ia64.c +++ b/kexec/arch/ia64/crashdump-ia64.c @@ -80,30 +80,6 @@ static void add_loaded_segments_info(struct kexec_info *info, } } -static int get_crash_notes_section_addr(int cpu, unsigned long *addr, - unsigned long *len) -{ - char crash_notes[128]; - char line[MAX_LINE]; - FILE *fp; - sprintf(crash_notes, "/sys/devices/system/cpu/cpu%d/crash_notes", cpu); - fp = fopen(crash_notes, "r"); - if (!fp) { - fprintf(stderr, "Cannot open %s: %s\n", - crash_notes, strerror(errno)); - fprintf(stderr, "Try mounting sysfs\n"); - return -1; - } - if (fscanf(fp, "%lx", addr) != 1) { - *addr = 0; - return -1; - } - - *len = MAX_NOTE_BYTES; - - return 0; -} - /* Removes crash reserve region from list of memory chunks for whom elf program * headers have to be created. Assuming crash reserve region to be a single * continuous area fully contained inside one of the memory chunks */ @@ -193,9 +169,11 @@ static int prepare_crash_memory_elf64_headers(struct kexec_info *info, } for (i = 0; i < nr_cpus; i++) { - if (get_crash_notes_section_addr (i, ¬es_addr, - ¬es_len) < 0) - break; + if (get_crash_notes_per_cpu(i, ¬es_addr, ¬es_len) < 0) { + /* This cpu is not present. Skip it. */ + continue; + } + notes_offset = notes_addr; phdr = (Elf64_Phdr *) bufp; bufp += sizeof(Elf64_Phdr); |