Implement upload and download commands.
[libguestfs.git] / ocaml / guestfs.mli
1 (* libguestfs generated file
2  * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3  * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
4  *
5  * Copyright (C) 2009 Red Hat Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *)
21
22 (** For API documentation you should refer to the C API
23     in the guestfs(3) manual page.  The OCaml API uses almost
24     exactly the same calls. *)
25
26 type t
27 (** A [guestfs_h] handle. *)
28
29 exception Error of string
30 (** This exception is raised when there is an error. *)
31
32 val create : unit -> t
33
34 val close : t -> unit
35 (** Handles are closed by the garbage collector when they become
36     unreferenced, but callers can also call this in order to
37     provide predictable cleanup. *)
38
39 type lvm_pv = {
40   pv_name : string;
41   pv_uuid : string;
42   pv_fmt : string;
43   pv_size : int64;
44   dev_size : int64;
45   pv_free : int64;
46   pv_used : int64;
47   pv_attr : string;
48   pv_pe_count : int64;
49   pv_pe_alloc_count : int64;
50   pv_tags : string;
51   pe_start : int64;
52   pv_mda_count : int64;
53   pv_mda_free : int64;
54 }
55
56 type lvm_vg = {
57   vg_name : string;
58   vg_uuid : string;
59   vg_fmt : string;
60   vg_attr : string;
61   vg_size : int64;
62   vg_free : int64;
63   vg_sysid : string;
64   vg_extent_size : int64;
65   vg_extent_count : int64;
66   vg_free_count : int64;
67   max_lv : int64;
68   max_pv : int64;
69   pv_count : int64;
70   lv_count : int64;
71   snap_count : int64;
72   vg_seqno : int64;
73   vg_tags : string;
74   vg_mda_count : int64;
75   vg_mda_free : int64;
76 }
77
78 type lvm_lv = {
79   lv_name : string;
80   lv_uuid : string;
81   lv_attr : string;
82   lv_major : int64;
83   lv_minor : int64;
84   lv_kernel_major : int64;
85   lv_kernel_minor : int64;
86   lv_size : int64;
87   seg_count : int64;
88   origin : string;
89   snap_percent : float option;
90   copy_percent : float option;
91   move_pv : string;
92   lv_tags : string;
93   mirror_log : string;
94   modules : string;
95 }
96
97 type stat = {
98   dev : int64;
99   ino : int64;
100   mode : int64;
101   nlink : int64;
102   uid : int64;
103   gid : int64;
104   rdev : int64;
105   size : int64;
106   blksize : int64;
107   blocks : int64;
108   atime : int64;
109   mtime : int64;
110   ctime : int64;
111 }
112
113 type statvfs = {
114   bsize : int64;
115   frsize : int64;
116   blocks : int64;
117   bfree : int64;
118   bavail : int64;
119   files : int64;
120   ffree : int64;
121   favail : int64;
122   fsid : int64;
123   flag : int64;
124   namemax : int64;
125 }
126
127 val launch : t -> unit
128 (** launch the qemu subprocess *)
129
130 val wait_ready : t -> unit
131 (** wait until the qemu subprocess launches *)
132
133 val kill_subprocess : t -> unit
134 (** kill the qemu subprocess *)
135
136 val add_drive : t -> string -> unit
137 (** add an image to examine or modify *)
138
139 val add_cdrom : t -> string -> unit
140 (** add a CD-ROM disk image to examine *)
141
142 val config : t -> string -> string option -> unit
143 (** add qemu parameters *)
144
145 val set_path : t -> string -> unit
146 (** set the search path *)
147
148 val get_path : t -> string
149 (** get the search path *)
150
151 val set_autosync : t -> bool -> unit
152 (** set autosync mode *)
153
154 val get_autosync : t -> bool
155 (** get autosync mode *)
156
157 val set_verbose : t -> bool -> unit
158 (** set verbose mode *)
159
160 val get_verbose : t -> bool
161 (** get verbose mode *)
162
163 val is_ready : t -> bool
164 (** is ready to accept commands *)
165
166 val is_config : t -> bool
167 (** is in configuration state *)
168
169 val is_launching : t -> bool
170 (** is launching subprocess *)
171
172 val is_busy : t -> bool
173 (** is busy processing a command *)
174
175 val get_state : t -> int
176 (** get the current state *)
177
178 val set_busy : t -> unit
179 (** set state to busy *)
180
181 val set_ready : t -> unit
182 (** set state to ready *)
183
184 val mount : t -> string -> string -> unit
185 (** mount a guest disk at a position in the filesystem *)
186
187 val sync : t -> unit
188 (** sync disks, writes are flushed through to the disk image *)
189
190 val touch : t -> string -> unit
191 (** update file timestamps or create a new file *)
192
193 val cat : t -> string -> string
194 (** list the contents of a file *)
195
196 val ll : t -> string -> string
197 (** list the files in a directory (long format) *)
198
199 val ls : t -> string -> string array
200 (** list the files in a directory *)
201
202 val list_devices : t -> string array
203 (** list the block devices *)
204
205 val list_partitions : t -> string array
206 (** list the partitions *)
207
208 val pvs : t -> string array
209 (** list the LVM physical volumes (PVs) *)
210
211 val vgs : t -> string array
212 (** list the LVM volume groups (VGs) *)
213
214 val lvs : t -> string array
215 (** list the LVM logical volumes (LVs) *)
216
217 val pvs_full : t -> lvm_pv array
218 (** list the LVM physical volumes (PVs) *)
219
220 val vgs_full : t -> lvm_vg array
221 (** list the LVM volume groups (VGs) *)
222
223 val lvs_full : t -> lvm_lv array
224 (** list the LVM logical volumes (LVs) *)
225
226 val read_lines : t -> string -> string array
227 (** read file as lines *)
228
229 val aug_init : t -> string -> int -> unit
230 (** create a new Augeas handle *)
231
232 val aug_close : t -> unit
233 (** close the current Augeas handle *)
234
235 val aug_defvar : t -> string -> string option -> int
236 (** define an Augeas variable *)
237
238 val aug_defnode : t -> string -> string -> string -> int * bool
239 (** define an Augeas node *)
240
241 val aug_get : t -> string -> string
242 (** look up the value of an Augeas path *)
243
244 val aug_set : t -> string -> string -> unit
245 (** set Augeas path to value *)
246
247 val aug_insert : t -> string -> string -> bool -> unit
248 (** insert a sibling Augeas node *)
249
250 val aug_rm : t -> string -> int
251 (** remove an Augeas path *)
252
253 val aug_mv : t -> string -> string -> unit
254 (** move Augeas node *)
255
256 val aug_match : t -> string -> string array
257 (** return Augeas nodes which match path *)
258
259 val aug_save : t -> unit
260 (** write all pending Augeas changes to disk *)
261
262 val aug_load : t -> unit
263 (** load files into the tree *)
264
265 val aug_ls : t -> string -> string array
266 (** list Augeas nodes under a path *)
267
268 val rm : t -> string -> unit
269 (** remove a file *)
270
271 val rmdir : t -> string -> unit
272 (** remove a directory *)
273
274 val rm_rf : t -> string -> unit
275 (** remove a file or directory recursively *)
276
277 val mkdir : t -> string -> unit
278 (** create a directory *)
279
280 val mkdir_p : t -> string -> unit
281 (** create a directory and parents *)
282
283 val chmod : t -> int -> string -> unit
284 (** change file mode *)
285
286 val chown : t -> int -> int -> string -> unit
287 (** change file owner and group *)
288
289 val exists : t -> string -> bool
290 (** test if file or directory exists *)
291
292 val is_file : t -> string -> bool
293 (** test if file exists *)
294
295 val is_dir : t -> string -> bool
296 (** test if file exists *)
297
298 val pvcreate : t -> string -> unit
299 (** create an LVM physical volume *)
300
301 val vgcreate : t -> string -> string array -> unit
302 (** create an LVM volume group *)
303
304 val lvcreate : t -> string -> string -> int -> unit
305 (** create an LVM volume group *)
306
307 val mkfs : t -> string -> string -> unit
308 (** make a filesystem *)
309
310 val sfdisk : t -> string -> int -> int -> int -> string array -> unit
311 (** create partitions on a block device *)
312
313 val write_file : t -> string -> string -> int -> unit
314 (** create a file *)
315
316 val umount : t -> string -> unit
317 (** unmount a filesystem *)
318
319 val mounts : t -> string array
320 (** show mounted filesystems *)
321
322 val umount_all : t -> unit
323 (** unmount all filesystems *)
324
325 val lvm_remove_all : t -> unit
326 (** remove all LVM LVs, VGs and PVs *)
327
328 val file : t -> string -> string
329 (** determine file type *)
330
331 val command : t -> string array -> string
332 (** run a command from the guest filesystem *)
333
334 val command_lines : t -> string array -> string array
335 (** run a command, returning lines *)
336
337 val stat : t -> string -> stat
338 (** get file information *)
339
340 val lstat : t -> string -> stat
341 (** get file information for a symbolic link *)
342
343 val statvfs : t -> string -> statvfs
344 (** get file system statistics *)
345
346 val tune2fs_l : t -> string -> (string * string) list
347 (** get ext2/ext3 superblock details *)
348
349 val blockdev_setro : t -> string -> unit
350 (** set block device to read-only *)
351
352 val blockdev_setrw : t -> string -> unit
353 (** set block device to read-write *)
354
355 val blockdev_getro : t -> string -> bool
356 (** is block device set to read-only *)
357
358 val blockdev_getss : t -> string -> int
359 (** get sectorsize of block device *)
360
361 val blockdev_getbsz : t -> string -> int
362 (** get blocksize of block device *)
363
364 val blockdev_setbsz : t -> string -> int -> unit
365 (** set blocksize of block device *)
366
367 val blockdev_getsz : t -> string -> int64
368 (** get total size of device in 512-byte sectors *)
369
370 val blockdev_getsize64 : t -> string -> int64
371 (** get total size of device in bytes *)
372
373 val blockdev_flushbufs : t -> string -> unit
374 (** flush device buffers *)
375
376 val blockdev_rereadpt : t -> string -> unit
377 (** reread partition table *)
378
379 val upload : t -> string -> string -> unit
380 (** upload a file from the local machine *)
381
382 val download : t -> string -> string -> unit
383 (** download a file to the local machine *)
384