using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class Kernel32 { /// Represents feature support for the an I/O ring API version. // https://docs.microsoft.com/en-us/windows/win32/api/ntioring_x/ne-ntioring_x-ioring_feature_flags typedef enum // IORING_FEATURE_FLAGS { IORING_FEATURE_FLAGS_NONE, IORING_FEATURE_UM_EMULATION, IORING_FEATURE_SET_COMPLETION_EVENT } ; [PInvokeData("ntioring_x.h", MSDNShortId = "NE:ntioring_x.IORING_FEATURE_FLAGS")] [Flags] public enum IORING_FEATURE_FLAGS { /// None. IORING_FEATURE_FLAGS_NONE = 0, /// /// I/O ring support is emulated in User Mode. When this flag is set there is no underlying kernel support for I/O ring. /// However, a user mode emulation layer is available to provide application compatibility, without the benefit of kernel /// support. This provides application compatibility at the expense of performance, allowing apps to make a choice at run-time. /// As of the current release, Microsoft does not provide an emulated I/O ring implementation. This value is provided to support /// potential emulated future emulated implementations. /// IORING_FEATURE_UM_EMULATION = 0x00000001, /// If this flag is present the IoRingSetCompletionEvent API is available and supported IORING_FEATURE_SET_COMPLETION_EVENT = 0x00000002, } /// Specifies the type of an I/O ring operation. // https://docs.microsoft.com/en-us/windows/win32/api/ntioring_x/ne-ntioring_x-ioring_op_code typedef enum IORING_OP_CODE { // IORING_OP_NOP, IORING_OP_READ, IORING_OP_REGISTER_FILES, IORING_OP_REGISTER_BUFFERS, IORING_OP_CANCEL } ; [PInvokeData("ntioring_x.h", MSDNShortId = "NE:ntioring_x.IORING_OP_CODE")] public enum IORING_OP_CODE { /// No operation. This value is provided to enable testing queue management and overhead performance./ IORING_OP_NOP, /// Read from a file to a buffer. IORING_OP_READ, /// /// Register an array of file handles with the I/O ring. /// /// If any existing registration exists, it is completely replaced by the registration for this opcode. Any entries in the array /// with INVALID_HANDLE_VALUE are sparse entries and are not used, which can be used to release one or more of the previously /// registered files. /// /// /// Unregistration of all current files is accomplished by providing a zero length array. The input array must remain valid /// until the operation completes. The change impacts all entries in the queue after this completes. I.e. This implicitly has /// "link" semantics in that any subsequent entry will not start until after this is completed. /// /// IORING_OP_REGISTER_FILES, /// /// Register an array of /// IORING_BUFFER_INFO /// with the IORING. /// /// If any existing registration exists, it is completely replaced by the registration for this opcode. Any entries in the array /// with INVALID_HANDLE_VALUE are sparse entries and are not used, which can be used to release one or more of the previously /// registered files. /// /// /// Unregistration of all current files is accomplished by providing a zero length array. The input array must remain valid /// until the operation completes. The change impacts all entries in the queue after this completes. I.e. This implicitly has /// "link" semantics in that any subsequent entry will not start until after this is completed. /// /// IORING_OP_REGISTER_BUFFERS, /// /// Request cancellation of a previously submitted operation. The /// UserData /// /// passed in when the operation was initiated is used to identify the operation to be cancelled. The cancellation operation /// completes after the canceled operation completes unless there is an error attempting the cancellation. For example, if no /// operation is found with the specified /// /// UserData /// . /// IORING_OP_CANCEL, } /// Specifies the I/O ring API version. // https://docs.microsoft.com/en-us/windows/win32/api/ntioring_x/ne-ntioring_x-ioring_version typedef enum IORING_VERSION { // IORING_VERSION_INVALID, IORING_VERSION_1 } ; [PInvokeData("ntioring_x.h", MSDNShortId = "NE:ntioring_x.IORING_VERSION")] public enum IORING_VERSION { /// Invalid version. IORING_VERSION_INVALID = 0, /// Version 1. IORING_VERSION_1, } /// Represents a data buffer that can be registered with an I/O ring. // https://docs.microsoft.com/en-us/windows/win32/api/ntioring_x/ns-ntioring_x-ioring_buffer_info typedef struct IORING_BUFFER_INFO // { void *Address; UINT32 Length; } IORING_BUFFER_INFO; [PInvokeData("ntioring_x.h", MSDNShortId = "NS:ntioring_x.IORING_BUFFER_INFO")] [StructLayout(LayoutKind.Sequential)] public struct IORING_BUFFER_INFO { /// A VOID pointer representing the address of the data buffer. public IntPtr Address; /// The length of the data buffer, in bytes. public uint Length; } /// Represents a buffer that has been registered with an I/O ring with a call to BuildIoRingRegisterBuffers. /// /// By using both a buffer index within the submission queue and an offset within the buffer, you can use large buffers and schedule /// multiple I/O ring operations within the same buffer to be performed asynchronously. /// // https://docs.microsoft.com/en-us/windows/win32/api/ntioring_x/ns-ntioring_x-ioring_registered_buffer typedef struct // IORING_REGISTERED_BUFFER { UINT32 BufferIndex; UINT32 Offset; } IORING_REGISTERED_BUFFER; [PInvokeData("ntioring_x.h", MSDNShortId = "NS:ntioring_x.IORING_REGISTERED_BUFFER")] [StructLayout(LayoutKind.Sequential)] public struct IORING_REGISTERED_BUFFER { /// A UINT32 specifying the index of the registered buffer. public uint BufferIndex; /// A UINT32 specifying the offset into the registered buffer. public uint Offset; } } }