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

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.