diff --git a/device-usage/block/unikernel.ml b/device-usage/block/unikernel.ml index f1ff3458..e25b2b77 100644 --- a/device-usage/block/unikernel.ml +++ b/device-usage/block/unikernel.ml @@ -45,7 +45,7 @@ module Main (Time : Mirage_time.S) (B : Mirage_block.S) = struct let alloc sector_size n = let rec loop = function - | 0 -> [] + | n when (n<=0) -> [] | n -> let page = Io_page.(to_cstruct (get 1)) in let phrase = diff --git a/device-usage/console/unikernel.ml b/device-usage/console/unikernel.ml index 3dfa4652..2a2bd2c8 100644 --- a/device-usage/console/unikernel.ml +++ b/device-usage/console/unikernel.ml @@ -3,7 +3,7 @@ open Lwt.Infix module Main (C : Mirage_console.S) (Time : Mirage_time.S) = struct let start c _time = let rec loop = function - | 0 -> Lwt.return_unit + | n when (n<=0) -> Lwt.return_unit | n -> C.log c "hello" >>= fun () -> Time.sleep_ns (Duration.of_sec 1) >>= fun () -> diff --git a/tutorial/hello-key/unikernel.ml b/tutorial/hello-key/unikernel.ml index 48232798..8254485f 100644 --- a/tutorial/hello-key/unikernel.ml +++ b/tutorial/hello-key/unikernel.ml @@ -5,7 +5,7 @@ module Hello (Time : Mirage_time.S) = struct let hello = Key_gen.hello () in let rec loop = function - | 0 -> Lwt.return_unit + | n when (n<=0) -> Lwt.return_unit | n -> Logs.info (fun f -> f "%s" hello); Time.sleep_ns (Duration.of_sec 1) >>= fun () -> loop (n - 1) diff --git a/tutorial/hello/unikernel.ml b/tutorial/hello/unikernel.ml index cb9d8848..be74a55f 100644 --- a/tutorial/hello/unikernel.ml +++ b/tutorial/hello/unikernel.ml @@ -3,7 +3,7 @@ open Lwt.Infix module Hello (Time : Mirage_time.S) = struct let start _time = let rec loop = function - | 0 -> Lwt.return_unit + | n when (n<=0) -> Lwt.return_unit | n -> Logs.info (fun f -> f "hello"); Time.sleep_ns (Duration.of_sec 1) >>= fun () -> loop (n - 1) diff --git a/tutorial/lwt/echo_server/unikernel.ml b/tutorial/lwt/echo_server/unikernel.ml index a5a596a0..3183365d 100644 --- a/tutorial/lwt/echo_server/unikernel.ml +++ b/tutorial/lwt/echo_server/unikernel.ml @@ -13,7 +13,7 @@ struct let start c _time _r = let rec echo_server = function - | 0 -> Lwt.return () + | n when (n<=0) -> Lwt.return () | n -> read_line () >>= fun s -> C.log c s >>= fun () -> echo_server (n - 1)