[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 26/44] block/raw-posix.c: Fixes raw_getlength() on
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 26/44] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD |
Date: |
Mon, 12 Jan 2015 16:40:16 +0000 |
From: Programmingkid <address@hidden>
Signed-off-by: John Arbuckle <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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, §ors);
+ if (ret == -1) {
+ return -errno;
+ }
+
+ /* Query the size of each sector */
+ ret = ioctl(fd, DKIOCGETBLOCKSIZE, §or_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 7539645..b6cc73e 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.
--
2.1.0
- [Qemu-devel] [PULL v2 00/44] Block patches, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 32/44] qemu-thread: add per-thread atexit functions, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 33/44] test-coroutine: avoid overflow on 32-bit systems, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 34/44] QSLIST: add lock-free operations, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 35/44] coroutine: rewrite pool to avoid mutex, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 26/44] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 36/44] coroutine: drop qemu_coroutine_adjust_pool_size, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 25/44] libqos: Add virtio MMIO support, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 21/44] libqos: Change use of pointers to uint64_t in virtio, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 24/44] libqos: Add malloc generic, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 39/44] block: Split BLOCK_OP_TYPE_COMMIT to BLOCK_OP_TYPE_COMMIT_{SOURCE, TARGET}, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 20/44] libqos: Convert malloc-pc allocator to a generic allocator, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 23/44] libqos: Remove PCI assumptions in constants of virtio driver, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 38/44] block: limited request size in write zeroes unsupported path, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 37/44] coroutine: try harder not to delete coroutines, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 41/44] nvme: Fix get/set number of queues feature, Stefan Hajnoczi, 2015/01/12