From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpweu-0007DT-Q4 for qemu-devel@nongnu.org; Fri, 30 Sep 2016 08:11:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpwep-0006O5-UW for qemu-devel@nongnu.org; Fri, 30 Sep 2016 08:11:20 -0400 From: Fam Zheng Date: Fri, 30 Sep 2016 20:09:39 +0800 Message-Id: <1475237406-26917-10-git-send-email-famz@redhat.com> In-Reply-To: <1475237406-26917-1-git-send-email-famz@redhat.com> References: <1475237406-26917-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v8 09/36] qemu-nbd: Add "--no-lock/-L" option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: berrange@redhat.com, John Snow , qemu-block@nongnu.org, Kevin Wolf , rjones@redhat.com, Jeff Cody , Max Reitz , Markus Armbruster , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com, eblake@redhat.com Signed-off-by: Fam Zheng Reviewed-by: Max Reitz --- 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 99297a5..6585b2c 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -102,6 +102,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" @@ -474,7 +475,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:T:"; + const char *sopt = "hVb:o:p:rsnLP:c:dvk:e:f:tl:x:T:"; struct option lopt[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -483,6 +484,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' }, @@ -638,6 +640,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 91ebf04..5936b37 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 -- 2.7.4