qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8] block/raw-posix.c: Fix raw_getlength() on Ma


From: Programmingkid
Subject: Re: [Qemu-devel] [PATCH v8] block/raw-posix.c: Fix raw_getlength() on Mac OS X for CD
Date: Tue, 20 Jan 2015 09:29:46 -0500

On Jan 20, 2015, at 3:33 AM, Markus Armbruster wrote:

> Programmingkid <address@hidden> writes:
> 
>> Subject was: 
>> Re: [PATCH v7] block/raw-posix.c: Fixes raw_getlength() 
>> on Mac OS X so that it reports the correct length of a real CD
> 
> Patch history information goes...
> 
>> 
>> This patch allows Mac OS X to use a real CDROM disc in QEMU.
>> Testing this patch will require using QEMU v2.2.0 because the
>> current git version has a bug in it that prevents /dev/cdrom from
>> being used.  "make check" did pass and my Debian boot disc did work. 
>> 
>> Signed-off-by: John Arbuckle <address@hidden>
>> 
>> ---
> 
> ... below the --- divider.

I thought I did this. The information above is the description of the patch. 
Not its history.

> 
>> Fixed code indentation to be inline with removed
>> size = LLONG_MAX.
>> 
>> block/raw-posix.c |   15 ++++++++++++++-
>> 1 files changed, 14 insertions(+), 1 deletions(-)
>> 
>> diff --git a/block/raw-posix.c b/block/raw-posix.c
>> index e51293a..fa431b2 100644
>> --- a/block/raw-posix.c
>> +++ b/block/raw-posix.c
>> @@ -1312,7 +1312,20 @@ again:
>>         if (size == 0)
>> #endif
>> #if defined(__APPLE__) && defined(__MACH__)
>> -        size = LLONG_MAX;
>> +        {
>> +            uint64_t sectors = 0;
>> +            uint32_t sector_size = 0;
> 
> Ignorant question: why do you need to initialize these?

We don't. It's just a habit. 

> 
> Patch looks plausible otherwise, but know nothing about Macs :)

It does do the job.

> 
>> +
>> +            if (ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors) == 0
>> +               && ioctl(fd, DKIOCGETBLOCKSIZE, &sector_size) == 0) {
>> +                size = sectors * sector_size;
>> +            } else {
>> +                size = lseek(fd, 0LL, SEEK_END);
>> +                if (size < 0) {
>> +                    return -errno;
>> +                }
>> +            }
>> +        }
>> #else
>>         size = lseek(fd, 0LL, SEEK_END);
>>         if (size < 0) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]