From patchwork Tue May 10 02:50:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 9053551 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 265F69F1C3 for ; Tue, 10 May 2016 02:57:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A43F2012B for ; Tue, 10 May 2016 02:57:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C87942009C for ; Tue, 10 May 2016 02:57:39 +0000 (UTC) Received: from localhost ([::1]:44127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxre-0003we-Vi for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 22:57:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxmR-0001tz-SJ for qemu-devel@nongnu.org; Mon, 09 May 2016 22:52:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azxmQ-0004om-C8 for qemu-devel@nongnu.org; Mon, 09 May 2016 22:52:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxmK-0004jU-D0; Mon, 09 May 2016 22:52:08 -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 D91C37F0B8; Tue, 10 May 2016 02:52:07 +0000 (UTC) Received: from ad.usersys.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4A2ovV3023061; Mon, 9 May 2016 22:52:04 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 10 May 2016 10:50:48 +0800 Message-Id: <1462848659-28659-17-git-send-email-famz@redhat.com> In-Reply-To: <1462848659-28659-1-git-send-email-famz@redhat.com> References: <1462848659-28659-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 10 May 2016 02:52:07 +0000 (UTC) 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 v4 16/27] 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, rjones@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Fam Zheng --- qemu-nbd.c | 7 ++++++- qemu-nbd.texi | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index c55b40f..a675a19 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -95,6 +95,7 @@ static void usage(const char *name) "Block device options:\n" " -f, --format=FORMAT set image format (raw, qcow2, ...)\n" " -r, --read-only export read-only\n" +" -L, --no-lock disable image locking\n" " -s, --snapshot use FILE as an external snapshot, create a temporary\n" " file with backing_file=FILE, redirect the write to\n" " the temporary one\n" @@ -464,7 +465,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 +474,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 +630,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