[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/26] block/raw-posix.c: Fixes raw_getlength() on Ma
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 07/26] block/raw-posix.c: Fixes raw_getlength() on Mac OS X so that it reports the correct length of a real CD |
Date: |
Fri, 9 Jan 2015 10:16:47 +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 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.
--
2.1.0
- [Qemu-devel] [PULL 00/26] Block patches, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 02/26] libqos: Change use of pointers to uint64_t in virtio, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 01/26] libqos: Convert malloc-pc allocator to a generic allocator, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 03/26] tests: Prepare virtio-blk-test for multi-arch implementation, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 05/26] libqos: Add malloc generic, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 06/26] libqos: Add virtio MMIO support, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 04/26] libqos: Remove PCI assumptions in constants of virtio driver, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 09/26] qemu-iotests: Replace "/bin/true" with "true", Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 07/26] 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 10/26] qemu-iotests: Add "_supported_os Linux" to 058, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 08/26] .gitignore: Ignore generated "common.env", Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 11/26] tests/Makefile: Add check-block to make check on Linux, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 13/26] coroutine-ucontext: use __thread, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 12/26] qemu-iotests: Add supported os parameter for python tests, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 14/26] qemu-thread: add per-thread atexit functions, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 16/26] QSLIST: add lock-free operations, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 15/26] test-coroutine: avoid overflow on 32-bit systems, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 17/26] coroutine: rewrite pool to avoid mutex, Stefan Hajnoczi, 2015/01/09
- [Qemu-devel] [PULL 18/26] coroutine: drop qemu_coroutine_adjust_pool_size, Stefan Hajnoczi, 2015/01/09