1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef _APISET_IORING_
|
---|
8 | #define _APISET_IORING_
|
---|
9 |
|
---|
10 | #include <apiset.h>
|
---|
11 | #include <apisetcconv.h>
|
---|
12 | #include <minwindef.h>
|
---|
13 | #include <minwinbase.h>
|
---|
14 | #include <ntioring_x.h>
|
---|
15 |
|
---|
16 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
---|
17 | #if NTDDI_VERSION >= NTDDI_WIN10_CO
|
---|
18 |
|
---|
19 | DECLARE_HANDLE(HIORING);
|
---|
20 |
|
---|
21 | typedef enum IORING_SQE_FLAGS {
|
---|
22 | IOSQE_FLAGS_NONE = 0
|
---|
23 | } IORING_SQE_FLAGS;
|
---|
24 | DEFINE_ENUM_FLAG_OPERATORS(IORING_SQE_FLAGS)
|
---|
25 |
|
---|
26 | typedef enum IORING_CREATE_REQUIRED_FLAGS {
|
---|
27 | IORING_CREATE_REQUIRED_FLAGS_NONE = 0
|
---|
28 | } IORING_CREATE_REQUIRED_FLAGS;
|
---|
29 | DEFINE_ENUM_FLAG_OPERATORS(IORING_CREATE_REQUIRED_FLAGS)
|
---|
30 |
|
---|
31 | typedef enum IORING_CREATE_ADVISORY_FLAGS {
|
---|
32 | IORING_CREATE_ADVISORY_FLAGS_NONE = 0
|
---|
33 | } IORING_CREATE_ADVISORY_FLAGS;
|
---|
34 | DEFINE_ENUM_FLAG_OPERATORS(IORING_CREATE_ADVISORY_FLAGS)
|
---|
35 |
|
---|
36 | typedef struct IORING_CREATE_FLAGS {
|
---|
37 | IORING_CREATE_REQUIRED_FLAGS Required;
|
---|
38 | IORING_CREATE_ADVISORY_FLAGS Advisory;
|
---|
39 | } IORING_CREATE_FLAGS;
|
---|
40 |
|
---|
41 | typedef struct IORING_INFO {
|
---|
42 | IORING_VERSION IoRingVersion;
|
---|
43 | IORING_CREATE_FLAGS Flags;
|
---|
44 | UINT32 SubmissionQueueSize;
|
---|
45 | UINT32 CompletionQueueSize;
|
---|
46 | } IORING_INFO;
|
---|
47 |
|
---|
48 | typedef struct IORING_CAPABILITIES {
|
---|
49 | IORING_VERSION MaxVersion;
|
---|
50 | UINT32 MaxSubmissionQueueSize;
|
---|
51 | UINT32 MaxCompletionQueueSize;
|
---|
52 | IORING_FEATURE_FLAGS FeatureFlags;
|
---|
53 | } IORING_CAPABILITIES;
|
---|
54 |
|
---|
55 | typedef enum IORING_REF_KIND {
|
---|
56 | IORING_REF_RAW,
|
---|
57 | IORING_REF_REGISTERED
|
---|
58 | } IORING_REF_KIND;
|
---|
59 |
|
---|
60 | typedef struct IORING_HANDLE_REF {
|
---|
61 | #ifdef __cplusplus
|
---|
62 | explicit IORING_HANDLE_REF(HANDLE h) : Kind(IORING_REF_KIND::IORING_REF_RAW), Handle(h) {}
|
---|
63 | explicit IORING_HANDLE_REF(UINT32 index) : Kind(IORING_REF_KIND::IORING_REF_REGISTERED), Handle(index) {}
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | IORING_REF_KIND Kind;
|
---|
67 | union HandleUnion {
|
---|
68 | #ifdef __cplusplus
|
---|
69 | HandleUnion(HANDLE h) : Handle(h) {}
|
---|
70 | HandleUnion(UINT32 index) : Index(index) {}
|
---|
71 | #endif
|
---|
72 | HANDLE Handle;
|
---|
73 | UINT32 Index;
|
---|
74 | } Handle;
|
---|
75 | } IORING_HANDLE_REF;
|
---|
76 |
|
---|
77 | #ifdef __cplusplus
|
---|
78 | #define IoRingHandleRefFromHandle(h) IORING_HANDLE_REF(static_cast<HANDLE>(h))
|
---|
79 | #define IoRingHandleRefFromIndex(i) IORING_HANDLE_REF(static_cast<UINT32>(i))
|
---|
80 | #else
|
---|
81 | #define IoRingHandleRefFromHandle(h) {IORING_REF_RAW, {.Handle = h}}
|
---|
82 | #define IoRingHandleRefFromIndex(i) {IORING_REF_REGISTERED, {.Index = i}}
|
---|
83 | #endif
|
---|
84 |
|
---|
85 | typedef struct IORING_BUFFER_REF {
|
---|
86 | #ifdef __cplusplus
|
---|
87 | explicit IORING_BUFFER_REF(void* address) : Kind(IORING_REF_KIND::IORING_REF_RAW), Buffer(address) {}
|
---|
88 | explicit IORING_BUFFER_REF(IORING_REGISTERED_BUFFER registeredBuffer) : Kind(IORING_REF_KIND::IORING_REF_REGISTERED), Buffer(registeredBuffer) {}
|
---|
89 | IORING_BUFFER_REF(UINT32 index, UINT32 offset) : IORING_BUFFER_REF(IORING_REGISTERED_BUFFER{index, offset}) {}
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | IORING_REF_KIND Kind;
|
---|
93 | union BufferUnion {
|
---|
94 | #ifdef __cplusplus
|
---|
95 | BufferUnion(void* address) : Address(address) {}
|
---|
96 | BufferUnion(IORING_REGISTERED_BUFFER indexAndOffset) : IndexAndOffset(indexAndOffset) {}
|
---|
97 | #endif
|
---|
98 | void* Address;
|
---|
99 | IORING_REGISTERED_BUFFER IndexAndOffset;
|
---|
100 | }Buffer;
|
---|
101 | } IORING_BUFFER_REF;
|
---|
102 |
|
---|
103 | #ifdef __cplusplus
|
---|
104 | #define IoRingBufferRefFromPointer(p) IORING_BUFFER_REF(static_cast<void*>(p))
|
---|
105 | #define IoRingBufferRefFromIndexAndOffset(i,o) IORING_BUFFER_REF((i),(o))
|
---|
106 | #else
|
---|
107 | #define IoRingBufferRefFromPointer(p) {IORING_REF_RAW, {.Address = p}}
|
---|
108 | #define IoRingBufferRefFromIndexAndOffset(i,o) {IORING_REF_REGISTERED, {.IndexAndOffset = {(i),(o)}}}
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | typedef struct IORING_CQE {
|
---|
112 | UINT_PTR UserData;
|
---|
113 | HRESULT ResultCode;
|
---|
114 | ULONG_PTR Information;
|
---|
115 | } IORING_CQE;
|
---|
116 |
|
---|
117 | #ifdef __cplusplus
|
---|
118 | extern "C" {
|
---|
119 | #endif
|
---|
120 |
|
---|
121 | STDAPI QueryIoRingCapabilities(IORING_CAPABILITIES* capabilities);
|
---|
122 | STDAPI_(WINBOOL) IsIoRingOpSupported(HIORING ioRing, IORING_OP_CODE op);
|
---|
123 | STDAPI CreateIoRing(IORING_VERSION ioringVersion, IORING_CREATE_FLAGS flags, UINT32 submissionQueueSize, UINT32 completionQueueSize, HIORING* h);
|
---|
124 | STDAPI GetIoRingInfo(HIORING ioRing, IORING_INFO* info);
|
---|
125 | STDAPI SubmitIoRing(HIORING ioRing, UINT32 waitOperations, UINT32 milliseconds, UINT32* submittedEntries);
|
---|
126 | STDAPI CloseIoRing(HIORING ioRing);
|
---|
127 | STDAPI PopIoRingCompletion(HIORING ioRing, IORING_CQE* cqe);
|
---|
128 | STDAPI SetIoRingCompletionEvent(HIORING ioRing, HANDLE hEvent);
|
---|
129 | STDAPI BuildIoRingCancelRequest(HIORING ioRing, IORING_HANDLE_REF file, UINT_PTR opToCancel, UINT_PTR userData);
|
---|
130 | STDAPI BuildIoRingReadFile(HIORING ioRing, IORING_HANDLE_REF fileRef, IORING_BUFFER_REF dataRef, UINT32 numberOfBytesToRead, UINT64 fileOffset, UINT_PTR userData, IORING_SQE_FLAGS flags);
|
---|
131 | STDAPI BuildIoRingRegisterFileHandles(HIORING ioRing, UINT32 count, HANDLE const handles[], UINT_PTR userData);
|
---|
132 | STDAPI BuildIoRingRegisterBuffers(HIORING ioRing, UINT32 count, IORING_BUFFER_INFO const buffers[], UINT_PTR userData);
|
---|
133 |
|
---|
134 | #ifdef __cplusplus
|
---|
135 | }
|
---|
136 | #endif
|
---|
137 |
|
---|
138 | #endif /* NTDDI_WIN10_CO */
|
---|
139 | #endif /* WINAPI_PARTITION_APP */
|
---|
140 | #endif /* _APISET_IORING_ */
|
---|