Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file key.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150(*
* Copyright (c) 2015 Gabriel Radanne <drupyog@zoho.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)moduleAction=Functoria.ActionmoduleKey=Functoria.KeyopenAstringopenCmdliner(** {2 Documentation helper} *)letmirage_section="MIRAGE PARAMETERS"letunikernel_section="UNIKERNEL PARAMETERS"letpp_group=Fmt.(option~none:(any"the unikernel")@@fmt"the %s group")(** {2 Special keys} *)(** {3 Mode} *)typemode_unix=[`Unix|`MacOSX]typemode_xen=[`Xen|`Qubes]typemode_solo5=[`Hvt|`Spt|`Virtio|`Muen|`Genode]typemode=[mode_unix|mode_xen|mode_solo5]let(target_conv:modeCmdliner.Arg.conv),target_doc_alts=letenum=[("unix",`Unix);("macosx",`MacOSX);("xen",`Xen);("virtio",`Virtio);("hvt",`Hvt);("muen",`Muen);("qubes",`Qubes);("genode",`Genode);("spt",`Spt);]inletparser,printer=Cmdliner.Arg.enumenumin((parser,printer),Cmdliner.Arg.doc_alts_enumenum)letpp_targetfmtm=sndtarget_convfmtmletdefault_target=matchSys.getenv"MIRAGE_DEFAULT_TARGET"with|"unix"->`Unix|s->Fmt.failwith"invalid default target: %S"s|exceptionNot_found->(matchAction.run@@Action.run_cmd_outBos.Cmd.(v"uname"%"-s")with|Ok"Darwin"->`MacOSX|_->`Unix)lettarget=letdoc=Fmt.str"Target platform to compile the unikernel for. Valid values are: %s"target_doc_altsinletdoc=Arg.info~docs:mirage_section~docv:"TARGET"~doc["t";"target"]~env:(Cmd.Env.info"MODE")inletkey=Key.Arg.opttarget_convdefault_targetdocinKey.create"target"keyletis_unix=Key.match_Key.(valuetarget)@@function|#mode_unix->true|#mode_xen|#mode_solo5->falseletis_solo5=Key.match_Key.(valuetarget)@@function|#mode_solo5->true|#mode_xen|#mode_unix->falseletis_xen=Key.match_Key.(valuetarget)@@function|#mode_xen->true|#mode_solo5|#mode_unix->false(** {2 General mirage keys} *)letconfigure_key?(group="")~doc~defaultconvname=letprefix=ifgroup=""thengroupelsegroup^"-"inletdoc=Arg.info~docs:unikernel_section~docv:(String.Ascii.uppercasename)~doc[prefix^name]inletkey=Key.Arg.optconvdefaultdocinKey.create(prefix^name)key(** {3 File system keys} *)letkv_ro?group()=letenum=[("crunch",`Crunch);("direct",`Direct)]inletconv=Cmdliner.Arg.enumenuminletdoc=Fmt.str"Use %s pass-through implementation for %a."(Cmdliner.Arg.doc_alts_enumenum)pp_groupgroupinconfigure_key~doc?group~default:`Crunchconv"kv_ro"(** {3 Block device keys} *)letblock?group()=letenum=[("xenstore",`XenstoreId);("file",`BlockFile);("ramdisk",`Ramdisk)]inletconv=Arg.enumenuminletdoc=Fmt.str"Use %s pass-through implementation for %a."(Cmdliner.Arg.doc_alts_enumenum)pp_groupgroupinconfigure_key~doc?group~default:`Ramdiskconv"block"(** {3 Stack keys} *)letdhcp?group()=letdoc=Fmt.str"Enable dhcp for %a."pp_groupgroupinconfigure_key~doc?group~default:falseArg.bool"dhcp"letnet?group():[`Host|`OCaml]optionKey.key=letenum=[("host",`Host);("socket",`Host);("direct",`OCaml);("ocaml",`OCaml);]inletconv=Cmdliner.Arg.enumenuminletdoc=Fmt.str"Use %s group for %a."(Cmdliner.Arg.doc_alts_enumenum)pp_groupgroupinconfigure_key~doc?group~default:None(Arg.someconv)"net"includeKey