parted/libparted-dasd-correct-the-offset-where-the-first-pa.patch
Marcus Meissner 5b97712c80 Accepting request 712877 from home:anicka:branches:Base:System
- port fixes for various bugs from upstream (bsc#1136245)
 - add: libparted-dasd-correct-the-offset-where-the-first-pa.patch
   4126d02, correct the offset where the first partition begins. 
   This patch implements libparted-dasd-do-not-use-first-tracks.patch 
 - remove: libparted-dasd-do-not-use-first-tracks.patch
 - add: parted-fix-crash-due-to-improper-partition-number-in.patch
   149f009, fix crash due to improper partition number input,
   changed call to strtol, use base 0 to fit our parted-type.patch
 - modify: parted-type.patch (removed ui.c part)
 - add: parted-check-the-name-of-partition-first-when-to-nam.patch
   d7a2ff1, check the name of partition first when to name a partition
 - add: libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch 
   c11f5c0, 571e078, add test cases for the new fdasd functions
 - add: libparted-dasd-add-an-exception-for-changing-DASD-LD.patch
   ee2c0c2, add an exception for changing DASD-LDL partition table
 - add: libpartd-dasd-improve-flag-processing-for-DASD-LDL.patch
   1545d6d, improve flag processing for DASD-LDL
 - add: clean-the-disk-information-when-commands-fail-in-int.patch
   5a61f15, clean the disk information when commands fail in 
   interactive mode
 - add: parted-ui-remove-unneccesary-information-of-command.patch
   0b7946a, remove unneccesary information of command line
 - add: parted-fix-wrong-error-label-jump-in-mkpart.patch
   af150f6, fix wrong error label jump in mkpart
 - refresh: libparted-dasd-unify-vtoc-handling-for-cdl-ldl.patch
   4f25d54, unify vtoc handling for cdl/ldl
 - refresh: libparted-dasd-update-and-improve-fdasd-functions.patch
   db37c8c, update and improve fdasd functions
 - refresh: libparted-dasd-add-new-fdasd-functions.patch
   b9e1281, add new fdasd functions

OBS-URL: https://build.opensuse.org/request/show/712877
OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=142
2019-07-08 12:12:35 +00:00

54 lines
2.0 KiB
Diff

From 4126d0292c75cf7d50a2f4e9d485a52b5beafccc Mon Sep 17 00:00:00 2001
From: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Date: Tue, 14 Jun 2016 12:19:40 +0200
Subject: [PATCH] libparted/dasd: correct the offset where the first partition
begins
The start point of first partition must start at least from the third
track of DASD, due to the existence of metadata in the first two track.
The previous constraint just sets all the device to be partitioned.
So when the start point of the first partition start before the third
track, (For example if it starts from.0) parted will exit abruptly.
And this kind of job must be done with constraint explicitly.
Then the constraint is modified to exclude the first two tracks and
to make the first partition start from the third track by default.
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/labels/dasd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index f79a867..4e68512 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -829,6 +829,7 @@ _primary_constraint (PedDisk* disk)
PedSector sector_size;
LinuxSpecific* arch_specific;
DasdDiskSpecific* disk_specific;
+ PedSector start;
PDEBUG;
@@ -842,7 +843,12 @@ _primary_constraint (PedDisk* disk)
if (!ped_alignment_init (&end_align, -1,
disk->dev->hw_geom.sectors * sector_size))
return NULL;
- if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length))
+
+ start = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors
+ * (long long) arch_specific->real_sector_size
+ / (long long) disk->dev->sector_size);
+
+ if (!ped_geometry_init (&max_geom, disk->dev, start, disk->dev->length))
return NULL;
return ped_constraint_new(&start_align, &end_align, &max_geom,
--
2.16.4