]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/linux-26-headers/include/linux/nbd.h
update
[l4.git] / l4 / pkg / linux-26-headers / include / linux / nbd.h
index 155719dab813e2fac8b52bc5a3ae3afdbcbbc8ce..e2c80255adbb6565afba8896f4cd07ae232a83d5 100644 (file)
 #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,
+       NBD_CMD_TRIM = 4
 };
 
-#define nbd_cmd(req) ((req)->cmd[0])
-
-/* userspace doesn't need the nbd_device structure */
-#ifdef __KERNEL__
-
-#include <linux/wait.h>
-#include <linux/mutex.h>
-
 /* values for flags field */
-#define NBD_READ_ONLY 0x0001
-#define NBD_WRITE_NOCHK 0x0002
-
-struct request;
+#define NBD_FLAG_HAS_FLAGS    (1 << 0) /* nbd-server supports flags */
+#define NBD_FLAG_READ_ONLY    (1 << 1) /* device is read-only */
+#define NBD_FLAG_SEND_FLUSH   (1 << 2) /* can flush writeback cache */
+/* there is a gap here to match userspace */
+#define NBD_FLAG_SEND_TRIM    (1 << 5) /* send trim/discard */
 
-struct nbd_device {
-       int flags;
-       int harderror;          /* Code of hard error                   */
-       struct socket * sock;
-       struct file * file;     /* If == NULL, device is not ready, yet */
-       int magic;
-
-       spinlock_t queue_lock;
-       struct list_head queue_head;    /* Requests waiting result */
-       struct request *active_req;
-       wait_queue_head_t active_wq;
-       struct list_head waiting_queue; /* Requests to be sent */
-       wait_queue_head_t waiting_wq;
-
-       struct mutex tx_lock;
-       struct gendisk *disk;
-       int blksize;
-       u64 bytesize;
-       pid_t pid; /* pid of nbd-client, if attached */
-       int xmit_timeout;
-};
+#define nbd_cmd(req) ((req)->cmd[0])
 
-#endif
+/* userspace doesn't need the nbd_device structure */
 
 /* These are sent over the network in the request/reply magic fields */
 
@@ -88,7 +64,7 @@ struct nbd_request {
        char handle[8];
        __be64 from;
        __be32 len;
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /*
  * This is the reply packet that nbd-server sends back to the client after
@@ -99,4 +75,4 @@ struct nbd_reply {
        __be32 error;           /* 0 = ok, else error   */
        char handle[8];         /* handle you got from request  */
 };
-#endif
+#endif /* LINUX_NBD_H */