From patchwork Fri Apr 1 09:32:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bligh X-Patchwork-Id: 8722001 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1EA7C0553 for ; Fri, 1 Apr 2016 09:33:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1431120396 for ; Fri, 1 Apr 2016 09:33:06 +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 68AE420149 for ; Fri, 1 Apr 2016 09:33:05 +0000 (UTC) Received: from localhost ([::1]:42946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alvRw-0004nX-ST for patchwork-qemu-devel@patchwork.kernel.org; Fri, 01 Apr 2016 05:33:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alvRp-0004nO-QD for qemu-devel@nongnu.org; Fri, 01 Apr 2016 05:32:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alvRl-0002z7-Uw for qemu-devel@nongnu.org; Fri, 01 Apr 2016 05:32:57 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:53804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alvRl-0002z2-OL for qemu-devel@nongnu.org; Fri, 01 Apr 2016 05:32:53 -0400 Received: by mail.avalus.com (Postfix) with ESMTPSA id 9AB07C5607B; Fri, 1 Apr 2016 10:32:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alex.org.uk; s=mail; t=1459503172; bh=TWvTdem8HV1uDNr7kyjrdw6IrVmn6Wh8Ux5kmWYDPQ4=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=s8pZ1HVYYgDXJ+y+F6DLF7vPOsl1wqW/ToY7wKU6McqEUXnVd+tt8rD+/lc51CBjz Z/amf2LmAfA56ObScexj1aEjxervweIxYixn6svy1CPScUDOyrCgKS3UdLQYxIosBc TGP1wsK6g5MnNz+e/aKuUUm+Sz0eHpK5niMCmBIY= Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) From: Alex Bligh In-Reply-To: <20160401075933.GA25514@grep.be> Date: Fri, 1 Apr 2016 10:32:50 +0100 Message-Id: References: <1459448132-52364-1-git-send-email-alex@alex.org.uk> <20160401075933.GA25514@grep.be> To: Wouter Verhelst X-Mailer: Apple Mail (2.1878.6) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:41c8:10:1dd::10 Cc: "nbd-general@lists.sourceforge.net" , "qemu-devel@nongnu.org" , Alex Bligh Subject: Re: [Qemu-devel] [Nbd] [PATCH 2/2] Correct definition of NBD_CMD_FLAG_FUA 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 On 1 Apr 2016, at 08:59, Wouter Verhelst wrote: > On Thu, Mar 31, 2016 at 07:15:32PM +0100, Alex Bligh wrote: >> NBD_CMD_FLAG_FUA is defined as 1<<0 in the documentation, but >> 1<<16 in nbd.h. It is not used anywhere within the code. > > Yes it is: > > wouter@gangtai:~/code/c/nbd$ grep -rl CMD_FLAG_FUA * > doc/proto.md > make-integrityhuge.c > nbd.h > nbd-server.c > nbd-trdump.c > tests/run/nbd-tester-client.c > wouter@gangtai:~/code/c/nbd$ > > I don't mind bringing the code in sync with what the documentation says, > but it should not change behaviour ;-) Sorry - I think I must have done 'git grep' in the wrong directory or something. Ignore this patch and I'll redo it. I think probably the easiest fix is (beware, manually generated untested patch) as follows, which at least shows the reason for the discrepancy. diff --git a/nbd.h b/nbd.h index f2a32dd..53b6ca1 100644 --- a/nbd.h +++ b/nbd.h @@ -38,7 +38,9 @@ enum { }; #define NBD_CMD_MASK_COMMAND 0x0000ffff -#define NBD_CMD_FLAG_FUA (1<<16) +#define NBD_CMD_SHIFT (16) +#define NBD_CMD_FLAG_FUA ((1 << 0) << NBD_CMD_SHIFT) /* values for flags field */ #define NBD_FLAG_HAS_FLAGS (1 << 0) /* Flags are there */