[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] Fix snap radius so that it is using half (#665496)
From: |
Jim Meyering |
Subject: |
Re: [PATCH 1/4] Fix snap radius so that it is using half (#665496) |
Date: |
Wed, 22 Jun 2011 21:59:29 +0200 |
Brian C. Lane wrote:
> The snap radius didn't match the documentation, it has been using +/-
> unit size instead +/- 0.5 * unit (eg. 500KB for a MB unit). This caused
> problems when specifying 1MB, 1GB, etc. as a partition start or end
> resulting in partitions being created that were nowhere near the
> specified size.
>
> * libparted/unit.c (ped_unit_parse_custom): divide radius by 2
> ---
> libparted/unit.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libparted/unit.c b/libparted/unit.c
> index dc4205b..1dafc90 100644
> --- a/libparted/unit.c
> +++ b/libparted/unit.c
> @@ -533,7 +533,7 @@ ped_unit_parse_custom (const char* str, const PedDevice*
> dev, PedUnit unit,
> }
>
> unit_size = ped_unit_get_size (dev, unit);
> - radius = ped_div_round_up (unit_size, dev->sector_size) - 1;
> + radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
> if (radius < 0)
> radius = 0;
> /* If the user specifies units in a power of 2, e.g., 4MiB, as in
Thanks a lot!
I particularly appreciate the test suite additions.
I've applied all four of those.
The only changes I made were to add either libparted: or test:
as a prefix to the one-line summary and to drop the leading
capital letter:
libparted: fix snap radius so that it is using half (#665496)
libparted: don't allow values less than 1 (#665496)
tests: add test for radius divide by 2 fix
tests: add test for value less than 1
Also, I changed s/ / / before the "/" above.