-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4730 from edwintorok/private/edvint/vtpm-state-me…
…rged
- Loading branch information
Showing
21 changed files
with
343 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Uuidm = struct | ||
include Uuidm | ||
|
||
(** Validate UUIDs by converting them to Uuidm.t in the API *) | ||
let typ_of = | ||
Rpc.Types.Abstract | ||
{ | ||
aname= "uuid" | ||
; test_data= [Uuidm.v4_gen (Random.get_state ()) ()] | ||
; rpc_of= (fun t -> Rpc.String (Uuidm.to_string t)) | ||
; of_rpc= | ||
(function | ||
| Rpc.String s -> ( | ||
match Uuidm.of_string s with | ||
| Some uuid -> | ||
Ok uuid | ||
| None -> | ||
Error | ||
(`Msg | ||
(Printf.sprintf "typ_of_vm_uuid: not a valid UUID: %s" s) | ||
) | ||
) | ||
| r -> | ||
Error | ||
(`Msg | ||
(Printf.sprintf | ||
"typ_of_vm_uuid: expected rpc string but got %s" | ||
(Rpc.to_string r) | ||
) | ||
) | ||
) | ||
} | ||
|
||
let t_of_sexp sexp = | ||
match sexp |> Sexplib.Std.string_of_sexp |> Uuidm.of_string with | ||
| None -> | ||
Sexplib.Conv.of_sexp_error "not a UUID" sexp | ||
| Some u -> | ||
u | ||
|
||
let sexp_of_t t = t |> Uuidm.to_string |> Sexplib.Std.sexp_of_string | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Uuidm : sig | ||
type t = Uuidm.t | ||
|
||
include module type of Uuidm with type t := t | ||
|
||
val typ_of : t Rpc.Types.typ | ||
|
||
val t_of_sexp : Sexplib.Sexp.t -> t | ||
|
||
val sexp_of_t : t -> Sexplib.Sexp.t | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.