diff mbox

[PATCHv2,2/2] Correct definition of NBD_CMD_FLAG_FUA

Message ID 1459507590-1191-2-git-send-email-alex@alex.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Bligh April 1, 2016, 10:46 a.m. UTC
NBD_CMD_FLAG_FUA is defined as 1<<0 in the documentation, but
1<<16 in nbd.h.

The code currently treats the command as a 32 bit quantity
and masks this off. This is confusing. Until such time as the
code is fixed up, make it obvious this isn't really bit 16.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
 nbd.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Blake April 1, 2016, 1:29 p.m. UTC | #1
On 04/01/2016 04:46 AM, Alex Bligh wrote:
> NBD_CMD_FLAG_FUA is defined as 1<<0 in the documentation, but
> 1<<16 in nbd.h.
> 
> The code currently treats the command as a 32 bit quantity
> and masks this off. This is confusing. Until such time as the
> code is fixed up, make it obvious this isn't really bit 16.
> 
> Signed-off-by: Alex Bligh <alex@alex.org.uk>
> ---
>  nbd.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/nbd.h b/nbd.h
index f2a32dd..732c605 100644
--- a/nbd.h
+++ b/nbd.h
@@ -38,7 +38,8 @@  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 */