xref: /illumos-gate/usr/src/test/nvme-tests/tests/ioctl/nvme_ioctl_util.h (revision de27825976aef9b5a7b956ede505fc9bab8acfd2)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2024 Oxide Computer Company
14  */
15 
16 #ifndef _NVME_IOCTL_UTIL_H
17 #define	_NVME_IOCTL_UTIL_H
18 
19 #include <stdint.h>
20 #include <sys/stdbool.h>
21 #include <sys/nvme.h>
22 #include <thread.h>
23 
24 /*
25  * Common definitions and functions for the NVMe ioctl tests.
26  */
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define	NVME_TEST_DEV_ENVVAR	"NVME_TEST_DEVICE"
33 
34 /*
35  * Base locking structures to help facilitate locking tests.
36  */
37 extern const nvme_ioctl_lock_t nvme_test_ctrl_wrlock;
38 extern const nvme_ioctl_lock_t nvme_test_ctrl_rdlock;
39 extern const nvme_ioctl_lock_t nvme_test_ns_wrlock;
40 extern const nvme_ioctl_lock_t nvme_test_ns_rdlock;
41 extern const nvme_ioctl_unlock_t nvme_test_ctrl_unlock;
42 extern const nvme_ioctl_unlock_t nvme_test_ns_unlock;
43 
44 extern int nvme_ioctl_test_get_fd(uint32_t);
45 extern void nvme_ioctl_test_lock(int, const nvme_ioctl_lock_t *);
46 extern bool nvme_ioctl_test_thr_blocked(thread_t);
47 
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif /* _NVME_IOCTL_UTIL_H */
54