From patchwork Fri Oct 5 18:07:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Bryant X-Patchwork-Id: 189557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 348A82C0040 for ; Sat, 6 Oct 2012 04:09:00 +1000 (EST) Received: from localhost ([::1]:50539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKY-0004HS-7Y for incoming@patchwork.ozlabs.org; Fri, 05 Oct 2012 14:08:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKP-0004G4-W1 for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKCKN-0004Se-PS for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:49 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:40835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKCKN-0004SM-JE for qemu-devel@nongnu.org; Fri, 05 Oct 2012 14:08:47 -0400 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Oct 2012 12:08:46 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Oct 2012 12:08:44 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 199EC3E40044 for ; Fri, 5 Oct 2012 12:08:40 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q95I8SwP079760 for ; Fri, 5 Oct 2012 12:08:30 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q95IA5mQ007111 for ; Fri, 5 Oct 2012 12:10:05 -0600 Received: from localhost ([9.80.102.135]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q95IA4b9007074; Fri, 5 Oct 2012 12:10:05 -0600 From: Corey Bryant To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2012 14:07:04 -0400 Message-Id: <1349460425-30601-4-git-send-email-coreyb@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> References: <1349460425-30601-1-git-send-email-coreyb@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12100518-5518-0000-0000-0000082D1DE5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.159 Cc: libvir-list@redhat.com, kwolf@redhat.com, Corey Bryant , eblake@redhat.com Subject: [Qemu-devel] [PATCH 3/4] qemu-config: Add -drive fd and opaque 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 These new options can be used for passing drive file descriptors on the command line, instead of using the file option to specify a file name. These new command line options mirror the existing add-fd QMP command which allows an fd to be passed to QEMU via SCM_RIGHTS and added to an fd set. The opaque option is also available with add-fd, and allows a free-form string to be stored in the fd set along with the fd. Signed-off-by: Corey Bryant --- qemu-config.c | 8 ++++++++ qemu-options.hx | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index cd1ec21..91053dd 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -114,6 +114,14 @@ static QemuOptsList qemu_drive_opts = { .name = "copy-on-read", .type = QEMU_OPT_BOOL, .help = "copy read data from backing file into image file", + },{ + .name = "fd", + .type = QEMU_OPT_NUMBER, + .help = "disk image file descriptor", + },{ + .name = "opaque", + .type = QEMU_OPT_STRING, + .help = "free-form string used to describe fd", }, { /* end of list */ } }, diff --git a/qemu-options.hx b/qemu-options.hx index 7d97f96..513530f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -149,7 +149,7 @@ using @file{/dev/cdrom} as filename (@pxref{host_drives}). ETEXI DEF("drive", HAS_ARG, QEMU_OPTION_drive, - "-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" + "-drive [file=file|fd=fd[,opaque=o]][,if=type][,bus=n][,unit=m][,media=d][,index=i]\n" " [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]\n" " [,cache=writethrough|writeback|none|directsync|unsafe][,format=f]\n" " [,serial=s][,addr=A][,id=name][,aio=threads|native]\n" @@ -170,6 +170,12 @@ this drive. If the filename contains comma, you must double it Special files such as iSCSI devices can be specified using protocol specific URLs. See the section for "Device URL Syntax" for more information. +@item fd=@var{fd} +This option defines which disk image (@pxref{disk_images}) file descriptor to +use with this drive. +@item opaque=@var{opaque} +This option defines a free-form string that describes @var{fd}. This is used +when storing @var{fd} in a file descriptor set. @item if=@var{interface} This option defines on which type on interface the drive is connected. Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio. @@ -257,12 +263,17 @@ qemu-system-i386 -drive file=file,index=2,media=disk qemu-system-i386 -drive file=file,index=3,media=disk @end example +You can open an image using a pre-opened file descriptor: +@example +qemu-system-i386 -drive fd=24,opaque="rdwr:/path/to/file",index=0,media=disk +@end example + You can connect a CDROM to the slave of ide0: @example qemu-system-i386 -drive file=file,if=ide,index=1,media=cdrom @end example -If you don't specify the "file=" argument, you define an empty drive: +If you don't specify the "file=" or "fd=" arguments, you define an empty drive: @example qemu-system-i386 -drive if=ide,index=1,media=cdrom @end example