From patchwork Fri Apr 15 03:28:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 610737 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qmNYn2TMxz9t4b for ; Fri, 15 Apr 2016 13:38:53 +1000 (AEST) Received: from localhost ([::1]:52938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aquap-00089B-8N for incoming@patchwork.ozlabs.org; Thu, 14 Apr 2016 23:38:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aquR7-0004xt-5f for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:28:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aquR6-0003AO-8z for qemu-devel@nongnu.org; Thu, 14 Apr 2016 23:28:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aquR2-00039C-E1; Thu, 14 Apr 2016 23:28:44 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19876C062CE7; Fri, 15 Apr 2016 03:28:44 +0000 (UTC) Received: from lemon.nay.redhat.com (dhcp-14-170.nay.redhat.com [10.66.14.170]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3F3S2RU008188; Thu, 14 Apr 2016 23:28:41 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 15 Apr 2016 11:28:01 +0800 Message-Id: <1460690887-32751-12-git-send-email-famz@redhat.com> In-Reply-To: <1460690887-32751-1-git-send-email-famz@redhat.com> References: <1460690887-32751-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.7 v2 11/17] qemu-nbd: Add "--no-lock/-L" option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Jeff Cody , Markus Armbruster , Max Reitz , den@openvz.org, pbonzini@redhat.com, John Snow Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Fam Zheng --- qemu-nbd.c | 6 +++++- qemu-nbd.texi | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index b5751f8..37da7a9 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -464,7 +464,7 @@ int main(int argc, char **argv) off_t fd_size; QemuOpts *sn_opts = NULL; const char *sn_id_or_name = NULL; - const char *sopt = "hVb:o:p:rsnP:c:dvk:e:f:tl:x:"; + const char *sopt = "hVb:o:p:rsnLP:c:dvk:e:f:tl:x:"; struct option lopt[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -473,6 +473,7 @@ int main(int argc, char **argv) { "socket", required_argument, NULL, 'k' }, { "offset", required_argument, NULL, 'o' }, { "read-only", no_argument, NULL, 'r' }, + { "no-lock", no_argument, NULL, 'L' }, { "partition", required_argument, NULL, 'P' }, { "connect", required_argument, NULL, 'c' }, { "disconnect", no_argument, NULL, 'd' }, @@ -628,6 +629,9 @@ int main(int argc, char **argv) nbdflags |= NBD_FLAG_READ_ONLY; flags &= ~BDRV_O_RDWR; break; + case 'L': + flags |= BDRV_O_NO_LOCK; + break; case 'P': partition = strtol(optarg, &end, 0); if (*end) { diff --git a/qemu-nbd.texi b/qemu-nbd.texi index 9f23343..6b7b1d1 100644 --- a/qemu-nbd.texi +++ b/qemu-nbd.texi @@ -43,6 +43,8 @@ Force the use of the block driver for format @var{fmt} instead of auto-detecting @item -r, --read-only Export the disk as read-only +@item -L, --no-lock +Disable image locking @item -P, --partition=@var{num} Only expose partition @var{num} @item -s, --snapshot