1 /* 2 * This header was generated from the Linux kernel headers by update_headers.py, 3 * to provide necessary information from kernel to userspace, such as constants, 4 * structures, and macros, and thus, contains no copyrightable information. 5 */ 6 #ifndef _UAPILINUX_NBD_H 7 #define _UAPILINUX_NBD_H 8 #include <linux/types.h> 9 #define NBD_SET_SOCK _IO( 0xab, 0 ) 10 #define NBD_SET_BLKSIZE _IO( 0xab, 1 ) 11 #define NBD_SET_SIZE _IO( 0xab, 2 ) 12 #define NBD_DO_IT _IO( 0xab, 3 ) 13 #define NBD_CLEAR_SOCK _IO( 0xab, 4 ) 14 #define NBD_CLEAR_QUE _IO( 0xab, 5 ) 15 #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) 16 #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) 17 #define NBD_DISCONNECT _IO( 0xab, 8 ) 18 #define NBD_SET_TIMEOUT _IO( 0xab, 9 ) 19 #define NBD_SET_FLAGS _IO( 0xab, 10) 20 enum { 21 NBD_CMD_READ = 0, 22 NBD_CMD_WRITE = 1, 23 NBD_CMD_DISC = 2, 24 NBD_CMD_FLUSH = 3, 25 NBD_CMD_TRIM = 4 26 }; 27 #define NBD_FLAG_HAS_FLAGS (1 << 0) 28 #define NBD_FLAG_READ_ONLY (1 << 1) 29 #define NBD_FLAG_SEND_FLUSH (1 << 2) 30 #define NBD_FLAG_SEND_FUA (1 << 3) 31 #define NBD_FLAG_SEND_TRIM (1 << 5) 32 #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) 33 #define NBD_CMD_FLAG_FUA (1 << 16) 34 #define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) 35 #define NBD_CFLAG_DISCONNECT_ON_CLOSE (1 << 1) 36 #define NBD_REQUEST_MAGIC 0x25609513 37 #define NBD_REPLY_MAGIC 0x67446698 38 struct nbd_request { 39 __be32 magic; 40 __be32 type; 41 char handle[8]; 42 __be64 from; 43 __be32 len; 44 } __attribute__((packed)); 45 struct nbd_reply { 46 __be32 magic; 47 __be32 error; 48 char handle[8]; 49 }; 50 #endif 51