diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:09:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:10:45 +0100 |
commit | 0884d8bbae6d76a603ec1385ada2938f88981c5c (patch) | |
tree | 15c91a3bc58ba3537d4b52c48accf8703f3d8ffb /perl | |
parent | f850e1f065fb04df7cc87a921ab3c658741cc393 (diff) | |
download | libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.gz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.xz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.zip |
Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Guestfs.xs | 68 | ||||
-rw-r--r-- | perl/lib/Sys/Guestfs.pm | 42 |
2 files changed, 110 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index 9c8b4595..8f4ab5f3 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -2902,3 +2902,71 @@ PREINIT: if (r == -1) croak ("mkswap_U: %s", guestfs_last_error (g)); +void +mknod (g, mode, devmajor, devminor, path) + guestfs_h *g; + int mode; + int devmajor; + int devminor; + char *path; +PREINIT: + int r; + PPCODE: + r = guestfs_mknod (g, mode, devmajor, devminor, path); + if (r == -1) + croak ("mknod: %s", guestfs_last_error (g)); + +void +mkfifo (g, mode, path) + guestfs_h *g; + int mode; + char *path; +PREINIT: + int r; + PPCODE: + r = guestfs_mkfifo (g, mode, path); + if (r == -1) + croak ("mkfifo: %s", guestfs_last_error (g)); + +void +mknod_b (g, mode, devmajor, devminor, path) + guestfs_h *g; + int mode; + int devmajor; + int devminor; + char *path; +PREINIT: + int r; + PPCODE: + r = guestfs_mknod_b (g, mode, devmajor, devminor, path); + if (r == -1) + croak ("mknod_b: %s", guestfs_last_error (g)); + +void +mknod_c (g, mode, devmajor, devminor, path) + guestfs_h *g; + int mode; + int devmajor; + int devminor; + char *path; +PREINIT: + int r; + PPCODE: + r = guestfs_mknod_c (g, mode, devmajor, devminor, path); + if (r == -1) + croak ("mknod_c: %s", guestfs_last_error (g)); + +SV * +umask (g, mask) + guestfs_h *g; + int mask; +PREINIT: + int oldmask; + CODE: + oldmask = guestfs_umask (g, mask); + if (oldmask == -1) + croak ("umask: %s", guestfs_last_error (g)); + RETVAL = newSViv (oldmask); + OUTPUT: + RETVAL + diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index 5f8cef41..083a0172 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -949,12 +949,40 @@ directory and its contents after use. See also: L<mkdtemp(3)> +=item $h->mkfifo ($mode, $path); + +This call creates a FIFO (named pipe) called C<path> with +mode C<mode>. It is just a convenient wrapper around +C<$h-E<gt>mknod>. + =item $h->mkfs ($fstype, $device); This creates a filesystem on C<device> (usually a partition or LVM logical volume). The filesystem type is C<fstype>, for example C<ext3>. +=item $h->mknod ($mode, $devmajor, $devminor, $path); + +This call creates block or character special devices, or +named pipes (FIFOs). + +The C<mode> parameter should be the mode, using the standard +constants. C<devmajor> and C<devminor> are the +device major and minor numbers, only used when creating block +and character special devices. + +=item $h->mknod_b ($mode, $devmajor, $devminor, $path); + +This call creates a block device node called C<path> with +mode C<mode> and device major/minor C<devmajor> and C<devminor>. +It is just a convenient wrapper around C<$h-E<gt>mknod>. + +=item $h->mknod_c ($mode, $devmajor, $devminor, $path); + +This call creates a char device node called C<path> with +mode C<mode> and device major/minor C<devmajor> and C<devminor>. +It is just a convenient wrapper around C<$h-E<gt>mknod>. + =item $h->mkswap ($device); Create a swap partition on C<device>. @@ -1442,6 +1470,20 @@ manpage for more details. The list of fields returned isn't clearly defined, and depends on both the version of C<tune2fs> that libguestfs was built against, and the filesystem itself. +=item $oldmask = $h->umask ($mask); + +This function sets the mask used for creating new files and +device nodes to C<mask & 0777>. + +Typical umask values would be C<022> which creates new files +with permissions like "-rw-r--r--" or "-rwxr-xr-x", and +C<002> which creates new files with permissions like +"-rw-rw-r--" or "-rwxrwxr-x". + +See also L<umask(2)>, C<$h-E<gt>mknod>, C<$h-E<gt>mkdir>. + +This call returns the previous umask. + =item $h->umount ($pathordevice); This unmounts the given filesystem. The filesystem may be |