----- "Dave Anderson" <anderson@xxxxxxxxxx> wrote: > > What could be done is to have the xc_core_verify() initialization code read > the dumpfile header into an "original" xc_core_header structure type, verify it > as one of the "old-style" dumpfiles, but then store the offsets into your > updated xc_core_header structure. > > Dave How does the attached patch work for you? Dave
--- xendump.h 3 Dec 2009 15:42:51 -0000 1.12 +++ xendump.h 4 Feb 2010 20:10:39 -0000 @@ -33,6 +33,20 @@ unsigned int xch_pages_offset; } xc_core_header_t; +/* + * Based upon the original xensource xc_core_header struct above, + * but with unsigned long offset values so that it can be used + * with the original dumpfile format and new ELF-style format. + */ +struct xen_core_header { + unsigned int xch_magic; + unsigned int xch_nr_vcpus; + unsigned int xch_nr_pages; + unsigned long xch_ctxt_offset; + unsigned long xch_index_offset; + unsigned long xch_pages_offset; +}; + struct pfn_offset_cache { off_t file_offset; ulong pfn; @@ -70,7 +84,7 @@ struct xc_core_data { int p2m_frames; ulong *p2m_frame_index_list; - struct xc_core_header header; + struct xen_core_header header; int elf_class; uint64_t format_version; off_t elf_strtab_offset; --- xendump.c 3 Dec 2009 15:42:51 -0000 1.23 +++ xendump.c 4 Feb 2010 20:04:52 -0000 @@ -123,8 +123,12 @@ clean_exit(1); } - BCOPY(xcp, &xd->xc_core.header, - sizeof(struct xc_core_header)); + xd->xc_core.header.xch_magic = xcp->xch_magic; + xd->xc_core.header.xch_nr_vcpus = xcp->xch_nr_vcpus; + xd->xc_core.header.xch_nr_pages = xcp->xch_nr_pages; + xd->xc_core.header.xch_ctxt_offset = (ulong)xcp->xch_ctxt_offset; + xd->xc_core.header.xch_index_offset = (ulong)xcp->xch_index_offset; + xd->xc_core.header.xch_pages_offset = (ulong)xcp->xch_pages_offset; xd->flags |= (XENDUMP_LOCAL | XC_CORE_ORIG | XC_CORE_P2M_CREATE); @@ -1036,13 +1040,13 @@ fprintf(fp, " xch_nr_pages: %d (0x%x)\n", xd->xc_core.header.xch_nr_pages, xd->xc_core.header.xch_nr_pages); - fprintf(fp, " xch_ctxt_offset: %d (0x%x)\n", + fprintf(fp, " xch_ctxt_offset: %ld (0x%lx)\n", xd->xc_core.header.xch_ctxt_offset, xd->xc_core.header.xch_ctxt_offset); - fprintf(fp, " xch_index_offset: %d (0x%x)\n", + fprintf(fp, " xch_index_offset: %ld (0x%lx)\n", xd->xc_core.header.xch_index_offset, xd->xc_core.header.xch_index_offset); - fprintf(fp, " xch_pages_offset: %d (0x%x)\n", + fprintf(fp, " xch_pages_offset: %ld (0x%lx)\n", xd->xc_core.header.xch_pages_offset, xd->xc_core.header.xch_pages_offset); @@ -2538,7 +2542,7 @@ if (STREQ(name, ".xen_prstatus")) xd->xc_core.header.xch_ctxt_offset = - (unsigned int)shdr.sh_offset; + (unsigned long)shdr.sh_offset; if (STREQ(name, ".xen_shared_info")) xd->xc_core.shared_info_offset = (off_t)shdr.sh_offset; @@ -2555,7 +2559,7 @@ if (STREQ(name, ".xen_pages")) xd->xc_core.header.xch_pages_offset = - (unsigned int)shdr.sh_offset; + (unsigned long)shdr.sh_offset; if (STREQ(name, ".xen_ia64_mapped_regs")) xd->xc_core.ia64_mapped_regs_offset = @@ -2638,7 +2642,7 @@ if (STREQ(name, ".xen_prstatus")) xd->xc_core.header.xch_ctxt_offset = - (unsigned int)shdr.sh_offset; + (unsigned long)shdr.sh_offset; if (STREQ(name, ".xen_shared_info")) xd->xc_core.shared_info_offset = (off_t)shdr.sh_offset; @@ -2655,7 +2659,7 @@ if (STREQ(name, ".xen_pages")) xd->xc_core.header.xch_pages_offset = - (unsigned int)shdr.sh_offset; + (unsigned long)shdr.sh_offset; if (STREQ(name, ".xen_ia64_mapped_regs")) xd->xc_core.ia64_mapped_regs_offset =
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility