| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 1 | /**************************************************************************** | 
|  | 2 | **************************************************************************** | 
|  | 3 | *** | 
|  | 4 | ***   This header was automatically generated from a Linux kernel header | 
|  | 5 | ***   of the same name, to make information necessary for userspace to | 
|  | 6 | ***   call into the kernel available to libc.  It contains only constants, | 
|  | 7 | ***   structures, and macros generated from the original header, and thus, | 
|  | 8 | ***   contains no copyrightable information. | 
|  | 9 | *** | 
|  | 10 | ***   To edit the content of this header, modify the corresponding | 
|  | 11 | ***   source file (e.g. under external/kernel-headers/original/) then | 
|  | 12 | ***   run bionic/libc/kernel/tools/update_all.py | 
|  | 13 | *** | 
|  | 14 | ***   Any manual change here will be lost the next time this script will | 
|  | 15 | ***   be run. You've been warned! | 
|  | 16 | *** | 
|  | 17 | **************************************************************************** | 
|  | 18 | ****************************************************************************/ | 
|  | 19 | #ifndef _UAPILINUX_NBD_H | 
|  | 20 | #define _UAPILINUX_NBD_H | 
|  | 21 | #include <linux/types.h> | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 22 | #define NBD_SET_SOCK _IO(0xab, 0) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | #define NBD_SET_BLKSIZE _IO(0xab, 1) | 
|  | 24 | #define NBD_SET_SIZE _IO(0xab, 2) | 
|  | 25 | #define NBD_DO_IT _IO(0xab, 3) | 
|  | 26 | #define NBD_CLEAR_SOCK _IO(0xab, 4) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 27 | #define NBD_CLEAR_QUE _IO(0xab, 5) | 
|  | 28 | #define NBD_PRINT_DEBUG _IO(0xab, 6) | 
|  | 29 | #define NBD_SET_SIZE_BLOCKS _IO(0xab, 7) | 
|  | 30 | #define NBD_DISCONNECT _IO(0xab, 8) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 31 | #define NBD_SET_TIMEOUT _IO(0xab, 9) | 
|  | 32 | #define NBD_SET_FLAGS _IO(0xab, 10) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 33 | enum { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 34 | NBD_CMD_READ = 0, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 35 | NBD_CMD_WRITE = 1, | 
|  | 36 | NBD_CMD_DISC = 2, | 
|  | 37 | NBD_CMD_FLUSH = 3, | 
|  | 38 | NBD_CMD_TRIM = 4 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | }; | 
|  | 40 | #define NBD_FLAG_HAS_FLAGS (1 << 0) | 
|  | 41 | #define NBD_FLAG_READ_ONLY (1 << 1) | 
|  | 42 | #define NBD_FLAG_SEND_FLUSH (1 << 2) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 43 | #define NBD_FLAG_SEND_FUA (1 << 3) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 44 | #define NBD_FLAG_SEND_TRIM (1 << 5) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 45 | #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 46 | #define NBD_CMD_FLAG_FUA (1 << 16) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 47 | #define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 48 | #define NBD_REQUEST_MAGIC 0x25609513 | 
|  | 49 | #define NBD_REPLY_MAGIC 0x67446698 | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 50 | struct nbd_request { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 | __be32 magic; | 
|  | 52 | __be32 type; | 
|  | 53 | char handle[8]; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 54 | __be64 from; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 55 | __be32 len; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 56 | } __attribute__((packed)); | 
|  | 57 | struct nbd_reply { | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 58 | __be32 magic; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 59 | __be32 error; | 
|  | 60 | char handle[8]; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 61 | }; | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 62 | #endif |