|
23 | 23 |
|
24 | 24 | module Region = Region
|
25 | 25 |
|
| 26 | +(** Type of flags that can be combined. *) |
| 27 | +module type FLAGS = sig |
| 28 | + type t = private int |
| 29 | + (** A set of flags. *) |
| 30 | + |
| 31 | + val empty : t |
| 32 | + |
| 33 | + val of_int : int -> t |
| 34 | + |
| 35 | + val ( + ) : t -> t -> t |
| 36 | + (** [a + b] is the union of the sets. *) |
| 37 | + |
| 38 | + val mem : t -> t -> bool |
| 39 | + (** [mem x flags] is [true] iff [x] is a subset of [flags]. *) |
| 40 | +end |
| 41 | + |
| 42 | +(** Flags that can be passed to {!create}. *) |
| 43 | +module Setup_flags : sig |
| 44 | + include FLAGS |
| 45 | + |
| 46 | + val iopoll : t |
| 47 | + (** io_context is polled *) |
| 48 | + |
| 49 | + val clamp : t |
| 50 | + (** Clamp SQ/CQ ring sizes *) |
| 51 | + |
| 52 | + val r_disabled : t |
| 53 | + (** Start with ring disabled *) |
| 54 | + |
| 55 | + val submit_all : t |
| 56 | + (** Continue submit on error *) |
| 57 | + |
| 58 | + val coop_taskrun : t |
| 59 | + (** Cooperative task running *) |
| 60 | + |
| 61 | + val taskrun_flag : t |
| 62 | + (** Get notified if task work is available *) |
| 63 | + |
| 64 | + val sqe128 : t |
| 65 | + (** SQEs are 128 byte *) |
| 66 | + |
| 67 | + val cqe32 : t |
| 68 | + (** CQEs are 32 byte *) |
| 69 | + |
| 70 | + val single_issuer : t |
| 71 | + (** Only one task is allowed to submit requests *) |
| 72 | + |
| 73 | + val defer_taskrun : t |
| 74 | + (** Defer running task work to get events *) |
| 75 | +end |
| 76 | + |
26 | 77 | type 'a t
|
27 | 78 | (** ['a t] is a reference to an Io_uring structure. *)
|
28 | 79 |
|
29 | 80 | type 'a job
|
30 | 81 | (** A handle for a submitted job, which can be used to cancel it.
|
31 | 82 | If an operation returns [None], this means that submission failed because the ring is full. *)
|
32 | 83 |
|
33 |
| -val create : ?polling_timeout:int -> queue_depth:int -> unit -> 'a t |
| 84 | +val create : ?flags:Setup_flags.t -> ?polling_timeout:int -> queue_depth:int -> unit -> 'a t |
34 | 85 | (** [create ~queue_depth] will return a fresh Io_uring structure [t].
|
35 | 86 | Initially, [t] has no fixed buffer. Use {!set_fixed_buffer} if you want one.
|
36 | 87 | @param polling_timeout If given, use polling mode with the given idle timeout (in ms).
|
@@ -86,21 +137,6 @@ val timeout: ?absolute:bool -> 'a t -> clock -> int64 -> 'a -> 'a job option
|
86 | 137 |
|
87 | 138 | [ns] is the timeout time in nanoseconds *)
|
88 | 139 |
|
89 |
| -module type FLAGS = sig |
90 |
| - type t = private int |
91 |
| - (** A set of flags. *) |
92 |
| - |
93 |
| - val empty : t |
94 |
| - |
95 |
| - val of_int : int -> t |
96 |
| - |
97 |
| - val ( + ) : t -> t -> t |
98 |
| - (** [a + b] is the union of the sets. *) |
99 |
| - |
100 |
| - val mem : t -> t -> bool |
101 |
| - (** [mem x flags] is [true] iff [x] is a subset of [flags]. *) |
102 |
| -end |
103 |
| - |
104 | 140 | (** Flags that can be passed to {!openat2}. *)
|
105 | 141 | module Open_flags : sig
|
106 | 142 | include FLAGS
|
|
0 commit comments