Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(synopsis "OCaml bindings for Linux io_uring")
(description "Bindings to the Linux io_uring kernel IO interfaces. See https://github.com/ocaml-multicore/eio for a higher-level API using this.")
(depends
(cstruct (>= 6.0.0))
(cstruct (>= 6.0.1))
(ocaml (>= 4.12.0))
dune-configurator
(lwt (and :with-test (>= 5.0.0)))
Expand Down
12 changes: 2 additions & 10 deletions tests/urcp_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ let queue_read uring t len =
let eagain = -11
let eintr = -4

let rec advance cs = function
| 0 -> cs
| n ->
match cs with
| [] -> failwith "Can't advance past end of vector!"
| c :: cs when n >= Cstruct.length c -> advance cs (n - Cstruct.length c)
| c :: cs -> Cstruct.shift c n :: cs

(* Check that a read has completely finished, and if not
* queue it up for completing the remaining amount *)
let handle_read_completion uring req res =
Expand All @@ -83,7 +75,7 @@ let handle_read_completion uring req res =
raise (Failure ("unix errorno " ^ (string_of_int n)))
| n when n < bytes_to_read ->
(* handle short read so new iovec and resubmit *)
req.iov.next <- advance req.iov.next n;
req.iov.next <- Cstruct.shiftv req.iov.next n;
req.off <- req.off + n;
let r = Uring.readv ~file_offset:(Int63.of_int req.off) uring req.t.infd req.iov.next req in
assert(r <> None);
Expand Down Expand Up @@ -112,7 +104,7 @@ let handle_write_completion uring req res =
Logs.debug (fun l -> l "requeued eintr read: %a" pp_req req);
| n when n < bytes_to_write ->
(* handle short write so new iovec and resubmit *)
req.iov.next <- advance req.iov.next n;
req.iov.next <- Cstruct.shiftv req.iov.next n;
req.off <- req.off + n;
let r = Uring.writev ~file_offset:req.fileoff uring req.t.infd req.iov.next req in
assert(r <> None);
Expand Down
2 changes: 1 addition & 1 deletion uring.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ homepage: "https://github.com/ocaml-multicore/ocaml-uring"
bug-reports: "https://github.com/ocaml-multicore/ocaml-uring/issues"
depends: [
"dune" {>= "2.7"}
"cstruct" {>= "6.0.0"}
"cstruct" {>= "6.0.1"}
"ocaml" {>= "4.12.0"}
"dune-configurator"
"lwt" {with-test & >= "5.0.0"}
Expand Down