From d3941e70c64977a97740fd9163c8d7486a69d613 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Thu, 22 Mar 2018 13:36:50 +0100 Subject: [PATCH] style --- app/vmm_console.ml | 42 +++++++++++++-------------------- app/vmm_log.ml | 3 +-- provision/vmm_req_delegation.ml | 2 +- src/vmm_engine.ml | 6 ++--- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/app/vmm_console.ml b/app/vmm_console.ml index 5f2baa4..a357572 100644 --- a/app/vmm_console.ml +++ b/app/vmm_console.ml @@ -123,35 +123,27 @@ let handle s addr () = (if not (version_eq hdr.version my_version) then Lwt.return (Error (`Msg "ignoring data with bad version")) else - match Console.int_to_op hdr.tag with - | Some Add -> - (match decode_str data with - | Error e -> Lwt.return (Error e) - | Ok (name, _) -> add_fifo s name) - | Some Attach -> - (match decode_str data with - | Error e -> Lwt.return (Error e) - | Ok (name, _) -> attach name) - | Some Detach -> - (match decode_str data with - | Error e -> Lwt.return (Error e) - | Ok (name, _) -> detach name) - | Some History -> - (match decode_str data with - | Error e -> Lwt.return (Error e) - | Ok (name, off) -> match decode_ts ~off data with - | Error e -> Lwt.return (Error e) - | Ok since -> history s name since) - | _ -> - Lwt.return (Error (`Msg "unknown command"))) >>= (function + match decode_str data with + | Error e -> Lwt.return (Error e) + | Ok (name, off) -> + match Console.int_to_op hdr.tag with + | Some Add -> add_fifo s name + | Some Attach -> attach name + | Some Detach -> detach name + | Some History -> + (match decode_ts ~off data with + | Error e -> Lwt.return (Error e) + | Ok since -> history s name since) + | _ -> + Lwt.return (Error (`Msg "unknown command"))) >>= (function | Ok msg -> Vmm_lwt.write_raw s (success ~msg hdr.id my_version) | Error (`Msg msg) -> Logs.err (fun m -> m "error while processing command: %s" msg) ; Vmm_lwt.write_raw s (fail ~msg hdr.id my_version)) >>= function - | Ok () -> loop () - | Error _ -> - Logs.err (fun m -> m "exception while writing to socket") ; - Lwt.return_unit + | Ok () -> loop () + | Error _ -> + Logs.err (fun m -> m "exception while writing to socket") ; + Lwt.return_unit in loop () >>= fun () -> Lwt.catch (fun () -> Lwt_unix.close s) (fun _ -> Lwt.return_unit) diff --git a/app/vmm_log.ml b/app/vmm_log.ml index 48583b1..4bc3af8 100644 --- a/app/vmm_log.ml +++ b/app/vmm_log.ml @@ -85,8 +85,7 @@ let handle fd ring s addr () = in Ok (`Out out) end - | _ -> - Error (`Msg "unknown command")) + | _ -> Error (`Msg "unknown command")) in match out with | Error (`Msg msg) -> diff --git a/provision/vmm_req_delegation.ml b/provision/vmm_req_delegation.ml index f7b6677..0c5eb96 100644 --- a/provision/vmm_req_delegation.ml +++ b/provision/vmm_req_delegation.ml @@ -13,7 +13,7 @@ let subca_csr key name cpus mem vms block bridges = | Some x -> [ (false, `Unsupported (Oid.block, int_to_cstruct x)) ] and bridge = match bridges with | [] -> [] - | xs -> [ (false, `Unsupported (Oid.bridges, bridges_to_cstruct bridges)) ] + | xs -> [ (false, `Unsupported (Oid.bridges, bridges_to_cstruct xs)) ] in let exts = [ (false, `Unsupported (Oid.version, version_to_cstruct asn_version)) ; diff --git a/src/vmm_engine.ml b/src/vmm_engine.ml index 01985d0..f8c488e 100644 --- a/src/vmm_engine.ml +++ b/src/vmm_engine.ml @@ -345,7 +345,7 @@ let handle_revocation t s leaf chain ca prefix = | None -> Ok () | Some local -> match X509.CRL.crl_number local, X509.CRL.crl_number crl with | None, _ -> Ok () - | Some x, None -> Error (`Msg "CRL number not present") + | Some _, None -> Error (`Msg "CRL number not present") | Some x, Some y -> if y > x then Ok () else Error (`Msg "CRL number not increased")) >>= fun () -> (* filename should be whatever_dir / crls / *) let filename = Fpath.(t.dir / "crls" / string_of_id prefix) in @@ -355,7 +355,7 @@ let handle_revocation t s leaf chain ca prefix = let crls = match local with | None -> crl :: t.crls - | Some x -> crl :: List.filter (fun c -> c <> crl) t.crls + | Some _ -> crl :: List.filter (fun c -> c <> crl) t.crls in (* iterate over revoked serials, find active resources, and kill them *) let newly_revoked = @@ -508,7 +508,7 @@ let handle_log state hdr buf = state, [] end else match IM.find hdr.id state.log_requests with | exception Not_found -> - Logs.err (fun m -> m "coudn't find log request") ; + Logs.warn (fun m -> m "(ignored) coudn't find log request") ; (state, []) | (s, rid) -> let r = match int_to_op hdr.tag with