rpms/kexec-tools/devel kexec-tools-1.101-makedumpfile-xen-syms.patch, NONE, 1.1

Neil Horman (nhorman) fedora-extras-commits at redhat.com
Wed Aug 22 19:20:01 UTC 2007


Author: nhorman

Update of /cvs/extras/rpms/kexec-tools/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16662

Added Files:
	kexec-tools-1.101-makedumpfile-xen-syms.patch 
Log Message:
Resolves bz 250341

kexec-tools-1.101-makedumpfile-xen-syms.patch:

--- NEW FILE kexec-tools-1.101-makedumpfile-xen-syms.patch ---
--- kexec-tools-1.101/makedumpfile/makedumpfile.c.orig	2007-07-27 13:16:28.000000000 -0400
+++ kexec-tools-1.101/makedumpfile/makedumpfile.c	2007-08-22 13:20:04.000000000 -0400
@@ -5195,6 +5195,9 @@
 	int i;
 	struct pt_load_segment *pls;
 	int ret = FALSE;
+	unsigned long long paddr;
+	off_t offset_page;
+	unsigned char *buf = NULL;
 
 	/*
 	 * NOTE: the first half of bitmap is not used for Xen extraction
@@ -5211,6 +5214,11 @@
 		    strerror(errno));
 		goto out;
 	}
+	if ((buf = malloc(info->page_size)) == NULL) {
+		ERRMSG("Can't allocate memory for the page. %s\n",
+		    strerror(errno));
+		goto out;
+	}
 
 	pfn = 0;
 	for (i = 0; i < info->num_load_memory; i++) {
@@ -5255,11 +5263,35 @@
 			 *  - xen heap area, or
 			 *  - selected domain page
 			 */
-			if (_domain == 0 ||
+			if (!(_domain == 0 ||
 				(info->xen_heap_start <= pfn && pfn < info->xen_heap_end) ||
-				((count_info & 0xffff) && is_select_domain(info, _domain))) {
-				set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
+				((count_info & 0xffff) && is_select_domain(info, _domain)))) {
+				continue;
+			}
+			if (info->dump_level & DL_EXCLUDE_ZERO) {
+				paddr = (unsigned long long)pfn * info->page_size;
+				offset_page = paddr_to_offset(info, paddr);
+				if (!offset_page) {
+					ERRMSG("Can't convert physaddr(%llx) to a offset.\n",
+					    paddr);
+					goto out;
+				}
+				if (lseek(info->fd_memory, offset_page,
+				    SEEK_SET) == (off_t)-1) {
+					ERRMSG("Can't seek the dump memory(%s). %s\n",
+					    info->name_memory, strerror(errno));
+					goto out;
+				}
+				if (read(info->fd_memory, buf, info->page_size)
+				    != info->page_size) {
+					ERRMSG("Can't read the dump memory(%s). %s\n",
+					    info->name_memory, strerror(errno));
+					goto out;
+				}
+				if (is_zero_page(buf, info->page_size))
+					continue;
 			}
+			set_bitmap(bm2.buf, pfn%PFN_BUFBITMAP, 1);
 		}
 	}
 
@@ -5275,6 +5307,8 @@
 out:
 	if (bm2.buf != NULL)
 		free(bm2.buf);
+	if (buf != NULL)
+		free(buf);
 
 	return ret;
 }
@@ -5546,7 +5580,7 @@
 			MSG("-E must be specified with --xen-syms or --xen-vmcoreinfo.\n");
 			goto out;
 		}
-		info->dump_level = DL_EXCLUDE_XEN;
+		info->dump_level |= DL_EXCLUDE_XEN;
 		return handle_xen(info);
 
 	} else if (info->flag_rearrange) {




More information about the fedora-extras-commits mailing list