1(* /etc/libvirt/qemu-lockd.conf *)
2
3module Libvirt_lockd =
4   autoload xfm
5
6   let eol   = del /[ \t]*\n/ "\n"
7   let value_sep   = del /[ \t]*=[ \t]*/  " = "
8   let indent = del /[ \t]*/ ""
9
10   let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
11   let bool_val = store /0|1/
12   let int_val = store /[0-9]+/
13
14   let str_entry       (kw:string) = [ key kw . value_sep . str_val ]
15   let bool_entry      (kw:string) = [ key kw . value_sep . bool_val ]
16   let int_entry       (kw:string) = [ key kw . value_sep . int_val ]
17
18
19   (* Each entry in the config is one of the following three ... *)
20   let entry = bool_entry "auto_disk_leases"
21             | bool_entry "require_lease_for_disks"
22             | str_entry "file_lockspace_dir"
23             | str_entry "lvm_lockspace_dir"
24             | str_entry "scsi_lockspace_dir"
25   let comment = [ label "#comment" . del /#[ \t]*/ "# " .  store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
26   let empty = [ label "#empty" . eol ]
27
28   let record = indent . entry . eol
29
30   let lns = ( record | comment | empty ) *
31
32   let filter = incl "/etc/libvirt/qemu-lockd.conf"
33              . Util.stdexcl
34
35   let xfm = transform lns filter
36