blob: 110220f3322948097df6372e45ebb01a1aefcb6c [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPILINUX_NBD_H
8#define _UAPILINUX_NBD_H
9#include <linux/types.h>
Tao Baod7db5942015-01-28 10:07:51 -080010#define NBD_SET_SOCK _IO(0xab, 0)
Tao Baod7db5942015-01-28 10:07:51 -080011#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 Baod7db5942015-01-28 10:07:51 -080015#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 Baod7db5942015-01-28 10:07:51 -080019#define NBD_SET_TIMEOUT _IO(0xab, 9)
20#define NBD_SET_FLAGS _IO(0xab, 10)
Ben Cheng655a7c02013-10-16 16:09:24 -070021enum {
Tao Baod7db5942015-01-28 10:07:51 -080022 NBD_CMD_READ = 0,
Tao Baod7db5942015-01-28 10:07:51 -080023 NBD_CMD_WRITE = 1,
24 NBD_CMD_DISC = 2,
25 NBD_CMD_FLUSH = 3,
Christopher Ferris65552ba2024-11-20 17:55:06 +000026 NBD_CMD_TRIM = 4,
27 NBD_CMD_WRITE_ZEROES = 6,
Ben Cheng655a7c02013-10-16 16:09:24 -070028};
29#define NBD_FLAG_HAS_FLAGS (1 << 0)
30#define NBD_FLAG_READ_ONLY (1 << 1)
31#define NBD_FLAG_SEND_FLUSH (1 << 2)
Christopher Ferris1308ad32017-11-14 17:32:13 -080032#define NBD_FLAG_SEND_FUA (1 << 3)
Christopher Ferris65552ba2024-11-20 17:55:06 +000033#define NBD_FLAG_ROTATIONAL (1 << 4)
Ben Cheng655a7c02013-10-16 16:09:24 -070034#define NBD_FLAG_SEND_TRIM (1 << 5)
Christopher Ferris65552ba2024-11-20 17:55:06 +000035#define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6)
Christopher Ferris48af7cb2017-02-21 12:35:09 -080036#define NBD_FLAG_CAN_MULTI_CONN (1 << 8)
Christopher Ferris1308ad32017-11-14 17:32:13 -080037#define NBD_CMD_FLAG_FUA (1 << 16)
Christopher Ferris65552ba2024-11-20 17:55:06 +000038#define NBD_CMD_FLAG_NO_HOLE (1 << 17)
Christopher Ferris525ce912017-07-26 13:12:53 -070039#define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0)
Christopher Ferrisa981e2e2018-10-25 12:11:39 -070040#define NBD_CFLAG_DISCONNECT_ON_CLOSE (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070041#define NBD_REQUEST_MAGIC 0x25609513
42#define NBD_REPLY_MAGIC 0x67446698
Christopher Ferris48af7cb2017-02-21 12:35:09 -080043struct nbd_request {
Tao Baod7db5942015-01-28 10:07:51 -080044 __be32 magic;
45 __be32 type;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070046 union {
47 __be64 cookie;
48 char handle[8];
49 };
Christopher Ferris48af7cb2017-02-21 12:35:09 -080050 __be64 from;
Tao Baod7db5942015-01-28 10:07:51 -080051 __be32 len;
Ben Cheng655a7c02013-10-16 16:09:24 -070052} __attribute__((packed));
53struct nbd_reply {
Christopher Ferris48af7cb2017-02-21 12:35:09 -080054 __be32 magic;
Tao Baod7db5942015-01-28 10:07:51 -080055 __be32 error;
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070056 union {
57 __be64 cookie;
58 char handle[8];
59 };
Ben Cheng655a7c02013-10-16 16:09:24 -070060};
Christopher Ferris48af7cb2017-02-21 12:35:09 -080061#endif