On Tue, Jun 14, 2016 at 12:19:40PM +0200, Hendrik Brueckner wrote:
> From: Wang Dong <[email protected]>
> 
> 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 <[email protected]>
> Reviewed-by: Viktor Mihajlovski <[email protected]>
> Signed-off-by: Hendrik Brueckner <[email protected]>
> ---
>  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,
> -- 
> 1.8.3.1
> 
> 

Looks good to me, thanks.


-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)

Reply via email to