xref: /spdk/lib/thread/thread_internal.h (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  */
3 
4 #ifndef SPDK_THREAD_INTERNAL_H_
5 #define SPDK_THREAD_INTERNAL_H_
6 
7 #include "spdk/assert.h"
8 #include "spdk/thread.h"
9 #include "spdk/tree.h"
10 
11 /**
12  * \brief Represents a per-thread channel for accessing an I/O device.
13  *
14  * An I/O device may be a physical entity (i.e. NVMe controller) or a software
15  *  entity (i.e. a blobstore).
16  *
17  * This structure is not part of the API - all accesses should be done through
18  *  spdk_io_channel function calls.
19  */
20 struct spdk_io_channel {
21 	struct spdk_thread		*thread;
22 	struct io_device		*dev;
23 	uint32_t			ref;
24 	uint32_t			destroy_ref;
25 	RB_ENTRY(spdk_io_channel)	node;
26 	spdk_io_channel_destroy_cb	destroy_cb;
27 
28 	uint8_t				_padding[40];
29 	/*
30 	 * Modules will allocate extra memory off the end of this structure
31 	 *  to store references to hardware-specific references (i.e. NVMe queue
32 	 *  pairs, or references to child device spdk_io_channels (i.e.
33 	 *  virtual bdevs).
34 	 */
35 };
36 
37 SPDK_STATIC_ASSERT(sizeof(struct spdk_io_channel) == SPDK_IO_CHANNEL_STRUCT_SIZE, "incorrect size");
38 
39 #endif /* SPDK_THREAD_INTERNAL_H_ */
40