Files
libguestfs/generator/events.ml
Richard W.M. Jones 457bdb4e2f common/mlstdutils: Drop our implementations of functions now in OCaml 4.01.
We reimplemented some functions which can now be found in the OCaml
stdlib since 4.01 (or earlier).  The functions I have dropped are:

 - String.map
 - |>
 - iteri  (replaced by List.iteri)
 - mapi   (replaced by List.mapi)

Note that our definition of iteri was slightly wrong: the type of the
function parameter was too wide, allowing (int -> 'a -> 'b) instead of
(int -> 'a -> unit).

I also added this new function to the Std_utils.String module as an
export from stdlib String:

 - String.iteri

Thanks: Pino Toscano
2017-10-05 11:32:54 +01:00

50 lines
1.8 KiB
OCaml

(* libguestfs
* Copyright (C) 2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
(* Please read generator/README first. *)
open Std_utils
open Utils
(* NB: DO NOT REORDER THESE, as doing so will change the ABI. Only
* add new event types at the end of the list.
*)
let events = [
"close"; (* close handle *)
"subprocess_quit"; (* subprocess quit *)
"launch_done"; (* launched *)
"progress"; (* progress message *)
(* log messages from various sources *)
"appliance"; (* log messages from
qemu / kernel / guestfsd / tools *)
"library"; (* log messages from library *)
"trace"; (* call trace messages *)
"enter"; (* enter a function *)
"libvirt_auth"; (* libvirt authentication request *)
"warning"; (* warnings from the library *)
]
let events = List.mapi (fun i name -> name, 1 lsl i) events
let all_events_bitmask = (1 lsl List.length events) - 1