xref: /illumos-gate/usr/src/test/nvme-tests/tests/libnvme/libnvme_test_common.h (revision cdd3e9a818787b4def17c9f707f435885ce0ed31)
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 _LIBNVME_TEST_COMMON_H
17 #define	_LIBNVME_TEST_COMMON_H
18 
19 #include <stdbool.h>
20 #include <libnvme.h>
21 #include <sys/ccompile.h>
22 
23 /*
24  * Common definitions and functions for the libnvme tests.
25  */
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define	NVME_TEST_DEV_ENVVAR	"NVME_TEST_DEVICE"
32 
33 extern void libnvme_test_init(nvme_t **, nvme_ctrl_t **);
34 
35 /*
36  * Warnings and fatal errors from the surrounding tests.
37  */
38 extern void libnvme_test_hdl_warn(nvme_t *, const char *,
39     ...) __PRINTFLIKE(2);
40 extern void libnvme_test_ctrl_warn(nvme_ctrl_t *, const char *,
41     ...) __PRINTFLIKE(2);
42 extern void libnvme_test_ctrl_info_warn(nvme_ctrl_info_t *, const char *,
43     ...) __PRINTFLIKE(2);
44 extern void libnvme_test_ns_info_warn(nvme_ns_info_t *, const char *,
45     ...) __PRINTFLIKE(2);
46 extern void libnvme_test_hdl_fatal(nvme_t *, const char *,
47     ...) __PRINTFLIKE(2) __NORETURN;
48 extern void libnvme_test_ctrl_fatal(nvme_ctrl_t *, const char *,
49     ...) __PRINTFLIKE(2) __NORETURN;
50 extern void libnvme_test_ctrl_info_fatal(nvme_ctrl_info_t *, const char *,
51     ...) __PRINTFLIKE(2) __NORETURN;
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif /* _LIBNVME_TEST_COMMON_H */
58