slave: Use slightly modified event_callback.
[guestfs-browser.git] / slave_utils.mli
1 (* Guestfs Browser.
2  * Copyright (C) 2010 Red Hat Inc.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *)
18
19 (** Helpers and utility functions used by the {!Slave} module. *)
20
21 val with_mount_ro : Guestfs.guestfs -> Slave_types.source -> (unit -> 'a) -> 'a
22   (** [with_mount_ro g source (fun () -> ...)] mounts [source]
23       read-only and calls the function.  It ensures that everything is
24       unmounted even if an exception is thrown.  *)
25
26 val get_ntfs_reparse_data : Guestfs.guestfs -> string -> string * string
27   (** This parses the NTFS "reparse data" (like a symlink) for the
28       given path, and returns a pair: the actual path, and the string
29       to display.
30
31       It can throw many different sorts of exception, so
32       callers should be prepared for that and able to turn
33       exceptions into a suitable error message. *)
34
35 val get_mounted_device : Guestfs.guestfs -> string -> string
36   (** [get_mounted_device g path] returns the device mounted on [path]
37       (where [path] can be any file or directory within the
38       device). *)
39
40 val get_filesystem_type : Guestfs.guestfs -> string -> string
41   (** [get_filesystem_type g path] returns the filesystem type of
42       the filesystem that contains [path]. *)
43
44 val lstatlist : Guestfs.guestfs -> string -> string array -> Guestfs.stat list
45   (** This is like {!Guestfs.lstatlist} but it splits the request up
46       into smaller chunks to avoid exceeding the protocol limit. *)
47
48 val readlinks : Guestfs.guestfs -> string -> string array -> Guestfs.stat array -> string list
49   (** This is like {!Guestfs.readlinklist} but: (1) It splits the
50       request up to avoid exceeding the protocol limit; and (2) it
51       resolves NTFS symbolic links using the NTFS reparse data, not
52       ntfs-3g. *)