[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5] block/raw-posix.c: Fixes raw_getlength() on
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v5] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD |
Date: |
Tue, 13 Jan 2015 18:54:15 +0000 |
On 13 January 2015 at 18:45, Programmingkid <address@hidden> wrote:
>
> On Jan 13, 2015, at 1:34 PM, Peter Maydell wrote:
>
>> On 13 January 2015 at 18:26, Programmingkid <address@hidden> wrote:
>>> Signed-off-by: John Arbuckle <address@hidden>
>>> + uint64_t sectors = 0;
>>> + uint32_t sector_size = 0;
>>> +
>>> + /* Query the number of sectors on the disk */
>>> + ret = ioctl(fd, DKIOCGETBLOCKCOUNT, §ors);
>>> + if (ret == -1) {
>>> + return 0;
>>
>> We should be falling back to lseek, not returning 0...
> I did try using lseek, but it doesn't work with Mac OS X block
> devices. It would always fail.
Right, but for block devices the ioctl will succeed, I thought?
We'll only try lseek() if the ioctl fails (hence "fall back").
-- PMM