Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 7 | #ifndef _UAPILINUX_NBD_H |
| 8 | #define _UAPILINUX_NBD_H |
| 9 | #include <linux/types.h> |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 10 | #define NBD_SET_SOCK _IO(0xab, 0) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 11 | #define NBD_SET_BLKSIZE _IO(0xab, 1) |
| 12 | #define NBD_SET_SIZE _IO(0xab, 2) |
| 13 | #define NBD_DO_IT _IO(0xab, 3) |
| 14 | #define NBD_CLEAR_SOCK _IO(0xab, 4) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 15 | #define NBD_CLEAR_QUE _IO(0xab, 5) |
| 16 | #define NBD_PRINT_DEBUG _IO(0xab, 6) |
| 17 | #define NBD_SET_SIZE_BLOCKS _IO(0xab, 7) |
| 18 | #define NBD_DISCONNECT _IO(0xab, 8) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 19 | #define NBD_SET_TIMEOUT _IO(0xab, 9) |
| 20 | #define NBD_SET_FLAGS _IO(0xab, 10) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 21 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 22 | NBD_CMD_READ = 0, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | NBD_CMD_WRITE = 1, |
| 24 | NBD_CMD_DISC = 2, |
| 25 | NBD_CMD_FLUSH = 3, |
| 26 | NBD_CMD_TRIM = 4 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 27 | }; |
| 28 | #define NBD_FLAG_HAS_FLAGS (1 << 0) |
| 29 | #define NBD_FLAG_READ_ONLY (1 << 1) |
| 30 | #define NBD_FLAG_SEND_FLUSH (1 << 2) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 31 | #define NBD_FLAG_SEND_FUA (1 << 3) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 32 | #define NBD_FLAG_SEND_TRIM (1 << 5) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 33 | #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) |
Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 34 | #define NBD_CMD_FLAG_FUA (1 << 16) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 35 | #define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) |
Christopher Ferris | a981e2e | 2018-10-25 12:11:39 -0700 | [diff] [blame] | 36 | #define NBD_CFLAG_DISCONNECT_ON_CLOSE (1 << 1) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 37 | #define NBD_REQUEST_MAGIC 0x25609513 |
| 38 | #define NBD_REPLY_MAGIC 0x67446698 |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 39 | struct nbd_request { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 40 | __be32 magic; |
| 41 | __be32 type; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 42 | union { |
| 43 | __be64 cookie; |
| 44 | char handle[8]; |
| 45 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 46 | __be64 from; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 47 | __be32 len; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 48 | } __attribute__((packed)); |
| 49 | struct nbd_reply { |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 50 | __be32 magic; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 51 | __be32 error; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 52 | union { |
| 53 | __be64 cookie; |
| 54 | char handle[8]; |
| 55 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 56 | }; |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 57 | #endif |