From patchwork Sat Nov 21 00:17:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 547095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44630141486 for ; Sat, 21 Nov 2015 11:18:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=w/WErEHi; dkim-atps=neutral Received: from localhost ([::1]:50494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzvsW-0002sI-V7 for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2015 19:18:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzvsI-0002YY-QI for qemu-devel@nongnu.org; Fri, 20 Nov 2015 19:17:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzvsE-0003pe-PS for qemu-devel@nongnu.org; Fri, 20 Nov 2015 19:17:54 -0500 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:33383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzvsE-0003pa-KC; Fri, 20 Nov 2015 19:17:50 -0500 Received: by qgea14 with SMTP id a14so83642089qge.0; Fri, 20 Nov 2015 16:17:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:date:message-id :cc:to:mime-version; bh=ObbqW0w9lU2sXs+iyw+WJ3AUwnJgDvP215KjfnaeDTQ=; b=w/WErEHiyNa+SYxfejJ9837HBgAhmdBnR0mrIrW9M1nAJZLEfxcK5/+CfOZiPYve7p 8/x4vvr7XM9zR37oRVTrTzM8P1a7Si2fizh/k4YQVStJLmP5HTbbNzIFSzHcsPPpgBZ3 k9Kpmo2PbLcPuCmDSJKv7Y474bdBOGSb9YevXw9YtjOOV34/xNG9tpd3GqULQvoEOWrm Tzif02XMzLFxvEIBCHAsxPGMGhgGKe5kgkcbaoQKT09juYtfr02/eOnZG5zoDteUMoJC tzSr6SCELGLMW9RRKTiWAmJrZ18XM0wPfZbPtRqww9pvKZsWwdOQatINpdydzcEEuxIm 5buw== X-Received: by 10.140.174.68 with SMTP id u65mr17349348qhu.62.1448065069980; Fri, 20 Nov 2015 16:17:49 -0800 (PST) Received: from [192.168.0.3] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id 32sm459358qkp.11.2015.11.20.16.17.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Nov 2015 16:17:49 -0800 (PST) From: Programmingkid Date: Fri, 20 Nov 2015 19:17:48 -0500 Message-Id: <23A3628D-B4DF-428C-BDE3-FD13A1AF9B6B@gmail.com> To: Kevin Wolf , qemu-devel qemu-devel Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22c Cc: Qemu-block Subject: [Qemu-devel] [PATCH v2] raw-posix.c: Make GetBSDPath() handle caching options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add support for caching options that can be specified from the command line. Signed-off-by: John Arbuckle --- Only location of code has been changed. 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 aec9ec6..ccfec1c 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 */