diff --git a/parted-3.1-avoid-dasd-as-default-file-image-type.patch b/parted-3.1-avoid-dasd-as-default-file-image-type.patch new file mode 100644 index 0000000..f380792 --- /dev/null +++ b/parted-3.1-avoid-dasd-as-default-file-image-type.patch @@ -0,0 +1,59 @@ +Subject: [PATCH] libparted: Avoid dasd as default disk type while probe + +From: Nageswara R Sastry + +This patch avoids setting 'dasd' as a default disk type for +'disk image file' at the time of probe. + +Signed-off-by: Nageswara R Sastry +--- + include/parted/fdasd.h | 1 + + libparted/labels/fdasd.c | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -261,6 +261,7 @@ typedef struct fdasd_anchor { + struct fdasd_hd_geometry geo; + unsigned int label_block; + unsigned int FBA_layout; ++ bool is_file; + } fdasd_anchor_t; + + enum offset {lower, upper}; +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t + } + anc->hw_cylinders = 0; + anc->formatted_cylinders = 0; ++ anc->is_file = 0; + } + + /* +@@ -892,7 +893,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, + /* Some times LDL formatted disks does not + contain any volume label */ + return 1; +- } else { ++ } else if (! anc->is_file) { + /* didn't find VOL1 volume label */ + anc->formatted_cylinders = anc->hw_cylinders; + anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads +@@ -976,6 +977,7 @@ fdasd_get_geometry (const PedDevice *dev + dasd_info.FBA_layout = 0; + anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / + anc->geo.heads; ++ anc->is_file = 1; + } else { + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + fdasd_error(anc, unable_to_ioctl, +@@ -997,6 +999,8 @@ fdasd_get_geometry (const PedDevice *dev + anc->hw_cylinders = characteristics->long_no_cyl; + else + anc->hw_cylinders = characteristics->no_cyl; ++ ++ anc->is_file = 0; + } + + anc->dev_type = dasd_info.dev_type; diff --git a/parted-3.1-libparted-mklabel-eav.patch b/parted-3.1-libparted-mklabel-eav.patch new file mode 100644 index 0000000..a8bc228 --- /dev/null +++ b/parted-3.1-libparted-mklabel-eav.patch @@ -0,0 +1,151 @@ +Subject: [PATCH] libparted: mklabel to support EAV DASD + +From: Nageswara R Sastry + +Extended Address Volume (EAV) DASDs are ECKD DASDs with more than +65520 cylinders. This patch adds support for mklabel to properly +handle unformatted EAV DASDs. + +Signed-off-by: Nageswara R Sastry +--- + include/parted/fdasd.h | 1 + libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 90 insertions(+), 3 deletions(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice + void fdasd_check_api_version (fdasd_anchor_t *anc, int fd); + int fdasd_check_volume (fdasd_anchor_t *anc, int fd); + int fdasd_write_labels (fdasd_anchor_t *anc, int fd); +-int fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc); + void fdasd_recreate_vtoc(fdasd_anchor_t *anc); + partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc, + unsigned int start, unsigned int stop); +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc + anc->vtoc_changed++; + } + ++ /* ++ * initialize the VOL1 volume label ++ */ ++static void ++fdasd_init_volume_label(fdasd_anchor_t *anc, int fd) ++{ ++ volume_label_t *vlabel = anc->vlabel; ++ ++ vtoc_volume_label_init(vlabel); ++ vtoc_volume_label_set_key(vlabel, "VOL1"); ++ vtoc_volume_label_set_label(vlabel, "VOL1"); ++ ++ vtoc_set_cchhb(&vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); ++} ++ ++ + /* + * sets some important partition data + * (like used, start_trk, end_trk, len_trk) +@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t + fdasd_update_partition_info (anc); + } + ++static void ++fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc) ++{ ++ PDEBUG ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, ++ FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++ ++ vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); ++} ++ ++/* ++ * we have a invalid FMT4 DSCB and therefore we will re-create the VTOC ++ */ ++static void ++fdasd_process_invalid_vtoc(fdasd_anchor_t *anc) ++{ ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, ++ FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++} ++ ++ + static int + fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) + { +@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t + if (anc->f4->DS4IDFMT == 0xf4) { + fdasd_process_valid_vtoc (anc, b, fd); + return 0; ++ } else { ++ fdasd_process_invalid_vtoc(anc); + } + if (strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("LNX1",str,4),4) == 0 || + strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("CMS1",str,4),4) == 0) +@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc, + else + return 0; + } else { +- return 1; ++ fdasd_invalid_vtoc_pointer(anc); + } + } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || + strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { + return 0; ++ } else if (anc->FBA_layout == 1) { ++ /* Some times LDL formatted disks does not ++ contain any volume label */ ++ return 1; ++ } else { ++ /* didn't find VOL1 volume label */ ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ ++ fdasd_init_volume_label(anc, fd); ++ ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', ++ anc->verbose, FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++ return 0; + } +- + return 1; + } + diff --git a/parted.spec b/parted.spec index 2370fbc..da16a2a 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.1 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -27,6 +27,9 @@ Patch10: parted-3.1-tests-cleanup-losetup-usage.patch Patch11: parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch Patch12: parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch Patch13: parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch +Patch14: parted-3.1-libparted-mklabel-eav.patch +Patch15: parted-3.1-avoid-dasd-as-default-file-image-type.patch + Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: e2fsprogs-devel @@ -162,6 +165,10 @@ fi %changelog +* Wed Dec 12 2012 Brian C. Lane 3.1-10 +- libparted: mklabel to support EAV DASD (#707032) +- libparted: Avoid dasd as default disk type while probe (#707032) + * Thu Nov 01 2012 Brian C. Lane 3.1-9 - don't canonicalize /dev/md/ paths (#872361)