qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
Date: Sun, 28 Dec 2014 10:23:37 +0000	[thread overview]
Message-ID: <CAFEAcA9DFO72HYVQtMQHscyhZ9d_eXTAW7s8PSBDs4+2NDEaOA@mail.gmail.com> (raw)
In-Reply-To: <FDDB6F2C-61B4-4AD2-9D9E-2DCE906E8DF4@gmail.com>

On 28 December 2014 at 03:00, Programmingkid <programmingkidx@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 <programmingkidx@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	other threads:[~2014-12-28 10:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-28  0:36 [Qemu-devel] [PATCH] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD Programmingkid
2014-12-28  1:19 ` Peter Maydell
2014-12-28  3:00   ` [Qemu-devel] [PATCH v2] " Programmingkid
2014-12-28 10:23     ` Peter Maydell [this message]
2014-12-28 17:37       ` Programmingkid
2014-12-28 19:43         ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA9DFO72HYVQtMQHscyhZ9d_eXTAW7s8PSBDs4+2NDEaOA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=kwolf@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).