Blame SOURCES/parted-3.1-avoid-dasd-as-default-file-image-type.patch

8dc857
Subject: [PATCH] libparted: Avoid dasd as default disk type while probe
8dc857
8dc857
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
8dc857
8dc857
This patch avoids setting 'dasd' as a default disk type for
8dc857
'disk image file' at the time of probe.
8dc857
8dc857
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
8dc857
---
8dc857
 include/parted/fdasd.h    |    1 +
8dc857
 libparted/labels/fdasd.c  |    6 +++++-
8dc857
 2 files changed, 6 insertions(+), 1 deletion(-)
8dc857
8dc857
--- a/include/parted/fdasd.h
8dc857
+++ b/include/parted/fdasd.h
8dc857
@@ -261,6 +261,7 @@ typedef struct fdasd_anchor {
8dc857
 	struct fdasd_hd_geometry geo;
8dc857
 	unsigned int label_block;
8dc857
 	unsigned int FBA_layout;
8dc857
+	bool is_file;
8dc857
 } fdasd_anchor_t;
8dc857
 
8dc857
 enum offset {lower, upper};
8dc857
--- a/libparted/labels/fdasd.c
8dc857
+++ b/libparted/labels/fdasd.c
8dc857
@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t
8dc857
 	}
8dc857
 	anc->hw_cylinders = 0;
8dc857
 	anc->formatted_cylinders = 0;
8dc857
+	anc->is_file = 0;
8dc857
 }
8dc857
 
8dc857
 /*
8dc857
@@ -892,7 +893,7 @@ fdasd_check_volume (fdasd_anchor_t *anc,
8dc857
 		/* Some times LDL formatted disks does not
8dc857
 		   contain any volume label */
8dc857
 		return 1;
8dc857
-	} else {
8dc857
+	} else if (! anc->is_file) {
8dc857
 	/* didn't find VOL1 volume label */
8dc857
 		anc->formatted_cylinders = anc->hw_cylinders;
8dc857
 		anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
8dc857
@@ -976,6 +977,7 @@ fdasd_get_geometry (const PedDevice *dev
8dc857
 	    dasd_info.FBA_layout = 0;
8dc857
 	    anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) /
8dc857
 				anc->geo.heads;
8dc857
+	    anc->is_file = 1;
8dc857
 	} else {
8dc857
 		if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
8dc857
 			fdasd_error(anc, unable_to_ioctl,
8dc857
@@ -997,6 +999,8 @@ fdasd_get_geometry (const PedDevice *dev
8dc857
 			anc->hw_cylinders = characteristics->long_no_cyl;
8dc857
 		else
8dc857
 			anc->hw_cylinders = characteristics->no_cyl;
8dc857
+
8dc857
+		anc->is_file = 0;
8dc857
 	}
8dc857
 
8dc857
 	anc->dev_type   = dasd_info.dev_type;