1 =head2 guestfs_add_cdrom
3 int guestfs_add_cdrom (guestfs_h *handle,
6 This function adds a virtual CD-ROM disk image to the guest.
8 This is equivalent to the qemu parameter C<-cdrom filename>.
10 This function returns 0 on success or -1 on error.
12 =head2 guestfs_add_drive
14 int guestfs_add_drive (guestfs_h *handle,
15 const char *filename);
17 This function adds a virtual machine disk image C<filename> to the
18 guest. The first time you call this function, the disk appears as IDE
19 disk 0 (C</dev/sda>) in the guest, the second time as C</dev/sdb>, and
22 You don't necessarily need to be root when using libguestfs. However
23 you obviously do need sufficient permissions to access the filename
24 for whatever operations you want to perform (ie. read access if you
25 just want to read the image or write access if you want to modify the
28 This is equivalent to the qemu parameter C<-drive file=filename>.
30 This function returns 0 on success or -1 on error.
32 =head2 guestfs_aug_close
34 int guestfs_aug_close (guestfs_h *handle);
36 Close the current Augeas handle and free up any resources
37 used by it. After calling this, you have to call
38 C<guestfs_aug_init> again before you can use any other
41 This function returns 0 on success or -1 on error.
43 =head2 guestfs_aug_defnode
45 struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *handle,
50 Defines a variable C<name> whose value is the result of
53 If C<expr> evaluates to an empty nodeset, a node is created,
54 equivalent to calling C<guestfs_aug_set> C<expr>, C<value>.
55 C<name> will be the nodeset containing that single node.
57 On success this returns a pair containing the
58 number of nodes in the nodeset, and a boolean flag
59 if a node was created.
61 This function returns a C<struct guestfs_int_bool *>,
62 or NULL if there was an error.
63 I<The caller must call C<guestfs_free_int_bool> after use>.
65 =head2 guestfs_aug_defvar
67 int guestfs_aug_defvar (guestfs_h *handle,
71 Defines an Augeas variable C<name> whose value is the result
72 of evaluating C<expr>. If C<expr> is NULL, then C<name> is
75 On success this returns the number of nodes in C<expr>, or
76 C<0> if C<expr> evaluates to something which is not a nodeset.
78 On error this function returns -1.
80 =head2 guestfs_aug_get
82 char *guestfs_aug_get (guestfs_h *handle,
85 Look up the value associated with C<path>. If C<path>
86 matches exactly one node, the C<value> is returned.
88 This function returns a string, or NULL on error.
89 I<The caller must free the returned string after use>.
91 =head2 guestfs_aug_init
93 int guestfs_aug_init (guestfs_h *handle,
97 Create a new Augeas handle for editing configuration files.
98 If there was any previous Augeas handle associated with this
99 guestfs session, then it is closed.
101 You must call this before using any other C<guestfs_aug_*>
104 C<root> is the filesystem root. C<root> must not be NULL,
107 The flags are the same as the flags defined in
108 E<lt>augeas.hE<gt>, the logical I<or> of the following
113 =item C<AUG_SAVE_BACKUP> = 1
115 Keep the original file with a C<.augsave> extension.
117 =item C<AUG_SAVE_NEWFILE> = 2
119 Save changes into a file with extension C<.augnew>, and
120 do not overwrite original. Overrides C<AUG_SAVE_BACKUP>.
122 =item C<AUG_TYPE_CHECK> = 4
124 Typecheck lenses (can be expensive).
126 =item C<AUG_NO_STDINC> = 8
128 Do not use standard load path for modules.
130 =item C<AUG_SAVE_NOOP> = 16
132 Make save a no-op, just record what would have been changed.
134 =item C<AUG_NO_LOAD> = 32
136 Do not load the tree in C<guestfs_aug_init>.
140 To close the handle, you can call C<guestfs_aug_close>.
142 To find out more about Augeas, see L<http://augeas.net/>.
144 This function returns 0 on success or -1 on error.
146 =head2 guestfs_aug_insert
148 int guestfs_aug_insert (guestfs_h *handle,
153 Create a new sibling C<label> for C<path>, inserting it into
154 the tree before or after C<path> (depending on the boolean
157 C<path> must match exactly one existing node in the tree, and
158 C<label> must be a label, ie. not contain C</>, C<*> or end
159 with a bracketed index C<[N]>.
161 This function returns 0 on success or -1 on error.
163 =head2 guestfs_aug_load
165 int guestfs_aug_load (guestfs_h *handle);
167 Load files into the tree.
169 See C<aug_load> in the Augeas documentation for the full gory
172 This function returns 0 on success or -1 on error.
174 =head2 guestfs_aug_ls
176 char **guestfs_aug_ls (guestfs_h *handle,
179 This is just a shortcut for listing C<guestfs_aug_match>
180 C<path/*> and sorting the resulting nodes into alphabetical order.
182 This function returns a NULL-terminated array of strings
183 (like L<environ(3)>), or NULL if there was an error.
184 I<The caller must free the strings and the array after use>.
186 =head2 guestfs_aug_match
188 char **guestfs_aug_match (guestfs_h *handle,
191 Returns a list of paths which match the path expression C<path>.
192 The returned paths are sufficiently qualified so that they match
193 exactly one node in the current tree.
195 This function returns a NULL-terminated array of strings
196 (like L<environ(3)>), or NULL if there was an error.
197 I<The caller must free the strings and the array after use>.
199 =head2 guestfs_aug_mv
201 int guestfs_aug_mv (guestfs_h *handle,
205 Move the node C<src> to C<dest>. C<src> must match exactly
206 one node. C<dest> is overwritten if it exists.
208 This function returns 0 on success or -1 on error.
210 =head2 guestfs_aug_rm
212 int guestfs_aug_rm (guestfs_h *handle,
215 Remove C<path> and all of its children.
217 On success this returns the number of entries which were removed.
219 On error this function returns -1.
221 =head2 guestfs_aug_save
223 int guestfs_aug_save (guestfs_h *handle);
225 This writes all pending changes to disk.
227 The flags which were passed to C<guestfs_aug_init> affect exactly
230 This function returns 0 on success or -1 on error.
232 =head2 guestfs_aug_set
234 int guestfs_aug_set (guestfs_h *handle,
238 Set the value associated with C<path> to C<value>.
240 This function returns 0 on success or -1 on error.
244 char *guestfs_cat (guestfs_h *handle,
247 Return the contents of the file named C<path>.
249 Note that this function cannot correctly handle binary files
250 (specifically, files containing C<\0> character which is treated
251 as end of string). For those you need to use the C<guestfs_read_file>
252 function which has a more complex interface.
254 This function returns a string, or NULL on error.
255 I<The caller must free the returned string after use>.
257 Because of the message protocol, there is a transfer limit
258 of somewhere between 2MB and 4MB. To transfer large files you should use
263 int guestfs_chmod (guestfs_h *handle,
267 Change the mode (permissions) of C<path> to C<mode>. Only
268 numeric modes are supported.
270 This function returns 0 on success or -1 on error.
274 int guestfs_chown (guestfs_h *handle,
279 Change the file owner to C<owner> and group to C<group>.
281 Only numeric uid and gid are supported. If you want to use
282 names, you will need to locate and parse the password file
283 yourself (Augeas support makes this relatively easy).
285 This function returns 0 on success or -1 on error.
287 =head2 guestfs_command
289 char *guestfs_command (guestfs_h *handle,
290 char * const* const arguments);
292 This call runs a command from the guest filesystem. The
293 filesystem must be mounted, and must contain a compatible
294 operating system (ie. something Linux, with the same
295 or compatible processor architecture).
297 The single parameter is an argv-style list of arguments.
298 The first element is the name of the program to run.
299 Subsequent elements are parameters. The list must be
300 non-empty (ie. must contain a program name).
302 The C<$PATH> environment variable will contain at least
303 C</usr/bin> and C</bin>. If you require a program from
304 another location, you should provide the full path in the
307 Shared libraries and data files required by the program
308 must be available on filesystems which are mounted in the
309 correct places. It is the caller's responsibility to ensure
310 all filesystems that are needed are mounted at the right
313 This function returns a string, or NULL on error.
314 I<The caller must free the returned string after use>.
316 =head2 guestfs_command_lines
318 char **guestfs_command_lines (guestfs_h *handle,
319 char * const* const arguments);
321 This is the same as C<guestfs_command>, but splits the
322 result into a list of lines.
324 This function returns a NULL-terminated array of strings
325 (like L<environ(3)>), or NULL if there was an error.
326 I<The caller must free the strings and the array after use>.
328 =head2 guestfs_config
330 int guestfs_config (guestfs_h *handle,
331 const char *qemuparam,
332 const char *qemuvalue);
334 This can be used to add arbitrary qemu command line parameters
335 of the form C<-param value>. Actually it's not quite arbitrary - we
336 prevent you from setting some parameters which would interfere with
337 parameters that we use.
339 The first character of C<param> string must be a C<-> (dash).
341 C<value> can be NULL.
343 This function returns 0 on success or -1 on error.
345 =head2 guestfs_exists
347 int guestfs_exists (guestfs_h *handle,
350 This returns C<true> if and only if there is a file, directory
351 (or anything) with the given C<path> name.
353 See also C<guestfs_is_file>, C<guestfs_is_dir>, C<guestfs_stat>.
355 This function returns a C truth value on success or -1 on error.
359 char *guestfs_file (guestfs_h *handle,
362 This call uses the standard L<file(1)> command to determine
363 the type or contents of the file. This also works on devices,
364 for example to find out whether a partition contains a filesystem.
366 The exact command which runs is C<file -bsL path>. Note in
367 particular that the filename is not prepended to the output
370 This function returns a string, or NULL on error.
371 I<The caller must free the returned string after use>.
373 =head2 guestfs_get_autosync
375 int guestfs_get_autosync (guestfs_h *handle);
377 Get the autosync flag.
379 This function returns a C truth value on success or -1 on error.
381 =head2 guestfs_get_path
383 const char *guestfs_get_path (guestfs_h *handle);
385 Return the current search path.
387 This is always non-NULL. If it wasn't set already, then this will
388 return the default path.
390 This function returns a string, or NULL on error.
391 The string is owned by the guest handle and must I<not> be freed.
393 =head2 guestfs_get_verbose
395 int guestfs_get_verbose (guestfs_h *handle);
397 This returns the verbose messages flag.
399 This function returns a C truth value on success or -1 on error.
401 =head2 guestfs_is_dir
403 int guestfs_is_dir (guestfs_h *handle,
406 This returns C<true> if and only if there is a directory
407 with the given C<path> name. Note that it returns false for
408 other objects like files.
410 See also C<guestfs_stat>.
412 This function returns a C truth value on success or -1 on error.
414 =head2 guestfs_is_file
416 int guestfs_is_file (guestfs_h *handle,
419 This returns C<true> if and only if there is a file
420 with the given C<path> name. Note that it returns false for
421 other objects like directories.
423 See also C<guestfs_stat>.
425 This function returns a C truth value on success or -1 on error.
427 =head2 guestfs_kill_subprocess
429 int guestfs_kill_subprocess (guestfs_h *handle);
431 This kills the qemu subprocess. You should never need to call this.
433 This function returns 0 on success or -1 on error.
435 =head2 guestfs_launch
437 int guestfs_launch (guestfs_h *handle);
439 Internally libguestfs is implemented by running a virtual machine
442 You should call this after configuring the handle
443 (eg. adding drives) but before performing any actions.
445 This function returns 0 on success or -1 on error.
447 =head2 guestfs_list_devices
449 char **guestfs_list_devices (guestfs_h *handle);
451 List all the block devices.
453 The full block device names are returned, eg. C</dev/sda>
455 This function returns a NULL-terminated array of strings
456 (like L<environ(3)>), or NULL if there was an error.
457 I<The caller must free the strings and the array after use>.
459 =head2 guestfs_list_partitions
461 char **guestfs_list_partitions (guestfs_h *handle);
463 List all the partitions detected on all block devices.
465 The full partition device names are returned, eg. C</dev/sda1>
467 This does not return logical volumes. For that you will need to
470 This function returns a NULL-terminated array of strings
471 (like L<environ(3)>), or NULL if there was an error.
472 I<The caller must free the strings and the array after use>.
476 char *guestfs_ll (guestfs_h *handle,
477 const char *directory);
479 List the files in C<directory> (relative to the root directory,
480 there is no cwd) in the format of 'ls -la'.
482 This command is mostly useful for interactive sessions. It
483 is I<not> intended that you try to parse the output string.
485 This function returns a string, or NULL on error.
486 I<The caller must free the returned string after use>.
490 char **guestfs_ls (guestfs_h *handle,
491 const char *directory);
493 List the files in C<directory> (relative to the root directory,
494 there is no cwd). The '.' and '..' entries are not returned, but
495 hidden files are shown.
497 This command is mostly useful for interactive sessions. Programs
498 should probably use C<guestfs_readdir> instead.
500 This function returns a NULL-terminated array of strings
501 (like L<environ(3)>), or NULL if there was an error.
502 I<The caller must free the strings and the array after use>.
506 struct guestfs_stat *guestfs_lstat (guestfs_h *handle,
509 Returns file information for the given C<path>.
511 This is the same as C<guestfs_stat> except that if C<path>
512 is a symbolic link, then the link is stat-ed, not the file it
515 This is the same as the C<lstat(2)> system call.
517 This function returns a C<struct guestfs_stat *>
518 (see L<stat(2)> and E<lt>guestfs-structs.hE<gt>),
519 or NULL if there was an error.
520 I<The caller must call C<free> after use>.
522 =head2 guestfs_lvcreate
524 int guestfs_lvcreate (guestfs_h *handle,
526 const char *volgroup,
529 This creates an LVM volume group called C<logvol>
530 on the volume group C<volgroup>, with C<size> megabytes.
532 This function returns 0 on success or -1 on error.
534 =head2 guestfs_lvm_remove_all
536 int guestfs_lvm_remove_all (guestfs_h *handle);
538 This command removes all LVM logical volumes, volume groups
539 and physical volumes.
541 This function returns 0 on success or -1 on error.
543 B<This command is dangerous. Without careful use you
544 can easily destroy all your data>.
548 char **guestfs_lvs (guestfs_h *handle);
550 List all the logical volumes detected. This is the equivalent
551 of the L<lvs(8)> command.
553 This returns a list of the logical volume device names
554 (eg. C</dev/VolGroup00/LogVol00>).
556 See also C<guestfs_lvs_full>.
558 This function returns a NULL-terminated array of strings
559 (like L<environ(3)>), or NULL if there was an error.
560 I<The caller must free the strings and the array after use>.
562 =head2 guestfs_lvs_full
564 struct guestfs_lvm_lv_list *guestfs_lvs_full (guestfs_h *handle);
566 List all the logical volumes detected. This is the equivalent
567 of the L<lvs(8)> command. The "full" version includes all fields.
569 This function returns a C<struct guestfs_lvm_lv_list *>
570 (see E<lt>guestfs-structs.hE<gt>),
571 or NULL if there was an error.
572 I<The caller must call C<guestfs_free_lvm_lv_list> after use>.
576 int guestfs_mkdir (guestfs_h *handle,
579 Create a directory named C<path>.
581 This function returns 0 on success or -1 on error.
583 =head2 guestfs_mkdir_p
585 int guestfs_mkdir_p (guestfs_h *handle,
588 Create a directory named C<path>, creating any parent directories
589 as necessary. This is like the C<mkdir -p> shell command.
591 This function returns 0 on success or -1 on error.
595 int guestfs_mkfs (guestfs_h *handle,
599 This creates a filesystem on C<device> (usually a partition
600 of LVM logical volume). The filesystem type is C<fstype>, for
603 This function returns 0 on success or -1 on error.
607 int guestfs_mount (guestfs_h *handle,
609 const char *mountpoint);
611 Mount a guest disk at a position in the filesystem. Block devices
612 are named C</dev/sda>, C</dev/sdb> and so on, as they were added to
613 the guest. If those block devices contain partitions, they will have
614 the usual names (eg. C</dev/sda1>). Also LVM C</dev/VG/LV>-style
617 The rules are the same as for L<mount(2)>: A filesystem must
618 first be mounted on C</> before others can be mounted. Other
619 filesystems can only be mounted on directories which already
622 The mounted filesystem is writable, if we have sufficient permissions
623 on the underlying device.
625 The filesystem options C<sync> and C<noatime> are set with this
626 call, in order to improve reliability.
628 This function returns 0 on success or -1 on error.
630 =head2 guestfs_mounts
632 char **guestfs_mounts (guestfs_h *handle);
634 This returns the list of currently mounted filesystems. It returns
635 the list of devices (eg. C</dev/sda1>, C</dev/VG/LV>).
637 Some internal mounts are not shown.
639 This function returns a NULL-terminated array of strings
640 (like L<environ(3)>), or NULL if there was an error.
641 I<The caller must free the strings and the array after use>.
643 =head2 guestfs_pvcreate
645 int guestfs_pvcreate (guestfs_h *handle,
648 This creates an LVM physical volume on the named C<device>,
649 where C<device> should usually be a partition name such
652 This function returns 0 on success or -1 on error.
656 char **guestfs_pvs (guestfs_h *handle);
658 List all the physical volumes detected. This is the equivalent
659 of the L<pvs(8)> command.
661 This returns a list of just the device names that contain
662 PVs (eg. C</dev/sda2>).
664 See also C<guestfs_pvs_full>.
666 This function returns a NULL-terminated array of strings
667 (like L<environ(3)>), or NULL if there was an error.
668 I<The caller must free the strings and the array after use>.
670 =head2 guestfs_pvs_full
672 struct guestfs_lvm_pv_list *guestfs_pvs_full (guestfs_h *handle);
674 List all the physical volumes detected. This is the equivalent
675 of the L<pvs(8)> command. The "full" version includes all fields.
677 This function returns a C<struct guestfs_lvm_pv_list *>
678 (see E<lt>guestfs-structs.hE<gt>),
679 or NULL if there was an error.
680 I<The caller must call C<guestfs_free_lvm_pv_list> after use>.
682 =head2 guestfs_read_lines
684 char **guestfs_read_lines (guestfs_h *handle,
687 Return the contents of the file named C<path>.
689 The file contents are returned as a list of lines. Trailing
690 C<LF> and C<CRLF> character sequences are I<not> returned.
692 Note that this function cannot correctly handle binary files
693 (specifically, files containing C<\0> character which is treated
694 as end of line). For those you need to use the C<guestfs_read_file>
695 function which has a more complex interface.
697 This function returns a NULL-terminated array of strings
698 (like L<environ(3)>), or NULL if there was an error.
699 I<The caller must free the strings and the array after use>.
703 int guestfs_rm (guestfs_h *handle,
706 Remove the single file C<path>.
708 This function returns 0 on success or -1 on error.
712 int guestfs_rm_rf (guestfs_h *handle,
715 Remove the file or directory C<path>, recursively removing the
716 contents if its a directory. This is like the C<rm -rf> shell
719 This function returns 0 on success or -1 on error.
723 int guestfs_rmdir (guestfs_h *handle,
726 Remove the single directory C<path>.
728 This function returns 0 on success or -1 on error.
730 =head2 guestfs_set_autosync
732 int guestfs_set_autosync (guestfs_h *handle,
735 If C<autosync> is true, this enables autosync. Libguestfs will make a
736 best effort attempt to run C<guestfs_sync> when the handle is closed
737 (also if the program exits without closing handles).
739 This function returns 0 on success or -1 on error.
741 =head2 guestfs_set_path
743 int guestfs_set_path (guestfs_h *handle,
746 Set the path that libguestfs searches for kernel and initrd.img.
748 The default is C<$libdir/guestfs> unless overridden by setting
749 C<LIBGUESTFS_PATH> environment variable.
751 The string C<path> is stashed in the libguestfs handle, so the caller
752 must make sure it remains valid for the lifetime of the handle.
754 Setting C<path> to C<NULL> restores the default path.
756 This function returns 0 on success or -1 on error.
758 =head2 guestfs_set_verbose
760 int guestfs_set_verbose (guestfs_h *handle,
763 If C<verbose> is true, this turns on verbose messages (to C<stderr>).
765 Verbose messages are disabled unless the environment variable
766 C<LIBGUESTFS_DEBUG> is defined and set to C<1>.
768 This function returns 0 on success or -1 on error.
770 =head2 guestfs_sfdisk
772 int guestfs_sfdisk (guestfs_h *handle,
777 char * const* const lines);
779 This is a direct interface to the L<sfdisk(8)> program for creating
780 partitions on block devices.
782 C<device> should be a block device, for example C</dev/sda>.
784 C<cyls>, C<heads> and C<sectors> are the number of cylinders, heads
785 and sectors on the device, which are passed directly to sfdisk as
786 the I<-C>, I<-H> and I<-S> parameters. If you pass C<0> for any
787 of these, then the corresponding parameter is omitted. Usually for
788 'large' disks, you can just pass C<0> for these, but for small
789 (floppy-sized) disks, sfdisk (or rather, the kernel) cannot work
790 out the right geometry and you will need to tell it.
792 C<lines> is a list of lines that we feed to C<sfdisk>. For more
793 information refer to the L<sfdisk(8)> manpage.
795 To create a single partition occupying the whole disk, you would
796 pass C<lines> as a single element list, when the single element being
797 the string C<,> (comma).
799 This function returns 0 on success or -1 on error.
801 B<This command is dangerous. Without careful use you
802 can easily destroy all your data>.
806 struct guestfs_stat *guestfs_stat (guestfs_h *handle,
809 Returns file information for the given C<path>.
811 This is the same as the C<stat(2)> system call.
813 This function returns a C<struct guestfs_stat *>
814 (see L<stat(2)> and E<lt>guestfs-structs.hE<gt>),
815 or NULL if there was an error.
816 I<The caller must call C<free> after use>.
818 =head2 guestfs_statvfs
820 struct guestfs_statvfs *guestfs_statvfs (guestfs_h *handle,
823 Returns file system statistics for any mounted file system.
824 C<path> should be a file or directory in the mounted file system
825 (typically it is the mount point itself, but it doesn't need to be).
827 This is the same as the C<statvfs(2)> system call.
829 This function returns a C<struct guestfs_statvfs *>
830 (see L<statvfs(2)> and E<lt>guestfs-structs.hE<gt>),
831 or NULL if there was an error.
832 I<The caller must call C<free> after use>.
836 int guestfs_sync (guestfs_h *handle);
838 This syncs the disk, so that any writes are flushed through to the
839 underlying disk image.
841 You should always call this if you have modified a disk image, before
844 This function returns 0 on success or -1 on error.
848 int guestfs_touch (guestfs_h *handle,
851 Touch acts like the L<touch(1)> command. It can be used to
852 update the timestamps on a file, or, if the file does not exist,
853 to create a new zero-length file.
855 This function returns 0 on success or -1 on error.
857 =head2 guestfs_umount
859 int guestfs_umount (guestfs_h *handle,
860 const char *pathordevice);
862 This unmounts the given filesystem. The filesystem may be
863 specified either by its mountpoint (path) or the device which
864 contains the filesystem.
866 This function returns 0 on success or -1 on error.
868 =head2 guestfs_umount_all
870 int guestfs_umount_all (guestfs_h *handle);
872 This unmounts all mounted filesystems.
874 Some internal mounts are not unmounted by this call.
876 This function returns 0 on success or -1 on error.
878 =head2 guestfs_vgcreate
880 int guestfs_vgcreate (guestfs_h *handle,
881 const char *volgroup,
882 char * const* const physvols);
884 This creates an LVM volume group called C<volgroup>
885 from the non-empty list of physical volumes C<physvols>.
887 This function returns 0 on success or -1 on error.
891 char **guestfs_vgs (guestfs_h *handle);
893 List all the volumes groups detected. This is the equivalent
894 of the L<vgs(8)> command.
896 This returns a list of just the volume group names that were
897 detected (eg. C<VolGroup00>).
899 See also C<guestfs_vgs_full>.
901 This function returns a NULL-terminated array of strings
902 (like L<environ(3)>), or NULL if there was an error.
903 I<The caller must free the strings and the array after use>.
905 =head2 guestfs_vgs_full
907 struct guestfs_lvm_vg_list *guestfs_vgs_full (guestfs_h *handle);
909 List all the volumes groups detected. This is the equivalent
910 of the L<vgs(8)> command. The "full" version includes all fields.
912 This function returns a C<struct guestfs_lvm_vg_list *>
913 (see E<lt>guestfs-structs.hE<gt>),
914 or NULL if there was an error.
915 I<The caller must call C<guestfs_free_lvm_vg_list> after use>.
917 =head2 guestfs_wait_ready
919 int guestfs_wait_ready (guestfs_h *handle);
921 Internally libguestfs is implemented by running a virtual machine
924 You should call this after C<guestfs_launch> to wait for the launch
927 This function returns 0 on success or -1 on error.
929 =head2 guestfs_write_file
931 int guestfs_write_file (guestfs_h *handle,
936 This call creates a file called C<path>. The contents of the
937 file is the string C<content> (which can contain any 8 bit data),
940 As a special case, if C<size> is C<0>
941 then the length is calculated using C<strlen> (so in this case
942 the content cannot contain embedded ASCII NULs).
944 This function returns 0 on success or -1 on error.
946 Because of the message protocol, there is a transfer limit
947 of somewhere between 2MB and 4MB. To transfer large files you should use