aboutsummaryrefslogtreecommitdiff
path: root/include/sg_pt_nvme.h
blob: 646a3a10429297190e0cdff980a2db7f5e5c0b28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef SG_PT_NVME_H
#define SG_PT_NVME_H

/*
 * Copyright (c) 2017 Douglas Gilbert.
 * All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the BSD_LICENSE file.
 */

#include <stdint.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

/* structures copied and slightly modified from <linux/nvme_ioctl.h> which
 * is Copyright (c) 2011-2014, Intel Corporation.  */

struct sg_nvme_user_io {
	uint8_t	opcode;
	uint8_t	flags;
	uint16_t control;
	uint16_t nblocks;
	uint16_t rsvd;
	uint64_t metadata;
	uint64_t addr;
	uint64_t slba;
	uint32_t dsmgmt;
	uint32_t reftag;
	uint16_t apptag;
	uint16_t appmask;
#ifdef SG_LIB_FREEBSD
} __packed;
#else
};
#endif

struct sg_nvme_passthru_cmd {
	uint8_t	opcode;
	uint8_t	flags;
	uint16_t rsvd1;
	uint32_t nsid;
	uint32_t cdw2;
	uint32_t cdw3;
	uint64_t metadata;
	uint64_t addr;
	uint32_t metadata_len;
	uint32_t data_len;
	uint32_t cdw10;
	uint32_t cdw11;
	uint32_t cdw12;
	uint32_t cdw13;
	uint32_t cdw14;
	uint32_t cdw15;

	uint32_t timeout_ms;
	uint32_t result;
#ifdef SG_LIB_FREEBSD
} __packed;
#else
};
#endif

#ifdef __cplusplus
}
#endif

#endif