All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
@ 2015-01-02 21:44 Programmingkid
  2015-01-06 14:02 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Programmingkid @ 2015-01-02 21:44 UTC (permalink / raw)
  To: Peter Maydell, Stefan Hajnoczi; +Cc: qemu-devel qemu-devel

Removes redundant ret variable and renames sectorSize variable to meet QEMU coding standards. 

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>

---
 block/raw-posix.c |   18 +++++++++++++++++-
 configure         |    2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index e51293a..16fa0a4 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1312,7 +1312,23 @@ again:
         if (size == 0)
 #endif
 #if defined(__APPLE__) && defined(__MACH__)
-        size = LLONG_MAX;
+    {
+         uint64_t sectors = 0;
+         uint32_t sector_size = 0;
+
+         /* Query the number of sectors on the disk */
+         ret = ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors);
+         if (ret == -1) {
+             return -errno;
+         }
+
+         /* Query the size of each sector */
+         ret = ioctl(fd, DKIOCGETBLOCKSIZE, &sector_size);
+         if (ret == -1) {
+             return -errno;
+         }
+         size = sectors * sector_size;
+   }
 #else
         size = lseek(fd, 0LL, SEEK_END);
         if (size < 0) {
diff --git a/configure b/configure
index cae588c..32d3d3f 100755
--- a/configure
+++ b/configure
@@ -611,7 +611,7 @@ Darwin)
   cocoa="yes"
   audio_drv_list="coreaudio"
   audio_possible_drivers="coreaudio sdl fmod"
-  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
+  LDFLAGS="-framework CoreFoundation -framework IOKit -framework ApplicationServices $LDFLAGS"
   libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
   # Disable attempts to use ObjectiveC features in os/object.h since they
   # won't work when we're compiling with gcc as a C compiler.
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
  2015-01-02 21:44 [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD Programmingkid
@ 2015-01-06 14:02 ` Stefan Hajnoczi
  2015-01-06 15:04   ` Programmingkid
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-01-06 14:02 UTC (permalink / raw)
  To: Programmingkid; +Cc: Peter Maydell, qemu-devel qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Fri, Jan 02, 2015 at 04:44:38PM -0500, Programmingkid wrote:
> Removes redundant ret variable and renames sectorSize variable to meet QEMU coding standards. 

This is a changelog item for v4 of this patch.  Changelogs should go
below the '---' line so they are not merged into git history.

The rationale is that when a patch is merged into git, the changelog
describing patch revisions that were posted on the mailing list is not
relevant (we only see the final patch in git, not the revisions from the
mailing list).

Patches usually look like this:

Subject: block/raw-posix: brief summary

A longer description of the problem, maybe a command-line to reproduce a
bug, and some rationale for this code change.

Signed-off-by: Me <my@email.com>
---
v2:
 * Fix int -> size_t for memory lengths [Requested by Bob]

The changelog at the bottom is useful to code reviewers but won't get
merged in the git history.

Anyway, thanks for this patch.  I have dropped this changelog line and
merged it!

> 
> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
> 
> ---
>  block/raw-posix.c |   18 +++++++++++++++++-
>  configure         |    2 +-
>  2 files changed, 18 insertions(+), 2 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
  2015-01-06 14:02 ` Stefan Hajnoczi
@ 2015-01-06 15:04   ` Programmingkid
  2015-01-13 14:05     ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Programmingkid @ 2015-01-06 15:04 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Peter Maydell, qemu-devel qemu-devel


On Jan 6, 2015, at 9:02 AM, Stefan Hajnoczi wrote:

> On Fri, Jan 02, 2015 at 04:44:38PM -0500, Programmingkid wrote:
>> Removes redundant ret variable and renames sectorSize variable to meet QEMU coding standards. 
> 
> This is a changelog item for v4 of this patch.  Changelogs should go
> below the '---' line so they are not merged into git history.
> 
> The rationale is that when a patch is merged into git, the changelog
> describing patch revisions that were posted on the mailing list is not
> relevant (we only see the final patch in git, not the revisions from the
> mailing list).
> 
> Patches usually look like this:
> 
> Subject: block/raw-posix: brief summary
> 
> A longer description of the problem, maybe a command-line to reproduce a
> bug, and some rationale for this code change.
> 
> Signed-off-by: Me <my@email.com>
> ---
> v2:
> * Fix int -> size_t for memory lengths [Requested by Bob]
> 
> The changelog at the bottom is useful to code reviewers but won't get
> merged in the git history.
> 
> Anyway, thanks for this patch.  I have dropped this changelog line and
> merged it!
> 
>> 
>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>> 
>> ---
>> block/raw-posix.c |   18 +++++++++++++++++-
>> configure         |    2 +-
>> 2 files changed, 18 insertions(+), 2 deletions(-)
> 
> Thanks, applied to my block tree:
> https://github.com/stefanha/qemu/commits/block
> 
> Stefan

Thank you very much for accepting my patch. 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
  2015-01-06 15:04   ` Programmingkid
@ 2015-01-13 14:05     ` Stefan Hajnoczi
  2015-01-13 17:52       ` Programmingkid
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2015-01-13 14:05 UTC (permalink / raw)
  To: Programmingkid; +Cc: Peter Maydell, qemu-devel qemu-devel

On Tue, Jan 6, 2015 at 3:04 PM, Programmingkid
<programmingkidx@gmail.com> wrote:
>
> On Jan 6, 2015, at 9:02 AM, Stefan Hajnoczi wrote:
>
>> On Fri, Jan 02, 2015 at 04:44:38PM -0500, Programmingkid wrote:
>>> Removes redundant ret variable and renames sectorSize variable to meet QEMU coding standards.
>>
>> This is a changelog item for v4 of this patch.  Changelogs should go
>> below the '---' line so they are not merged into git history.
>>
>> The rationale is that when a patch is merged into git, the changelog
>> describing patch revisions that were posted on the mailing list is not
>> relevant (we only see the final patch in git, not the revisions from the
>> mailing list).
>>
>> Patches usually look like this:
>>
>> Subject: block/raw-posix: brief summary
>>
>> A longer description of the problem, maybe a command-line to reproduce a
>> bug, and some rationale for this code change.
>>
>> Signed-off-by: Me <my@email.com>
>> ---
>> v2:
>> * Fix int -> size_t for memory lengths [Requested by Bob]
>>
>> The changelog at the bottom is useful to code reviewers but won't get
>> merged in the git history.
>>
>> Anyway, thanks for this patch.  I have dropped this changelog line and
>> merged it!
>>
>>>
>>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>>>
>>> ---
>>> block/raw-posix.c |   18 +++++++++++++++++-
>>> configure         |    2 +-
>>> 2 files changed, 18 insertions(+), 2 deletions(-)
>>
>> Thanks, applied to my block tree:
>> https://github.com/stefanha/qemu/commits/block
>>
>> Stefan
>
> Thank you very much for accepting my patch.

Hi,
Unfortunately I had to drop this patch because it breaks -drive
file=/dev/null,...

/dev/null is a character device and we should not return -ENOTSUP when
the CD-ROM ioctls fail.

Please let it fail gracefully when the device is not a CD-ROM.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
  2015-01-13 14:05     ` Stefan Hajnoczi
@ 2015-01-13 17:52       ` Programmingkid
  2015-01-13 18:05         ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Programmingkid @ 2015-01-13 17:52 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Peter Maydell, qemu-devel qemu-devel


On Jan 13, 2015, at 9:05 AM, Stefan Hajnoczi wrote:

> On Tue, Jan 6, 2015 at 3:04 PM, Programmingkid
> <programmingkidx@gmail.com> wrote:
>> 
>> On Jan 6, 2015, at 9:02 AM, Stefan Hajnoczi wrote:
>> 
>>> On Fri, Jan 02, 2015 at 04:44:38PM -0500, Programmingkid wrote:
>>>> Removes redundant ret variable and renames sectorSize variable to meet QEMU coding standards.
>>> 
>>> This is a changelog item for v4 of this patch.  Changelogs should go
>>> below the '---' line so they are not merged into git history.
>>> 
>>> The rationale is that when a patch is merged into git, the changelog
>>> describing patch revisions that were posted on the mailing list is not
>>> relevant (we only see the final patch in git, not the revisions from the
>>> mailing list).
>>> 
>>> Patches usually look like this:
>>> 
>>> Subject: block/raw-posix: brief summary
>>> 
>>> A longer description of the problem, maybe a command-line to reproduce a
>>> bug, and some rationale for this code change.
>>> 
>>> Signed-off-by: Me <my@email.com>
>>> ---
>>> v2:
>>> * Fix int -> size_t for memory lengths [Requested by Bob]
>>> 
>>> The changelog at the bottom is useful to code reviewers but won't get
>>> merged in the git history.
>>> 
>>> Anyway, thanks for this patch.  I have dropped this changelog line and
>>> merged it!
>>> 
>>>> 
>>>> Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
>>>> 
>>>> ---
>>>> block/raw-posix.c |   18 +++++++++++++++++-
>>>> configure         |    2 +-
>>>> 2 files changed, 18 insertions(+), 2 deletions(-)
>>> 
>>> Thanks, applied to my block tree:
>>> https://github.com/stefanha/qemu/commits/block
>>> 
>>> Stefan
>> 
>> Thank you very much for accepting my patch.
> 
> Hi,
> Unfortunately I had to drop this patch because it breaks -drive
> file=/dev/null,...
> 
> /dev/null is a character device and we should not return -ENOTSUP when
> the CD-ROM ioctls fail.
> 
> Please let it fail gracefully when the device is not a CD-ROM.
> 
> Stefan

What is the exact command you use with QEMU involving the /dev/null device?

What value is suppose to be returned when using a device like /dev/null?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD
  2015-01-13 17:52       ` Programmingkid
@ 2015-01-13 18:05         ` Peter Maydell
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-01-13 18:05 UTC (permalink / raw)
  To: Programmingkid; +Cc: Stefan Hajnoczi, qemu-devel qemu-devel

On 13 January 2015 at 17:52, Programmingkid <programmingkidx@gmail.com> wrote:
> What is the exact command you use with QEMU involving the /dev/null device?

"make check" includes some tests which do this...

> What value is suppose to be returned when using a device like /dev/null?

I think we should fall back to the "try lseek" code path, as we do on
Linux. (That will return zero, as it happens.)

-- PMM

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-13 18:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-02 21:44 [Qemu-devel] [PATCH v4] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD Programmingkid
2015-01-06 14:02 ` Stefan Hajnoczi
2015-01-06 15:04   ` Programmingkid
2015-01-13 14:05     ` Stefan Hajnoczi
2015-01-13 17:52       ` Programmingkid
2015-01-13 18:05         ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.