aboutsummaryrefslogtreecommitdiff
path: root/original/uapi/linux/nbd.h
diff options
context:
space:
mode:
Diffstat (limited to 'original/uapi/linux/nbd.h')
-rw-r--r--original/uapi/linux/nbd.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/original/uapi/linux/nbd.h b/original/uapi/linux/nbd.h
index 20d6cc9..80ce0ef 100644
--- a/original/uapi/linux/nbd.h
+++ b/original/uapi/linux/nbd.h
@@ -11,6 +11,8 @@
* Cleanup PARANOIA usage & code.
* 2004/02/19 Paul Clements
* Removed PARANOIA, plus various cleanup and comments
+ * 2023 Copyright Red Hat
+ * Link to userspace extensions, favor cookie over handle.
*/
#ifndef _UAPILINUX_NBD_H
@@ -30,12 +32,18 @@
#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
#define NBD_SET_FLAGS _IO( 0xab, 10)
+/*
+ * See also https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
+ * for additional userspace extensions not yet utilized in the kernel module.
+ */
+
enum {
NBD_CMD_READ = 0,
NBD_CMD_WRITE = 1,
NBD_CMD_DISC = 2,
NBD_CMD_FLUSH = 3,
NBD_CMD_TRIM = 4
+ /* userspace defines additional extension commands */
};
/* values for flags field, these are server interaction specific. */
@@ -64,15 +72,19 @@ enum {
#define NBD_REQUEST_MAGIC 0x25609513
#define NBD_REPLY_MAGIC 0x67446698
/* Do *not* use magics: 0x12560953 0x96744668. */
+/* magic 0x668e33ef for structured reply not supported by kernel yet */
/*
* This is the packet used for communication between client and
* server. All data are in network byte order.
*/
struct nbd_request {
- __be32 magic;
- __be32 type; /* == READ || == WRITE */
- char handle[8];
+ __be32 magic; /* NBD_REQUEST_MAGIC */
+ __be32 type; /* See NBD_CMD_* */
+ union {
+ __be64 cookie; /* Opaque identifier for request */
+ char handle[8]; /* older spelling of cookie */
+ };
__be64 from;
__be32 len;
} __attribute__((packed));
@@ -82,8 +94,11 @@ struct nbd_request {
* it has completed an I/O request (or an error occurs).
*/
struct nbd_reply {
- __be32 magic;
+ __be32 magic; /* NBD_REPLY_MAGIC */
__be32 error; /* 0 = ok, else error */
- char handle[8]; /* handle you got from request */
+ union {
+ __be64 cookie; /* Opaque identifier from request */
+ char handle[8]; /* older spelling of cookie */
+ };
};
#endif /* _UAPILINUX_NBD_H */