diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-15 10:45:01 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-15 10:45:01 +0100 |
commit | 6bcbe54b5785cb8c911ccf4b724ae6abfdf53ce4 (patch) | |
tree | 17dc6cbf4514f5808fbc204e592723bea95c4382 /perl | |
parent | 212a55d483c2a20e61f42211c0c64aab3645cb09 (diff) | |
download | libguestfs-6bcbe54b5785cb8c911ccf4b724ae6abfdf53ce4.tar.gz libguestfs-6bcbe54b5785cb8c911ccf4b724ae6abfdf53ce4.tar.xz libguestfs-6bcbe54b5785cb8c911ccf4b724ae6abfdf53ce4.zip |
Generated code for stat/lstat/statvfs changes.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Guestfs.xs | 76 | ||||
-rw-r--r-- | perl/lib/Sys/Guestfs.pm | 24 |
2 files changed, 100 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index c1eaa11f..37a15e09 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -1011,3 +1011,79 @@ PREINIT: } free (lines); +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); + diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index c9caf088..09663bc5 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -402,6 +402,16 @@ hidden files are shown. This command is mostly useful for interactive sessions. Programs should probably use C<$h-E<gt>readdir> instead. +=item %statbuf = $h->lstat ($path); + +Returns file information for the given C<path>. + +This is the same as C<$h-E<gt>stat> except that if C<path> +is a symbolic link, then the link is stat-ed, not the file it +refers to. + +This is the same as the C<lstat(2)> system call. + =item $h->lvcreate ($logvol, $volgroup, $mbytes); This creates an LVM volume group called C<logvol> @@ -568,6 +578,20 @@ the string C<,> (comma). B<This command is dangerous. Without careful use you can easily destroy all your data>. +=item %statbuf = $h->stat ($path); + +Returns file information for the given C<path>. + +This is the same as the C<stat(2)> system call. + +=item %statbuf = $h->statvfs ($path); + +Returns file system statistics for any mounted file system. +C<path> should be a file or directory in the mounted file system +(typically it is the mount point itself, but it doesn't need to be). + +This is the same as the C<statvfs(2)> system call. + =item $h->sync (); This syncs the disk, so that any writes are flushed through to the |