Generated code for ping-daemon command.
[libguestfs.git] / perl / Guestfs.xs
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 #include "EXTERN.h"
23 #include "perl.h"
24 #include "XSUB.h"
25
26 #include <guestfs.h>
27
28 #ifndef PRId64
29 #define PRId64 "lld"
30 #endif
31
32 static SV *
33 my_newSVll(long long val) {
34 #ifdef USE_64_BIT_ALL
35   return newSViv(val);
36 #else
37   char buf[100];
38   int len;
39   len = snprintf(buf, 100, "%" PRId64, val);
40   return newSVpv(buf, len);
41 #endif
42 }
43
44 #ifndef PRIu64
45 #define PRIu64 "llu"
46 #endif
47
48 static SV *
49 my_newSVull(unsigned long long val) {
50 #ifdef USE_64_BIT_ALL
51   return newSVuv(val);
52 #else
53   char buf[100];
54   int len;
55   len = snprintf(buf, 100, "%" PRIu64, val);
56   return newSVpv(buf, len);
57 #endif
58 }
59
60 /* http://www.perlmonks.org/?node_id=680842 */
61 static char **
62 XS_unpack_charPtrPtr (SV *arg) {
63   char **ret;
64   AV *av;
65   I32 i;
66
67   if (!arg || !SvOK (arg) || !SvROK (arg) || SvTYPE (SvRV (arg)) != SVt_PVAV)
68     croak ("array reference expected");
69
70   av = (AV *)SvRV (arg);
71   ret = malloc (av_len (av) + 1 + 1);
72   if (!ret)
73     croak ("malloc failed");
74
75   for (i = 0; i <= av_len (av); i++) {
76     SV **elem = av_fetch (av, i, 0);
77
78     if (!elem || !*elem)
79       croak ("missing element in list");
80
81     ret[i] = SvPV_nolen (*elem);
82   }
83
84   ret[i] = NULL;
85
86   return ret;
87 }
88
89 MODULE = Sys::Guestfs  PACKAGE = Sys::Guestfs
90
91 guestfs_h *
92 _create ()
93    CODE:
94       RETVAL = guestfs_create ();
95       if (!RETVAL)
96         croak ("could not create guestfs handle");
97       guestfs_set_error_handler (RETVAL, NULL, NULL);
98  OUTPUT:
99       RETVAL
100
101 void
102 DESTROY (g)
103       guestfs_h *g;
104  PPCODE:
105       guestfs_close (g);
106
107 void
108 launch (g)
109       guestfs_h *g;
110 PREINIT:
111       int r;
112  PPCODE:
113       r = guestfs_launch (g);
114       if (r == -1)
115         croak ("launch: %s", guestfs_last_error (g));
116
117 void
118 wait_ready (g)
119       guestfs_h *g;
120 PREINIT:
121       int r;
122  PPCODE:
123       r = guestfs_wait_ready (g);
124       if (r == -1)
125         croak ("wait_ready: %s", guestfs_last_error (g));
126
127 void
128 kill_subprocess (g)
129       guestfs_h *g;
130 PREINIT:
131       int r;
132  PPCODE:
133       r = guestfs_kill_subprocess (g);
134       if (r == -1)
135         croak ("kill_subprocess: %s", guestfs_last_error (g));
136
137 void
138 add_drive (g, filename)
139       guestfs_h *g;
140       char *filename;
141 PREINIT:
142       int r;
143  PPCODE:
144       r = guestfs_add_drive (g, filename);
145       if (r == -1)
146         croak ("add_drive: %s", guestfs_last_error (g));
147
148 void
149 add_cdrom (g, filename)
150       guestfs_h *g;
151       char *filename;
152 PREINIT:
153       int r;
154  PPCODE:
155       r = guestfs_add_cdrom (g, filename);
156       if (r == -1)
157         croak ("add_cdrom: %s", guestfs_last_error (g));
158
159 void
160 config (g, qemuparam, qemuvalue)
161       guestfs_h *g;
162       char *qemuparam;
163       char *qemuvalue;
164 PREINIT:
165       int r;
166  PPCODE:
167       r = guestfs_config (g, qemuparam, qemuvalue);
168       if (r == -1)
169         croak ("config: %s", guestfs_last_error (g));
170
171 void
172 set_qemu (g, qemu)
173       guestfs_h *g;
174       char *qemu;
175 PREINIT:
176       int r;
177  PPCODE:
178       r = guestfs_set_qemu (g, qemu);
179       if (r == -1)
180         croak ("set_qemu: %s", guestfs_last_error (g));
181
182 SV *
183 get_qemu (g)
184       guestfs_h *g;
185 PREINIT:
186       const char *qemu;
187    CODE:
188       qemu = guestfs_get_qemu (g);
189       if (qemu == NULL)
190         croak ("get_qemu: %s", guestfs_last_error (g));
191       RETVAL = newSVpv (qemu, 0);
192  OUTPUT:
193       RETVAL
194
195 void
196 set_path (g, path)
197       guestfs_h *g;
198       char *path;
199 PREINIT:
200       int r;
201  PPCODE:
202       r = guestfs_set_path (g, path);
203       if (r == -1)
204         croak ("set_path: %s", guestfs_last_error (g));
205
206 SV *
207 get_path (g)
208       guestfs_h *g;
209 PREINIT:
210       const char *path;
211    CODE:
212       path = guestfs_get_path (g);
213       if (path == NULL)
214         croak ("get_path: %s", guestfs_last_error (g));
215       RETVAL = newSVpv (path, 0);
216  OUTPUT:
217       RETVAL
218
219 void
220 set_autosync (g, autosync)
221       guestfs_h *g;
222       int autosync;
223 PREINIT:
224       int r;
225  PPCODE:
226       r = guestfs_set_autosync (g, autosync);
227       if (r == -1)
228         croak ("set_autosync: %s", guestfs_last_error (g));
229
230 SV *
231 get_autosync (g)
232       guestfs_h *g;
233 PREINIT:
234       int autosync;
235    CODE:
236       autosync = guestfs_get_autosync (g);
237       if (autosync == -1)
238         croak ("get_autosync: %s", guestfs_last_error (g));
239       RETVAL = newSViv (autosync);
240  OUTPUT:
241       RETVAL
242
243 void
244 set_verbose (g, verbose)
245       guestfs_h *g;
246       int verbose;
247 PREINIT:
248       int r;
249  PPCODE:
250       r = guestfs_set_verbose (g, verbose);
251       if (r == -1)
252         croak ("set_verbose: %s", guestfs_last_error (g));
253
254 SV *
255 get_verbose (g)
256       guestfs_h *g;
257 PREINIT:
258       int verbose;
259    CODE:
260       verbose = guestfs_get_verbose (g);
261       if (verbose == -1)
262         croak ("get_verbose: %s", guestfs_last_error (g));
263       RETVAL = newSViv (verbose);
264  OUTPUT:
265       RETVAL
266
267 SV *
268 is_ready (g)
269       guestfs_h *g;
270 PREINIT:
271       int ready;
272    CODE:
273       ready = guestfs_is_ready (g);
274       if (ready == -1)
275         croak ("is_ready: %s", guestfs_last_error (g));
276       RETVAL = newSViv (ready);
277  OUTPUT:
278       RETVAL
279
280 SV *
281 is_config (g)
282       guestfs_h *g;
283 PREINIT:
284       int config;
285    CODE:
286       config = guestfs_is_config (g);
287       if (config == -1)
288         croak ("is_config: %s", guestfs_last_error (g));
289       RETVAL = newSViv (config);
290  OUTPUT:
291       RETVAL
292
293 SV *
294 is_launching (g)
295       guestfs_h *g;
296 PREINIT:
297       int launching;
298    CODE:
299       launching = guestfs_is_launching (g);
300       if (launching == -1)
301         croak ("is_launching: %s", guestfs_last_error (g));
302       RETVAL = newSViv (launching);
303  OUTPUT:
304       RETVAL
305
306 SV *
307 is_busy (g)
308       guestfs_h *g;
309 PREINIT:
310       int busy;
311    CODE:
312       busy = guestfs_is_busy (g);
313       if (busy == -1)
314         croak ("is_busy: %s", guestfs_last_error (g));
315       RETVAL = newSViv (busy);
316  OUTPUT:
317       RETVAL
318
319 SV *
320 get_state (g)
321       guestfs_h *g;
322 PREINIT:
323       int state;
324    CODE:
325       state = guestfs_get_state (g);
326       if (state == -1)
327         croak ("get_state: %s", guestfs_last_error (g));
328       RETVAL = newSViv (state);
329  OUTPUT:
330       RETVAL
331
332 void
333 set_busy (g)
334       guestfs_h *g;
335 PREINIT:
336       int r;
337  PPCODE:
338       r = guestfs_set_busy (g);
339       if (r == -1)
340         croak ("set_busy: %s", guestfs_last_error (g));
341
342 void
343 set_ready (g)
344       guestfs_h *g;
345 PREINIT:
346       int r;
347  PPCODE:
348       r = guestfs_set_ready (g);
349       if (r == -1)
350         croak ("set_ready: %s", guestfs_last_error (g));
351
352 void
353 mount (g, device, mountpoint)
354       guestfs_h *g;
355       char *device;
356       char *mountpoint;
357 PREINIT:
358       int r;
359  PPCODE:
360       r = guestfs_mount (g, device, mountpoint);
361       if (r == -1)
362         croak ("mount: %s", guestfs_last_error (g));
363
364 void
365 sync (g)
366       guestfs_h *g;
367 PREINIT:
368       int r;
369  PPCODE:
370       r = guestfs_sync (g);
371       if (r == -1)
372         croak ("sync: %s", guestfs_last_error (g));
373
374 void
375 touch (g, path)
376       guestfs_h *g;
377       char *path;
378 PREINIT:
379       int r;
380  PPCODE:
381       r = guestfs_touch (g, path);
382       if (r == -1)
383         croak ("touch: %s", guestfs_last_error (g));
384
385 SV *
386 cat (g, path)
387       guestfs_h *g;
388       char *path;
389 PREINIT:
390       char *content;
391    CODE:
392       content = guestfs_cat (g, path);
393       if (content == NULL)
394         croak ("cat: %s", guestfs_last_error (g));
395       RETVAL = newSVpv (content, 0);
396       free (content);
397  OUTPUT:
398       RETVAL
399
400 SV *
401 ll (g, directory)
402       guestfs_h *g;
403       char *directory;
404 PREINIT:
405       char *listing;
406    CODE:
407       listing = guestfs_ll (g, directory);
408       if (listing == NULL)
409         croak ("ll: %s", guestfs_last_error (g));
410       RETVAL = newSVpv (listing, 0);
411       free (listing);
412  OUTPUT:
413       RETVAL
414
415 void
416 ls (g, directory)
417       guestfs_h *g;
418       char *directory;
419 PREINIT:
420       char **listing;
421       int i, n;
422  PPCODE:
423       listing = guestfs_ls (g, directory);
424       if (listing == NULL)
425         croak ("ls: %s", guestfs_last_error (g));
426       for (n = 0; listing[n] != NULL; ++n) /**/;
427       EXTEND (SP, n);
428       for (i = 0; i < n; ++i) {
429         PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
430         free (listing[i]);
431       }
432       free (listing);
433
434 void
435 list_devices (g)
436       guestfs_h *g;
437 PREINIT:
438       char **devices;
439       int i, n;
440  PPCODE:
441       devices = guestfs_list_devices (g);
442       if (devices == NULL)
443         croak ("list_devices: %s", guestfs_last_error (g));
444       for (n = 0; devices[n] != NULL; ++n) /**/;
445       EXTEND (SP, n);
446       for (i = 0; i < n; ++i) {
447         PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
448         free (devices[i]);
449       }
450       free (devices);
451
452 void
453 list_partitions (g)
454       guestfs_h *g;
455 PREINIT:
456       char **partitions;
457       int i, n;
458  PPCODE:
459       partitions = guestfs_list_partitions (g);
460       if (partitions == NULL)
461         croak ("list_partitions: %s", guestfs_last_error (g));
462       for (n = 0; partitions[n] != NULL; ++n) /**/;
463       EXTEND (SP, n);
464       for (i = 0; i < n; ++i) {
465         PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
466         free (partitions[i]);
467       }
468       free (partitions);
469
470 void
471 pvs (g)
472       guestfs_h *g;
473 PREINIT:
474       char **physvols;
475       int i, n;
476  PPCODE:
477       physvols = guestfs_pvs (g);
478       if (physvols == NULL)
479         croak ("pvs: %s", guestfs_last_error (g));
480       for (n = 0; physvols[n] != NULL; ++n) /**/;
481       EXTEND (SP, n);
482       for (i = 0; i < n; ++i) {
483         PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
484         free (physvols[i]);
485       }
486       free (physvols);
487
488 void
489 vgs (g)
490       guestfs_h *g;
491 PREINIT:
492       char **volgroups;
493       int i, n;
494  PPCODE:
495       volgroups = guestfs_vgs (g);
496       if (volgroups == NULL)
497         croak ("vgs: %s", guestfs_last_error (g));
498       for (n = 0; volgroups[n] != NULL; ++n) /**/;
499       EXTEND (SP, n);
500       for (i = 0; i < n; ++i) {
501         PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
502         free (volgroups[i]);
503       }
504       free (volgroups);
505
506 void
507 lvs (g)
508       guestfs_h *g;
509 PREINIT:
510       char **logvols;
511       int i, n;
512  PPCODE:
513       logvols = guestfs_lvs (g);
514       if (logvols == NULL)
515         croak ("lvs: %s", guestfs_last_error (g));
516       for (n = 0; logvols[n] != NULL; ++n) /**/;
517       EXTEND (SP, n);
518       for (i = 0; i < n; ++i) {
519         PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
520         free (logvols[i]);
521       }
522       free (logvols);
523
524 void
525 pvs_full (g)
526       guestfs_h *g;
527 PREINIT:
528       struct guestfs_lvm_pv_list *physvols;
529       int i;
530       HV *hv;
531  PPCODE:
532       physvols = guestfs_pvs_full (g);
533       if (physvols == NULL)
534         croak ("pvs_full: %s", guestfs_last_error (g));
535       EXTEND (SP, physvols->len);
536       for (i = 0; i < physvols->len; ++i) {
537         hv = newHV ();
538         (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
539         (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
540         (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
541         (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
542         (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
543         (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
544         (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
545         (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
546         (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
547         (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
548         (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
549         (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
550         (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
551         (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
552         PUSHs (sv_2mortal ((SV *) hv));
553       }
554       guestfs_free_lvm_pv_list (physvols);
555
556 void
557 vgs_full (g)
558       guestfs_h *g;
559 PREINIT:
560       struct guestfs_lvm_vg_list *volgroups;
561       int i;
562       HV *hv;
563  PPCODE:
564       volgroups = guestfs_vgs_full (g);
565       if (volgroups == NULL)
566         croak ("vgs_full: %s", guestfs_last_error (g));
567       EXTEND (SP, volgroups->len);
568       for (i = 0; i < volgroups->len; ++i) {
569         hv = newHV ();
570         (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
571         (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
572         (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
573         (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
574         (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
575         (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
576         (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
577         (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
578         (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
579         (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
580         (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
581         (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
582         (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
583         (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
584         (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
585         (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
586         (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
587         (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
588         (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
589         PUSHs (sv_2mortal ((SV *) hv));
590       }
591       guestfs_free_lvm_vg_list (volgroups);
592
593 void
594 lvs_full (g)
595       guestfs_h *g;
596 PREINIT:
597       struct guestfs_lvm_lv_list *logvols;
598       int i;
599       HV *hv;
600  PPCODE:
601       logvols = guestfs_lvs_full (g);
602       if (logvols == NULL)
603         croak ("lvs_full: %s", guestfs_last_error (g));
604       EXTEND (SP, logvols->len);
605       for (i = 0; i < logvols->len; ++i) {
606         hv = newHV ();
607         (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
608         (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
609         (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
610         (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
611         (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
612         (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
613         (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
614         (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
615         (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
616         (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
617         (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
618         (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
619         (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
620         (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
621         (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
622         (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
623         PUSHs (sv_2mortal ((SV *) hv));
624       }
625       guestfs_free_lvm_lv_list (logvols);
626
627 void
628 read_lines (g, path)
629       guestfs_h *g;
630       char *path;
631 PREINIT:
632       char **lines;
633       int i, n;
634  PPCODE:
635       lines = guestfs_read_lines (g, path);
636       if (lines == NULL)
637         croak ("read_lines: %s", guestfs_last_error (g));
638       for (n = 0; lines[n] != NULL; ++n) /**/;
639       EXTEND (SP, n);
640       for (i = 0; i < n; ++i) {
641         PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
642         free (lines[i]);
643       }
644       free (lines);
645
646 void
647 aug_init (g, root, flags)
648       guestfs_h *g;
649       char *root;
650       int flags;
651 PREINIT:
652       int r;
653  PPCODE:
654       r = guestfs_aug_init (g, root, flags);
655       if (r == -1)
656         croak ("aug_init: %s", guestfs_last_error (g));
657
658 void
659 aug_close (g)
660       guestfs_h *g;
661 PREINIT:
662       int r;
663  PPCODE:
664       r = guestfs_aug_close (g);
665       if (r == -1)
666         croak ("aug_close: %s", guestfs_last_error (g));
667
668 SV *
669 aug_defvar (g, name, expr)
670       guestfs_h *g;
671       char *name;
672       char *expr;
673 PREINIT:
674       int nrnodes;
675    CODE:
676       nrnodes = guestfs_aug_defvar (g, name, expr);
677       if (nrnodes == -1)
678         croak ("aug_defvar: %s", guestfs_last_error (g));
679       RETVAL = newSViv (nrnodes);
680  OUTPUT:
681       RETVAL
682
683 void
684 aug_defnode (g, name, expr, val)
685       guestfs_h *g;
686       char *name;
687       char *expr;
688       char *val;
689 PREINIT:
690       struct guestfs_int_bool *r;
691  PPCODE:
692       r = guestfs_aug_defnode (g, name, expr, val);
693       if (r == NULL)
694         croak ("aug_defnode: %s", guestfs_last_error (g));
695       EXTEND (SP, 2);
696       PUSHs (sv_2mortal (newSViv (r->i)));
697       PUSHs (sv_2mortal (newSViv (r->b)));
698       guestfs_free_int_bool (r);
699
700 SV *
701 aug_get (g, path)
702       guestfs_h *g;
703       char *path;
704 PREINIT:
705       char *val;
706    CODE:
707       val = guestfs_aug_get (g, path);
708       if (val == NULL)
709         croak ("aug_get: %s", guestfs_last_error (g));
710       RETVAL = newSVpv (val, 0);
711       free (val);
712  OUTPUT:
713       RETVAL
714
715 void
716 aug_set (g, path, val)
717       guestfs_h *g;
718       char *path;
719       char *val;
720 PREINIT:
721       int r;
722  PPCODE:
723       r = guestfs_aug_set (g, path, val);
724       if (r == -1)
725         croak ("aug_set: %s", guestfs_last_error (g));
726
727 void
728 aug_insert (g, path, label, before)
729       guestfs_h *g;
730       char *path;
731       char *label;
732       int before;
733 PREINIT:
734       int r;
735  PPCODE:
736       r = guestfs_aug_insert (g, path, label, before);
737       if (r == -1)
738         croak ("aug_insert: %s", guestfs_last_error (g));
739
740 SV *
741 aug_rm (g, path)
742       guestfs_h *g;
743       char *path;
744 PREINIT:
745       int nrnodes;
746    CODE:
747       nrnodes = guestfs_aug_rm (g, path);
748       if (nrnodes == -1)
749         croak ("aug_rm: %s", guestfs_last_error (g));
750       RETVAL = newSViv (nrnodes);
751  OUTPUT:
752       RETVAL
753
754 void
755 aug_mv (g, src, dest)
756       guestfs_h *g;
757       char *src;
758       char *dest;
759 PREINIT:
760       int r;
761  PPCODE:
762       r = guestfs_aug_mv (g, src, dest);
763       if (r == -1)
764         croak ("aug_mv: %s", guestfs_last_error (g));
765
766 void
767 aug_match (g, path)
768       guestfs_h *g;
769       char *path;
770 PREINIT:
771       char **matches;
772       int i, n;
773  PPCODE:
774       matches = guestfs_aug_match (g, path);
775       if (matches == NULL)
776         croak ("aug_match: %s", guestfs_last_error (g));
777       for (n = 0; matches[n] != NULL; ++n) /**/;
778       EXTEND (SP, n);
779       for (i = 0; i < n; ++i) {
780         PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
781         free (matches[i]);
782       }
783       free (matches);
784
785 void
786 aug_save (g)
787       guestfs_h *g;
788 PREINIT:
789       int r;
790  PPCODE:
791       r = guestfs_aug_save (g);
792       if (r == -1)
793         croak ("aug_save: %s", guestfs_last_error (g));
794
795 void
796 aug_load (g)
797       guestfs_h *g;
798 PREINIT:
799       int r;
800  PPCODE:
801       r = guestfs_aug_load (g);
802       if (r == -1)
803         croak ("aug_load: %s", guestfs_last_error (g));
804
805 void
806 aug_ls (g, path)
807       guestfs_h *g;
808       char *path;
809 PREINIT:
810       char **matches;
811       int i, n;
812  PPCODE:
813       matches = guestfs_aug_ls (g, path);
814       if (matches == NULL)
815         croak ("aug_ls: %s", guestfs_last_error (g));
816       for (n = 0; matches[n] != NULL; ++n) /**/;
817       EXTEND (SP, n);
818       for (i = 0; i < n; ++i) {
819         PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
820         free (matches[i]);
821       }
822       free (matches);
823
824 void
825 rm (g, path)
826       guestfs_h *g;
827       char *path;
828 PREINIT:
829       int r;
830  PPCODE:
831       r = guestfs_rm (g, path);
832       if (r == -1)
833         croak ("rm: %s", guestfs_last_error (g));
834
835 void
836 rmdir (g, path)
837       guestfs_h *g;
838       char *path;
839 PREINIT:
840       int r;
841  PPCODE:
842       r = guestfs_rmdir (g, path);
843       if (r == -1)
844         croak ("rmdir: %s", guestfs_last_error (g));
845
846 void
847 rm_rf (g, path)
848       guestfs_h *g;
849       char *path;
850 PREINIT:
851       int r;
852  PPCODE:
853       r = guestfs_rm_rf (g, path);
854       if (r == -1)
855         croak ("rm_rf: %s", guestfs_last_error (g));
856
857 void
858 mkdir (g, path)
859       guestfs_h *g;
860       char *path;
861 PREINIT:
862       int r;
863  PPCODE:
864       r = guestfs_mkdir (g, path);
865       if (r == -1)
866         croak ("mkdir: %s", guestfs_last_error (g));
867
868 void
869 mkdir_p (g, path)
870       guestfs_h *g;
871       char *path;
872 PREINIT:
873       int r;
874  PPCODE:
875       r = guestfs_mkdir_p (g, path);
876       if (r == -1)
877         croak ("mkdir_p: %s", guestfs_last_error (g));
878
879 void
880 chmod (g, mode, path)
881       guestfs_h *g;
882       int mode;
883       char *path;
884 PREINIT:
885       int r;
886  PPCODE:
887       r = guestfs_chmod (g, mode, path);
888       if (r == -1)
889         croak ("chmod: %s", guestfs_last_error (g));
890
891 void
892 chown (g, owner, group, path)
893       guestfs_h *g;
894       int owner;
895       int group;
896       char *path;
897 PREINIT:
898       int r;
899  PPCODE:
900       r = guestfs_chown (g, owner, group, path);
901       if (r == -1)
902         croak ("chown: %s", guestfs_last_error (g));
903
904 SV *
905 exists (g, path)
906       guestfs_h *g;
907       char *path;
908 PREINIT:
909       int existsflag;
910    CODE:
911       existsflag = guestfs_exists (g, path);
912       if (existsflag == -1)
913         croak ("exists: %s", guestfs_last_error (g));
914       RETVAL = newSViv (existsflag);
915  OUTPUT:
916       RETVAL
917
918 SV *
919 is_file (g, path)
920       guestfs_h *g;
921       char *path;
922 PREINIT:
923       int fileflag;
924    CODE:
925       fileflag = guestfs_is_file (g, path);
926       if (fileflag == -1)
927         croak ("is_file: %s", guestfs_last_error (g));
928       RETVAL = newSViv (fileflag);
929  OUTPUT:
930       RETVAL
931
932 SV *
933 is_dir (g, path)
934       guestfs_h *g;
935       char *path;
936 PREINIT:
937       int dirflag;
938    CODE:
939       dirflag = guestfs_is_dir (g, path);
940       if (dirflag == -1)
941         croak ("is_dir: %s", guestfs_last_error (g));
942       RETVAL = newSViv (dirflag);
943  OUTPUT:
944       RETVAL
945
946 void
947 pvcreate (g, device)
948       guestfs_h *g;
949       char *device;
950 PREINIT:
951       int r;
952  PPCODE:
953       r = guestfs_pvcreate (g, device);
954       if (r == -1)
955         croak ("pvcreate: %s", guestfs_last_error (g));
956
957 void
958 vgcreate (g, volgroup, physvols)
959       guestfs_h *g;
960       char *volgroup;
961       char **physvols;
962 PREINIT:
963       int r;
964  PPCODE:
965       r = guestfs_vgcreate (g, volgroup, physvols);
966       free (physvols);
967       if (r == -1)
968         croak ("vgcreate: %s", guestfs_last_error (g));
969
970 void
971 lvcreate (g, logvol, volgroup, mbytes)
972       guestfs_h *g;
973       char *logvol;
974       char *volgroup;
975       int mbytes;
976 PREINIT:
977       int r;
978  PPCODE:
979       r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
980       if (r == -1)
981         croak ("lvcreate: %s", guestfs_last_error (g));
982
983 void
984 mkfs (g, fstype, device)
985       guestfs_h *g;
986       char *fstype;
987       char *device;
988 PREINIT:
989       int r;
990  PPCODE:
991       r = guestfs_mkfs (g, fstype, device);
992       if (r == -1)
993         croak ("mkfs: %s", guestfs_last_error (g));
994
995 void
996 sfdisk (g, device, cyls, heads, sectors, lines)
997       guestfs_h *g;
998       char *device;
999       int cyls;
1000       int heads;
1001       int sectors;
1002       char **lines;
1003 PREINIT:
1004       int r;
1005  PPCODE:
1006       r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1007       free (lines);
1008       if (r == -1)
1009         croak ("sfdisk: %s", guestfs_last_error (g));
1010
1011 void
1012 write_file (g, path, content, size)
1013       guestfs_h *g;
1014       char *path;
1015       char *content;
1016       int size;
1017 PREINIT:
1018       int r;
1019  PPCODE:
1020       r = guestfs_write_file (g, path, content, size);
1021       if (r == -1)
1022         croak ("write_file: %s", guestfs_last_error (g));
1023
1024 void
1025 umount (g, pathordevice)
1026       guestfs_h *g;
1027       char *pathordevice;
1028 PREINIT:
1029       int r;
1030  PPCODE:
1031       r = guestfs_umount (g, pathordevice);
1032       if (r == -1)
1033         croak ("umount: %s", guestfs_last_error (g));
1034
1035 void
1036 mounts (g)
1037       guestfs_h *g;
1038 PREINIT:
1039       char **devices;
1040       int i, n;
1041  PPCODE:
1042       devices = guestfs_mounts (g);
1043       if (devices == NULL)
1044         croak ("mounts: %s", guestfs_last_error (g));
1045       for (n = 0; devices[n] != NULL; ++n) /**/;
1046       EXTEND (SP, n);
1047       for (i = 0; i < n; ++i) {
1048         PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1049         free (devices[i]);
1050       }
1051       free (devices);
1052
1053 void
1054 umount_all (g)
1055       guestfs_h *g;
1056 PREINIT:
1057       int r;
1058  PPCODE:
1059       r = guestfs_umount_all (g);
1060       if (r == -1)
1061         croak ("umount_all: %s", guestfs_last_error (g));
1062
1063 void
1064 lvm_remove_all (g)
1065       guestfs_h *g;
1066 PREINIT:
1067       int r;
1068  PPCODE:
1069       r = guestfs_lvm_remove_all (g);
1070       if (r == -1)
1071         croak ("lvm_remove_all: %s", guestfs_last_error (g));
1072
1073 SV *
1074 file (g, path)
1075       guestfs_h *g;
1076       char *path;
1077 PREINIT:
1078       char *description;
1079    CODE:
1080       description = guestfs_file (g, path);
1081       if (description == NULL)
1082         croak ("file: %s", guestfs_last_error (g));
1083       RETVAL = newSVpv (description, 0);
1084       free (description);
1085  OUTPUT:
1086       RETVAL
1087
1088 SV *
1089 command (g, arguments)
1090       guestfs_h *g;
1091       char **arguments;
1092 PREINIT:
1093       char *output;
1094    CODE:
1095       output = guestfs_command (g, arguments);
1096       free (arguments);
1097       if (output == NULL)
1098         croak ("command: %s", guestfs_last_error (g));
1099       RETVAL = newSVpv (output, 0);
1100       free (output);
1101  OUTPUT:
1102       RETVAL
1103
1104 void
1105 command_lines (g, arguments)
1106       guestfs_h *g;
1107       char **arguments;
1108 PREINIT:
1109       char **lines;
1110       int i, n;
1111  PPCODE:
1112       lines = guestfs_command_lines (g, arguments);
1113       free (arguments);
1114       if (lines == NULL)
1115         croak ("command_lines: %s", guestfs_last_error (g));
1116       for (n = 0; lines[n] != NULL; ++n) /**/;
1117       EXTEND (SP, n);
1118       for (i = 0; i < n; ++i) {
1119         PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1120         free (lines[i]);
1121       }
1122       free (lines);
1123
1124 void
1125 stat (g, path)
1126       guestfs_h *g;
1127       char *path;
1128 PREINIT:
1129       struct guestfs_stat *statbuf;
1130  PPCODE:
1131       statbuf = guestfs_stat (g, path);
1132       if (statbuf == NULL)
1133         croak ("stat: %s", guestfs_last_error (g));
1134       EXTEND (SP, 13);
1135       PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1136       PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1137       PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1138       PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1139       PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1140       PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1141       PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1142       PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1143       PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1144       PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1145       PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1146       PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1147       PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1148       free (statbuf);
1149
1150 void
1151 lstat (g, path)
1152       guestfs_h *g;
1153       char *path;
1154 PREINIT:
1155       struct guestfs_stat *statbuf;
1156  PPCODE:
1157       statbuf = guestfs_lstat (g, path);
1158       if (statbuf == NULL)
1159         croak ("lstat: %s", guestfs_last_error (g));
1160       EXTEND (SP, 13);
1161       PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1162       PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1163       PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1164       PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1165       PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1166       PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1167       PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1168       PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1169       PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1170       PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1171       PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1172       PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1173       PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1174       free (statbuf);
1175
1176 void
1177 statvfs (g, path)
1178       guestfs_h *g;
1179       char *path;
1180 PREINIT:
1181       struct guestfs_statvfs *statbuf;
1182  PPCODE:
1183       statbuf = guestfs_statvfs (g, path);
1184       if (statbuf == NULL)
1185         croak ("statvfs: %s", guestfs_last_error (g));
1186       EXTEND (SP, 11);
1187       PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1188       PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1189       PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1190       PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1191       PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1192       PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1193       PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1194       PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1195       PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1196       PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1197       PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1198       free (statbuf);
1199
1200 void
1201 tune2fs_l (g, device)
1202       guestfs_h *g;
1203       char *device;
1204 PREINIT:
1205       char **superblock;
1206       int i, n;
1207  PPCODE:
1208       superblock = guestfs_tune2fs_l (g, device);
1209       if (superblock == NULL)
1210         croak ("tune2fs_l: %s", guestfs_last_error (g));
1211       for (n = 0; superblock[n] != NULL; ++n) /**/;
1212       EXTEND (SP, n);
1213       for (i = 0; i < n; ++i) {
1214         PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1215         free (superblock[i]);
1216       }
1217       free (superblock);
1218
1219 void
1220 blockdev_setro (g, device)
1221       guestfs_h *g;
1222       char *device;
1223 PREINIT:
1224       int r;
1225  PPCODE:
1226       r = guestfs_blockdev_setro (g, device);
1227       if (r == -1)
1228         croak ("blockdev_setro: %s", guestfs_last_error (g));
1229
1230 void
1231 blockdev_setrw (g, device)
1232       guestfs_h *g;
1233       char *device;
1234 PREINIT:
1235       int r;
1236  PPCODE:
1237       r = guestfs_blockdev_setrw (g, device);
1238       if (r == -1)
1239         croak ("blockdev_setrw: %s", guestfs_last_error (g));
1240
1241 SV *
1242 blockdev_getro (g, device)
1243       guestfs_h *g;
1244       char *device;
1245 PREINIT:
1246       int ro;
1247    CODE:
1248       ro = guestfs_blockdev_getro (g, device);
1249       if (ro == -1)
1250         croak ("blockdev_getro: %s", guestfs_last_error (g));
1251       RETVAL = newSViv (ro);
1252  OUTPUT:
1253       RETVAL
1254
1255 SV *
1256 blockdev_getss (g, device)
1257       guestfs_h *g;
1258       char *device;
1259 PREINIT:
1260       int sectorsize;
1261    CODE:
1262       sectorsize = guestfs_blockdev_getss (g, device);
1263       if (sectorsize == -1)
1264         croak ("blockdev_getss: %s", guestfs_last_error (g));
1265       RETVAL = newSViv (sectorsize);
1266  OUTPUT:
1267       RETVAL
1268
1269 SV *
1270 blockdev_getbsz (g, device)
1271       guestfs_h *g;
1272       char *device;
1273 PREINIT:
1274       int blocksize;
1275    CODE:
1276       blocksize = guestfs_blockdev_getbsz (g, device);
1277       if (blocksize == -1)
1278         croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1279       RETVAL = newSViv (blocksize);
1280  OUTPUT:
1281       RETVAL
1282
1283 void
1284 blockdev_setbsz (g, device, blocksize)
1285       guestfs_h *g;
1286       char *device;
1287       int blocksize;
1288 PREINIT:
1289       int r;
1290  PPCODE:
1291       r = guestfs_blockdev_setbsz (g, device, blocksize);
1292       if (r == -1)
1293         croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1294
1295 SV *
1296 blockdev_getsz (g, device)
1297       guestfs_h *g;
1298       char *device;
1299 PREINIT:
1300       int64_t sizeinsectors;
1301    CODE:
1302       sizeinsectors = guestfs_blockdev_getsz (g, device);
1303       if (sizeinsectors == -1)
1304         croak ("blockdev_getsz: %s", guestfs_last_error (g));
1305       RETVAL = my_newSVll (sizeinsectors);
1306  OUTPUT:
1307       RETVAL
1308
1309 SV *
1310 blockdev_getsize64 (g, device)
1311       guestfs_h *g;
1312       char *device;
1313 PREINIT:
1314       int64_t sizeinbytes;
1315    CODE:
1316       sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1317       if (sizeinbytes == -1)
1318         croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1319       RETVAL = my_newSVll (sizeinbytes);
1320  OUTPUT:
1321       RETVAL
1322
1323 void
1324 blockdev_flushbufs (g, device)
1325       guestfs_h *g;
1326       char *device;
1327 PREINIT:
1328       int r;
1329  PPCODE:
1330       r = guestfs_blockdev_flushbufs (g, device);
1331       if (r == -1)
1332         croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1333
1334 void
1335 blockdev_rereadpt (g, device)
1336       guestfs_h *g;
1337       char *device;
1338 PREINIT:
1339       int r;
1340  PPCODE:
1341       r = guestfs_blockdev_rereadpt (g, device);
1342       if (r == -1)
1343         croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1344
1345 void
1346 upload (g, filename, remotefilename)
1347       guestfs_h *g;
1348       char *filename;
1349       char *remotefilename;
1350 PREINIT:
1351       int r;
1352  PPCODE:
1353       r = guestfs_upload (g, filename, remotefilename);
1354       if (r == -1)
1355         croak ("upload: %s", guestfs_last_error (g));
1356
1357 void
1358 download (g, remotefilename, filename)
1359       guestfs_h *g;
1360       char *remotefilename;
1361       char *filename;
1362 PREINIT:
1363       int r;
1364  PPCODE:
1365       r = guestfs_download (g, remotefilename, filename);
1366       if (r == -1)
1367         croak ("download: %s", guestfs_last_error (g));
1368
1369 SV *
1370 checksum (g, csumtype, path)
1371       guestfs_h *g;
1372       char *csumtype;
1373       char *path;
1374 PREINIT:
1375       char *checksum;
1376    CODE:
1377       checksum = guestfs_checksum (g, csumtype, path);
1378       if (checksum == NULL)
1379         croak ("checksum: %s", guestfs_last_error (g));
1380       RETVAL = newSVpv (checksum, 0);
1381       free (checksum);
1382  OUTPUT:
1383       RETVAL
1384
1385 void
1386 tar_in (g, tarfile, directory)
1387       guestfs_h *g;
1388       char *tarfile;
1389       char *directory;
1390 PREINIT:
1391       int r;
1392  PPCODE:
1393       r = guestfs_tar_in (g, tarfile, directory);
1394       if (r == -1)
1395         croak ("tar_in: %s", guestfs_last_error (g));
1396
1397 void
1398 tar_out (g, directory, tarfile)
1399       guestfs_h *g;
1400       char *directory;
1401       char *tarfile;
1402 PREINIT:
1403       int r;
1404  PPCODE:
1405       r = guestfs_tar_out (g, directory, tarfile);
1406       if (r == -1)
1407         croak ("tar_out: %s", guestfs_last_error (g));
1408
1409 void
1410 tgz_in (g, tarball, directory)
1411       guestfs_h *g;
1412       char *tarball;
1413       char *directory;
1414 PREINIT:
1415       int r;
1416  PPCODE:
1417       r = guestfs_tgz_in (g, tarball, directory);
1418       if (r == -1)
1419         croak ("tgz_in: %s", guestfs_last_error (g));
1420
1421 void
1422 tgz_out (g, directory, tarball)
1423       guestfs_h *g;
1424       char *directory;
1425       char *tarball;
1426 PREINIT:
1427       int r;
1428  PPCODE:
1429       r = guestfs_tgz_out (g, directory, tarball);
1430       if (r == -1)
1431         croak ("tgz_out: %s", guestfs_last_error (g));
1432
1433 void
1434 mount_ro (g, device, mountpoint)
1435       guestfs_h *g;
1436       char *device;
1437       char *mountpoint;
1438 PREINIT:
1439       int r;
1440  PPCODE:
1441       r = guestfs_mount_ro (g, device, mountpoint);
1442       if (r == -1)
1443         croak ("mount_ro: %s", guestfs_last_error (g));
1444
1445 void
1446 mount_options (g, options, device, mountpoint)
1447       guestfs_h *g;
1448       char *options;
1449       char *device;
1450       char *mountpoint;
1451 PREINIT:
1452       int r;
1453  PPCODE:
1454       r = guestfs_mount_options (g, options, device, mountpoint);
1455       if (r == -1)
1456         croak ("mount_options: %s", guestfs_last_error (g));
1457
1458 void
1459 mount_vfs (g, options, vfstype, device, mountpoint)
1460       guestfs_h *g;
1461       char *options;
1462       char *vfstype;
1463       char *device;
1464       char *mountpoint;
1465 PREINIT:
1466       int r;
1467  PPCODE:
1468       r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
1469       if (r == -1)
1470         croak ("mount_vfs: %s", guestfs_last_error (g));
1471
1472 SV *
1473 debug (g, subcmd, extraargs)
1474       guestfs_h *g;
1475       char *subcmd;
1476       char **extraargs;
1477 PREINIT:
1478       char *result;
1479    CODE:
1480       result = guestfs_debug (g, subcmd, extraargs);
1481       free (extraargs);
1482       if (result == NULL)
1483         croak ("debug: %s", guestfs_last_error (g));
1484       RETVAL = newSVpv (result, 0);
1485       free (result);
1486  OUTPUT:
1487       RETVAL
1488
1489 void
1490 lvremove (g, device)
1491       guestfs_h *g;
1492       char *device;
1493 PREINIT:
1494       int r;
1495  PPCODE:
1496       r = guestfs_lvremove (g, device);
1497       if (r == -1)
1498         croak ("lvremove: %s", guestfs_last_error (g));
1499
1500 void
1501 vgremove (g, vgname)
1502       guestfs_h *g;
1503       char *vgname;
1504 PREINIT:
1505       int r;
1506  PPCODE:
1507       r = guestfs_vgremove (g, vgname);
1508       if (r == -1)
1509         croak ("vgremove: %s", guestfs_last_error (g));
1510
1511 void
1512 pvremove (g, device)
1513       guestfs_h *g;
1514       char *device;
1515 PREINIT:
1516       int r;
1517  PPCODE:
1518       r = guestfs_pvremove (g, device);
1519       if (r == -1)
1520         croak ("pvremove: %s", guestfs_last_error (g));
1521
1522 void
1523 set_e2label (g, device, label)
1524       guestfs_h *g;
1525       char *device;
1526       char *label;
1527 PREINIT:
1528       int r;
1529  PPCODE:
1530       r = guestfs_set_e2label (g, device, label);
1531       if (r == -1)
1532         croak ("set_e2label: %s", guestfs_last_error (g));
1533
1534 SV *
1535 get_e2label (g, device)
1536       guestfs_h *g;
1537       char *device;
1538 PREINIT:
1539       char *label;
1540    CODE:
1541       label = guestfs_get_e2label (g, device);
1542       if (label == NULL)
1543         croak ("get_e2label: %s", guestfs_last_error (g));
1544       RETVAL = newSVpv (label, 0);
1545       free (label);
1546  OUTPUT:
1547       RETVAL
1548
1549 void
1550 set_e2uuid (g, device, uuid)
1551       guestfs_h *g;
1552       char *device;
1553       char *uuid;
1554 PREINIT:
1555       int r;
1556  PPCODE:
1557       r = guestfs_set_e2uuid (g, device, uuid);
1558       if (r == -1)
1559         croak ("set_e2uuid: %s", guestfs_last_error (g));
1560
1561 SV *
1562 get_e2uuid (g, device)
1563       guestfs_h *g;
1564       char *device;
1565 PREINIT:
1566       char *uuid;
1567    CODE:
1568       uuid = guestfs_get_e2uuid (g, device);
1569       if (uuid == NULL)
1570         croak ("get_e2uuid: %s", guestfs_last_error (g));
1571       RETVAL = newSVpv (uuid, 0);
1572       free (uuid);
1573  OUTPUT:
1574       RETVAL
1575
1576 SV *
1577 fsck (g, fstype, device)
1578       guestfs_h *g;
1579       char *fstype;
1580       char *device;
1581 PREINIT:
1582       int status;
1583    CODE:
1584       status = guestfs_fsck (g, fstype, device);
1585       if (status == -1)
1586         croak ("fsck: %s", guestfs_last_error (g));
1587       RETVAL = newSViv (status);
1588  OUTPUT:
1589       RETVAL
1590
1591 void
1592 zero (g, device)
1593       guestfs_h *g;
1594       char *device;
1595 PREINIT:
1596       int r;
1597  PPCODE:
1598       r = guestfs_zero (g, device);
1599       if (r == -1)
1600         croak ("zero: %s", guestfs_last_error (g));
1601
1602 void
1603 grub_install (g, root, device)
1604       guestfs_h *g;
1605       char *root;
1606       char *device;
1607 PREINIT:
1608       int r;
1609  PPCODE:
1610       r = guestfs_grub_install (g, root, device);
1611       if (r == -1)
1612         croak ("grub_install: %s", guestfs_last_error (g));
1613
1614 void
1615 cp (g, src, dest)
1616       guestfs_h *g;
1617       char *src;
1618       char *dest;
1619 PREINIT:
1620       int r;
1621  PPCODE:
1622       r = guestfs_cp (g, src, dest);
1623       if (r == -1)
1624         croak ("cp: %s", guestfs_last_error (g));
1625
1626 void
1627 cp_a (g, src, dest)
1628       guestfs_h *g;
1629       char *src;
1630       char *dest;
1631 PREINIT:
1632       int r;
1633  PPCODE:
1634       r = guestfs_cp_a (g, src, dest);
1635       if (r == -1)
1636         croak ("cp_a: %s", guestfs_last_error (g));
1637
1638 void
1639 mv (g, src, dest)
1640       guestfs_h *g;
1641       char *src;
1642       char *dest;
1643 PREINIT:
1644       int r;
1645  PPCODE:
1646       r = guestfs_mv (g, src, dest);
1647       if (r == -1)
1648         croak ("mv: %s", guestfs_last_error (g));
1649
1650 void
1651 drop_caches (g, whattodrop)
1652       guestfs_h *g;
1653       int whattodrop;
1654 PREINIT:
1655       int r;
1656  PPCODE:
1657       r = guestfs_drop_caches (g, whattodrop);
1658       if (r == -1)
1659         croak ("drop_caches: %s", guestfs_last_error (g));
1660
1661 SV *
1662 dmesg (g)
1663       guestfs_h *g;
1664 PREINIT:
1665       char *kmsgs;
1666    CODE:
1667       kmsgs = guestfs_dmesg (g);
1668       if (kmsgs == NULL)
1669         croak ("dmesg: %s", guestfs_last_error (g));
1670       RETVAL = newSVpv (kmsgs, 0);
1671       free (kmsgs);
1672  OUTPUT:
1673       RETVAL
1674
1675 void
1676 ping_daemon (g)
1677       guestfs_h *g;
1678 PREINIT:
1679       int r;
1680  PPCODE:
1681       r = guestfs_ping_daemon (g);
1682       if (r == -1)
1683         croak ("ping_daemon: %s", guestfs_last_error (g));
1684