Skip to content

Commit

Permalink
Merge pull request #52 from djs55/add-logs
Browse files Browse the repository at this point in the history
Strip deprecated prefixes from params keys
  • Loading branch information
djs55 committed Mar 13, 2016
2 parents 8fb54b9 + dc48bba commit b20cf9b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Library mirage_block_xen_front
Findlibparent: mirage_block_xen
Findlibname: front
Modules: Blkfront, Block
BuildDepends: logs, lwt, cstruct (>= 1.9.0), cstruct.ppx, mirage-types, io-page, shared-memory-ring, shared-memory-ring.lwt, mirage-block-xen, xen-evtchn, xen-gnt, mirage-xen
BuildDepends: logs, stringext, lwt, cstruct (>= 1.9.0), cstruct.ppx, mirage-types, io-page, shared-memory-ring, shared-memory-ring.lwt, mirage-block-xen, xen-evtchn, xen-gnt, mirage-xen

Library mirage_block_xen_back
CompiledObject: best
Expand Down
3 changes: 2 additions & 1 deletion _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 50d4d8749ab4144004adca089d05858e)
# DO NOT EDIT (digest: 78f30a8b3dcde264f25cc840846e2df5)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand All @@ -20,6 +20,7 @@ true: annot, bin_annot
"lib/mirage_block_xen_front.cmxs": use_mirage_block_xen_front
<lib/*.ml{,i,y}>: pkg_mirage-types
<lib/*.ml{,i,y}>: pkg_mirage-xen
<lib/*.ml{,i,y}>: pkg_stringext
# Library mirage_block_xen_back
"lib/mirage_block_xen_back.cmxs": use_mirage_block_xen_back
<lib/*.ml{,i,y}>: pkg_cstruct
Expand Down
4 changes: 2 additions & 2 deletions lib/META
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: ae86881c19cc0d4259f17e81d226f2ea)
# DO NOT EDIT (digest: 7864e0b6357db2edd217cdda08a0efb3)
version = "1.3.1"
description = "Xen block frontend and backend driver implementation"
requires = "cstruct cstruct.ppx"
Expand All @@ -12,7 +12,7 @@ package "front" (
version = "1.3.1"
description = "Xen block frontend and backend driver implementation"
requires =
"logs lwt cstruct cstruct.ppx mirage-types io-page shared-memory-ring shared-memory-ring.lwt mirage-block-xen xen-evtchn xen-gnt mirage-xen"
"logs stringext lwt cstruct cstruct.ppx mirage-types io-page shared-memory-ring shared-memory-ring.lwt mirage-block-xen xen-evtchn xen-gnt mirage-xen"
archive(byte) = "mirage_block_xen_front.cma"
archive(byte, plugin) = "mirage_block_xen_front.cma"
archive(native) = "mirage_block_xen_front.cmxa"
Expand Down
18 changes: 17 additions & 1 deletion lib/blkfront.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ let enumerate () =
return []
)

let deprecated_prefixes = [ "tapdisk"; "tap2"; "aio"; "ioemu"; "file"; "phy" ]

let strip_prefixes x =
Stringext.split x ~on:':'
|> List.fold_left (fun acc x -> match acc with
| [] ->
if List.mem x deprecated_prefixes
then []
else [ x ]
| xs -> x :: xs
) []
|> List.rev
|> String.concat ":"

(** Return a list of pairs [backend-params-key, frontend-id].
This is only intended to be a heuristic for 'connect' below. *)
let params_to_frontend_ids ids =
Expand All @@ -222,7 +236,9 @@ let params_to_frontend_ids ids =
>>= fun backend ->
Xs.(immediate xs (fun h -> read h (Printf.sprintf "%s/params" backend)))
>>= fun params ->
return ((params, id) :: list)
(* According to http://xenbits.xen.org/docs/4.6-testing/misc/xl-disk-configuration.txt
the params keys can have deprecated prefixes which should be stripped and ignored. *)
return ((strip_prefixes params, id) :: list)
) (function
| Xs_protocol.Enoent path ->
Log.warn (fun f -> f "Blkfront.params_to_frontend_ids: missing %s" path);
Expand Down
1 change: 1 addition & 0 deletions opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ depends: [
"ocamlfind"
"cmdliner"
"logs"
"stringext"
"lwt" {>= "2.4.3"}
"cstruct" {>= "1.9.0"}
"ppx_tools"
Expand Down
7 changes: 4 additions & 3 deletions setup.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.3.1 *)

(* OASIS_START *)
(* DO NOT EDIT (digest: 375c5ddc67ca489c87f052bb79c5cd6b) *)
(* DO NOT EDIT (digest: 9062ed4f0826702e47d1acc4d0fdc3ea) *)
(*
Regenerated by OASIS v0.4.5
Visit http://oasis.forge.ocamlcore.org for more information and
Expand Down Expand Up @@ -6776,6 +6776,7 @@ let setup_t =
bs_build_depends =
[
FindlibPackage ("logs", None);
FindlibPackage ("stringext", None);
FindlibPackage ("lwt", None);
FindlibPackage
("cstruct",
Expand Down Expand Up @@ -6861,14 +6862,14 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.5";
oasis_digest = Some "¨ZPÎ\031u\156Õ\000(ñsÄ}Z­";
oasis_digest = Some "Y\137\134`\003Ø\031\005\t8\152a­5f@";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
};;

let setup () = BaseSetup.setup setup_t;;

# 6873 "setup.ml"
# 6874 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;

0 comments on commit b20cf9b

Please sign in to comment.