+ if (guestfs_chown (g, owner, group, path) == -1) {
+ croak ("chown: %s", guestfs_last_error (g));
+ }
+
+SV *
+exists (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ int existsflag;
+ CODE:
+ existsflag = guestfs_exists (g, path);
+ if (existsflag == -1) {
+ croak ("exists: %s", guestfs_last_error (g));
+ }
+ RETVAL = newSViv (existsflag);
+ OUTPUT:
+ RETVAL
+
+SV *
+is_file (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ int fileflag;
+ CODE:
+ fileflag = guestfs_is_file (g, path);
+ if (fileflag == -1) {
+ croak ("is_file: %s", guestfs_last_error (g));
+ }
+ RETVAL = newSViv (fileflag);
+ OUTPUT:
+ RETVAL
+
+SV *
+is_dir (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ int dirflag;
+ CODE:
+ dirflag = guestfs_is_dir (g, path);
+ if (dirflag == -1) {
+ croak ("is_dir: %s", guestfs_last_error (g));
+ }
+ RETVAL = newSViv (dirflag);
+ OUTPUT:
+ RETVAL
+
+void
+pvcreate (g, device)
+ guestfs_h *g;
+ char *device;
+ PPCODE:
+ if (guestfs_pvcreate (g, device) == -1) {
+ croak ("pvcreate: %s", guestfs_last_error (g));
+ }
+
+void
+vgcreate (g, volgroup, physvols)
+ guestfs_h *g;
+ char *volgroup;
+ char **physvols;
+ PPCODE:
+ if (guestfs_vgcreate (g, volgroup, physvols) == -1) {
+ free (physvols);
+ croak ("vgcreate: %s", guestfs_last_error (g));
+ }
+ free (physvols);
+
+void
+lvcreate (g, logvol, volgroup, mbytes)
+ guestfs_h *g;
+ char *logvol;
+ char *volgroup;
+ int mbytes;
+ PPCODE:
+ if (guestfs_lvcreate (g, logvol, volgroup, mbytes) == -1) {
+ croak ("lvcreate: %s", guestfs_last_error (g));
+ }
+
+void
+mkfs (g, fstype, device)
+ guestfs_h *g;
+ char *fstype;
+ char *device;
+ PPCODE:
+ if (guestfs_mkfs (g, fstype, device) == -1) {
+ croak ("mkfs: %s", guestfs_last_error (g));
+ }
+
+void
+sfdisk (g, device, cyls, heads, sectors, lines)
+ guestfs_h *g;
+ char *device;
+ int cyls;
+ int heads;
+ int sectors;
+ char **lines;
+ PPCODE:
+ if (guestfs_sfdisk (g, device, cyls, heads, sectors, lines) == -1) {
+ free (lines);
+ croak ("sfdisk: %s", guestfs_last_error (g));
+ }
+ free (lines);
+
+void
+write_file (g, path, content, size)
+ guestfs_h *g;
+ char *path;
+ char *content;
+ int size;
+ PPCODE:
+ if (guestfs_write_file (g, path, content, size) == -1) {
+ croak ("write_file: %s", guestfs_last_error (g));
+ }
+
+void
+umount (g, pathordevice)
+ guestfs_h *g;
+ char *pathordevice;
+ PPCODE:
+ if (guestfs_umount (g, pathordevice) == -1) {
+ croak ("umount: %s", guestfs_last_error (g));
+ }
+
+void
+mounts (g)
+ guestfs_h *g;
+PREINIT:
+ char **devices;
+ int i, n;
+ PPCODE:
+ devices = guestfs_mounts (g);
+ if (devices == NULL) {
+ croak ("mounts: %s", guestfs_last_error (g));
+ }
+ for (n = 0; devices[n] != NULL; ++n) /**/;
+ EXTEND (SP, n);
+ for (i = 0; i < n; ++i) {
+ PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
+ free (devices[i]);
+ }
+ free (devices);
+
+void
+umount_all (g)
+ guestfs_h *g;
+ PPCODE:
+ if (guestfs_umount_all (g) == -1) {
+ croak ("umount_all: %s", guestfs_last_error (g));
+ }
+
+void
+lvm_remove_all (g)
+ guestfs_h *g;
+ PPCODE:
+ if (guestfs_lvm_remove_all (g) == -1) {
+ croak ("lvm_remove_all: %s", guestfs_last_error (g));
+ }
+
+SV *
+file (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ char *description;
+ CODE:
+ description = guestfs_file (g, path);
+ if (description == NULL) {
+ croak ("file: %s", guestfs_last_error (g));
+ }
+ RETVAL = newSVpv (description, 0);
+ free (description);
+ OUTPUT:
+ RETVAL