On 28 December 2014 at 03:00, Programmingkid <programmingk...@gmail.com> wrote:
> Here is version 2 of the patch. All the suggestions have been implemented.

Thanks.

Last round of nits, but the rest of the change is fine.
If you post v3 as its own email that will make it easier
to apply (most of our patch-handling tools assume patches
come in their own emails, rather than embedded in other
threads).

> signed-off-by: John Arbuckle <programmingk...@gmail.com>
>
> ---
>  block/raw-posix.c |   20 +++++++++++++++++++-
>  1 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index e51293a..0148161 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -1312,7 +1312,25 @@ again:
>          if (size == 0)
>  #endif
>  #if defined(__APPLE__) && defined(__MACH__)
> -        size = LLONG_MAX;
> +        #define IOCTL_ERROR_VALUE -1

You don't need this -- just compare against -1.

Open brace here.

> +        uint64_t sectors = 0;
> +        uint32_t sectorSize = 0;
> +        int ret;
> +
> +        /* Query the number of sectors on the disk */
> +        ret = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
> +        if(ret == IOCTL_ERROR_VALUE) {

Spaces needed between "if" and "(".

> +           printf("\n\nWarning: problem detected retrieving sector 
> count!\n\n");

Delete these printfs.

> +           return -errno;
> +        }
> +
> +        /* Query the size of each sector */
> +        ret = ioctl(fd, DKIOCGETBLOCKSIZE, &sectorSize);
> +        if(ret == IOCTL_ERROR_VALUE) {
> +           printf("\n\nWarning: problem detected retrieving sector 
> size!\n\n");
> +           return -errno;
> +        }
> +        size = sectors * sectorSize;

Close brace here.

>  #else
>          size = lseek(fd, 0LL, SEEK_END);
>          if (size < 0) {
> --
> 1.7.5.4

thanks
-- PMM

Reply via email to