[Nbd] [PATCH 2/5] move NBD_FLAGS from cliserv.h to nbd.h as they will be used in the kernel when we have the ioctl. Add NBD_CMD_FLUSH.
- To: nbd-general@lists.sourceforge.net
- Subject: [Nbd] [PATCH 2/5] move NBD_FLAGS from cliserv.h to nbd.h as they will be used in the kernel when we have the ioctl. Add NBD_CMD_FLUSH.
- From: Alex Bligh <alex@...872...>
- Date: Tue, 17 May 2011 13:34:52 +0100
- Message-id: <1305635695-24058-2-git-send-email-alex@...872...>
- In-reply-to: <1305635695-24058-1-git-send-email-alex@...872...>
- References: <1305635695-24058-1-git-send-email-alex@...872...>
Signed-off-by: Alex Bligh <alex@...872...>
---
cliserv.h | 4 ----
nbd.h | 14 +++++++++++++-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/cliserv.h b/cliserv.h
index 51c8bd1..b32626f 100644
--- a/cliserv.h
+++ b/cliserv.h
@@ -132,10 +132,6 @@ u64 ntohll(u64 a) {
#endif
#define htonll ntohll
-/* Flags used between the client and server */
-#define NBD_FLAG_HAS_FLAGS (1 << 0) /* Flags are there */
-#define NBD_FLAG_READ_ONLY (1 << 1) /* Device is read-only */
-
#define NBD_DEFAULT_PORT "10809" /* Port on which named exports are
* served */
diff --git a/nbd.h b/nbd.h
index 451f50c..875c215 100644
--- a/nbd.h
+++ b/nbd.h
@@ -27,13 +27,25 @@
#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
#define NBD_DISCONNECT _IO( 0xab, 8 )
#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
+#define NBD_SET_FLAGS _IO( 0xab, 10 )
enum {
NBD_CMD_READ = 0,
NBD_CMD_WRITE = 1,
- NBD_CMD_DISC = 2
+ NBD_CMD_DISC = 2,
+ NBD_CMD_FLUSH = 3
};
+#define NBD_CMD_MASK_COMMAND 0x0000ffff
+#define NBD_CMD_FLAG_FUA (1<<16)
+
+/* values for flags field */
+#define NBD_FLAG_HAS_FLAGS (1 << 0) /* Flags are there */
+#define NBD_FLAG_READ_ONLY (1 << 1) /* Device is read-only */
+#define NBD_FLAG_SEND_FLUSH (1 << 2) /* Send FLUSH */
+#define NBD_FLAG_SEND_FUA (1 << 3) /* Send FUA (Force Unit Access) */
+#define NBD_FLAG_ROTATIONAL (1 << 4) /* Use elevator algorithm - rotational media */
+
#define nbd_cmd(req) ((req)->cmd[0])
/* userspace doesn't need the nbd_device structure */
--
1.7.1
Reply to: