+void
+stat (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ struct guestfs_stat *statbuf;
+ PPCODE:
+ statbuf = guestfs_stat (g, path);
+ if (statbuf == NULL)
+ croak ("stat: %s", guestfs_last_error (g));
+ EXTEND (SP, 13);
+ PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
+ free (statbuf);
+
+void
+lstat (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ struct guestfs_stat *statbuf;
+ PPCODE:
+ statbuf = guestfs_lstat (g, path);
+ if (statbuf == NULL)
+ croak ("lstat: %s", guestfs_last_error (g));
+ EXTEND (SP, 13);
+ PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
+ free (statbuf);
+
+void
+statvfs (g, path)
+ guestfs_h *g;
+ char *path;
+PREINIT:
+ struct guestfs_statvfs *statbuf;
+ PPCODE:
+ statbuf = guestfs_statvfs (g, path);
+ if (statbuf == NULL)
+ croak ("statvfs: %s", guestfs_last_error (g));
+ EXTEND (SP, 11);
+ PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
+ PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
+ free (statbuf);
+
+void
+tune2fs_l (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ char **superblock;
+ int i, n;
+ PPCODE:
+ superblock = guestfs_tune2fs_l (g, device);
+ if (superblock == NULL)
+ croak ("tune2fs_l: %s", guestfs_last_error (g));
+ for (n = 0; superblock[n] != NULL; ++n) /**/;
+ EXTEND (SP, n);
+ for (i = 0; i < n; ++i) {
+ PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
+ free (superblock[i]);
+ }
+ free (superblock);
+
+void
+blockdev_setro (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_blockdev_setro (g, device);
+ if (r == -1)
+ croak ("blockdev_setro: %s", guestfs_last_error (g));
+
+void
+blockdev_setrw (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ croak ("blockdev_setrw: %s", guestfs_last_error (g));
+
+SV *
+blockdev_getro (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int ro;
+ CODE:
+ ro = guestfs_blockdev_getro (g, device);
+ if (ro == -1)
+ croak ("blockdev_getro: %s", guestfs_last_error (g));
+ RETVAL = newSViv (ro);
+ OUTPUT:
+ RETVAL
+
+SV *
+blockdev_getss (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int sectorsize;
+ CODE:
+ sectorsize = guestfs_blockdev_getss (g, device);
+ if (sectorsize == -1)
+ croak ("blockdev_getss: %s", guestfs_last_error (g));
+ RETVAL = newSViv (sectorsize);
+ OUTPUT:
+ RETVAL
+
+SV *
+blockdev_getbsz (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int blocksize;
+ CODE:
+ blocksize = guestfs_blockdev_getbsz (g, device);
+ if (blocksize == -1)
+ croak ("blockdev_getbsz: %s", guestfs_last_error (g));
+ RETVAL = newSViv (blocksize);
+ OUTPUT:
+ RETVAL
+
+void
+blockdev_setbsz (g, device, blocksize)
+ guestfs_h *g;
+ char *device;
+ int blocksize;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_blockdev_setbsz (g, device, blocksize);
+ if (r == -1)
+ croak ("blockdev_setbsz: %s", guestfs_last_error (g));
+
+SV *
+blockdev_getsz (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int64_t sizeinsectors;
+ CODE:
+ sizeinsectors = guestfs_blockdev_getsz (g, device);
+ if (sizeinsectors == -1)
+ croak ("blockdev_getsz: %s", guestfs_last_error (g));
+ RETVAL = my_newSVll (sizeinsectors);
+ OUTPUT:
+ RETVAL
+
+SV *
+blockdev_getsize64 (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int64_t sizeinbytes;
+ CODE:
+ sizeinbytes = guestfs_blockdev_getsize64 (g, device);
+ if (sizeinbytes == -1)
+ croak ("blockdev_getsize64: %s", guestfs_last_error (g));
+ RETVAL = my_newSVll (sizeinbytes);
+ OUTPUT:
+ RETVAL
+
+void
+blockdev_flushbufs (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_blockdev_flushbufs (g, device);
+ if (r == -1)
+ croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
+
+void
+blockdev_rereadpt (g, device)
+ guestfs_h *g;
+ char *device;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_blockdev_rereadpt (g, device);
+ if (r == -1)
+ croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
+
+void
+upload (g, filename, remotefilename)
+ guestfs_h *g;
+ char *filename;
+ char *remotefilename;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_upload (g, filename, remotefilename);
+ if (r == -1)
+ croak ("upload: %s", guestfs_last_error (g));
+
+void
+download (g, remotefilename, filename)
+ guestfs_h *g;
+ char *remotefilename;
+ char *filename;
+PREINIT:
+ int r;
+ PPCODE:
+ r = guestfs_download (g, remotefilename, filename);
+ if (r == -1)
+ croak ("download: %s", guestfs_last_error (g));
+
+SV *
+checksum (g, csumtype, path)
+ guestfs_h *g;
+ char *csumtype;
+ char *path;
+PREINIT:
+ char *checksum;
+ CODE:
+ checksum = guestfs_checksum (g, csumtype, path);
+ if (checksum == NULL)
+ croak ("checksum: %s", guestfs_last_error (g));
+ RETVAL = newSVpv (checksum, 0);
+ free (checksum);
+ OUTPUT:
+ RETVAL
+