2013-08-30 10:58:08 +00:00
|
|
|
(* /etc/libvirt/virtlockd.conf *)
|
2013-08-08 15:06:31 +00:00
|
|
|
|
2013-08-30 10:58:08 +00:00
|
|
|
module Virtlockd =
|
2013-08-08 15:06:31 +00:00
|
|
|
autoload xfm
|
|
|
|
|
|
|
|
let eol = del /[ \t]*\n/ "\n"
|
|
|
|
let value_sep = del /[ \t]*=[ \t]*/ " = "
|
|
|
|
let indent = del /[ \t]*/ ""
|
|
|
|
|
|
|
|
let array_sep = del /,[ \t\n]*/ ", "
|
|
|
|
let array_start = del /\[[ \t\n]*/ "[ "
|
|
|
|
let array_end = del /\]/ "]"
|
|
|
|
|
|
|
|
let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
|
|
|
|
let bool_val = store /0|1/
|
|
|
|
let int_val = store /[0-9]+/
|
|
|
|
let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
|
|
|
|
let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end
|
|
|
|
|
|
|
|
let str_entry (kw:string) = [ key kw . value_sep . str_val ]
|
|
|
|
let bool_entry (kw:string) = [ key kw . value_sep . bool_val ]
|
|
|
|
let int_entry (kw:string) = [ key kw . value_sep . int_val ]
|
|
|
|
let str_array_entry (kw:string) = [ key kw . value_sep . str_array_val ]
|
|
|
|
|
|
|
|
|
|
|
|
(* Config entry grouped by function - same order as example config *)
|
|
|
|
let logging_entry = int_entry "log_level"
|
|
|
|
| str_entry "log_filters"
|
|
|
|
| str_entry "log_outputs"
|
2013-08-19 11:38:23 +00:00
|
|
|
| int_entry "max_clients"
|
2018-01-19 14:54:00 +00:00
|
|
|
| int_entry "admin_max_clients"
|
2013-08-08 15:06:31 +00:00
|
|
|
|
|
|
|
(* Each enty in the config is one of the following three ... *)
|
|
|
|
let entry = logging_entry
|
|
|
|
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
|
|
|
|
let empty = [ label "#empty" . eol ]
|
|
|
|
|
|
|
|
let record = indent . entry . eol
|
|
|
|
|
|
|
|
let lns = ( record | comment | empty ) *
|
|
|
|
|
|
|
|
let filter = incl "/etc/libvirt/virtlockd.conf"
|
|
|
|
. Util.stdexcl
|
|
|
|
|
|
|
|
let xfm = transform lns filter
|