* [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options
@ 2015-07-27 16:28 Programmingkid
2015-07-28 10:18 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Programmingkid @ 2015-07-27 16:28 UTC (permalink / raw)
To: Stefan Hajnoczi, Kevin Wolf; +Cc: qemu-devel qemu-devel, Qemu-block
[-- Attachment #1: Type: text/plain, Size: 2501 bytes --]
Add support for caching options that can be specified from
the command line.
Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
block/raw-posix.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index cbe6574..67d1d48 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1973,8 +1973,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;
@@ -2001,7 +2001,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;
@@ -2014,7 +2015,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;
@@ -2126,8 +2129,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.7.5.4
[-- Attachment #2: Type: text/html, Size: 11898 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options
2015-07-27 16:28 [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options Programmingkid
@ 2015-07-28 10:18 ` Stefan Hajnoczi
2015-07-28 15:26 ` Programmingkid
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2015-07-28 10:18 UTC (permalink / raw)
To: Programmingkid; +Cc: Kevin Wolf, qemu-devel qemu-devel, Qemu-block
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
On Mon, Jul 27, 2015 at 12:28:03PM -0400, Programmingkid wrote:
> Add support for caching options that can be specified from
> the command line.
Please squash this into the commit message when merging:
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.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options
2015-07-28 10:18 ` Stefan Hajnoczi
@ 2015-07-28 15:26 ` Programmingkid
2015-07-28 15:43 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Programmingkid @ 2015-07-28 15:26 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Kevin Wolf, qemu-devel qemu-devel, Qemu-block
On Jul 28, 2015, at 6:18 AM, Stefan Hajnoczi wrote:
> On Mon, Jul 27, 2015 at 12:28:03PM -0400, Programmingkid wrote:
>> Add support for caching options that can be specified from
>> the command line.
>
> Please squash this into the commit message when merging:
Is this message meant for Kevin Wolf?
>
> 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.
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options
2015-07-28 15:26 ` Programmingkid
@ 2015-07-28 15:43 ` Stefan Hajnoczi
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2015-07-28 15:43 UTC (permalink / raw)
To: Programmingkid; +Cc: Kevin Wolf, qemu-devel qemu-devel, Qemu-block
On Tue, Jul 28, 2015 at 4:26 PM, Programmingkid
<programmingkidx@gmail.com> wrote:
>
> On Jul 28, 2015, at 6:18 AM, Stefan Hajnoczi wrote:
>
>> On Mon, Jul 27, 2015 at 12:28:03PM -0400, Programmingkid wrote:
>>> Add support for caching options that can be specified from
>>> the command line.
>>
>> Please squash this into the commit message when merging:
>
> Is this message meant for Kevin Wolf?
Yes. He maintains block/raw-posix.c and will see the message when
reviewing this patch series.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-28 15:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 16:28 [Qemu-devel] [PATCH] raw-posix.c: Make GetBSDPath() handle caching options Programmingkid
2015-07-28 10:18 ` Stefan Hajnoczi
2015-07-28 15:26 ` Programmingkid
2015-07-28 15:43 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).