[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 4/6] raw-posix.c: Make GetBSDPath() handle caching op
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 4/6] raw-posix.c: Make GetBSDPath() handle caching options |
Date: |
Wed, 25 Nov 2015 15:10:22 +0100 |
From: Programmingkid <address@hidden>
Add support for caching options that can be specified from the command
line.
The CD-ROM raw char device bypasses the host page cache and therefore
has alignment requirements. Alignment probing is necessary so only use
the raw char device if BDRV_O_NOCACHE is set.
This patch fixes -cdrom /dev/cdrom on Mac OS X hosts, where bdrv_read()
used to fail due to misaligned requests during image format probing.
Signed-off-by: John Arbuckle <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/raw-posix.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index aec9ec6..d9162fd 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1976,8 +1976,8 @@ BlockDriver bdrv_file = {
#if defined(__APPLE__) && defined(__MACH__)
static kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator );
-static kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath,
CFIndex maxPathSize );
-
+static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
+ CFIndex maxPathSize, int flags);
kern_return_t FindEjectableCDMedia( io_iterator_t *mediaIterator )
{
kern_return_t kernResult;
@@ -2004,7 +2004,8 @@ kern_return_t FindEjectableCDMedia( io_iterator_t
*mediaIterator )
return kernResult;
}
-kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex
maxPathSize )
+kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
+ CFIndex maxPathSize, int flags)
{
io_object_t nextMedia;
kern_return_t kernResult = KERN_FAILURE;
@@ -2017,7 +2018,9 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator,
char *bsdPath, CFIndex ma
if ( bsdPathAsCFString ) {
size_t devPathLength;
strcpy( bsdPath, _PATH_DEV );
- strcat( bsdPath, "r" );
+ if (flags & BDRV_O_NOCACHE) {
+ strcat(bsdPath, "r");
+ }
devPathLength = strlen( bsdPath );
if ( CFStringGetCString( bsdPathAsCFString, bsdPath +
devPathLength, maxPathSize - devPathLength, kCFStringEncodingASCII ) ) {
kernResult = KERN_SUCCESS;
@@ -2129,8 +2132,8 @@ static int hdev_open(BlockDriverState *bs, QDict
*options, int flags,
int fd;
kernResult = FindEjectableCDMedia( &mediaIterator );
- kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) );
-
+ kernResult = GetBSDPath(mediaIterator, bsdPath, sizeof(bsdPath),
+ flags);
if ( bsdPath[ 0 ] != '\0' ) {
strcat(bsdPath,"s0");
/* some CDs don't have a partition 0 */
--
1.8.3.1
- [Qemu-block] [PULL 0/6] Block patches for 2.5.0-rc2, Kevin Wolf, 2015/11/25
- [Qemu-block] [PULL 2/6] test-aio: Fix event notifier cleanup, Kevin Wolf, 2015/11/25
- [Qemu-block] [PULL 4/6] raw-posix.c: Make GetBSDPath() handle caching options,
Kevin Wolf <=
- [Qemu-block] [PULL 3/6] nand: fix flash erase when oob is in memory, Kevin Wolf, 2015/11/25
- [Qemu-block] [PULL 5/6] block/qapi: Plug memory leak on query-block error path, Kevin Wolf, 2015/11/25
- [Qemu-block] [PULL 1/6] tests/Makefile: Add more dependencies for test-timed-average, Kevin Wolf, 2015/11/25
- [Qemu-block] [PULL 6/6] qemu-iotests: Add -nographic when starting QEMU in 119 and 120, Kevin Wolf, 2015/11/25
- Re: [Qemu-block] [Qemu-devel] [PULL 0/6] Block patches for 2.5.0-rc2, Peter Maydell, 2015/11/25