1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Red Hat Inc.
3 # This file is distributed under the same license as the libguestfs package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: libguestfs 1.5.13\n"
10 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
11 "POT-Creation-Date: 2010-09-13 15:07+0200\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=utf-8\n"
17 "Content-Transfer-Encoding: ENCODING"
20 #: ../src/guestfs.pod:1 ../fish/guestfish.pod:1 ../test-tool/libguestfs-test-tool.pod:1 ../fuse/guestmount.pod:1 ../inspector/virt-inspector.pl:36 ../tools/virt-cat.pl:30 ../tools/virt-df.pl:32 ../tools/virt-edit.pl:31 ../tools/virt-list-filesystems.pl:28 ../tools/virt-list-partitions.pl:28 ../tools/virt-ls.pl:31 ../tools/virt-make-fs.pl:33 ../tools/virt-rescue.pl:29 ../tools/virt-resize.pl:38 ../tools/virt-tar.pl:30 ../tools/virt-win-reg.pl:34
25 #: ../src/guestfs.pod:3 ../fish/guestfish.pod:3 ../test-tool/libguestfs-test-tool.pod:3 ../fuse/guestmount.pod:3 ../inspector/virt-inspector.pl:38 ../tools/virt-cat.pl:32 ../tools/virt-df.pl:34 ../tools/virt-edit.pl:33 ../tools/virt-list-filesystems.pl:30 ../tools/virt-list-partitions.pl:30 ../tools/virt-ls.pl:33 ../tools/virt-make-fs.pl:35 ../tools/virt-rescue.pl:31 ../tools/virt-resize.pl:40 ../tools/virt-tar.pl:32 ../tools/virt-win-reg.pl:36
30 #: ../src/guestfs.pod:5
31 msgid "guestfs - Library for accessing and modifying virtual machine images"
35 #: ../src/guestfs.pod:7 ../fish/guestfish.pod:7 ../test-tool/libguestfs-test-tool.pod:7 ../fuse/guestmount.pod:7 ../inspector/virt-inspector.pl:42 ../tools/virt-cat.pl:36 ../tools/virt-df.pl:38 ../tools/virt-edit.pl:37 ../tools/virt-list-filesystems.pl:34 ../tools/virt-list-partitions.pl:34 ../tools/virt-ls.pl:37 ../tools/virt-make-fs.pl:39 ../tools/virt-rescue.pl:35 ../tools/virt-resize.pl:44 ../tools/virt-tar.pl:36 ../tools/virt-win-reg.pl:40
40 #: ../src/guestfs.pod:9
43 " #include <guestfs.h>\n"
48 #: ../src/guestfs.pod:11
51 " guestfs_h *g = guestfs_create ();\n"
52 " guestfs_add_drive (g, \"guest.img\");\n"
53 " guestfs_launch (g);\n"
54 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
55 " guestfs_touch (g, \"/hello\");\n"
56 " guestfs_umount (g, \"/\");\n"
57 " guestfs_sync (g);\n"
58 " guestfs_close (g);\n"
63 #: ../src/guestfs.pod:20
66 " cc prog.c -o prog -lguestfs\n"
68 " cc prog.c -o prog `pkg-config libguestfs --cflags --libs`\n"
73 #: ../src/guestfs.pod:24 ../fish/guestfish.pod:115 ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:16 ../inspector/virt-inspector.pl:48 ../tools/virt-cat.pl:42 ../tools/virt-df.pl:46 ../tools/virt-edit.pl:51 ../tools/virt-list-filesystems.pl:40 ../tools/virt-list-partitions.pl:40 ../tools/virt-ls.pl:43 ../tools/virt-make-fs.pl:47 ../tools/virt-rescue.pl:51 ../tools/virt-resize.pl:50 ../tools/virt-tar.pl:73 ../tools/virt-win-reg.pl:64
78 #: ../src/guestfs.pod:26
80 "Libguestfs is a library for accessing and modifying guest disk images. "
81 "Amongst the things this is good for: making batch configuration changes to "
82 "guests, getting disk used/free statistics (see also: virt-df), migrating "
83 "between virtualization systems (see also: virt-p2v), performing partial "
84 "backups, performing partial guest clones, cloning guests and changing "
85 "registry/UUID/hostname info, and much else besides."
89 #: ../src/guestfs.pod:34
91 "Libguestfs uses Linux kernel and qemu code, and can access any type of guest "
92 "filesystem that Linux and qemu can, including but not limited to: ext2/3/4, "
93 "btrfs, FAT and NTFS, LVM, many different disk partition schemes, qcow, "
98 #: ../src/guestfs.pod:39
100 "Libguestfs provides ways to enumerate guest storage (eg. partitions, LVs, "
101 "what filesystem is in each LV, etc.). It can also run commands in the "
102 "context of the guest. Also you can access filesystems over FUSE."
106 #: ../src/guestfs.pod:44
108 "Libguestfs is a library that can be linked with C and C++ management "
109 "programs (or management programs written in OCaml, Perl, Python, Ruby, Java, "
110 "PHP, Haskell or C#). You can also use it from shell scripts or the command "
115 #: ../src/guestfs.pod:49
117 "You don't need to be root to use libguestfs, although obviously you do need "
118 "enough permissions to access the disk images."
122 #: ../src/guestfs.pod:52
124 "Libguestfs is a large API because it can do many things. For a gentle "
125 "introduction, please read the L</API OVERVIEW> section next."
129 #: ../src/guestfs.pod:55
134 #: ../src/guestfs.pod:57
136 "This section provides a gentler overview of the libguestfs API. We also try "
137 "to group API calls together, where that may not be obvious from reading "
138 "about the individual calls in the main section of this manual."
142 #: ../src/guestfs.pod:62
147 #: ../src/guestfs.pod:64
149 "Before you can use libguestfs calls, you have to create a handle. Then you "
150 "must add at least one disk image to the handle, followed by launching the "
151 "handle, then performing whatever operations you want, and finally closing "
152 "the handle. By convention we use the single letter C<g> for the name of the "
153 "handle variable, although of course you can use any name you want."
157 #: ../src/guestfs.pod:71
158 msgid "The general structure of all libguestfs-using programs looks like this:"
162 #: ../src/guestfs.pod:74
165 " guestfs_h *g = guestfs_create ();\n"
170 #: ../src/guestfs.pod:76
173 " /* Call guestfs_add_drive additional times if there are\n"
174 " * multiple disk images.\n"
176 " guestfs_add_drive (g, \"guest.img\");\n"
181 #: ../src/guestfs.pod:81
184 " /* Most manipulation calls won't work until you've launched\n"
185 " * the handle 'g'. You have to do this _after_ adding drives\n"
186 " * and _before_ other commands.\n"
188 " guestfs_launch (g);\n"
193 #: ../src/guestfs.pod:87
196 " /* Now you can examine what partitions, LVs etc are available.\n"
198 " char **partitions = guestfs_list_partitions (g);\n"
199 " char **logvols = guestfs_lvs (g);\n"
204 #: ../src/guestfs.pod:92
207 " /* To access a filesystem in the image, you must mount it.\n"
209 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
214 #: ../src/guestfs.pod:96
217 " /* Now you can perform filesystem actions on the guest\n"
220 " guestfs_touch (g, \"/hello\");\n"
225 #: ../src/guestfs.pod:101
228 " /* You only need to call guestfs_sync if you have made\n"
229 " * changes to the guest image. (But if you've made changes\n"
230 " * then you *must* sync). See also: guestfs_umount and\n"
231 " * guestfs_umount_all calls.\n"
233 " guestfs_sync (g);\n"
238 #: ../src/guestfs.pod:108
241 " /* Close the handle 'g'. */\n"
242 " guestfs_close (g);\n"
247 #: ../src/guestfs.pod:111
249 "The code above doesn't include any error checking. In real code you should "
250 "check return values carefully for errors. In general all functions that "
251 "return integers return C<-1> on error, and all functions that return "
252 "pointers return C<NULL> on error. See section L</ERROR HANDLING> below for "
253 "how to handle errors, and consult the documentation for each function call "
254 "below to see precisely how they return error indications."
258 #: ../src/guestfs.pod:119
263 #: ../src/guestfs.pod:121
265 "The image filename (C<\"guest.img\"> in the example above) could be a disk "
266 "image from a virtual machine, a L<dd(1)> copy of a physical hard disk, an "
267 "actual block device, or simply an empty file of zeroes that you have created "
268 "through L<posix_fallocate(3)>. Libguestfs lets you do useful things to all "
273 #: ../src/guestfs.pod:127
275 "You can add a disk read-only using L</guestfs_add_drive_ro>, in which case "
276 "libguestfs won't modify the file."
280 #: ../src/guestfs.pod:130
282 "Be extremely cautious if the disk image is in use, eg. if it is being used "
283 "by a virtual machine. Adding it read-write will almost certainly cause disk "
284 "corruption, but adding it read-only is safe."
288 #: ../src/guestfs.pod:134
290 "You must add at least one disk image, and you may add multiple disk images. "
291 "In the API, the disk images are usually referred to as C</dev/sda> (for the "
292 "first one you added), C</dev/sdb> (for the second one you added), etc."
296 #: ../src/guestfs.pod:139
298 "Once L</guestfs_launch> has been called you cannot add any more images. You "
299 "can call L</guestfs_list_devices> to get a list of the device names, in the "
300 "order that you added them. See also L</BLOCK DEVICE NAMING> below."
304 #: ../src/guestfs.pod:144
309 #: ../src/guestfs.pod:146
311 "Before you can read or write files, create directories and so on in a disk "
312 "image that contains filesystems, you have to mount those filesystems using "
313 "L</guestfs_mount>. If you already know that a disk image contains (for "
314 "example) one partition with a filesystem on that partition, then you can "
319 #: ../src/guestfs.pod:152
322 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
327 #: ../src/guestfs.pod:154
329 "where C</dev/sda1> means literally the first partition (C<1>) of the first "
330 "disk image that we added (C</dev/sda>). If the disk contains Linux LVM2 "
331 "logical volumes you could refer to those instead (eg. C</dev/VG/LV>)."
335 #: ../src/guestfs.pod:158
337 "If you are given a disk image and you don't know what it contains then you "
338 "have to find out. Libguestfs can do that too: use "
339 "L</guestfs_list_partitions> and L</guestfs_lvs> to list possible partitions "
340 "and LVs, and either try mounting each to see what is mountable, or else "
341 "examine them with L</guestfs_vfs_type> or L</guestfs_file>. Libguestfs also "
342 "has a set of APIs for inspection of disk images (see L</INSPECTION> below). "
343 "But you might find it easier to look at higher level programs built on top "
344 "of libguestfs, in particular L<virt-inspector(1)>."
348 #: ../src/guestfs.pod:168
350 "To mount a disk image read-only, use L</guestfs_mount_ro>. There are "
351 "several other variations of the C<guestfs_mount_*> call."
355 #: ../src/guestfs.pod:171
356 msgid "FILESYSTEM ACCESS AND MODIFICATION"
360 #: ../src/guestfs.pod:173
362 "The majority of the libguestfs API consists of fairly low-level calls for "
363 "accessing and modifying the files, directories, symlinks etc on mounted "
364 "filesystems. There are over a hundred such calls which you can find listed "
365 "in detail below in this man page, and we don't even pretend to cover them "
366 "all in this overview."
370 #: ../src/guestfs.pod:179
372 "Specify filenames as full paths, starting with C<\"/\"> and including the "
377 #: ../src/guestfs.pod:182
379 "For example, if you mounted a filesystem at C<\"/\"> and you want to read "
380 "the file called C<\"etc/passwd\"> then you could do:"
384 #: ../src/guestfs.pod:185
387 " char *data = guestfs_cat (g, \"/etc/passwd\");\n"
392 #: ../src/guestfs.pod:187
394 "This would return C<data> as a newly allocated buffer containing the full "
395 "content of that file (with some conditions: see also L</DOWNLOADING> below), "
396 "or C<NULL> if there was an error."
400 #: ../src/guestfs.pod:191
402 "As another example, to create a top-level directory on that filesystem "
403 "called C<\"var\"> you would do:"
407 #: ../src/guestfs.pod:194
410 " guestfs_mkdir (g, \"/var\");\n"
415 #: ../src/guestfs.pod:196
416 msgid "To create a symlink you could do:"
420 #: ../src/guestfs.pod:198
423 " guestfs_ln_s (g, \"/etc/init.d/portmap\",\n"
424 " \"/etc/rc3.d/S30portmap\");\n"
429 #: ../src/guestfs.pod:201
431 "Libguestfs will reject attempts to use relative paths and there is no "
432 "concept of a current working directory."
436 #: ../src/guestfs.pod:204
438 "Libguestfs can return errors in many situations: for example if the "
439 "filesystem isn't writable, or if a file or directory that you requested "
440 "doesn't exist. If you are using the C API (documented here) you have to "
441 "check for those error conditions after each call. (Other language bindings "
442 "turn these errors into exceptions)."
446 #: ../src/guestfs.pod:210
448 "File writes are affected by the per-handle umask, set by calling "
449 "L</guestfs_umask> and defaulting to 022. See L</UMASK>."
453 #: ../src/guestfs.pod:213
458 #: ../src/guestfs.pod:215
460 "Libguestfs contains API calls to read, create and modify partition tables on "
465 #: ../src/guestfs.pod:218
467 "In the common case where you want to create a single partition covering the "
468 "whole disk, you should use the L</guestfs_part_disk> call:"
472 #: ../src/guestfs.pod:222
475 " const char *parttype = \"mbr\";\n"
476 " if (disk_is_larger_than_2TB)\n"
477 " parttype = \"gpt\";\n"
478 " guestfs_part_disk (g, \"/dev/sda\", parttype);\n"
483 #: ../src/guestfs.pod:227
485 "Obviously this effectively wipes anything that was on that disk image "
490 #: ../src/guestfs.pod:230
495 #: ../src/guestfs.pod:232
497 "Libguestfs provides access to a large part of the LVM2 API, such as "
498 "L</guestfs_lvcreate> and L</guestfs_vgremove>. It won't make much sense "
499 "unless you familiarize yourself with the concepts of physical volumes, "
500 "volume groups and logical volumes."
504 #: ../src/guestfs.pod:237
506 "This author strongly recommends reading the LVM HOWTO, online at "
507 "L<http://tldp.org/HOWTO/LVM-HOWTO/>."
511 #: ../src/guestfs.pod:240
516 #: ../src/guestfs.pod:242
518 "Use L</guestfs_cat> to download small, text only files. This call is "
519 "limited to files which are less than 2 MB and which cannot contain any ASCII "
520 "NUL (C<\\0>) characters. However it has a very simple to use API."
524 #: ../src/guestfs.pod:247
526 "L</guestfs_read_file> can be used to read files which contain arbitrary 8 "
527 "bit data, since it returns a (pointer, size) pair. However it is still "
528 "limited to \"small\" files, less than 2 MB."
532 #: ../src/guestfs.pod:251
534 "L</guestfs_download> can be used to download any file, with no limits on "
535 "content or size (even files larger than 4 GB)."
539 #: ../src/guestfs.pod:254
540 msgid "To download multiple files, see L</guestfs_tar_out> and L</guestfs_tgz_out>."
544 #: ../src/guestfs.pod:257
549 #: ../src/guestfs.pod:259
551 "It's often the case that you want to write a file or files to the disk "
556 #: ../src/guestfs.pod:262
558 "To write a small file with fixed content, use L</guestfs_write>. To create "
559 "a file of all zeroes, use L</guestfs_truncate_size> (sparse) or "
560 "L</guestfs_fallocate64> (with all disk blocks allocated). There are a "
561 "variety of other functions for creating test files, for example "
562 "L</guestfs_fill> and L</guestfs_fill_pattern>."
566 #: ../src/guestfs.pod:268
568 "To upload a single file, use L</guestfs_upload>. This call has no limits on "
569 "file content or size (even files larger than 4 GB)."
573 #: ../src/guestfs.pod:271
574 msgid "To upload multiple files, see L</guestfs_tar_in> and L</guestfs_tgz_in>."
578 #: ../src/guestfs.pod:273
580 "However the fastest way to upload I<large numbers of arbitrary files> is to "
581 "turn them into a squashfs or CD ISO (see L<mksquashfs(8)> and "
582 "L<mkisofs(8)>), then attach this using L</guestfs_add_drive_ro>. If you add "
583 "the drive in a predictable way (eg. adding it last after all other drives) "
584 "then you can get the device name from L</guestfs_list_devices> and mount it "
585 "directly using L</guestfs_mount_ro>. Note that squashfs images are "
586 "sometimes non-portable between kernel versions, and they don't support "
587 "labels or UUIDs. If you want to pre-build an image or you need to mount it "
588 "using a label or UUID, use an ISO image instead."
592 #: ../src/guestfs.pod:284
597 #: ../src/guestfs.pod:286
599 "There are various different commands for copying between files and devices "
600 "and in and out of the guest filesystem. These are summarised in the table "
605 #: ../src/guestfs.pod:292
606 msgid "B<file> to B<file>"
610 #: ../src/guestfs.pod:294
612 "Use L</guestfs_cp> to copy a single file, or L</guestfs_cp_a> to copy "
613 "directories recursively."
617 #: ../src/guestfs.pod:297
618 msgid "B<file or device> to B<file or device>"
622 #: ../src/guestfs.pod:299
624 "Use L</guestfs_dd> which efficiently uses L<dd(1)> to copy between files and "
625 "devices in the guest."
629 #: ../src/guestfs.pod:302
630 msgid "Example: duplicate the contents of an LV:"
634 #: ../src/guestfs.pod:304
637 " guestfs_dd (g, \"/dev/VG/Original\", \"/dev/VG/Copy\");\n"
642 #: ../src/guestfs.pod:306
644 "The destination (C</dev/VG/Copy>) must be at least as large as the source "
645 "(C</dev/VG/Original>). To copy less than the whole source device, use "
646 "L</guestfs_copy_size>."
650 #: ../src/guestfs.pod:310
651 msgid "B<file on the host> to B<file or device>"
655 #: ../src/guestfs.pod:312
656 msgid "Use L</guestfs_upload>. See L</UPLOADING> above."
660 #: ../src/guestfs.pod:314
661 msgid "B<file or device> to B<file on the host>"
665 #: ../src/guestfs.pod:316
666 msgid "Use L</guestfs_download>. See L</DOWNLOADING> above."
670 #: ../src/guestfs.pod:320
671 msgid "LISTING FILES"
675 #: ../src/guestfs.pod:322
677 "L</guestfs_ll> is just designed for humans to read (mainly when using the "
678 "L<guestfish(1)>-equivalent command C<ll>)."
682 #: ../src/guestfs.pod:325
684 "L</guestfs_ls> is a quick way to get a list of files in a directory from "
685 "programs, as a flat list of strings."
689 #: ../src/guestfs.pod:328
691 "L</guestfs_readdir> is a programmatic way to get a list of files in a "
692 "directory, plus additional information about each one. It is more "
693 "equivalent to using the L<readdir(3)> call on a local filesystem."
697 #: ../src/guestfs.pod:332
699 "L</guestfs_find> and L</guestfs_find0> can be used to recursively list "
704 #: ../src/guestfs.pod:335
705 msgid "RUNNING COMMANDS"
709 #: ../src/guestfs.pod:337
711 "Although libguestfs is primarily an API for manipulating files inside guest "
712 "images, we also provide some limited facilities for running commands inside "
717 #: ../src/guestfs.pod:341
718 msgid "There are many limitations to this:"
722 #: ../src/guestfs.pod:345 ../src/guestfs.pod:350 ../src/guestfs.pod:355 ../src/guestfs.pod:359 ../src/guestfs.pod:364 ../src/guestfs.pod:368 ../src/guestfs.pod:373 ../src/guestfs.pod:1223 ../src/guestfs.pod:1228 ../src/guestfs.pod:1232 ../src/guestfs.pod:1334 ../src/guestfs.pod:1338 ../src/guestfs.pod:1342 ../src/guestfs.pod:1347 ../src/guestfs.pod:1355 ../src/guestfs.pod:1374 ../src/guestfs.pod:1382 ../src/guestfs.pod:1612 ../src/guestfs.pod:1618 ../src/guestfs.pod:1623 ../src/guestfs.pod:1629 ../src/guestfs.pod:1736 ../src/guestfs.pod:1740 ../src/guestfs.pod:1744 ../src/guestfs.pod:1748 ../src/guestfs-actions.pod:14 ../src/guestfs-actions.pod:21 ../src/guestfs-actions.pod:372 ../src/guestfs-actions.pod:380 ../src/guestfs-actions.pod:387 ../src/guestfs-actions.pod:394 ../src/guestfs-actions.pod:1257 ../src/guestfs-actions.pod:1261 ../src/guestfs-actions.pod:1265 ../src/guestfs-actions.pod:1269 ../src/guestfs-actions.pod:1277 ../src/guestfs-actions.pod:1281 ../src/guestfs-actions.pod:1285 ../src/guestfs-actions.pod:1295 ../src/guestfs-actions.pod:1299 ../src/guestfs-actions.pod:1303 ../src/guestfs-actions.pod:1426 ../src/guestfs-actions.pod:1430 ../src/guestfs-actions.pod:1435 ../src/guestfs-actions.pod:1440 ../src/guestfs-actions.pod:1492 ../src/guestfs-actions.pod:1496 ../src/guestfs-actions.pod:1501 ../fish/guestfish.pod:309 ../fish/guestfish.pod:313 ../fish/guestfish.pod:317 ../fish/guestfish.pod:321 ../fish/guestfish-actions.pod:13 ../fish/guestfish-actions.pod:20 ../fish/guestfish-actions.pod:300 ../fish/guestfish-actions.pod:308 ../fish/guestfish-actions.pod:315 ../fish/guestfish-actions.pod:322 ../fish/guestfish-actions.pod:998 ../fish/guestfish-actions.pod:1002 ../fish/guestfish-actions.pod:1006 ../fish/guestfish-actions.pod:1010 ../fish/guestfish-actions.pod:1018 ../fish/guestfish-actions.pod:1022 ../fish/guestfish-actions.pod:1026 ../fish/guestfish-actions.pod:1036 ../fish/guestfish-actions.pod:1040 ../fish/guestfish-actions.pod:1044 ../fish/guestfish-actions.pod:1134 ../fish/guestfish-actions.pod:1138 ../fish/guestfish-actions.pod:1143 ../fish/guestfish-actions.pod:1148 ../fish/guestfish-actions.pod:1190 ../fish/guestfish-actions.pod:1194 ../fish/guestfish-actions.pod:1199 ../tools/virt-resize.pl:324 ../tools/virt-resize.pl:329 ../tools/virt-resize.pl:339
727 #: ../src/guestfs.pod:347
729 "The kernel version that the command runs under will be different from what "
734 #: ../src/guestfs.pod:352
736 "If the command needs to communicate with daemons, then most likely they "
741 #: ../src/guestfs.pod:357
742 msgid "The command will be running in limited memory."
746 #: ../src/guestfs.pod:361
748 "The network may not be available unless you enable it (see "
749 "L</guestfs_set_network>)."
753 #: ../src/guestfs.pod:366
754 msgid "Only supports Linux guests (not Windows, BSD, etc)."
758 #: ../src/guestfs.pod:370
759 msgid "Architecture limitations (eg. won't work for a PPC guest on an X86 host)."
763 #: ../src/guestfs.pod:375
765 "For SELinux guests, you may need to enable SELinux and load policy first. "
766 "See L</SELINUX> in this manpage."
770 #: ../src/guestfs.pod:380
772 "The two main API calls to run commands are L</guestfs_command> and "
773 "L</guestfs_sh> (there are also variations)."
777 #: ../src/guestfs.pod:383
779 "The difference is that L</guestfs_sh> runs commands using the shell, so any "
780 "shell globs, redirections, etc will work."
784 #: ../src/guestfs.pod:386
785 msgid "CONFIGURATION FILES"
789 #: ../src/guestfs.pod:388
791 "To read and write configuration files in Linux guest filesystems, we "
792 "strongly recommend using Augeas. For example, Augeas understands how to "
793 "read and write, say, a Linux shadow password file or X.org configuration "
794 "file, and so avoids you having to write that code."
798 #: ../src/guestfs.pod:393
800 "The main Augeas calls are bound through the C<guestfs_aug_*> APIs. We don't "
801 "document Augeas itself here because there is excellent documentation on the "
802 "L<http://augeas.net/> website."
806 #: ../src/guestfs.pod:397
808 "If you don't want to use Augeas (you fool!) then try calling "
809 "L</guestfs_read_lines> to get the file as a list of lines which you can "
814 #: ../src/guestfs.pod:401
819 #: ../src/guestfs.pod:403
821 "We support SELinux guests. To ensure that labeling happens correctly in "
822 "SELinux guests, you need to enable SELinux and load the guest's policy:"
826 #: ../src/guestfs.pod:409
831 #: ../src/guestfs.pod:411
832 msgid "Before launching, do:"
836 #: ../src/guestfs.pod:413
839 " guestfs_set_selinux (g, 1);\n"
844 #: ../src/guestfs.pod:415
849 #: ../src/guestfs.pod:417
851 "After mounting the guest's filesystem(s), load the policy. This is best "
852 "done by running the L<load_policy(8)> command in the guest itself:"
856 #: ../src/guestfs.pod:421
859 " guestfs_sh (g, \"/usr/sbin/load_policy\");\n"
864 #: ../src/guestfs.pod:423
866 "(Older versions of C<load_policy> require you to specify the name of the "
871 #: ../src/guestfs.pod:426
876 #: ../src/guestfs.pod:428
878 "Optionally, set the security context for the API. The correct security "
879 "context to use can only be known by inspecting the guest. As an example:"
883 #: ../src/guestfs.pod:432
886 " guestfs_setcon (g, \"unconfined_u:unconfined_r:unconfined_t:s0\");\n"
891 #: ../src/guestfs.pod:436
892 msgid "This will work for running commands and editing existing files."
896 #: ../src/guestfs.pod:438
898 "When new files are created, you may need to label them explicitly, for "
899 "example by running the external command C<restorecon pathname>."
903 #: ../src/guestfs.pod:442
908 #: ../src/guestfs.pod:444
910 "Certain calls are affected by the current file mode creation mask (the "
911 "\"umask\"). In particular ones which create files or directories, such as "
912 "L</guestfs_touch>, L</guestfs_mknod> or L</guestfs_mkdir>. This affects "
913 "either the default mode that the file is created with or modifies the mode "
918 #: ../src/guestfs.pod:450
920 "The default umask is C<022>, so files are created with modes such as C<0644> "
921 "and directories with C<0755>."
925 #: ../src/guestfs.pod:453
927 "There are two ways to avoid being affected by umask. Either set umask to 0 "
928 "(call C<guestfs_umask (g, 0)> early after launching). Or call "
929 "L</guestfs_chmod> after creating each file or directory."
933 #: ../src/guestfs.pod:457
934 msgid "For more information about umask, see L<umask(2)>."
938 #: ../src/guestfs.pod:459 ../fish/guestfish.pod:559
939 msgid "ENCRYPTED DISKS"
943 #: ../src/guestfs.pod:461
945 "Libguestfs allows you to access Linux guests which have been encrypted using "
946 "whole disk encryption that conforms to the Linux Unified Key Setup (LUKS) "
947 "standard. This includes nearly all whole disk encryption systems used by "
948 "modern Linux guests."
952 #: ../src/guestfs.pod:467
954 "Use L</guestfs_vfs_type> to identify LUKS-encrypted block devices (it "
955 "returns the string C<crypto_LUKS>)."
959 #: ../src/guestfs.pod:470
961 "Then open these devices by calling L</guestfs_luks_open>. Obviously you "
962 "will require the passphrase!"
966 #: ../src/guestfs.pod:473
968 "Opening a LUKS device creates a new device mapper device called "
969 "C</dev/mapper/mapname> (where C<mapname> is the string you supply to "
970 "L</guestfs_luks_open>). Reads and writes to this mapper device are "
971 "decrypted from and encrypted to the underlying block device respectively."
975 #: ../src/guestfs.pod:479
977 "LVM volume groups on the device can be made visible by calling "
978 "L</guestfs_vgscan> followed by L</guestfs_vg_activate_all>. The logical "
979 "volume(s) can now be mounted in the usual way."
983 #: ../src/guestfs.pod:483
985 "Use the reverse process to close a LUKS device. Unmount any logical volumes "
986 "on it, deactivate the volume groups by caling C<guestfs_vg_activate (g, 0, "
987 "[\"/dev/VG\"])>. Then close the mapper device by calling "
988 "L</guestfs_luks_close> on the C</dev/mapper/mapname> device (I<not> the "
989 "underlying encrypted block device)."
993 #: ../src/guestfs.pod:490
998 #: ../src/guestfs.pod:492
1000 "Libguestfs has APIs for inspecting an unknown disk image to find out if it "
1001 "contains operating systems. (These APIs used to be in a separate Perl-only "
1002 "library called L<Sys::Guestfs::Lib(3)> but since version 1.5.3 the most "
1003 "frequently used part of this library has been rewritten in C and moved into "
1008 #: ../src/guestfs.pod:498
1010 "Add all disks belonging to the unknown virtual machine and call "
1011 "L</guestfs_launch> in the usual way."
1015 #: ../src/guestfs.pod:501
1017 "Then call L</guestfs_inspect_os>. This function uses other libguestfs calls "
1018 "and certain heuristics, and returns a list of operating systems that were "
1019 "found. An empty list means none were found. A single element is the root "
1020 "filesystem of the operating system. For dual- or multi-boot guests, "
1021 "multiple roots can be returned, each one corresponding to a separate "
1022 "operating system. (Multi-boot virtual machines are extremely rare in the "
1023 "world of virtualization, but since this scenario can happen, we have built "
1024 "libguestfs to deal with it.)"
1028 #: ../src/guestfs.pod:510
1030 "For each root, you can then call various C<guestfs_inspect_get_*> functions "
1031 "to get additional details about that operating system. For example, call "
1032 "L</guestfs_inspect_get_type> to return the string C<windows> or C<linux> for "
1033 "Windows and Linux-based operating systems respectively."
1037 #: ../src/guestfs.pod:516
1039 "Un*x-like and Linux-based operating systems usually consist of several "
1040 "filesystems which are mounted at boot time (for example, a separate boot "
1041 "partition mounted on C</boot>). The inspection rules are able to detect how "
1042 "filesystems correspond to mount points. Call "
1043 "C<guestfs_inspect_get_mountpoints> to get this mapping. It might return a "
1044 "hash table like this example:"
1048 #: ../src/guestfs.pod:523
1051 " /boot => /dev/sda1\n"
1052 " / => /dev/vg_guest/lv_root\n"
1053 " /usr => /dev/vg_guest/lv_usr\n"
1058 #: ../src/guestfs.pod:527
1060 "The caller can then make calls to L</guestfs_mount_options> to mount the "
1061 "filesystems as suggested."
1065 #: ../src/guestfs.pod:530
1067 "Be careful to mount filesystems in the right order (eg. C</> before "
1068 "C</usr>). Sorting the keys of the hash by length, shortest first, should "
1073 #: ../src/guestfs.pod:534
1075 "Inspection currently only works for some common operating systems. "
1076 "Contributors are welcome to send patches for other operating systems that we "
1077 "currently cannot detect."
1081 #: ../src/guestfs.pod:538
1083 "Encrypted disks must be opened before inspection. See L</ENCRYPTED DISKS> "
1084 "for more details. The L</guestfs_inspect_os> function just ignores any "
1085 "encrypted devices."
1089 #: ../src/guestfs.pod:542
1091 "A note on the implementation: The call L</guestfs_inspect_os> performs "
1092 "inspection and caches the results in the guest handle. Subsequent calls to "
1093 "C<guestfs_inspect_get_*> return this cached information, but I<do not> "
1094 "re-read the disks. If you change the content of the guest disks, you can "
1095 "redo inspection by calling L</guestfs_inspect_os> again."
1099 #: ../src/guestfs.pod:549
1100 msgid "SPECIAL CONSIDERATIONS FOR WINDOWS GUESTS"
1104 #: ../src/guestfs.pod:551
1106 "Libguestfs can mount NTFS partitions. It does this using the "
1107 "L<http://www.ntfs-3g.org/> driver."
1111 #: ../src/guestfs.pod:554
1113 "DOS and Windows still use drive letters, and the filesystems are always "
1114 "treated as case insensitive by Windows itself, and therefore you might find "
1115 "a Windows configuration file referring to a path like "
1116 "C<c:\\windows\\system32>. When the filesystem is mounted in libguestfs, "
1117 "that directory might be referred to as C</WINDOWS/System32>."
1121 #: ../src/guestfs.pod:560
1123 "Drive letter mappings are outside the scope of libguestfs. You have to use "
1124 "libguestfs to read the appropriate Windows Registry and configuration files, "
1125 "to determine yourself how drives are mapped (see also L<hivex(3)> and "
1126 "L<virt-inspector(1)>)."
1130 #: ../src/guestfs.pod:565
1132 "Replacing backslash characters with forward slash characters is also outside "
1133 "the scope of libguestfs, but something that you can easily do."
1137 #: ../src/guestfs.pod:568
1139 "Where we can help is in resolving the case insensitivity of paths. For "
1140 "this, call L</guestfs_case_sensitive_path>."
1144 #: ../src/guestfs.pod:571
1146 "Libguestfs also provides some help for decoding Windows Registry \"hive\" "
1147 "files, through the library C<hivex> which is part of the libguestfs project "
1148 "although ships as a separate tarball. You have to locate and download the "
1149 "hive file(s) yourself, and then pass them to C<hivex> functions. See also "
1150 "the programs L<hivexml(1)>, L<hivexsh(1)>, L<hivexregedit(1)> and "
1151 "L<virt-win-reg(1)> for more help on this issue."
1155 #: ../src/guestfs.pod:579
1156 msgid "USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES"
1160 #: ../src/guestfs.pod:581
1162 "Although we don't want to discourage you from using the C API, we will "
1163 "mention here that the same API is also available in other languages."
1167 #: ../src/guestfs.pod:584
1169 "The API is broadly identical in all supported languages. This means that "
1170 "the C call C<guestfs_mount(g,path)> is C<$g-E<gt>mount($path)> in Perl, "
1171 "C<g.mount(path)> in Python, and C<Guestfs.mount g path> in OCaml. In other "
1172 "words, a straightforward, predictable isomorphism between each language."
1176 #: ../src/guestfs.pod:590
1178 "Error messages are automatically transformed into exceptions if the language "
1183 #: ../src/guestfs.pod:593
1185 "We don't try to \"object orientify\" parts of the API in OO languages, "
1186 "although contributors are welcome to write higher level APIs above what we "
1187 "provide in their favourite languages if they wish."
1191 #: ../src/guestfs.pod:599
1196 #: ../src/guestfs.pod:601
1198 "You can use the I<guestfs.h> header file from C++ programs. The C++ API is "
1199 "identical to the C API. C++ classes and exceptions are not used."
1203 #: ../src/guestfs.pod:605
1208 #: ../src/guestfs.pod:607
1210 "The C# bindings are highly experimental. Please read the warnings at the "
1211 "top of C<csharp/Libguestfs.cs>."
1215 #: ../src/guestfs.pod:610
1220 #: ../src/guestfs.pod:612
1222 "This is the only language binding that is working but incomplete. Only "
1223 "calls which return simple integers have been bound in Haskell, and we are "
1224 "looking for help to complete this binding."
1228 #: ../src/guestfs.pod:616
1233 #: ../src/guestfs.pod:618
1235 "Full documentation is contained in the Javadoc which is distributed with "
1240 #: ../src/guestfs.pod:621
1245 #: ../src/guestfs.pod:623
1246 msgid "For documentation see the file C<guestfs.mli>."
1250 #: ../src/guestfs.pod:625
1255 #: ../src/guestfs.pod:627
1256 msgid "For documentation see L<Sys::Guestfs(3)>."
1260 #: ../src/guestfs.pod:629
1265 #: ../src/guestfs.pod:631
1267 "For documentation see C<README-PHP> supplied with libguestfs sources or in "
1268 "the php-libguestfs package for your distribution."
1272 #: ../src/guestfs.pod:634
1273 msgid "The PHP binding only works correctly on 64 bit machines."
1277 #: ../src/guestfs.pod:636
1282 #: ../src/guestfs.pod:638
1283 msgid "For documentation do:"
1287 #: ../src/guestfs.pod:640
1291 " >>> import guestfs\n"
1292 " >>> help (guestfs)\n"
1297 #: ../src/guestfs.pod:644
1302 #: ../src/guestfs.pod:646
1304 "Use the Guestfs module. There is no Ruby-specific documentation, but you "
1305 "can find examples written in Ruby in the libguestfs source."
1309 #: ../src/guestfs.pod:649
1310 msgid "B<shell scripts>"
1314 #: ../src/guestfs.pod:651
1315 msgid "For documentation see L<guestfish(1)>."
1319 #: ../src/guestfs.pod:655
1320 msgid "LIBGUESTFS GOTCHAS"
1324 #: ../src/guestfs.pod:657
1326 "L<http://en.wikipedia.org/wiki/Gotcha_(programming)>: \"A feature of a "
1327 "system [...] that works in the way it is documented but is counterintuitive "
1328 "and almost invites mistakes.\""
1332 #: ../src/guestfs.pod:661
1334 "Since we developed libguestfs and the associated tools, there are several "
1335 "things we would have designed differently, but are now stuck with for "
1336 "backwards compatibility or other reasons. If there is ever a libguestfs 2.0 "
1337 "release, you can expect these to change. Beware of them."
1341 #: ../src/guestfs.pod:669
1342 msgid "Autosync / forgetting to sync."
1346 #: ../src/guestfs.pod:671
1348 "When modifying a filesystem from C or another language, you B<must> unmount "
1349 "all filesystems and call L</guestfs_sync> explicitly before you close the "
1350 "libguestfs handle. You can also call:"
1354 #: ../src/guestfs.pod:675
1357 " guestfs_set_autosync (g, 1);\n"
1362 #: ../src/guestfs.pod:677
1364 "to have the unmount/sync done automatically for you when the handle 'g' is "
1365 "closed. (This feature is called \"autosync\", L</guestfs_set_autosync> "
1370 #: ../src/guestfs.pod:681
1372 "If you forget to do this, then it is entirely possible that your changes "
1373 "won't be written out, or will be partially written, or (very rarely) that "
1374 "you'll get disk corruption."
1378 #: ../src/guestfs.pod:685
1380 "Note that in L<guestfish(3)> autosync is the default. So quick and dirty "
1381 "guestfish scripts that forget to sync will work just fine, which can make "
1382 "this very puzzling if you are trying to debug a problem."
1386 #: ../src/guestfs.pod:689
1387 msgid "Mount option C<-o sync> should not be the default."
1391 #: ../src/guestfs.pod:691
1393 "If you use L</guestfs_mount>, then C<-o sync,noatime> are added implicitly. "
1394 "However C<-o sync> does not add any reliability benefit, but does have a "
1395 "very large performance impact."
1399 #: ../src/guestfs.pod:695
1401 "The work around is to use L</guestfs_mount_options> and set the mount "
1402 "options that you actually want to use."
1406 #: ../src/guestfs.pod:698
1407 msgid "Read-only should be the default."
1411 #: ../src/guestfs.pod:700
1413 "In L<guestfish(3)>, I<--ro> should be the default, and you should have to "
1414 "specify I<--rw> if you want to make changes to the image."
1418 #: ../src/guestfs.pod:703
1419 msgid "This would reduce the potential to corrupt live VM images."
1423 #: ../src/guestfs.pod:705
1425 "Note that many filesystems change the disk when you just mount and unmount, "
1426 "even if you didn't perform any writes. You need to use "
1427 "L</guestfs_add_drive_ro> to guarantee that the disk is not changed."
1431 #: ../src/guestfs.pod:709
1432 msgid "guestfish command line is hard to use."
1436 #: ../src/guestfs.pod:711
1438 "C<guestfish disk.img> doesn't do what people expect (open C<disk.img> for "
1439 "examination). It tries to run a guestfish command C<disk.img> which doesn't "
1440 "exist, so it fails. In earlier versions of guestfish the error message was "
1441 "also unintuitive, but we have corrected this since. Like the Bourne shell, "
1442 "we should have used C<guestfish -c command> to run commands."
1446 #: ../src/guestfs.pod:718
1447 msgid "guestfish megabyte modifiers don't work right on all commands"
1451 #: ../src/guestfs.pod:720
1453 "In recent guestfish you can use C<1M> to mean 1 megabyte (and similarly for "
1454 "other modifiers). What guestfish actually does is to multiply the number "
1455 "part by the modifier part and pass the result to the C API. However this "
1456 "doesn't work for a few APIs which aren't expecting bytes, but are already "
1457 "expecting some other unit (eg. megabytes)."
1461 #: ../src/guestfs.pod:727
1462 msgid "The most common is L</guestfs_lvcreate>. The guestfish command:"
1466 #: ../src/guestfs.pod:729
1469 " lvcreate LV VG 100M\n"
1474 #: ../src/guestfs.pod:731
1476 "does not do what you might expect. Instead because L</guestfs_lvcreate> is "
1477 "already expecting megabytes, this tries to create a 100 I<terabyte> (100 "
1478 "megabytes * megabytes) logical volume. The error message you get from this "
1479 "is also a little obscure."
1483 #: ../src/guestfs.pod:736
1485 "This could be fixed in the generator by specially marking parameters and "
1486 "return values which take bytes or other units."
1490 #: ../src/guestfs.pod:739
1491 msgid "Library should return errno with error messages."
1495 #: ../src/guestfs.pod:741
1497 "It would be a nice-to-have to be able to get the original value of 'errno' "
1498 "from inside the appliance along error paths (where set). Currently "
1499 "L<guestmount(1)> goes through hoops to try to reverse the error message "
1500 "string into an errno, see the function error() in fuse/guestmount.c."
1504 #: ../src/guestfs.pod:747
1506 "In libguestfs 1.5.4, the protocol was changed so that the Linux errno is "
1507 "sent back from the daemon."
1511 #: ../src/guestfs.pod:752
1512 msgid "PROTOCOL LIMITS"
1516 #: ../src/guestfs.pod:754
1518 "Internally libguestfs uses a message-based protocol to pass API calls and "
1519 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1520 "plenty more detail about this). The maximum message size used by the "
1521 "protocol is slightly less than 4 MB. For some API calls you may need to be "
1522 "aware of this limit. The API calls which may be affected are individually "
1523 "documented, with a link back to this section of the documentation."
1527 #: ../src/guestfs.pod:762
1529 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1530 "a simple string. Because this string is at some point internally encoded as "
1531 "a message, the maximum size that it can return is slightly under 4 MB. If "
1532 "the requested file is larger than this then you will get an error."
1536 #: ../src/guestfs.pod:768
1538 "In order to transfer large files into and out of the guest filesystem, you "
1539 "need to use particular calls that support this. The sections L</UPLOADING> "
1540 "and L</DOWNLOADING> document how to do this."
1544 #: ../src/guestfs.pod:772
1546 "You might also consider mounting the disk image using our FUSE filesystem "
1547 "support (L<guestmount(1)>)."
1551 #: ../src/guestfs.pod:775
1552 msgid "KEYS AND PASSPHRASES"
1556 #: ../src/guestfs.pod:777
1558 "Certain libguestfs calls take a parameter that contains sensitive key "
1559 "material, passed in as a C string."
1563 #: ../src/guestfs.pod:780
1565 "In the future we would hope to change the libguestfs implementation so that "
1566 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1567 "swap. However this is I<not> done at the moment, because of the complexity "
1568 "of such an implementation."
1572 #: ../src/guestfs.pod:785
1574 "Therefore you should be aware that any key parameter you pass to libguestfs "
1575 "might end up being written out to the swap partition. If this is a concern, "
1576 "scrub the swap partition or don't use libguestfs on encrypted devices."
1580 #: ../src/guestfs.pod:790
1581 msgid "CONNECTION MANAGEMENT"
1585 #: ../src/guestfs.pod:792
1590 #: ../src/guestfs.pod:794
1592 "C<guestfs_h> is the opaque type representing a connection handle. Create a "
1593 "handle by calling L</guestfs_create>. Call L</guestfs_close> to free the "
1594 "handle and release all resources used."
1598 #: ../src/guestfs.pod:798
1600 "For information on using multiple handles and threads, see the section "
1601 "L</MULTIPLE HANDLES AND MULTIPLE THREADS> below."
1605 #: ../src/guestfs.pod:801
1606 msgid "guestfs_create"
1610 #: ../src/guestfs.pod:803
1613 " guestfs_h *guestfs_create (void);\n"
1618 #: ../src/guestfs.pod:805
1619 msgid "Create a connection handle."
1623 #: ../src/guestfs.pod:807
1624 msgid "You have to call L</guestfs_add_drive> on the handle at least once."
1628 #: ../src/guestfs.pod:809
1630 "This function returns a non-NULL pointer to a handle on success or NULL on "
1635 #: ../src/guestfs.pod:812
1636 msgid "After configuring the handle, you have to call L</guestfs_launch>."
1640 #: ../src/guestfs.pod:814
1642 "You may also want to configure error handling for the handle. See L</ERROR "
1643 "HANDLING> section below."
1647 #: ../src/guestfs.pod:817
1648 msgid "guestfs_close"
1652 #: ../src/guestfs.pod:819
1655 " void guestfs_close (guestfs_h *g);\n"
1660 #: ../src/guestfs.pod:821
1661 msgid "This closes the connection handle and frees up all resources used."
1665 #: ../src/guestfs.pod:823
1666 msgid "ERROR HANDLING"
1670 #: ../src/guestfs.pod:825
1672 "The convention in all functions that return C<int> is that they return C<-1> "
1673 "to indicate an error. You can get additional information on errors by "
1674 "calling L</guestfs_last_error> and/or by setting up an error handler with "
1675 "L</guestfs_set_error_handler>."
1679 #: ../src/guestfs.pod:830
1680 msgid "The default error handler prints the information string to C<stderr>."
1684 #: ../src/guestfs.pod:832
1686 "Out of memory errors are handled differently. The default action is to call "
1687 "L<abort(3)>. If this is undesirable, then you can set a handler using "
1688 "L</guestfs_set_out_of_memory_handler>."
1692 #: ../src/guestfs.pod:836
1693 msgid "guestfs_last_error"
1697 #: ../src/guestfs.pod:838
1700 " const char *guestfs_last_error (guestfs_h *g);\n"
1705 #: ../src/guestfs.pod:840
1707 "This returns the last error message that happened on C<g>. If there has not "
1708 "been an error since the handle was created, then this returns C<NULL>."
1712 #: ../src/guestfs.pod:844
1714 "The lifetime of the returned string is until the next error occurs, or "
1715 "L</guestfs_close> is called."
1719 #: ../src/guestfs.pod:847
1721 "The error string is not localized (ie. is always in English), because this "
1722 "makes searching for error messages in search engines give the largest number "
1727 #: ../src/guestfs.pod:851
1728 msgid "guestfs_set_error_handler"
1732 #: ../src/guestfs.pod:853
1735 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
1737 " const char *msg);\n"
1738 " void guestfs_set_error_handler (guestfs_h *g,\n"
1739 " guestfs_error_handler_cb cb,\n"
1745 #: ../src/guestfs.pod:860
1747 "The callback C<cb> will be called if there is an error. The parameters "
1748 "passed to the callback are an opaque data pointer and the error message "
1753 #: ../src/guestfs.pod:864
1755 "Note that the message string C<msg> is freed as soon as the callback "
1756 "function returns, so if you want to stash it somewhere you must make your "
1761 #: ../src/guestfs.pod:868
1762 msgid "The default handler prints messages on C<stderr>."
1766 #: ../src/guestfs.pod:870
1767 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
1771 #: ../src/guestfs.pod:872
1772 msgid "guestfs_get_error_handler"
1776 #: ../src/guestfs.pod:874
1779 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
1780 " void **opaque_rtn);\n"
1785 #: ../src/guestfs.pod:877
1786 msgid "Returns the current error handler callback."
1790 #: ../src/guestfs.pod:879
1791 msgid "guestfs_set_out_of_memory_handler"
1795 #: ../src/guestfs.pod:881
1798 " typedef void (*guestfs_abort_cb) (void);\n"
1799 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
1800 " guestfs_abort_cb);\n"
1805 #: ../src/guestfs.pod:885
1807 "The callback C<cb> will be called if there is an out of memory situation. "
1808 "I<Note this callback must not return>."
1812 #: ../src/guestfs.pod:888
1813 msgid "The default is to call L<abort(3)>."
1817 #: ../src/guestfs.pod:890
1818 msgid "You cannot set C<cb> to C<NULL>. You can't ignore out of memory situations."
1822 #: ../src/guestfs.pod:893
1823 msgid "guestfs_get_out_of_memory_handler"
1827 #: ../src/guestfs.pod:895
1830 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
1835 #: ../src/guestfs.pod:897
1836 msgid "This returns the current out of memory handler."
1840 #: ../src/guestfs.pod:899
1845 #: ../src/guestfs.pod:901
1847 "Libguestfs needs a kernel and initrd.img, which it finds by looking along an "
1852 #: ../src/guestfs.pod:904
1854 "By default it looks for these in the directory C<$libdir/guestfs> "
1855 "(eg. C</usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
1859 #: ../src/guestfs.pod:907
1861 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
1862 "to change the directories that libguestfs will search in. The value is a "
1863 "colon-separated list of paths. The current directory is I<not> searched "
1864 "unless the path contains an empty element or C<.>. For example "
1865 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
1866 "then C</usr/lib/guestfs>."
1870 #: ../src/guestfs.pod:914
1871 msgid "HIGH-LEVEL API ACTIONS"
1875 #: ../src/guestfs.pod:916
1876 msgid "ABI GUARANTEE"
1880 #: ../src/guestfs.pod:918
1882 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
1883 "actions as outlined in this section. Although we will deprecate some "
1884 "actions, for example if they get replaced by newer calls, we will keep the "
1885 "old actions forever. This allows you the developer to program in confidence "
1886 "against the libguestfs API."
1890 #: ../src/guestfs.pod:924 ../fish/guestfish.pod:926
1895 #: ../src/guestfs.pod:926
1900 #: ../src/guestfs.pod:928
1905 #: ../src/guestfs.pod:930
1906 msgid "AVAILABILITY"
1910 #: ../src/guestfs.pod:932
1911 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
1915 #: ../src/guestfs.pod:934
1917 "Using L</guestfs_available> you can test availability of the following "
1918 "groups of functions. This test queries the appliance to see if the "
1919 "appliance you are currently using supports the functionality."
1923 #: ../src/guestfs.pod:939
1924 msgid "@AVAILABILITY@"
1928 #: ../src/guestfs.pod:941
1929 msgid "GUESTFISH supported COMMAND"
1933 #: ../src/guestfs.pod:943
1935 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
1936 "prints out the available groups and whether they are supported by this build "
1937 "of libguestfs. Note however that you have to do C<run> first."
1941 #: ../src/guestfs.pod:948
1942 msgid "SINGLE CALLS AT COMPILE TIME"
1946 #: ../src/guestfs.pod:950
1948 "Since version 1.5.8, C<E<lt>guestfs.hE<gt>> defines symbols for each C API "
1949 "function, such as:"
1953 #: ../src/guestfs.pod:953
1956 " #define LIBGUESTFS_HAVE_DD 1\n"
1961 #: ../src/guestfs.pod:955
1962 msgid "if L</guestfs_dd> is available."
1966 #: ../src/guestfs.pod:957
1968 "Before version 1.5.8, if you needed to test whether a single libguestfs "
1969 "function is available at compile time, we recommended using build tools such "
1970 "as autoconf or cmake. For example in autotools you could use:"
1974 #: ../src/guestfs.pod:962
1977 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
1978 " AC_CHECK_FUNCS([guestfs_dd])\n"
1983 #: ../src/guestfs.pod:965
1985 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
1990 #: ../src/guestfs.pod:968
1991 msgid "SINGLE CALLS AT RUN TIME"
1995 #: ../src/guestfs.pod:970
1997 "Testing at compile time doesn't guarantee that a function really exists in "
1998 "the library. The reason is that you might be dynamically linked against a "
1999 "previous I<libguestfs.so> (dynamic library) which doesn't have the call. "
2000 "This situation unfortunately results in a segmentation fault, which is a "
2001 "shortcoming of the C dynamic linking system itself."
2005 #: ../src/guestfs.pod:977
2007 "You can use L<dlopen(3)> to test if a function is available at run time, as "
2008 "in this example program (note that you still need the compile time check as "
2013 #: ../src/guestfs.pod:981
2016 " #include <stdio.h>\n"
2017 " #include <stdlib.h>\n"
2018 " #include <unistd.h>\n"
2019 " #include <dlfcn.h>\n"
2020 " #include <guestfs.h>\n"
2025 #: ../src/guestfs.pod:987
2030 " #ifdef LIBGUESTFS_HAVE_DD\n"
2032 " int has_function;\n"
2037 #: ../src/guestfs.pod:993
2040 " /* Test if the function guestfs_dd is really available. */\n"
2041 " dl = dlopen (NULL, RTLD_LAZY);\n"
2043 " fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
2044 " exit (EXIT_FAILURE);\n"
2046 " has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
2052 #: ../src/guestfs.pod:1002
2055 " if (!has_function)\n"
2056 " printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
2058 " printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
2059 " /* Now it's safe to call\n"
2060 " guestfs_dd (g, \"foo\", \"bar\");\n"
2064 " printf (\"guestfs_dd function was not found at compile time\\n\");\n"
2071 #: ../src/guestfs.pod:1015
2073 "You may think the above is an awful lot of hassle, and it is. There are "
2074 "other ways outside of the C linking system to ensure that this kind of "
2075 "incompatibility never arises, such as using package versioning:"
2079 #: ../src/guestfs.pod:1020
2082 " Requires: libguestfs >= 1.0.80\n"
2087 #: ../src/guestfs.pod:1022 ../src/guestfs.pod:1027
2092 #: ../src/guestfs.pod:1024
2094 "<!-- old anchor for the next section --> <a "
2095 "name=\"state_machine_and_low_level_event_api\"/>"
2099 #: ../src/guestfs.pod:1029
2100 msgid "ARCHITECTURE"
2104 #: ../src/guestfs.pod:1031
2106 "Internally, libguestfs is implemented by running an appliance (a special "
2107 "type of small virtual machine) using L<qemu(1)>. Qemu runs as a child "
2108 "process of the main program."
2112 #: ../src/guestfs.pod:1035
2115 " ___________________\n"
2117 " | main program |\n"
2119 " | | child process / appliance\n"
2120 " | | __________________________\n"
2122 " +-------------------+ RPC | +-----------------+ |\n"
2123 " | libguestfs <--------------------> guestfsd | |\n"
2124 " | | | +-----------------+ |\n"
2125 " \\___________________/ | | Linux kernel | |\n"
2126 " | +--^--------------+ |\n"
2127 " \\_________|________________/\n"
2133 " \\______________/\n"
2138 #: ../src/guestfs.pod:1055
2140 "The library, linked to the main program, creates the child process and hence "
2141 "the appliance in the L</guestfs_launch> function."
2145 #: ../src/guestfs.pod:1058
2147 "Inside the appliance is a Linux kernel and a complete stack of userspace "
2148 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
2149 "L</guestfsd>. The library talks to L</guestfsd> using remote procedure "
2150 "calls (RPC). There is a mostly one-to-one correspondence between libguestfs "
2151 "API calls and RPC calls to the daemon. Lastly the disk image(s) are "
2152 "attached to the qemu process which translates device access by the "
2153 "appliance's Linux kernel into accesses to the image."
2157 #: ../src/guestfs.pod:1067
2159 "A common misunderstanding is that the appliance \"is\" the virtual machine. "
2160 "Although the disk image you are attached to might also be used by some "
2161 "virtual machine, libguestfs doesn't know or care about this. (But you will "
2162 "care if both libguestfs's qemu process and your virtual machine are trying "
2163 "to update the disk image at the same time, since these usually results in "
2164 "massive disk corruption)."
2168 #: ../src/guestfs.pod:1074
2169 msgid "STATE MACHINE"
2173 #: ../src/guestfs.pod:1076
2174 msgid "libguestfs uses a state machine to model the child process:"
2178 #: ../src/guestfs.pod:1078
2190 " / | \\ \\ guestfs_launch\n"
2191 " / | _\\__V______\n"
2193 " / | | LAUNCHING |\n"
2194 " / | \\___________/\n"
2196 " / | guestfs_launch\n"
2198 " ______ / __|____V\n"
2199 " / \\ ------> / \\\n"
2200 " | BUSY | | READY |\n"
2201 " \\______/ <------ \\________/\n"
2206 #: ../src/guestfs.pod:1100
2208 "The normal transitions are (1) CONFIG (when the handle is created, but there "
2209 "is no child process), (2) LAUNCHING (when the child process is booting up), "
2210 "(3) alternating between READY and BUSY as commands are issued to, and "
2211 "carried out by, the child process."
2215 #: ../src/guestfs.pod:1105
2217 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
2218 "asynchronously at any time (eg. due to some internal error), and that causes "
2219 "the state to transition back to CONFIG."
2223 #: ../src/guestfs.pod:1109
2225 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
2226 "issued when in the CONFIG state."
2230 #: ../src/guestfs.pod:1112
2232 "The API offers one call that goes from CONFIG through LAUNCHING to READY. "
2233 "L</guestfs_launch> blocks until the child process is READY to accept "
2234 "commands (or until some failure or timeout). L</guestfs_launch> internally "
2235 "moves the state from CONFIG to LAUNCHING while it is running."
2239 #: ../src/guestfs.pod:1118
2241 "API actions such as L</guestfs_mount> can only be issued when in the READY "
2242 "state. These API calls block waiting for the command to be carried out "
2243 "(ie. the state to transition to BUSY and then back to READY). There are no "
2244 "non-blocking versions, and no way to issue more than one command per handle "
2249 #: ../src/guestfs.pod:1124
2251 "Finally, the child process sends asynchronous messages back to the main "
2252 "program, such as kernel log messages. You can register a callback to "
2253 "receive these messages."
2257 #: ../src/guestfs.pod:1128
2258 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
2262 #: ../src/guestfs.pod:1130
2264 "The child process generates events in some situations. Current events "
2265 "include: receiving a log message, the child process exits."
2269 #: ../src/guestfs.pod:1133
2271 "Use the C<guestfs_set_*_callback> functions to set a callback for different "
2276 #: ../src/guestfs.pod:1136
2278 "Only I<one callback of each type> can be registered for each handle. "
2279 "Calling C<guestfs_set_*_callback> again overwrites the previous callback of "
2280 "that type. Cancel all callbacks of this type by calling this function with "
2281 "C<cb> set to C<NULL>."
2285 #: ../src/guestfs.pod:1141
2286 msgid "guestfs_set_log_message_callback"
2290 #: ../src/guestfs.pod:1143
2293 " typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,\n"
2294 " char *buf, int len);\n"
2295 " void guestfs_set_log_message_callback (guestfs_h *g,\n"
2296 " guestfs_log_message_cb cb,\n"
2302 #: ../src/guestfs.pod:1149
2304 "The callback function C<cb> will be called whenever qemu or the guest writes "
2305 "anything to the console."
2309 #: ../src/guestfs.pod:1152
2310 msgid "Use this function to capture kernel messages and similar."
2314 #: ../src/guestfs.pod:1154
2316 "Normally there is no log message handler, and log messages are just "
2321 #: ../src/guestfs.pod:1157
2322 msgid "guestfs_set_subprocess_quit_callback"
2326 #: ../src/guestfs.pod:1159
2329 " typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);\n"
2330 " void guestfs_set_subprocess_quit_callback (guestfs_h *g,\n"
2331 " guestfs_subprocess_quit_cb cb,\n"
2337 #: ../src/guestfs.pod:1164
2339 "The callback function C<cb> will be called when the child process quits, "
2340 "either asynchronously or if killed by L</guestfs_kill_subprocess>. (This "
2341 "corresponds to a transition from any state to the CONFIG state)."
2345 #: ../src/guestfs.pod:1169
2346 msgid "guestfs_set_launch_done_callback"
2350 #: ../src/guestfs.pod:1171
2353 " typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);\n"
2354 " void guestfs_set_launch_done_callback (guestfs_h *g,\n"
2355 " guestfs_launch_done_cb cb,\n"
2361 #: ../src/guestfs.pod:1176
2363 "The callback function C<cb> will be called when the child process becomes "
2364 "ready first time after it has been launched. (This corresponds to a "
2365 "transition from LAUNCHING to the READY state)."
2369 #: ../src/guestfs.pod:1180
2370 msgid "guestfs_set_close_callback"
2374 #: ../src/guestfs.pod:1182
2377 " typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);\n"
2378 " void guestfs_set_close_callback (guestfs_h *g,\n"
2379 " guestfs_close_cb cb,\n"
2385 #: ../src/guestfs.pod:1187
2387 "The callback function C<cb> will be called while the handle is being closed "
2388 "(synchronously from L</guestfs_close>)."
2392 #: ../src/guestfs.pod:1190
2394 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
2395 "handles that are open when the program exits. This means that this callback "
2396 "might be called indirectly from L<exit(3)>, which can cause unexpected "
2397 "problems in higher-level languages (eg. if your HLL interpreter has already "
2398 "been cleaned up by the time this is called, and if your callback then jumps "
2399 "into some HLL function)."
2403 #: ../src/guestfs.pod:1198
2404 msgid "guestfs_set_progress_callback"
2408 #: ../src/guestfs.pod:1200
2411 " typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque,\n"
2412 " int proc_nr, int serial,\n"
2413 " uint64_t position, uint64_t total);\n"
2414 " void guestfs_set_progress_callback (guestfs_h *g,\n"
2415 " guestfs_progress_cb cb,\n"
2421 #: ../src/guestfs.pod:1207
2423 "Some long-running operations can generate progress messages. If this "
2424 "callback is registered, then it will be called each time a progress message "
2425 "is generated (usually two seconds after the operation started, and three "
2426 "times per second thereafter until it completes, although the frequency may "
2427 "change in future versions)."
2431 #: ../src/guestfs.pod:1213
2433 "The callback receives two numbers: C<position> and C<total>. The units of "
2434 "C<total> are not defined, although for some operations C<total> may relate "
2435 "in some way to the amount of data to be transferred (eg. in bytes or "
2436 "megabytes), and C<position> may be the portion which has been transferred."
2440 #: ../src/guestfs.pod:1219
2441 msgid "The only defined and stable parts of the API are:"
2445 #: ../src/guestfs.pod:1225
2447 "The callback can display to the user some type of progress bar or indicator "
2448 "which shows the ratio of C<position>:C<total>."
2452 #: ../src/guestfs.pod:1230
2453 msgid "0 E<lt>= C<position> E<lt>= C<total>"
2457 #: ../src/guestfs.pod:1234
2459 "If any progress notification is sent during a call, then a final progress "
2460 "notification is always sent when C<position> = C<total>."
2464 #: ../src/guestfs.pod:1237
2466 "This is to simplify caller code, so callers can easily set the progress "
2467 "indicator to \"100%\" at the end of the operation, without requiring special "
2468 "code to detect this case."
2472 #: ../src/guestfs.pod:1243
2474 "The callback also receives the procedure number and serial number of the "
2475 "call. These are only useful for debugging protocol issues, and the callback "
2476 "can normally ignore them. The callback may want to print these numbers in "
2477 "error messages or debugging messages."
2481 #: ../src/guestfs.pod:1248
2482 msgid "PRIVATE DATA AREA"
2486 #: ../src/guestfs.pod:1250
2488 "You can attach named pieces of private data to the libguestfs handle, and "
2489 "fetch them by name for the lifetime of the handle. This is called the "
2490 "private data area and is only available from the C API."
2494 #: ../src/guestfs.pod:1254
2495 msgid "To attach a named piece of data, use the following call:"
2499 #: ../src/guestfs.pod:1256
2502 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
2507 #: ../src/guestfs.pod:1258
2509 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
2510 "pointer (which can be C<NULL>). Any previous item with the same name is "
2515 #: ../src/guestfs.pod:1262
2517 "You can use any C<key> you want, but names beginning with an underscore "
2518 "character are reserved for internal libguestfs purposes (for implementing "
2519 "language bindings). It is recommended to prefix the name with some unique "
2520 "string to avoid collisions with other users."
2524 #: ../src/guestfs.pod:1267
2525 msgid "To retrieve the pointer, use:"
2529 #: ../src/guestfs.pod:1269
2532 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
2537 #: ../src/guestfs.pod:1271
2539 "This function returns C<NULL> if either no data is found associated with "
2540 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
2545 #: ../src/guestfs.pod:1275
2547 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
2548 "way. As far as libguestfs is concerned, it need not be a valid pointer at "
2549 "all. In particular, libguestfs does I<not> try to free the data when the "
2550 "handle is closed. If the data must be freed, then the caller must either "
2551 "free it before calling L</guestfs_close> or must set up a close callback to "
2552 "do it (see L</guestfs_set_close_callback>, and note that only one callback "
2553 "can be registered for a handle)."
2557 #: ../src/guestfs.pod:1283
2559 "The private data area is implemented using a hash table, and should be "
2560 "reasonably efficient for moderate numbers of keys."
2564 #: ../src/guestfs.pod:1286
2565 msgid "BLOCK DEVICE NAMING"
2569 #: ../src/guestfs.pod:1288
2571 "In the kernel there is now quite a profusion of schemata for naming block "
2572 "devices (in this context, by I<block device> I mean a physical or virtual "
2573 "hard drive). The original Linux IDE driver used names starting with "
2574 "C</dev/hd*>. SCSI devices have historically used a different naming scheme, "
2575 "C</dev/sd*>. When the Linux kernel I<libata> driver became a popular "
2576 "replacement for the old IDE driver (particularly for SATA devices) those "
2577 "devices also used the C</dev/sd*> scheme. Additionally we now have virtual "
2578 "machines with paravirtualized drivers. This has created several different "
2579 "naming systems, such as C</dev/vd*> for virtio disks and C</dev/xvd*> for "
2584 #: ../src/guestfs.pod:1300
2586 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2587 "Linux kernel to access block devices. We can run a variety of appliances "
2588 "based on a variety of Linux kernels."
2592 #: ../src/guestfs.pod:1304
2594 "This causes a problem for libguestfs because many API calls use device or "
2595 "partition names. Working scripts and the recipe (example) scripts that we "
2596 "make available over the internet could fail if the naming scheme changes."
2600 #: ../src/guestfs.pod:1309
2602 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>. "
2603 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2604 "required. For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2605 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2609 #: ../src/guestfs.pod:1315
2611 "Note that this I<only> applies to parameters. The L</guestfs_list_devices>, "
2612 "L</guestfs_list_partitions> and similar calls return the true names of the "
2613 "devices and partitions as known to the appliance."
2617 #: ../src/guestfs.pod:1320
2618 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
2622 #: ../src/guestfs.pod:1322
2624 "Usually this translation is transparent. However in some (very rare) cases "
2625 "you may need to know the exact algorithm. Such cases include where you use "
2626 "L</guestfs_config> to add a mixture of virtio and IDE devices to the "
2627 "qemu-based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> "
2632 #: ../src/guestfs.pod:1328
2634 "The algorithm is applied only to I<parameters> which are known to be either "
2635 "device or partition names. Return values from functions such as "
2636 "L</guestfs_list_devices> are never changed."
2640 #: ../src/guestfs.pod:1336
2641 msgid "Is the string a parameter which is a device or partition name?"
2645 #: ../src/guestfs.pod:1340
2646 msgid "Does the string begin with C</dev/sd>?"
2650 #: ../src/guestfs.pod:1344
2652 "Does the named device exist? If so, we use that device. However if I<not> "
2653 "then we continue with this algorithm."
2657 #: ../src/guestfs.pod:1349
2658 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
2662 #: ../src/guestfs.pod:1351
2663 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
2667 #: ../src/guestfs.pod:1353
2668 msgid "If that named device exists, use it. If not, continue."
2672 #: ../src/guestfs.pod:1357
2673 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
2677 #: ../src/guestfs.pod:1359
2678 msgid "If that named device exists, use it. If not, return an error."
2682 #: ../src/guestfs.pod:1363
2683 msgid "PORTABILITY CONCERNS"
2687 #: ../src/guestfs.pod:1365
2689 "Although the standard naming scheme and automatic translation is useful for "
2690 "simple programs and guestfish scripts, for larger programs it is best not to "
2691 "rely on this mechanism."
2695 #: ../src/guestfs.pod:1369
2697 "Where possible for maximum future portability programs using libguestfs "
2698 "should use these future-proof techniques:"
2702 #: ../src/guestfs.pod:1376
2704 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
2705 "device names, and then use those names directly."
2709 #: ../src/guestfs.pod:1379
2710 msgid "Since those device names exist by definition, they will never be translated."
2714 #: ../src/guestfs.pod:1384
2716 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
2717 "filesystem labels."
2721 #: ../src/guestfs.pod:1389
2726 #: ../src/guestfs.pod:1391
2727 msgid "COMMUNICATION PROTOCOL"
2731 #: ../src/guestfs.pod:1393
2733 "Don't rely on using this protocol directly. This section documents how it "
2734 "currently works, but it may change at any time."
2738 #: ../src/guestfs.pod:1396
2740 "The protocol used to talk between the library and the daemon running inside "
2741 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
2742 "1014, RFC 1832, RFC 4506)."
2746 #: ../src/guestfs.pod:1400
2748 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
2749 "this file is automatically generated)."
2753 #: ../src/guestfs.pod:1403
2755 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
2756 "and C<FileOut> parameters, which are handled with very simple request/reply "
2757 "messages. Then there are functions that have any C<FileIn> or C<FileOut> "
2758 "parameters, which use the same request and reply messages, but they may also "
2759 "be followed by files sent using a chunked encoding."
2763 #: ../src/guestfs.pod:1410
2764 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
2768 #: ../src/guestfs.pod:1412
2769 msgid "For ordinary functions, the request message is:"
2773 #: ../src/guestfs.pod:1414
2776 " total length (header + arguments,\n"
2777 " but not including the length word itself)\n"
2778 " struct guestfs_message_header (encoded as XDR)\n"
2779 " struct guestfs_<foo>_args (encoded as XDR)\n"
2784 #: ../src/guestfs.pod:1419
2786 "The total length field allows the daemon to allocate a fixed size buffer "
2787 "into which it slurps the rest of the message. As a result, the total length "
2788 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
2789 "effective size of any request is limited to somewhere under this size."
2793 #: ../src/guestfs.pod:1425
2795 "Note also that many functions don't take any arguments, in which case the "
2796 "C<guestfs_I<foo>_args> is completely omitted."
2800 #: ../src/guestfs.pod:1428
2802 "The header contains the procedure number (C<guestfs_proc>) which is how the "
2803 "receiver knows what type of args structure to expect, or none at all."
2807 #: ../src/guestfs.pod:1432
2808 msgid "The reply message for ordinary functions is:"
2812 #: ../src/guestfs.pod:1434
2815 " total length (header + ret,\n"
2816 " but not including the length word itself)\n"
2817 " struct guestfs_message_header (encoded as XDR)\n"
2818 " struct guestfs_<foo>_ret (encoded as XDR)\n"
2823 #: ../src/guestfs.pod:1439
2825 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
2826 "functions that return no formal return values."
2830 #: ../src/guestfs.pod:1442
2831 msgid "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
2835 #: ../src/guestfs.pod:1445
2837 "In the case of an error, a flag is set in the header, and the reply message "
2838 "is slightly changed:"
2842 #: ../src/guestfs.pod:1448
2845 " total length (header + error,\n"
2846 " but not including the length word itself)\n"
2847 " struct guestfs_message_header (encoded as XDR)\n"
2848 " struct guestfs_message_error (encoded as XDR)\n"
2853 #: ../src/guestfs.pod:1453
2855 "The C<guestfs_message_error> structure contains the error message as a "
2860 #: ../src/guestfs.pod:1456
2861 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
2865 #: ../src/guestfs.pod:1458
2867 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest. "
2868 "The normal request message is sent (see above). However this is followed by "
2869 "a sequence of file chunks."
2873 #: ../src/guestfs.pod:1462
2876 " total length (header + arguments,\n"
2877 " but not including the length word itself,\n"
2878 " and not including the chunks)\n"
2879 " struct guestfs_message_header (encoded as XDR)\n"
2880 " struct guestfs_<foo>_args (encoded as XDR)\n"
2881 " sequence of chunks for FileIn param #0\n"
2882 " sequence of chunks for FileIn param #1 etc.\n"
2887 #: ../src/guestfs.pod:1470
2888 msgid "The \"sequence of chunks\" is:"
2892 #: ../src/guestfs.pod:1472
2895 " length of chunk (not including length word itself)\n"
2896 " struct guestfs_chunk (encoded as XDR)\n"
2897 " length of chunk\n"
2898 " struct guestfs_chunk (encoded as XDR)\n"
2900 " length of chunk\n"
2901 " struct guestfs_chunk (with data.data_len == 0)\n"
2906 #: ../src/guestfs.pod:1480
2908 "The final chunk has the C<data_len> field set to zero. Additionally a flag "
2909 "is set in the final chunk to indicate either successful completion or early "
2914 #: ../src/guestfs.pod:1484
2916 "At time of writing there are no functions that have more than one FileIn "
2917 "parameter. However this is (theoretically) supported, by sending the "
2918 "sequence of chunks for each FileIn parameter one after another (from left to "
2923 #: ../src/guestfs.pod:1489
2925 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
2926 "transfer. The library does this by sending a chunk with a special flag set "
2927 "to indicate cancellation. When the daemon sees this, it cancels the whole "
2928 "RPC, does I<not> send any reply, and goes back to reading the next request."
2932 #: ../src/guestfs.pod:1495
2934 "The daemon may also cancel. It does this by writing a special word "
2935 "C<GUESTFS_CANCEL_FLAG> to the socket. The library listens for this during "
2936 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
2937 "cancel chunk). The special word is chosen so that even if cancellation "
2938 "happens right at the end of the transfer (after the library has finished "
2939 "writing and has started listening for the reply), the \"spurious\" cancel "
2940 "flag will not be confused with the reply message."
2944 #: ../src/guestfs.pod:1504
2946 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
2947 "limit), and also files where the size is not known in advance (eg. from "
2948 "pipes or sockets). However the chunks are rather small "
2949 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
2950 "to keep much in memory."
2954 #: ../src/guestfs.pod:1510
2955 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
2959 #: ../src/guestfs.pod:1512
2961 "The protocol for FileOut parameters is exactly the same as for FileIn "
2962 "parameters, but with the roles of daemon and library reversed."
2966 #: ../src/guestfs.pod:1515
2969 " total length (header + ret,\n"
2970 " but not including the length word itself,\n"
2971 " and not including the chunks)\n"
2972 " struct guestfs_message_header (encoded as XDR)\n"
2973 " struct guestfs_<foo>_ret (encoded as XDR)\n"
2974 " sequence of chunks for FileOut param #0\n"
2975 " sequence of chunks for FileOut param #1 etc.\n"
2980 #: ../src/guestfs.pod:1523
2981 msgid "INITIAL MESSAGE"
2985 #: ../src/guestfs.pod:1525
2987 "When the daemon launches it sends an initial word (C<GUESTFS_LAUNCH_FLAG>) "
2988 "which indicates that the guest and daemon is alive. This is what "
2989 "L</guestfs_launch> waits for."
2993 #: ../src/guestfs.pod:1529
2994 msgid "PROGRESS NOTIFICATION MESSAGES"
2998 #: ../src/guestfs.pod:1531
3000 "The daemon may send progress notification messages at any time. These are "
3001 "distinguished by the normal length word being replaced by "
3002 "C<GUESTFS_PROGRESS_FLAG>, followed by a fixed size progress message."
3006 #: ../src/guestfs.pod:1535
3008 "The library turns them into progress callbacks (see "
3009 "C<guestfs_set_progress_callback>) if there is a callback registered, or "
3010 "discards them if not."
3014 #: ../src/guestfs.pod:1539
3016 "The daemon self-limits the frequency of progress messages it sends (see "
3017 "C<daemon/proto.c:notify_progress>). Not all calls generate progress "
3022 #: ../src/guestfs.pod:1543
3023 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
3027 #: ../src/guestfs.pod:1545
3029 "All high-level libguestfs actions are synchronous. If you want to use "
3030 "libguestfs asynchronously then you must create a thread."
3034 #: ../src/guestfs.pod:1548
3036 "Only use the handle from a single thread. Either use the handle exclusively "
3037 "from one thread, or provide your own mutex so that two threads cannot issue "
3038 "calls on the same handle at the same time."
3042 #: ../src/guestfs.pod:1552
3044 "See the graphical program guestfs-browser for one possible architecture for "
3045 "multithreaded programs using libvirt and libguestfs."
3049 #: ../src/guestfs.pod:1555
3050 msgid "QEMU WRAPPERS"
3054 #: ../src/guestfs.pod:1557
3056 "If you want to compile your own qemu, run qemu from a non-standard location, "
3057 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
3062 #: ../src/guestfs.pod:1561
3064 "There is one important rule to remember: you I<must C<exec qemu>> as the "
3065 "last command in the shell script (so that qemu replaces the shell and "
3066 "becomes the direct child of the libguestfs-using program). If you don't do "
3067 "this, then the qemu process won't be cleaned up correctly."
3071 #: ../src/guestfs.pod:1566
3073 "Here is an example of a wrapper, where I have built my own copy of qemu from "
3078 #: ../src/guestfs.pod:1569
3082 " qemudir=/home/rjones/d/qemu\n"
3083 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "
3089 #: ../src/guestfs.pod:1573
3091 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
3092 "then use it by setting the LIBGUESTFS_QEMU environment variable. For "
3097 #: ../src/guestfs.pod:1577
3100 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
3105 #: ../src/guestfs.pod:1579
3107 "Note that libguestfs also calls qemu with the -help and -version options in "
3108 "order to determine features."
3112 #: ../src/guestfs.pod:1582
3113 msgid "LIBGUESTFS VERSION NUMBERS"
3117 #: ../src/guestfs.pod:1584
3119 "Since April 2010, libguestfs has started to make separate development and "
3120 "stable releases, along with corresponding branches in our git repository. "
3121 "These separate releases can be identified by version number:"
3125 #: ../src/guestfs.pod:1589
3128 " even numbers for stable: 1.2.x, 1.4.x, ...\n"
3129 " .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
3135 " | `-------- sub-version\n"
3137 " `------ always '1' because we don't change the ABI\n"
3142 #: ../src/guestfs.pod:1600
3143 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
3147 #: ../src/guestfs.pod:1602
3149 "As time passes we cherry pick fixes from the development branch and backport "
3150 "those into the stable branch, the effect being that the stable branch should "
3151 "get more stable and less buggy over time. So the stable releases are ideal "
3152 "for people who don't need new features but would just like the software to "
3157 #: ../src/guestfs.pod:1608
3158 msgid "Our criteria for backporting changes are:"
3162 #: ../src/guestfs.pod:1614
3164 "Documentation changes which don't affect any code are backported unless the "
3165 "documentation refers to a future feature which is not in stable."
3169 #: ../src/guestfs.pod:1620
3171 "Bug fixes which are not controversial, fix obvious problems, and have been "
3172 "well tested are backported."
3176 #: ../src/guestfs.pod:1625
3178 "Simple rearrangements of code which shouldn't affect how it works get "
3179 "backported. This is so that the code in the two branches doesn't get too "
3180 "far out of step, allowing us to backport future fixes more easily."
3184 #: ../src/guestfs.pod:1631
3186 "We I<don't> backport new features, new APIs, new tools etc, except in one "
3187 "exceptional case: the new feature is required in order to implement an "
3188 "important bug fix."
3192 #: ../src/guestfs.pod:1637
3194 "A new stable branch starts when we think the new features in development are "
3195 "substantial and compelling enough over the current stable branch to warrant "
3196 "it. When that happens we create new stable and development versions 1.N.0 "
3197 "and 1.(N+1).0 [N is even]. The new dot-oh release won't necessarily be so "
3198 "stable at this point, but by backporting fixes from development, that branch "
3199 "will stabilize over time."
3203 #: ../src/guestfs.pod:1645 ../fish/guestfish.pod:933 ../test-tool/libguestfs-test-tool.pod:104 ../tools/virt-edit.pl:312 ../tools/virt-rescue.pl:226
3204 msgid "ENVIRONMENT VARIABLES"
3208 #: ../src/guestfs.pod:1649 ../fish/guestfish.pod:953
3209 msgid "LIBGUESTFS_APPEND"
3213 #: ../src/guestfs.pod:1651 ../fish/guestfish.pod:955
3214 msgid "Pass additional options to the guest kernel."
3218 #: ../src/guestfs.pod:1653 ../fish/guestfish.pod:957
3219 msgid "LIBGUESTFS_DEBUG"
3223 #: ../src/guestfs.pod:1655
3225 "Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the same "
3226 "effect as calling C<guestfs_set_verbose (g, 1)>."
3230 #: ../src/guestfs.pod:1658 ../fish/guestfish.pod:962
3231 msgid "LIBGUESTFS_MEMSIZE"
3235 #: ../src/guestfs.pod:1660 ../fish/guestfish.pod:964
3236 msgid "Set the memory allocated to the qemu process, in megabytes. For example:"
3240 #: ../src/guestfs.pod:1663 ../fish/guestfish.pod:967
3243 " LIBGUESTFS_MEMSIZE=700\n"
3248 #: ../src/guestfs.pod:1665 ../fish/guestfish.pod:969
3249 msgid "LIBGUESTFS_PATH"
3253 #: ../src/guestfs.pod:1667
3255 "Set the path that libguestfs uses to search for kernel and initrd.img. See "
3256 "the discussion of paths in section PATH above."
3260 #: ../src/guestfs.pod:1670 ../fish/guestfish.pod:974
3261 msgid "LIBGUESTFS_QEMU"
3265 #: ../src/guestfs.pod:1672 ../fish/guestfish.pod:976
3267 "Set the default qemu binary that libguestfs uses. If not set, then the qemu "
3268 "which was found at compile time by the configure script is used."
3272 #: ../src/guestfs.pod:1676
3273 msgid "See also L</QEMU WRAPPERS> above."
3277 #: ../src/guestfs.pod:1678 ../fish/guestfish.pod:980
3278 msgid "LIBGUESTFS_TRACE"
3282 #: ../src/guestfs.pod:1680
3284 "Set C<LIBGUESTFS_TRACE=1> to enable command traces. This has the same "
3285 "effect as calling C<guestfs_set_trace (g, 1)>."
3289 #: ../src/guestfs.pod:1683 ../fish/guestfish.pod:989
3294 #: ../src/guestfs.pod:1685 ../fish/guestfish.pod:991
3295 msgid "Location of temporary directory, defaults to C</tmp>."
3299 #: ../src/guestfs.pod:1687 ../fish/guestfish.pod:993
3301 "If libguestfs was compiled to use the supermin appliance then each handle "
3302 "will require rather a large amount of space in this directory for short "
3303 "periods of time (~ 80 MB). You can use C<$TMPDIR> to configure another "
3304 "directory to use in case C</tmp> is not large enough."
3308 #: ../src/guestfs.pod:1695 ../fish/guestfish.pod:1051 ../test-tool/libguestfs-test-tool.pod:109 ../fuse/guestmount.pod:178 ../inspector/virt-inspector.pl:846 ../tools/virt-cat.pl:163 ../tools/virt-df.pl:482 ../tools/virt-edit.pl:325 ../tools/virt-list-filesystems.pl:191 ../tools/virt-list-partitions.pl:229 ../tools/virt-ls.pl:210 ../tools/virt-make-fs.pl:527 ../tools/virt-rescue.pl:231 ../tools/virt-resize.pl:1390 ../tools/virt-tar.pl:257 ../tools/virt-win-reg.pl:461
3313 #: ../src/guestfs.pod:1697
3315 "L<guestfish(1)>, L<guestmount(1)>, L<virt-cat(1)>, L<virt-df(1)>, "
3316 "L<virt-edit(1)>, L<virt-inspector(1)>, L<virt-list-filesystems(1)>, "
3317 "L<virt-list-partitions(1)>, L<virt-ls(1)>, L<virt-make-fs(1)>, "
3318 "L<virt-rescue(1)>, L<virt-tar(1)>, L<virt-win-reg(1)>, L<qemu(1)>, "
3319 "L<febootstrap(1)>, L<hivex(3)>, L<http://libguestfs.org/>."
3323 #: ../src/guestfs.pod:1715
3325 "Tools with a similar purpose: L<fdisk(8)>, L<parted(8)>, L<kpartx(8)>, "
3326 "L<lvm(8)>, L<disktype(1)>."
3330 #: ../src/guestfs.pod:1722 ../tools/virt-make-fs.pl:541 ../tools/virt-win-reg.pl:476
3335 #: ../src/guestfs.pod:1724
3336 msgid "To get a list of bugs against libguestfs use this link:"
3340 #: ../src/guestfs.pod:1726
3341 msgid "L<https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools>"
3345 #: ../src/guestfs.pod:1728
3346 msgid "To report a new bug against libguestfs use this link:"
3350 #: ../src/guestfs.pod:1730
3351 msgid "L<https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools>"
3355 #: ../src/guestfs.pod:1732
3356 msgid "When reporting a bug, please check:"
3360 #: ../src/guestfs.pod:1738
3361 msgid "That the bug hasn't been reported already."
3365 #: ../src/guestfs.pod:1742
3366 msgid "That you are testing a recent version."
3370 #: ../src/guestfs.pod:1746
3371 msgid "Describe the bug accurately, and give a way to reproduce it."
3375 #: ../src/guestfs.pod:1750
3377 "Run libguestfs-test-tool and paste the B<complete, unedited> output into the "
3382 #: ../src/guestfs.pod:1755 ../fish/guestfish.pod:1067 ../test-tool/libguestfs-test-tool.pod:115 ../fuse/guestmount.pod:189 ../inspector/virt-inspector.pl:855
3387 #: ../src/guestfs.pod:1757 ../fish/guestfish.pod:1069 ../test-tool/libguestfs-test-tool.pod:117 ../fuse/guestmount.pod:191
3388 msgid "Richard W.M. Jones (C<rjones at redhat dot com>)"
3392 #: ../src/guestfs.pod:1759 ../fish/guestfish.pod:1071 ../test-tool/libguestfs-test-tool.pod:119 ../fuse/guestmount.pod:193 ../inspector/virt-inspector.pl:861 ../tools/virt-cat.pl:177 ../tools/virt-df.pl:495 ../tools/virt-edit.pl:341 ../tools/virt-list-filesystems.pl:207 ../tools/virt-list-partitions.pl:244 ../tools/virt-ls.pl:225 ../tools/virt-make-fs.pl:556 ../tools/virt-rescue.pl:245 ../tools/virt-resize.pl:1411 ../tools/virt-tar.pl:272 ../tools/virt-win-reg.pl:491
3397 #: ../src/guestfs.pod:1761 ../fish/guestfish.pod:1073
3398 msgid "Copyright (C) 2009-2010 Red Hat Inc. L<http://libguestfs.org/>"
3402 #: ../src/guestfs.pod:1764
3404 "This library is free software; you can redistribute it and/or modify it "
3405 "under the terms of the GNU Lesser General Public License as published by the "
3406 "Free Software Foundation; either version 2 of the License, or (at your "
3407 "option) any later version."
3411 #: ../src/guestfs.pod:1769
3413 "This library is distributed in the hope that it will be useful, but WITHOUT "
3414 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
3415 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
3420 #: ../src/guestfs.pod:1774
3422 "You should have received a copy of the GNU Lesser General Public License "
3423 "along with this library; if not, write to the Free Software Foundation, "
3424 "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
3428 #: ../src/guestfs-actions.pod:1
3429 msgid "guestfs_add_cdrom"
3433 #: ../src/guestfs-actions.pod:3
3436 " int guestfs_add_cdrom (guestfs_h *g,\n"
3437 "\t\tconst char *filename);\n"
3442 #: ../src/guestfs-actions.pod:6 ../fish/guestfish-actions.pod:5
3443 msgid "This function adds a virtual CD-ROM disk image to the guest."
3447 #: ../src/guestfs-actions.pod:8 ../fish/guestfish-actions.pod:7
3448 msgid "This is equivalent to the qemu parameter C<-cdrom filename>."
3452 #: ../src/guestfs-actions.pod:10 ../src/guestfs-actions.pod:1488 ../fish/guestfish-actions.pod:9 ../fish/guestfish-actions.pod:1186
3457 #: ../src/guestfs-actions.pod:16
3459 "This call checks for the existence of C<filename>. This stops you from "
3460 "specifying other types of drive which are supported by qemu such as C<nbd:> "
3461 "and C<http:> URLs. To specify those, use the general C<guestfs_config> call "
3466 #: ../src/guestfs-actions.pod:23
3468 "If you just want to add an ISO file (often you use this as an efficient way "
3469 "to transfer large files into the guest), then you should probably use "
3470 "C<guestfs_add_drive_ro> instead."
3474 #: ../src/guestfs-actions.pod:29 ../src/guestfs-actions.pod:63 ../src/guestfs-actions.pod:92 ../src/guestfs-actions.pod:103 ../src/guestfs-actions.pod:114 ../src/guestfs-actions.pod:124 ../src/guestfs-actions.pod:135 ../src/guestfs-actions.pod:238 ../src/guestfs-actions.pod:255 ../src/guestfs-actions.pod:266 ../src/guestfs-actions.pod:302 ../src/guestfs-actions.pod:324 ../src/guestfs-actions.pod:339 ../src/guestfs-actions.pod:403 ../src/guestfs-actions.pod:430 ../src/guestfs-actions.pod:441 ../src/guestfs-actions.pod:453 ../src/guestfs-actions.pod:534 ../src/guestfs-actions.pod:549 ../src/guestfs-actions.pod:560 ../src/guestfs-actions.pod:571 ../src/guestfs-actions.pod:717 ../src/guestfs-actions.pod:734 ../src/guestfs-actions.pod:749 ../src/guestfs-actions.pod:824 ../src/guestfs-actions.pod:839 ../src/guestfs-actions.pod:855 ../src/guestfs-actions.pod:866 ../src/guestfs-actions.pod:883 ../src/guestfs-actions.pod:916 ../src/guestfs-actions.pod:974 ../src/guestfs-actions.pod:996 ../src/guestfs-actions.pod:1027 ../src/guestfs-actions.pod:1115 ../src/guestfs-actions.pod:1146 ../src/guestfs-actions.pod:1346 ../src/guestfs-actions.pod:1365 ../src/guestfs-actions.pod:1446 ../src/guestfs-actions.pod:1794 ../src/guestfs-actions.pod:1917 ../src/guestfs-actions.pod:1972 ../src/guestfs-actions.pod:2002 ../src/guestfs-actions.pod:2409 ../src/guestfs-actions.pod:2421 ../src/guestfs-actions.pod:2438 ../src/guestfs-actions.pod:2503 ../src/guestfs-actions.pod:2514 ../src/guestfs-actions.pod:2524 ../src/guestfs-actions.pod:2535 ../src/guestfs-actions.pod:2547 ../src/guestfs-actions.pod:2577 ../src/guestfs-actions.pod:2641 ../src/guestfs-actions.pod:2658 ../src/guestfs-actions.pod:2672 ../src/guestfs-actions.pod:2692 ../src/guestfs-actions.pod:2712 ../src/guestfs-actions.pod:2741 ../src/guestfs-actions.pod:2757 ../src/guestfs-actions.pod:2773 ../src/guestfs-actions.pod:2785 ../src/guestfs-actions.pod:2794 ../src/guestfs-actions.pod:2827 ../src/guestfs-actions.pod:2840 ../src/guestfs-actions.pod:2850 ../src/guestfs-actions.pod:2862 ../src/guestfs-actions.pod:2876 ../src/guestfs-actions.pod:2956 ../src/guestfs-actions.pod:2973 ../src/guestfs-actions.pod:2983 ../src/guestfs-actions.pod:3028 ../src/guestfs-actions.pod:3043 ../src/guestfs-actions.pod:3058 ../src/guestfs-actions.pod:3071 ../src/guestfs-actions.pod:3082 ../src/guestfs-actions.pod:3093 ../src/guestfs-actions.pod:3107 ../src/guestfs-actions.pod:3119 ../src/guestfs-actions.pod:3136 ../src/guestfs-actions.pod:3167 ../src/guestfs-actions.pod:3195 ../src/guestfs-actions.pod:3211 ../src/guestfs-actions.pod:3227 ../src/guestfs-actions.pod:3236 ../src/guestfs-actions.pod:3250 ../src/guestfs-actions.pod:3260 ../src/guestfs-actions.pod:3272 ../src/guestfs-actions.pod:3284 ../src/guestfs-actions.pod:3316 ../src/guestfs-actions.pod:3328 ../src/guestfs-actions.pod:3345 ../src/guestfs-actions.pod:3356 ../src/guestfs-actions.pod:3370 ../src/guestfs-actions.pod:3410 ../src/guestfs-actions.pod:3441 ../src/guestfs-actions.pod:3452 ../src/guestfs-actions.pod:3477 ../src/guestfs-actions.pod:3491 ../src/guestfs-actions.pod:3506 ../src/guestfs-actions.pod:3628 ../src/guestfs-actions.pod:3680 ../src/guestfs-actions.pod:3699 ../src/guestfs-actions.pod:3714 ../src/guestfs-actions.pod:3725 ../src/guestfs-actions.pod:3759 ../src/guestfs-actions.pod:3773 ../src/guestfs-actions.pod:3783 ../src/guestfs-actions.pod:3794 ../src/guestfs-actions.pod:4026 ../src/guestfs-actions.pod:4042 ../src/guestfs-actions.pod:4053 ../src/guestfs-actions.pod:4062 ../src/guestfs-actions.pod:4073 ../src/guestfs-actions.pod:4082 ../src/guestfs-actions.pod:4093 ../src/guestfs-actions.pod:4106 ../src/guestfs-actions.pod:4124 ../src/guestfs-actions.pod:4140 ../src/guestfs-actions.pod:4156 ../src/guestfs-actions.pod:4171 ../src/guestfs-actions.pod:4191 ../src/guestfs-actions.pod:4206 ../src/guestfs-actions.pod:4222 ../src/guestfs-actions.pod:4240 ../src/guestfs-actions.pod:4256 ../src/guestfs-actions.pod:4270 ../src/guestfs-actions.pod:4295 ../src/guestfs-actions.pod:4316 ../src/guestfs-actions.pod:4332 ../src/guestfs-actions.pod:4353 ../src/guestfs-actions.pod:4365 ../src/guestfs-actions.pod:4377 ../src/guestfs-actions.pod:4393 ../src/guestfs-actions.pod:4427 ../src/guestfs-actions.pod:4447 ../src/guestfs-actions.pod:4470 ../src/guestfs-actions.pod:4560 ../src/guestfs-actions.pod:4666 ../src/guestfs-actions.pod:4675 ../src/guestfs-actions.pod:4685 ../src/guestfs-actions.pod:4695 ../src/guestfs-actions.pod:4714 ../src/guestfs-actions.pod:4724 ../src/guestfs-actions.pod:4734 ../src/guestfs-actions.pod:4744 ../src/guestfs-actions.pod:4756 ../src/guestfs-actions.pod:4806 ../src/guestfs-actions.pod:4820 ../src/guestfs-actions.pod:4833 ../src/guestfs-actions.pod:4846 ../src/guestfs-actions.pod:4860 ../src/guestfs-actions.pod:4870 ../src/guestfs-actions.pod:4887 ../src/guestfs-actions.pod:4917 ../src/guestfs-actions.pod:4928 ../src/guestfs-actions.pod:4963 ../src/guestfs-actions.pod:4973 ../src/guestfs-actions.pod:4988 ../src/guestfs-actions.pod:5016 ../src/guestfs-actions.pod:5120 ../src/guestfs-actions.pod:5135 ../src/guestfs-actions.pod:5146 ../src/guestfs-actions.pod:5192 ../src/guestfs-actions.pod:5202 ../src/guestfs-actions.pod:5239 ../src/guestfs-actions.pod:5266 ../src/guestfs-actions.pod:5308 ../src/guestfs-actions.pod:5331 ../src/guestfs-actions.pod:5388 ../src/guestfs-actions.pod:5404 ../src/guestfs-actions.pod:5430
3475 msgid "This function returns 0 on success or -1 on error."
3479 #: ../src/guestfs-actions.pod:31
3480 msgid "guestfs_add_drive"
3484 #: ../src/guestfs-actions.pod:33
3487 " int guestfs_add_drive (guestfs_h *g,\n"
3488 "\t\tconst char *filename);\n"
3493 #: ../src/guestfs-actions.pod:36 ../fish/guestfish-actions.pod:32
3495 "This function adds a virtual machine disk image C<filename> to the guest. "
3496 "The first time you call this function, the disk appears as IDE disk 0 "
3497 "(C</dev/sda>) in the guest, the second time as C</dev/sdb>, and so on."
3501 #: ../src/guestfs-actions.pod:41 ../fish/guestfish-actions.pod:37
3503 "You don't necessarily need to be root when using libguestfs. However you "
3504 "obviously do need sufficient permissions to access the filename for whatever "
3505 "operations you want to perform (ie. read access if you just want to read the "
3506 "image or write access if you want to modify the image)."
3510 #: ../src/guestfs-actions.pod:47 ../fish/guestfish-actions.pod:43
3512 "This is equivalent to the qemu parameter C<-drive "
3513 "file=filename,cache=off,if=...>."
3517 #: ../src/guestfs-actions.pod:50 ../fish/guestfish-actions.pod:46
3519 "C<cache=off> is omitted in cases where it is not supported by the underlying "
3524 #: ../src/guestfs-actions.pod:53 ../src/guestfs-actions.pod:82
3526 "C<if=...> is set at compile time by the configuration option C<./configure "
3527 "--with-drive-if=...>. In the rare case where you might need to change this "
3528 "at run time, use C<guestfs_add_drive_with_if> or "
3529 "C<guestfs_add_drive_ro_with_if>."
3533 #: ../src/guestfs-actions.pod:58 ../src/guestfs-actions.pod:87
3535 "Note that this call checks for the existence of C<filename>. This stops you "
3536 "from specifying other types of drive which are supported by qemu such as "
3537 "C<nbd:> and C<http:> URLs. To specify those, use the general "
3538 "C<guestfs_config> call instead."
3542 #: ../src/guestfs-actions.pod:65
3543 msgid "guestfs_add_drive_ro"
3547 #: ../src/guestfs-actions.pod:67
3550 " int guestfs_add_drive_ro (guestfs_h *g,\n"
3551 "\t\tconst char *filename);\n"
3556 #: ../src/guestfs-actions.pod:70 ../fish/guestfish-actions.pod:63
3557 msgid "This adds a drive in snapshot mode, making it effectively read-only."
3561 #: ../src/guestfs-actions.pod:73 ../fish/guestfish-actions.pod:66
3563 "Note that writes to the device are allowed, and will be seen for the "
3564 "duration of the guestfs handle, but they are written to a temporary file "
3565 "which is discarded as soon as the guestfs handle is closed. We don't "
3566 "currently have any method to enable changes to be committed, although qemu "
3571 #: ../src/guestfs-actions.pod:79 ../fish/guestfish-actions.pod:72
3573 "This is equivalent to the qemu parameter C<-drive "
3574 "file=filename,snapshot=on,if=...>."
3578 #: ../src/guestfs-actions.pod:94
3579 msgid "guestfs_add_drive_ro_with_if"
3583 #: ../src/guestfs-actions.pod:96
3586 " int guestfs_add_drive_ro_with_if (guestfs_h *g,\n"
3587 "\t\tconst char *filename,\n"
3588 "\t\tconst char *iface);\n"
3593 #: ../src/guestfs-actions.pod:100
3595 "This is the same as C<guestfs_add_drive_ro> but it allows you to specify the "
3596 "QEMU interface emulation to use at run time."
3600 #: ../src/guestfs-actions.pod:105
3601 msgid "guestfs_add_drive_with_if"
3605 #: ../src/guestfs-actions.pod:107
3608 " int guestfs_add_drive_with_if (guestfs_h *g,\n"
3609 "\t\tconst char *filename,\n"
3610 "\t\tconst char *iface);\n"
3615 #: ../src/guestfs-actions.pod:111
3617 "This is the same as C<guestfs_add_drive> but it allows you to specify the "
3618 "QEMU interface emulation to use at run time."
3622 #: ../src/guestfs-actions.pod:116
3623 msgid "guestfs_aug_clear"
3627 #: ../src/guestfs-actions.pod:118
3630 " int guestfs_aug_clear (guestfs_h *g,\n"
3631 "\t\tconst char *augpath);\n"
3636 #: ../src/guestfs-actions.pod:121 ../fish/guestfish-actions.pod:103
3638 "Set the value associated with C<path> to C<NULL>. This is the same as the "
3639 "L<augtool(1)> C<clear> command."
3643 #: ../src/guestfs-actions.pod:126
3644 msgid "guestfs_aug_close"
3648 #: ../src/guestfs-actions.pod:128
3651 " int guestfs_aug_close (guestfs_h *g);\n"
3656 #: ../src/guestfs-actions.pod:130
3658 "Close the current Augeas handle and free up any resources used by it. After "
3659 "calling this, you have to call C<guestfs_aug_init> again before you can use "
3660 "any other Augeas functions."
3664 #: ../src/guestfs-actions.pod:137
3665 msgid "guestfs_aug_defnode"
3669 #: ../src/guestfs-actions.pod:139
3672 " struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,\n"
3673 "\t\tconst char *name,\n"
3674 "\t\tconst char *expr,\n"
3675 "\t\tconst char *val);\n"
3680 #: ../src/guestfs-actions.pod:144 ../fish/guestfish-actions.pod:119
3681 msgid "Defines a variable C<name> whose value is the result of evaluating C<expr>."
3685 #: ../src/guestfs-actions.pod:147
3687 "If C<expr> evaluates to an empty nodeset, a node is created, equivalent to "
3688 "calling C<guestfs_aug_set> C<expr>, C<value>. C<name> will be the nodeset "
3689 "containing that single node."
3693 #: ../src/guestfs-actions.pod:151 ../fish/guestfish-actions.pod:126
3695 "On success this returns a pair containing the number of nodes in the "
3696 "nodeset, and a boolean flag if a node was created."
3700 #: ../src/guestfs-actions.pod:155
3702 "This function returns a C<struct guestfs_int_bool *>, or NULL if there was "
3703 "an error. I<The caller must call C<guestfs_free_int_bool> after use>."
3707 #: ../src/guestfs-actions.pod:159
3708 msgid "guestfs_aug_defvar"
3712 #: ../src/guestfs-actions.pod:161
3715 " int guestfs_aug_defvar (guestfs_h *g,\n"
3716 "\t\tconst char *name,\n"
3717 "\t\tconst char *expr);\n"
3722 #: ../src/guestfs-actions.pod:165 ../fish/guestfish-actions.pod:134
3724 "Defines an Augeas variable C<name> whose value is the result of evaluating "
3725 "C<expr>. If C<expr> is NULL, then C<name> is undefined."
3729 #: ../src/guestfs-actions.pod:169 ../fish/guestfish-actions.pod:138
3731 "On success this returns the number of nodes in C<expr>, or C<0> if C<expr> "
3732 "evaluates to something which is not a nodeset."
3736 #: ../src/guestfs-actions.pod:172 ../src/guestfs-actions.pod:313 ../src/guestfs-actions.pod:467 ../src/guestfs-actions.pod:492 ../src/guestfs-actions.pod:507 ../src/guestfs-actions.pod:523 ../src/guestfs-actions.pod:1013 ../src/guestfs-actions.pod:1328 ../src/guestfs-actions.pod:1510 ../src/guestfs-actions.pod:1591 ../src/guestfs-actions.pod:1622 ../src/guestfs-actions.pod:1665 ../src/guestfs-actions.pod:1682 ../src/guestfs-actions.pod:1907 ../src/guestfs-actions.pod:2119 ../src/guestfs-actions.pod:2137 ../src/guestfs-actions.pod:3430 ../src/guestfs-actions.pod:3537 ../src/guestfs-actions.pod:3853 ../src/guestfs-actions.pod:4952 ../src/guestfs-actions.pod:5276 ../src/guestfs-actions.pod:5286 ../src/guestfs-actions.pod:5296
3737 msgid "On error this function returns -1."
3741 #: ../src/guestfs-actions.pod:174
3742 msgid "guestfs_aug_get"
3746 #: ../src/guestfs-actions.pod:176
3749 " char *guestfs_aug_get (guestfs_h *g,\n"
3750 "\t\tconst char *augpath);\n"
3755 #: ../src/guestfs-actions.pod:179 ../fish/guestfish-actions.pod:145
3757 "Look up the value associated with C<path>. If C<path> matches exactly one "
3758 "node, the C<value> is returned."
3762 #: ../src/guestfs-actions.pod:182 ../src/guestfs-actions.pod:610 ../src/guestfs-actions.pod:625 ../src/guestfs-actions.pod:682 ../src/guestfs-actions.pod:695 ../src/guestfs-actions.pod:786 ../src/guestfs-actions.pod:899 ../src/guestfs-actions.pod:928 ../src/guestfs-actions.pod:942 ../src/guestfs-actions.pod:958 ../src/guestfs-actions.pod:1041 ../src/guestfs-actions.pod:1205 ../src/guestfs-actions.pod:1314 ../src/guestfs-actions.pod:1459 ../src/guestfs-actions.pod:1473 ../src/guestfs-actions.pod:1549 ../src/guestfs-actions.pod:1567 ../src/guestfs-actions.pod:1701 ../src/guestfs-actions.pod:1840 ../src/guestfs-actions.pod:2021 ../src/guestfs-actions.pod:2071 ../src/guestfs-actions.pod:2187 ../src/guestfs-actions.pod:2222 ../src/guestfs-actions.pod:2492 ../src/guestfs-actions.pod:2913 ../src/guestfs-actions.pod:3009 ../src/guestfs-actions.pod:3552 ../src/guestfs-actions.pod:3831 ../src/guestfs-actions.pod:3969 ../src/guestfs-actions.pod:4012 ../src/guestfs-actions.pod:4488 ../src/guestfs-actions.pod:4501 ../src/guestfs-actions.pod:4515 ../src/guestfs-actions.pod:4536 ../src/guestfs-actions.pod:5069 ../src/guestfs-actions.pod:5085 ../src/guestfs-actions.pod:5100 ../src/guestfs-actions.pod:5248 ../src/guestfs-actions.pod:5478
3764 "This function returns a string, or NULL on error. I<The caller must free "
3765 "the returned string after use>."
3769 #: ../src/guestfs-actions.pod:185
3770 msgid "guestfs_aug_init"
3774 #: ../src/guestfs-actions.pod:187
3777 " int guestfs_aug_init (guestfs_h *g,\n"
3778 "\t\tconst char *root,\n"
3784 #: ../src/guestfs-actions.pod:191 ../fish/guestfish-actions.pod:152
3786 "Create a new Augeas handle for editing configuration files. If there was "
3787 "any previous Augeas handle associated with this guestfs session, then it is "
3792 #: ../src/guestfs-actions.pod:195
3793 msgid "You must call this before using any other C<guestfs_aug_*> commands."
3797 #: ../src/guestfs-actions.pod:198 ../fish/guestfish-actions.pod:159
3798 msgid "C<root> is the filesystem root. C<root> must not be NULL, use C</> instead."
3802 #: ../src/guestfs-actions.pod:201 ../fish/guestfish-actions.pod:162
3804 "The flags are the same as the flags defined in E<lt>augeas.hE<gt>, the "
3805 "logical I<or> of the following integers:"
3809 #: ../src/guestfs-actions.pod:207 ../fish/guestfish-actions.pod:168
3810 msgid "C<AUG_SAVE_BACKUP> = 1"
3814 #: ../src/guestfs-actions.pod:209 ../fish/guestfish-actions.pod:170
3815 msgid "Keep the original file with a C<.augsave> extension."
3819 #: ../src/guestfs-actions.pod:211 ../fish/guestfish-actions.pod:172
3820 msgid "C<AUG_SAVE_NEWFILE> = 2"
3824 #: ../src/guestfs-actions.pod:213 ../fish/guestfish-actions.pod:174
3826 "Save changes into a file with extension C<.augnew>, and do not overwrite "
3827 "original. Overrides C<AUG_SAVE_BACKUP>."
3831 #: ../src/guestfs-actions.pod:216 ../fish/guestfish-actions.pod:177
3832 msgid "C<AUG_TYPE_CHECK> = 4"
3836 #: ../src/guestfs-actions.pod:218 ../fish/guestfish-actions.pod:179
3837 msgid "Typecheck lenses (can be expensive)."
3841 #: ../src/guestfs-actions.pod:220 ../fish/guestfish-actions.pod:181
3842 msgid "C<AUG_NO_STDINC> = 8"
3846 #: ../src/guestfs-actions.pod:222 ../fish/guestfish-actions.pod:183
3847 msgid "Do not use standard load path for modules."
3851 #: ../src/guestfs-actions.pod:224 ../fish/guestfish-actions.pod:185
3852 msgid "C<AUG_SAVE_NOOP> = 16"
3856 #: ../src/guestfs-actions.pod:226 ../fish/guestfish-actions.pod:187
3857 msgid "Make save a no-op, just record what would have been changed."
3861 #: ../src/guestfs-actions.pod:228 ../fish/guestfish-actions.pod:189
3862 msgid "C<AUG_NO_LOAD> = 32"
3866 #: ../src/guestfs-actions.pod:230
3867 msgid "Do not load the tree in C<guestfs_aug_init>."
3871 #: ../src/guestfs-actions.pod:234
3872 msgid "To close the handle, you can call C<guestfs_aug_close>."
3876 #: ../src/guestfs-actions.pod:236 ../fish/guestfish-actions.pod:197
3877 msgid "To find out more about Augeas, see L<http://augeas.net/>."
3881 #: ../src/guestfs-actions.pod:240
3882 msgid "guestfs_aug_insert"
3886 #: ../src/guestfs-actions.pod:242
3889 " int guestfs_aug_insert (guestfs_h *g,\n"
3890 "\t\tconst char *augpath,\n"
3891 "\t\tconst char *label,\n"
3892 "\t\tint before);\n"
3897 #: ../src/guestfs-actions.pod:247 ../fish/guestfish-actions.pod:203
3899 "Create a new sibling C<label> for C<path>, inserting it into the tree before "
3900 "or after C<path> (depending on the boolean flag C<before>)."
3904 #: ../src/guestfs-actions.pod:251 ../fish/guestfish-actions.pod:207
3906 "C<path> must match exactly one existing node in the tree, and C<label> must "
3907 "be a label, ie. not contain C</>, C<*> or end with a bracketed index C<[N]>."
3911 #: ../src/guestfs-actions.pod:257
3912 msgid "guestfs_aug_load"
3916 #: ../src/guestfs-actions.pod:259
3919 " int guestfs_aug_load (guestfs_h *g);\n"
3924 #: ../src/guestfs-actions.pod:261 ../fish/guestfish-actions.pod:215
3925 msgid "Load files into the tree."
3929 #: ../src/guestfs-actions.pod:263 ../fish/guestfish-actions.pod:217
3930 msgid "See C<aug_load> in the Augeas documentation for the full gory details."
3934 #: ../src/guestfs-actions.pod:268
3935 msgid "guestfs_aug_ls"
3939 #: ../src/guestfs-actions.pod:270
3942 " char **guestfs_aug_ls (guestfs_h *g,\n"
3943 "\t\tconst char *augpath);\n"
3948 #: ../src/guestfs-actions.pod:273
3950 "This is just a shortcut for listing C<guestfs_aug_match> C<path/*> and "
3951 "sorting the resulting nodes into alphabetical order."
3955 #: ../src/guestfs-actions.pod:276 ../src/guestfs-actions.pod:289 ../src/guestfs-actions.pod:417 ../src/guestfs-actions.pod:802 ../src/guestfs-actions.pod:1053 ../src/guestfs-actions.pod:1069 ../src/guestfs-actions.pod:1157 ../src/guestfs-actions.pod:1173 ../src/guestfs-actions.pod:1404 ../src/guestfs-actions.pod:1738 ../src/guestfs-actions.pod:1751 ../src/guestfs-actions.pod:1767 ../src/guestfs-actions.pod:1804 ../src/guestfs-actions.pod:1825 ../src/guestfs-actions.pod:1887 ../src/guestfs-actions.pod:1927 ../src/guestfs-actions.pod:2093 ../src/guestfs-actions.pod:2259 ../src/guestfs-actions.pod:2462 ../src/guestfs-actions.pod:2477 ../src/guestfs-actions.pod:2561 ../src/guestfs-actions.pod:2890 ../src/guestfs-actions.pod:3397 ../src/guestfs-actions.pod:3808 ../src/guestfs-actions.pod:3894 ../src/guestfs-actions.pod:4000 ../src/guestfs-actions.pod:4549 ../src/guestfs-actions.pod:4598 ../src/guestfs-actions.pod:4650 ../src/guestfs-actions.pod:4766 ../src/guestfs-actions.pod:4787 ../src/guestfs-actions.pod:5161 ../src/guestfs-actions.pod:5178 ../src/guestfs-actions.pod:5216 ../src/guestfs-actions.pod:5352 ../src/guestfs-actions.pod:5368 ../src/guestfs-actions.pod:5441 ../src/guestfs-actions.pod:5457 ../src/guestfs-actions.pod:5497 ../src/guestfs-actions.pod:5513
3957 "This function returns a NULL-terminated array of strings (like "
3958 "L<environ(3)>), or NULL if there was an error. I<The caller must free the "
3959 "strings and the array after use>."
3963 #: ../src/guestfs-actions.pod:280
3964 msgid "guestfs_aug_match"
3968 #: ../src/guestfs-actions.pod:282
3971 " char **guestfs_aug_match (guestfs_h *g,\n"
3972 "\t\tconst char *augpath);\n"
3977 #: ../src/guestfs-actions.pod:285 ../fish/guestfish-actions.pod:231
3979 "Returns a list of paths which match the path expression C<path>. The "
3980 "returned paths are sufficiently qualified so that they match exactly one "
3981 "node in the current tree."
3985 #: ../src/guestfs-actions.pod:293
3986 msgid "guestfs_aug_mv"
3990 #: ../src/guestfs-actions.pod:295
3993 " int guestfs_aug_mv (guestfs_h *g,\n"
3994 "\t\tconst char *src,\n"
3995 "\t\tconst char *dest);\n"
4000 #: ../src/guestfs-actions.pod:299 ../fish/guestfish-actions.pod:239
4002 "Move the node C<src> to C<dest>. C<src> must match exactly one node. "
4003 "C<dest> is overwritten if it exists."
4007 #: ../src/guestfs-actions.pod:304
4008 msgid "guestfs_aug_rm"
4012 #: ../src/guestfs-actions.pod:306
4015 " int guestfs_aug_rm (guestfs_h *g,\n"
4016 "\t\tconst char *augpath);\n"
4021 #: ../src/guestfs-actions.pod:309 ../fish/guestfish-actions.pod:246
4022 msgid "Remove C<path> and all of its children."
4026 #: ../src/guestfs-actions.pod:311 ../fish/guestfish-actions.pod:248
4027 msgid "On success this returns the number of entries which were removed."
4031 #: ../src/guestfs-actions.pod:315
4032 msgid "guestfs_aug_save"
4036 #: ../src/guestfs-actions.pod:317
4039 " int guestfs_aug_save (guestfs_h *g);\n"
4044 #: ../src/guestfs-actions.pod:319 ../fish/guestfish-actions.pod:254
4045 msgid "This writes all pending changes to disk."
4049 #: ../src/guestfs-actions.pod:321
4051 "The flags which were passed to C<guestfs_aug_init> affect exactly how files "
4056 #: ../src/guestfs-actions.pod:326
4057 msgid "guestfs_aug_set"
4061 #: ../src/guestfs-actions.pod:328
4064 " int guestfs_aug_set (guestfs_h *g,\n"
4065 "\t\tconst char *augpath,\n"
4066 "\t\tconst char *val);\n"
4071 #: ../src/guestfs-actions.pod:332 ../fish/guestfish-actions.pod:263
4072 msgid "Set the value associated with C<path> to C<val>."
4076 #: ../src/guestfs-actions.pod:334
4078 "In the Augeas API, it is possible to clear a node by setting the value to "
4079 "NULL. Due to an oversight in the libguestfs API you cannot do that with "
4080 "this call. Instead you must use the C<guestfs_aug_clear> call."
4084 #: ../src/guestfs-actions.pod:341
4085 msgid "guestfs_available"
4089 #: ../src/guestfs-actions.pod:343
4092 " int guestfs_available (guestfs_h *g,\n"
4093 "\t\tchar *const *groups);\n"
4098 #: ../src/guestfs-actions.pod:346 ../fish/guestfish-actions.pod:274
4100 "This command is used to check the availability of some groups of "
4101 "functionality in the appliance, which not all builds of the libguestfs "
4102 "appliance will be able to provide."
4106 #: ../src/guestfs-actions.pod:350
4108 "The libguestfs groups, and the functions that those groups correspond to, "
4109 "are listed in L<guestfs(3)/AVAILABILITY>. You can also fetch this list at "
4110 "runtime by calling C<guestfs_available_all_groups>."
4114 #: ../src/guestfs-actions.pod:355 ../fish/guestfish-actions.pod:283
4116 "The argument C<groups> is a list of group names, eg: C<[\"inotify\", "
4117 "\"augeas\"]> would check for the availability of the Linux inotify functions "
4118 "and Augeas (configuration file editing) functions."
4122 #: ../src/guestfs-actions.pod:360 ../fish/guestfish-actions.pod:288
4123 msgid "The command returns no error if I<all> requested groups are available."
4127 #: ../src/guestfs-actions.pod:362 ../fish/guestfish-actions.pod:290
4129 "It fails with an error if one or more of the requested groups is unavailable "
4134 #: ../src/guestfs-actions.pod:365 ../fish/guestfish-actions.pod:293
4136 "If an unknown group name is included in the list of groups then an error is "
4141 #: ../src/guestfs-actions.pod:368 ../fish/guestfish-actions.pod:296
4146 #: ../src/guestfs-actions.pod:374
4147 msgid "You must call C<guestfs_launch> before calling this function."
4151 #: ../src/guestfs-actions.pod:376 ../fish/guestfish-actions.pod:304
4153 "The reason is because we don't know what groups are supported by the "
4154 "appliance/daemon until it is running and can be queried."
4158 #: ../src/guestfs-actions.pod:382 ../fish/guestfish-actions.pod:310
4160 "If a group of functions is available, this does not necessarily mean that "
4161 "they will work. You still have to check for errors when calling individual "
4162 "API functions even if they are available."
4166 #: ../src/guestfs-actions.pod:389 ../fish/guestfish-actions.pod:317
4168 "It is usually the job of distro packagers to build complete functionality "
4169 "into the libguestfs appliance. Upstream libguestfs, if built from source "
4170 "with all requirements satisfied, will support everything."
4174 #: ../src/guestfs-actions.pod:396
4176 "This call was added in version C<1.0.80>. In previous versions of "
4177 "libguestfs all you could do would be to speculatively execute a command to "
4178 "find out if the daemon implemented it. See also C<guestfs_version>."
4182 #: ../src/guestfs-actions.pod:405
4183 msgid "guestfs_available_all_groups"
4187 #: ../src/guestfs-actions.pod:407
4190 " char **guestfs_available_all_groups (guestfs_h *g);\n"
4195 #: ../src/guestfs-actions.pod:409
4197 "This command returns a list of all optional groups that this daemon knows "
4198 "about. Note this returns both supported and unsupported groups. To find "
4199 "out which ones the daemon can actually support you have to call "
4200 "C<guestfs_available> on each member of the returned list."
4204 #: ../src/guestfs-actions.pod:415
4205 msgid "See also C<guestfs_available> and L<guestfs(3)/AVAILABILITY>."
4209 #: ../src/guestfs-actions.pod:421
4210 msgid "guestfs_base64_in"
4214 #: ../src/guestfs-actions.pod:423
4217 " int guestfs_base64_in (guestfs_h *g,\n"
4218 "\t\tconst char *base64file,\n"
4219 "\t\tconst char *filename);\n"
4224 #: ../src/guestfs-actions.pod:427 ../fish/guestfish-actions.pod:347
4225 msgid "This command uploads base64-encoded data from C<base64file> to C<filename>."
4229 #: ../src/guestfs-actions.pod:432
4230 msgid "guestfs_base64_out"
4234 #: ../src/guestfs-actions.pod:434
4237 " int guestfs_base64_out (guestfs_h *g,\n"
4238 "\t\tconst char *filename,\n"
4239 "\t\tconst char *base64file);\n"
4244 #: ../src/guestfs-actions.pod:438 ../fish/guestfish-actions.pod:356
4246 "This command downloads the contents of C<filename>, writing it out to local "
4247 "file C<base64file> encoded as base64."
4251 #: ../src/guestfs-actions.pod:443
4252 msgid "guestfs_blockdev_flushbufs"
4256 #: ../src/guestfs-actions.pod:445
4259 " int guestfs_blockdev_flushbufs (guestfs_h *g,\n"
4260 "\t\tconst char *device);\n"
4265 #: ../src/guestfs-actions.pod:448 ../fish/guestfish-actions.pod:365
4266 msgid "This tells the kernel to flush internal buffers associated with C<device>."
4270 #: ../src/guestfs-actions.pod:451 ../src/guestfs-actions.pod:465 ../src/guestfs-actions.pod:477 ../src/guestfs-actions.pod:490 ../src/guestfs-actions.pod:505 ../src/guestfs-actions.pod:521 ../src/guestfs-actions.pod:532 ../src/guestfs-actions.pod:547 ../src/guestfs-actions.pod:558 ../src/guestfs-actions.pod:569 ../fish/guestfish-actions.pod:368 ../fish/guestfish-actions.pod:379 ../fish/guestfish-actions.pod:388 ../fish/guestfish-actions.pod:398 ../fish/guestfish-actions.pod:410 ../fish/guestfish-actions.pod:423 ../fish/guestfish-actions.pod:431 ../fish/guestfish-actions.pod:442 ../fish/guestfish-actions.pod:450 ../fish/guestfish-actions.pod:458
4271 msgid "This uses the L<blockdev(8)> command."
4275 #: ../src/guestfs-actions.pod:455
4276 msgid "guestfs_blockdev_getbsz"
4280 #: ../src/guestfs-actions.pod:457
4283 " int guestfs_blockdev_getbsz (guestfs_h *g,\n"
4284 "\t\tconst char *device);\n"
4289 #: ../src/guestfs-actions.pod:460 ../fish/guestfish-actions.pod:374
4290 msgid "This returns the block size of a device."
4294 #: ../src/guestfs-actions.pod:462 ../src/guestfs-actions.pod:544 ../fish/guestfish-actions.pod:376 ../fish/guestfish-actions.pod:439
4296 "(Note this is different from both I<size in blocks> and I<filesystem block "
4301 #: ../src/guestfs-actions.pod:469
4302 msgid "guestfs_blockdev_getro"
4306 #: ../src/guestfs-actions.pod:471
4309 " int guestfs_blockdev_getro (guestfs_h *g,\n"
4310 "\t\tconst char *device);\n"
4315 #: ../src/guestfs-actions.pod:474 ../fish/guestfish-actions.pod:385
4317 "Returns a boolean indicating if the block device is read-only (true if "
4318 "read-only, false if not)."
4322 #: ../src/guestfs-actions.pod:479 ../src/guestfs-actions.pod:1087 ../src/guestfs-actions.pod:1099 ../src/guestfs-actions.pod:1531 ../src/guestfs-actions.pod:1539 ../src/guestfs-actions.pod:1599 ../src/guestfs-actions.pod:1642 ../src/guestfs-actions.pod:1654 ../src/guestfs-actions.pod:1673 ../src/guestfs-actions.pod:1690 ../src/guestfs-actions.pod:2273 ../src/guestfs-actions.pod:2284 ../src/guestfs-actions.pod:2296 ../src/guestfs-actions.pod:2307 ../src/guestfs-actions.pod:2320 ../src/guestfs-actions.pod:2332 ../src/guestfs-actions.pod:2345 ../src/guestfs-actions.pod:2356 ../src/guestfs-actions.pod:2366 ../src/guestfs-actions.pod:2377 ../src/guestfs-actions.pod:2389 ../src/guestfs-actions.pod:2401 ../src/guestfs-actions.pod:3522
4323 msgid "This function returns a C truth value on success or -1 on error."
4327 #: ../src/guestfs-actions.pod:481
4328 msgid "guestfs_blockdev_getsize64"
4332 #: ../src/guestfs-actions.pod:483
4335 " int64_t guestfs_blockdev_getsize64 (guestfs_h *g,\n"
4336 "\t\tconst char *device);\n"
4341 #: ../src/guestfs-actions.pod:486 ../fish/guestfish-actions.pod:394
4342 msgid "This returns the size of the device in bytes."
4346 #: ../src/guestfs-actions.pod:488
4347 msgid "See also C<guestfs_blockdev_getsz>."
4351 #: ../src/guestfs-actions.pod:494
4352 msgid "guestfs_blockdev_getss"
4356 #: ../src/guestfs-actions.pod:496
4359 " int guestfs_blockdev_getss (guestfs_h *g,\n"
4360 "\t\tconst char *device);\n"
4365 #: ../src/guestfs-actions.pod:499 ../fish/guestfish-actions.pod:404
4367 "This returns the size of sectors on a block device. Usually 512, but can be "
4368 "larger for modern devices."
4372 #: ../src/guestfs-actions.pod:502
4374 "(Note, this is not the size in sectors, use C<guestfs_blockdev_getsz> for "
4379 #: ../src/guestfs-actions.pod:509
4380 msgid "guestfs_blockdev_getsz"
4384 #: ../src/guestfs-actions.pod:511
4387 " int64_t guestfs_blockdev_getsz (guestfs_h *g,\n"
4388 "\t\tconst char *device);\n"
4393 #: ../src/guestfs-actions.pod:514 ../fish/guestfish-actions.pod:416
4395 "This returns the size of the device in units of 512-byte sectors (even if "
4396 "the sectorsize isn't 512 bytes ... weird)."
4400 #: ../src/guestfs-actions.pod:517
4402 "See also C<guestfs_blockdev_getss> for the real sector size of the device, "
4403 "and C<guestfs_blockdev_getsize64> for the more useful I<size in bytes>."
4407 #: ../src/guestfs-actions.pod:525
4408 msgid "guestfs_blockdev_rereadpt"
4412 #: ../src/guestfs-actions.pod:527
4415 " int guestfs_blockdev_rereadpt (guestfs_h *g,\n"
4416 "\t\tconst char *device);\n"
4421 #: ../src/guestfs-actions.pod:530 ../fish/guestfish-actions.pod:429
4422 msgid "Reread the partition table on C<device>."
4426 #: ../src/guestfs-actions.pod:536
4427 msgid "guestfs_blockdev_setbsz"
4431 #: ../src/guestfs-actions.pod:538
4434 " int guestfs_blockdev_setbsz (guestfs_h *g,\n"
4435 "\t\tconst char *device,\n"
4436 "\t\tint blocksize);\n"
4441 #: ../src/guestfs-actions.pod:542 ../fish/guestfish-actions.pod:437
4442 msgid "This sets the block size of a device."
4446 #: ../src/guestfs-actions.pod:551
4447 msgid "guestfs_blockdev_setro"
4451 #: ../src/guestfs-actions.pod:553
4454 " int guestfs_blockdev_setro (guestfs_h *g,\n"
4455 "\t\tconst char *device);\n"
4460 #: ../src/guestfs-actions.pod:556 ../fish/guestfish-actions.pod:448
4461 msgid "Sets the block device named C<device> to read-only."
4465 #: ../src/guestfs-actions.pod:562
4466 msgid "guestfs_blockdev_setrw"
4470 #: ../src/guestfs-actions.pod:564
4473 " int guestfs_blockdev_setrw (guestfs_h *g,\n"
4474 "\t\tconst char *device);\n"
4479 #: ../src/guestfs-actions.pod:567 ../fish/guestfish-actions.pod:456
4480 msgid "Sets the block device named C<device> to read-write."
4484 #: ../src/guestfs-actions.pod:573
4485 msgid "guestfs_case_sensitive_path"
4489 #: ../src/guestfs-actions.pod:575
4492 " char *guestfs_case_sensitive_path (guestfs_h *g,\n"
4493 "\t\tconst char *path);\n"
4498 #: ../src/guestfs-actions.pod:578 ../fish/guestfish-actions.pod:464
4500 "This can be used to resolve case insensitive paths on a filesystem which is "
4501 "case sensitive. The use case is to resolve paths which you have read from "
4502 "Windows configuration files or the Windows Registry, to the true path."
4506 #: ../src/guestfs-actions.pod:583 ../fish/guestfish-actions.pod:469
4508 "The command handles a peculiarity of the Linux ntfs-3g filesystem driver "
4509 "(and probably others), which is that although the underlying filesystem is "
4510 "case-insensitive, the driver exports the filesystem to Linux as "
4515 #: ../src/guestfs-actions.pod:588 ../fish/guestfish-actions.pod:474
4517 "One consequence of this is that special directories such as C<c:\\windows> "
4518 "may appear as C</WINDOWS> or C</windows> (or other things) depending on the "
4519 "precise details of how they were created. In Windows itself this would not "
4524 #: ../src/guestfs-actions.pod:594 ../fish/guestfish-actions.pod:480
4526 "Bug or feature? You decide: "
4527 "L<http://www.tuxera.com/community/ntfs-3g-faq/#posixfilenames1>"
4531 #: ../src/guestfs-actions.pod:597 ../fish/guestfish-actions.pod:483
4533 "This function resolves the true case of each element in the path and returns "
4534 "the case-sensitive path."
4538 #: ../src/guestfs-actions.pod:600
4540 "Thus C<guestfs_case_sensitive_path> (\"/Windows/System32\") might return "
4541 "C<\"/WINDOWS/system32\"> (the exact return value would depend on details of "
4542 "how the directories were originally created under Windows)."
4546 #: ../src/guestfs-actions.pod:605 ../fish/guestfish-actions.pod:491
4547 msgid "I<Note>: This function does not handle drive names, backslashes etc."
4551 #: ../src/guestfs-actions.pod:608
4552 msgid "See also C<guestfs_realpath>."
4556 #: ../src/guestfs-actions.pod:613
4561 #: ../src/guestfs-actions.pod:615
4564 " char *guestfs_cat (guestfs_h *g,\n"
4565 "\t\tconst char *path);\n"
4570 #: ../src/guestfs-actions.pod:618 ../src/guestfs-actions.pod:3884 ../fish/guestfish-actions.pod:500 ../fish/guestfish-actions.pod:2989
4571 msgid "Return the contents of the file named C<path>."