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.20\n"
10 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
11 "POT-Creation-Date: 2010-09-26 22:40+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-edit.pl:31 ../tools/virt-win-reg.pl:34 ../tools/virt-df.pl:32 ../tools/virt-ls.pl:31 ../tools/virt-resize.pl:38 ../tools/virt-list-filesystems.pl:28 ../tools/virt-cat.pl:30 ../tools/virt-tar.pl:30 ../tools/virt-rescue.pl:29 ../tools/virt-make-fs.pl:33 ../tools/virt-list-partitions.pl:28
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-edit.pl:33 ../tools/virt-win-reg.pl:36 ../tools/virt-df.pl:34 ../tools/virt-ls.pl:33 ../tools/virt-resize.pl:40 ../tools/virt-list-filesystems.pl:30 ../tools/virt-cat.pl:32 ../tools/virt-tar.pl:32 ../tools/virt-rescue.pl:31 ../tools/virt-make-fs.pl:35 ../tools/virt-list-partitions.pl:30
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-edit.pl:37 ../tools/virt-win-reg.pl:40 ../tools/virt-df.pl:38 ../tools/virt-ls.pl:37 ../tools/virt-resize.pl:44 ../tools/virt-list-filesystems.pl:34 ../tools/virt-cat.pl:36 ../tools/virt-tar.pl:36 ../tools/virt-rescue.pl:35 ../tools/virt-make-fs.pl:39 ../tools/virt-list-partitions.pl:34
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:30 ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:16 ../inspector/virt-inspector.pl:48 ../tools/virt-edit.pl:51 ../tools/virt-win-reg.pl:64 ../tools/virt-df.pl:46 ../tools/virt-ls.pl:43 ../tools/virt-resize.pl:50 ../tools/virt-list-filesystems.pl:40 ../tools/virt-cat.pl:42 ../tools/virt-tar.pl:73 ../tools/virt-rescue.pl:51 ../tools/virt-make-fs.pl:47 ../tools/virt-list-partitions.pl:40
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:1254 ../src/guestfs.pod:1259 ../src/guestfs.pod:1263 ../src/guestfs.pod:1365 ../src/guestfs.pod:1369 ../src/guestfs.pod:1373 ../src/guestfs.pod:1378 ../src/guestfs.pod:1386 ../src/guestfs.pod:1405 ../src/guestfs.pod:1413 ../src/guestfs.pod:1643 ../src/guestfs.pod:1649 ../src/guestfs.pod:1654 ../src/guestfs.pod:1660 ../src/guestfs.pod:1767 ../src/guestfs.pod:1771 ../src/guestfs.pod:1775 ../src/guestfs.pod:1779 ../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:1285 ../src/guestfs-actions.pod:1289 ../src/guestfs-actions.pod:1293 ../src/guestfs-actions.pod:1297 ../src/guestfs-actions.pod:1305 ../src/guestfs-actions.pod:1309 ../src/guestfs-actions.pod:1313 ../src/guestfs-actions.pod:1323 ../src/guestfs-actions.pod:1327 ../src/guestfs-actions.pod:1331 ../src/guestfs-actions.pod:1454 ../src/guestfs-actions.pod:1458 ../src/guestfs-actions.pod:1463 ../src/guestfs-actions.pod:1468 ../src/guestfs-actions.pod:1520 ../src/guestfs-actions.pod:1524 ../src/guestfs-actions.pod:1529 ../fish/guestfish.pod:338 ../fish/guestfish.pod:342 ../fish/guestfish.pod:346 ../fish/guestfish.pod:350 ../fish/guestfish-actions.pod:15 ../fish/guestfish-actions.pod:22 ../fish/guestfish-actions.pod:306 ../fish/guestfish-actions.pod:314 ../fish/guestfish-actions.pod:321 ../fish/guestfish-actions.pod:328 ../fish/guestfish-actions.pod:1023 ../fish/guestfish-actions.pod:1027 ../fish/guestfish-actions.pod:1031 ../fish/guestfish-actions.pod:1035 ../fish/guestfish-actions.pod:1043 ../fish/guestfish-actions.pod:1047 ../fish/guestfish-actions.pod:1051 ../fish/guestfish-actions.pod:1061 ../fish/guestfish-actions.pod:1065 ../fish/guestfish-actions.pod:1069 ../fish/guestfish-actions.pod:1159 ../fish/guestfish-actions.pod:1163 ../fish/guestfish-actions.pod:1168 ../fish/guestfish-actions.pod:1173 ../fish/guestfish-actions.pod:1215 ../fish/guestfish-actions.pod:1219 ../fish/guestfish-actions.pod:1224 ../tools/virt-df.pl:144 ../tools/virt-df.pl:150 ../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:589
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:750
1512 msgid "Ambiguity between devices and paths"
1516 #: ../src/guestfs.pod:752
1518 "There is a subtle ambiguity in the API between a device name "
1519 "(eg. C</dev/sdb2>) and a similar pathname. A file might just happen to be "
1520 "called C<sdb2> in the directory C</dev> (consider some non-Unix VM image)."
1524 #: ../src/guestfs.pod:757
1526 "In the current API we usually resolve this ambiguity by having two separate "
1527 "calls, for example L</guestfs_checksum> and L</guestfs_checksum_device>. "
1528 "Some API calls are ambiguous and (incorrectly) resolve the problem by "
1529 "detecting if the path supplied begins with C</dev/>."
1533 #: ../src/guestfs.pod:763
1535 "To avoid both the ambiguity and the need to duplicate some calls, we could "
1536 "make paths/devices into structured names. One way to do this would be to "
1537 "use a notation like grub (C<hd(0,0)>), although nobody really likes this "
1538 "aspect of grub. Another way would be to use a structured type, equivalent "
1539 "to this OCaml type:"
1543 #: ../src/guestfs.pod:769
1546 " type path = Path of string | Device of int | Partition of int * int\n"
1551 #: ../src/guestfs.pod:771
1552 msgid "which would allow you to pass arguments like:"
1556 #: ../src/guestfs.pod:773
1559 " Path \"/foo/bar\"\n"
1560 " Device 1 (* /dev/sdb, or perhaps /dev/sda *)\n"
1561 " Partition (1, 2) (* /dev/sdb2 (or is it /dev/sda2 or /dev/sdb3?) *)\n"
1562 " Path \"/dev/sdb2\" (* not a device *)\n"
1567 #: ../src/guestfs.pod:778
1569 "As you can see there are still problems to resolve even with this "
1570 "representation. Also consider how it might work in guestfish."
1574 #: ../src/guestfs.pod:783
1575 msgid "PROTOCOL LIMITS"
1579 #: ../src/guestfs.pod:785
1581 "Internally libguestfs uses a message-based protocol to pass API calls and "
1582 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1583 "plenty more detail about this). The maximum message size used by the "
1584 "protocol is slightly less than 4 MB. For some API calls you may need to be "
1585 "aware of this limit. The API calls which may be affected are individually "
1586 "documented, with a link back to this section of the documentation."
1590 #: ../src/guestfs.pod:793
1592 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1593 "a simple string. Because this string is at some point internally encoded as "
1594 "a message, the maximum size that it can return is slightly under 4 MB. If "
1595 "the requested file is larger than this then you will get an error."
1599 #: ../src/guestfs.pod:799
1601 "In order to transfer large files into and out of the guest filesystem, you "
1602 "need to use particular calls that support this. The sections L</UPLOADING> "
1603 "and L</DOWNLOADING> document how to do this."
1607 #: ../src/guestfs.pod:803
1609 "You might also consider mounting the disk image using our FUSE filesystem "
1610 "support (L<guestmount(1)>)."
1614 #: ../src/guestfs.pod:806
1615 msgid "KEYS AND PASSPHRASES"
1619 #: ../src/guestfs.pod:808
1621 "Certain libguestfs calls take a parameter that contains sensitive key "
1622 "material, passed in as a C string."
1626 #: ../src/guestfs.pod:811
1628 "In the future we would hope to change the libguestfs implementation so that "
1629 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1630 "swap. However this is I<not> done at the moment, because of the complexity "
1631 "of such an implementation."
1635 #: ../src/guestfs.pod:816
1637 "Therefore you should be aware that any key parameter you pass to libguestfs "
1638 "might end up being written out to the swap partition. If this is a concern, "
1639 "scrub the swap partition or don't use libguestfs on encrypted devices."
1643 #: ../src/guestfs.pod:821
1644 msgid "CONNECTION MANAGEMENT"
1648 #: ../src/guestfs.pod:823
1653 #: ../src/guestfs.pod:825
1655 "C<guestfs_h> is the opaque type representing a connection handle. Create a "
1656 "handle by calling L</guestfs_create>. Call L</guestfs_close> to free the "
1657 "handle and release all resources used."
1661 #: ../src/guestfs.pod:829
1663 "For information on using multiple handles and threads, see the section "
1664 "L</MULTIPLE HANDLES AND MULTIPLE THREADS> below."
1668 #: ../src/guestfs.pod:832
1669 msgid "guestfs_create"
1673 #: ../src/guestfs.pod:834
1676 " guestfs_h *guestfs_create (void);\n"
1681 #: ../src/guestfs.pod:836
1682 msgid "Create a connection handle."
1686 #: ../src/guestfs.pod:838
1687 msgid "You have to call L</guestfs_add_drive> on the handle at least once."
1691 #: ../src/guestfs.pod:840
1693 "This function returns a non-NULL pointer to a handle on success or NULL on "
1698 #: ../src/guestfs.pod:843
1699 msgid "After configuring the handle, you have to call L</guestfs_launch>."
1703 #: ../src/guestfs.pod:845
1705 "You may also want to configure error handling for the handle. See L</ERROR "
1706 "HANDLING> section below."
1710 #: ../src/guestfs.pod:848
1711 msgid "guestfs_close"
1715 #: ../src/guestfs.pod:850
1718 " void guestfs_close (guestfs_h *g);\n"
1723 #: ../src/guestfs.pod:852
1724 msgid "This closes the connection handle and frees up all resources used."
1728 #: ../src/guestfs.pod:854
1729 msgid "ERROR HANDLING"
1733 #: ../src/guestfs.pod:856
1735 "The convention in all functions that return C<int> is that they return C<-1> "
1736 "to indicate an error. You can get additional information on errors by "
1737 "calling L</guestfs_last_error> and/or by setting up an error handler with "
1738 "L</guestfs_set_error_handler>."
1742 #: ../src/guestfs.pod:861
1743 msgid "The default error handler prints the information string to C<stderr>."
1747 #: ../src/guestfs.pod:863
1749 "Out of memory errors are handled differently. The default action is to call "
1750 "L<abort(3)>. If this is undesirable, then you can set a handler using "
1751 "L</guestfs_set_out_of_memory_handler>."
1755 #: ../src/guestfs.pod:867
1756 msgid "guestfs_last_error"
1760 #: ../src/guestfs.pod:869
1763 " const char *guestfs_last_error (guestfs_h *g);\n"
1768 #: ../src/guestfs.pod:871
1770 "This returns the last error message that happened on C<g>. If there has not "
1771 "been an error since the handle was created, then this returns C<NULL>."
1775 #: ../src/guestfs.pod:875
1777 "The lifetime of the returned string is until the next error occurs, or "
1778 "L</guestfs_close> is called."
1782 #: ../src/guestfs.pod:878
1784 "The error string is not localized (ie. is always in English), because this "
1785 "makes searching for error messages in search engines give the largest number "
1790 #: ../src/guestfs.pod:882
1791 msgid "guestfs_set_error_handler"
1795 #: ../src/guestfs.pod:884
1798 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
1800 " const char *msg);\n"
1801 " void guestfs_set_error_handler (guestfs_h *g,\n"
1802 " guestfs_error_handler_cb cb,\n"
1808 #: ../src/guestfs.pod:891
1810 "The callback C<cb> will be called if there is an error. The parameters "
1811 "passed to the callback are an opaque data pointer and the error message "
1816 #: ../src/guestfs.pod:895
1818 "Note that the message string C<msg> is freed as soon as the callback "
1819 "function returns, so if you want to stash it somewhere you must make your "
1824 #: ../src/guestfs.pod:899
1825 msgid "The default handler prints messages on C<stderr>."
1829 #: ../src/guestfs.pod:901
1830 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
1834 #: ../src/guestfs.pod:903
1835 msgid "guestfs_get_error_handler"
1839 #: ../src/guestfs.pod:905
1842 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
1843 " void **opaque_rtn);\n"
1848 #: ../src/guestfs.pod:908
1849 msgid "Returns the current error handler callback."
1853 #: ../src/guestfs.pod:910
1854 msgid "guestfs_set_out_of_memory_handler"
1858 #: ../src/guestfs.pod:912
1861 " typedef void (*guestfs_abort_cb) (void);\n"
1862 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
1863 " guestfs_abort_cb);\n"
1868 #: ../src/guestfs.pod:916
1870 "The callback C<cb> will be called if there is an out of memory situation. "
1871 "I<Note this callback must not return>."
1875 #: ../src/guestfs.pod:919
1876 msgid "The default is to call L<abort(3)>."
1880 #: ../src/guestfs.pod:921
1881 msgid "You cannot set C<cb> to C<NULL>. You can't ignore out of memory situations."
1885 #: ../src/guestfs.pod:924
1886 msgid "guestfs_get_out_of_memory_handler"
1890 #: ../src/guestfs.pod:926
1893 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
1898 #: ../src/guestfs.pod:928
1899 msgid "This returns the current out of memory handler."
1903 #: ../src/guestfs.pod:930
1908 #: ../src/guestfs.pod:932
1910 "Libguestfs needs a kernel and initrd.img, which it finds by looking along an "
1915 #: ../src/guestfs.pod:935
1917 "By default it looks for these in the directory C<$libdir/guestfs> "
1918 "(eg. C</usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
1922 #: ../src/guestfs.pod:938
1924 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
1925 "to change the directories that libguestfs will search in. The value is a "
1926 "colon-separated list of paths. The current directory is I<not> searched "
1927 "unless the path contains an empty element or C<.>. For example "
1928 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
1929 "then C</usr/lib/guestfs>."
1933 #: ../src/guestfs.pod:945
1934 msgid "HIGH-LEVEL API ACTIONS"
1938 #: ../src/guestfs.pod:947
1939 msgid "ABI GUARANTEE"
1943 #: ../src/guestfs.pod:949
1945 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
1946 "actions as outlined in this section. Although we will deprecate some "
1947 "actions, for example if they get replaced by newer calls, we will keep the "
1948 "old actions forever. This allows you the developer to program in confidence "
1949 "against the libguestfs API."
1953 #: ../src/guestfs.pod:955 ../fish/guestfish.pod:819
1958 #: ../src/guestfs.pod:957
1963 #: ../src/guestfs.pod:959
1968 #: ../src/guestfs.pod:961
1969 msgid "AVAILABILITY"
1973 #: ../src/guestfs.pod:963
1974 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
1978 #: ../src/guestfs.pod:965
1980 "Using L</guestfs_available> you can test availability of the following "
1981 "groups of functions. This test queries the appliance to see if the "
1982 "appliance you are currently using supports the functionality."
1986 #: ../src/guestfs.pod:970
1987 msgid "@AVAILABILITY@"
1991 #: ../src/guestfs.pod:972
1992 msgid "GUESTFISH supported COMMAND"
1996 #: ../src/guestfs.pod:974
1998 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
1999 "prints out the available groups and whether they are supported by this build "
2000 "of libguestfs. Note however that you have to do C<run> first."
2004 #: ../src/guestfs.pod:979
2005 msgid "SINGLE CALLS AT COMPILE TIME"
2009 #: ../src/guestfs.pod:981
2011 "Since version 1.5.8, C<E<lt>guestfs.hE<gt>> defines symbols for each C API "
2012 "function, such as:"
2016 #: ../src/guestfs.pod:984
2019 " #define LIBGUESTFS_HAVE_DD 1\n"
2024 #: ../src/guestfs.pod:986
2025 msgid "if L</guestfs_dd> is available."
2029 #: ../src/guestfs.pod:988
2031 "Before version 1.5.8, if you needed to test whether a single libguestfs "
2032 "function is available at compile time, we recommended using build tools such "
2033 "as autoconf or cmake. For example in autotools you could use:"
2037 #: ../src/guestfs.pod:993
2040 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
2041 " AC_CHECK_FUNCS([guestfs_dd])\n"
2046 #: ../src/guestfs.pod:996
2048 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
2053 #: ../src/guestfs.pod:999
2054 msgid "SINGLE CALLS AT RUN TIME"
2058 #: ../src/guestfs.pod:1001
2060 "Testing at compile time doesn't guarantee that a function really exists in "
2061 "the library. The reason is that you might be dynamically linked against a "
2062 "previous I<libguestfs.so> (dynamic library) which doesn't have the call. "
2063 "This situation unfortunately results in a segmentation fault, which is a "
2064 "shortcoming of the C dynamic linking system itself."
2068 #: ../src/guestfs.pod:1008
2070 "You can use L<dlopen(3)> to test if a function is available at run time, as "
2071 "in this example program (note that you still need the compile time check as "
2076 #: ../src/guestfs.pod:1012
2079 " #include <stdio.h>\n"
2080 " #include <stdlib.h>\n"
2081 " #include <unistd.h>\n"
2082 " #include <dlfcn.h>\n"
2083 " #include <guestfs.h>\n"
2088 #: ../src/guestfs.pod:1018
2093 " #ifdef LIBGUESTFS_HAVE_DD\n"
2095 " int has_function;\n"
2100 #: ../src/guestfs.pod:1024
2103 " /* Test if the function guestfs_dd is really available. */\n"
2104 " dl = dlopen (NULL, RTLD_LAZY);\n"
2106 " fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
2107 " exit (EXIT_FAILURE);\n"
2109 " has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
2115 #: ../src/guestfs.pod:1033
2118 " if (!has_function)\n"
2119 " printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
2121 " printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
2122 " /* Now it's safe to call\n"
2123 " guestfs_dd (g, \"foo\", \"bar\");\n"
2127 " printf (\"guestfs_dd function was not found at compile time\\n\");\n"
2134 #: ../src/guestfs.pod:1046
2136 "You may think the above is an awful lot of hassle, and it is. There are "
2137 "other ways outside of the C linking system to ensure that this kind of "
2138 "incompatibility never arises, such as using package versioning:"
2142 #: ../src/guestfs.pod:1051
2145 " Requires: libguestfs >= 1.0.80\n"
2150 #: ../src/guestfs.pod:1053 ../src/guestfs.pod:1058
2155 #: ../src/guestfs.pod:1055
2157 "<!-- old anchor for the next section --> <a "
2158 "name=\"state_machine_and_low_level_event_api\"/>"
2162 #: ../src/guestfs.pod:1060
2163 msgid "ARCHITECTURE"
2167 #: ../src/guestfs.pod:1062
2169 "Internally, libguestfs is implemented by running an appliance (a special "
2170 "type of small virtual machine) using L<qemu(1)>. Qemu runs as a child "
2171 "process of the main program."
2175 #: ../src/guestfs.pod:1066
2178 " ___________________\n"
2180 " | main program |\n"
2182 " | | child process / appliance\n"
2183 " | | __________________________\n"
2185 " +-------------------+ RPC | +-----------------+ |\n"
2186 " | libguestfs <--------------------> guestfsd | |\n"
2187 " | | | +-----------------+ |\n"
2188 " \\___________________/ | | Linux kernel | |\n"
2189 " | +--^--------------+ |\n"
2190 " \\_________|________________/\n"
2196 " \\______________/\n"
2201 #: ../src/guestfs.pod:1086
2203 "The library, linked to the main program, creates the child process and hence "
2204 "the appliance in the L</guestfs_launch> function."
2208 #: ../src/guestfs.pod:1089
2210 "Inside the appliance is a Linux kernel and a complete stack of userspace "
2211 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
2212 "L</guestfsd>. The library talks to L</guestfsd> using remote procedure "
2213 "calls (RPC). There is a mostly one-to-one correspondence between libguestfs "
2214 "API calls and RPC calls to the daemon. Lastly the disk image(s) are "
2215 "attached to the qemu process which translates device access by the "
2216 "appliance's Linux kernel into accesses to the image."
2220 #: ../src/guestfs.pod:1098
2222 "A common misunderstanding is that the appliance \"is\" the virtual machine. "
2223 "Although the disk image you are attached to might also be used by some "
2224 "virtual machine, libguestfs doesn't know or care about this. (But you will "
2225 "care if both libguestfs's qemu process and your virtual machine are trying "
2226 "to update the disk image at the same time, since these usually results in "
2227 "massive disk corruption)."
2231 #: ../src/guestfs.pod:1105
2232 msgid "STATE MACHINE"
2236 #: ../src/guestfs.pod:1107
2237 msgid "libguestfs uses a state machine to model the child process:"
2241 #: ../src/guestfs.pod:1109
2253 " / | \\ \\ guestfs_launch\n"
2254 " / | _\\__V______\n"
2256 " / | | LAUNCHING |\n"
2257 " / | \\___________/\n"
2259 " / | guestfs_launch\n"
2261 " ______ / __|____V\n"
2262 " / \\ ------> / \\\n"
2263 " | BUSY | | READY |\n"
2264 " \\______/ <------ \\________/\n"
2269 #: ../src/guestfs.pod:1131
2271 "The normal transitions are (1) CONFIG (when the handle is created, but there "
2272 "is no child process), (2) LAUNCHING (when the child process is booting up), "
2273 "(3) alternating between READY and BUSY as commands are issued to, and "
2274 "carried out by, the child process."
2278 #: ../src/guestfs.pod:1136
2280 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
2281 "asynchronously at any time (eg. due to some internal error), and that causes "
2282 "the state to transition back to CONFIG."
2286 #: ../src/guestfs.pod:1140
2288 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
2289 "issued when in the CONFIG state."
2293 #: ../src/guestfs.pod:1143
2295 "The API offers one call that goes from CONFIG through LAUNCHING to READY. "
2296 "L</guestfs_launch> blocks until the child process is READY to accept "
2297 "commands (or until some failure or timeout). L</guestfs_launch> internally "
2298 "moves the state from CONFIG to LAUNCHING while it is running."
2302 #: ../src/guestfs.pod:1149
2304 "API actions such as L</guestfs_mount> can only be issued when in the READY "
2305 "state. These API calls block waiting for the command to be carried out "
2306 "(ie. the state to transition to BUSY and then back to READY). There are no "
2307 "non-blocking versions, and no way to issue more than one command per handle "
2312 #: ../src/guestfs.pod:1155
2314 "Finally, the child process sends asynchronous messages back to the main "
2315 "program, such as kernel log messages. You can register a callback to "
2316 "receive these messages."
2320 #: ../src/guestfs.pod:1159
2321 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
2325 #: ../src/guestfs.pod:1161
2327 "The child process generates events in some situations. Current events "
2328 "include: receiving a log message, the child process exits."
2332 #: ../src/guestfs.pod:1164
2334 "Use the C<guestfs_set_*_callback> functions to set a callback for different "
2339 #: ../src/guestfs.pod:1167
2341 "Only I<one callback of each type> can be registered for each handle. "
2342 "Calling C<guestfs_set_*_callback> again overwrites the previous callback of "
2343 "that type. Cancel all callbacks of this type by calling this function with "
2344 "C<cb> set to C<NULL>."
2348 #: ../src/guestfs.pod:1172
2349 msgid "guestfs_set_log_message_callback"
2353 #: ../src/guestfs.pod:1174
2356 " typedef void (*guestfs_log_message_cb) (guestfs_h *g, void *opaque,\n"
2357 " char *buf, int len);\n"
2358 " void guestfs_set_log_message_callback (guestfs_h *g,\n"
2359 " guestfs_log_message_cb cb,\n"
2365 #: ../src/guestfs.pod:1180
2367 "The callback function C<cb> will be called whenever qemu or the guest writes "
2368 "anything to the console."
2372 #: ../src/guestfs.pod:1183
2373 msgid "Use this function to capture kernel messages and similar."
2377 #: ../src/guestfs.pod:1185
2379 "Normally there is no log message handler, and log messages are just "
2384 #: ../src/guestfs.pod:1188
2385 msgid "guestfs_set_subprocess_quit_callback"
2389 #: ../src/guestfs.pod:1190
2392 " typedef void (*guestfs_subprocess_quit_cb) (guestfs_h *g, void *opaque);\n"
2393 " void guestfs_set_subprocess_quit_callback (guestfs_h *g,\n"
2394 " guestfs_subprocess_quit_cb cb,\n"
2400 #: ../src/guestfs.pod:1195
2402 "The callback function C<cb> will be called when the child process quits, "
2403 "either asynchronously or if killed by L</guestfs_kill_subprocess>. (This "
2404 "corresponds to a transition from any state to the CONFIG state)."
2408 #: ../src/guestfs.pod:1200
2409 msgid "guestfs_set_launch_done_callback"
2413 #: ../src/guestfs.pod:1202
2416 " typedef void (*guestfs_launch_done_cb) (guestfs_h *g, void *opaque);\n"
2417 " void guestfs_set_launch_done_callback (guestfs_h *g,\n"
2418 " guestfs_launch_done_cb cb,\n"
2424 #: ../src/guestfs.pod:1207
2426 "The callback function C<cb> will be called when the child process becomes "
2427 "ready first time after it has been launched. (This corresponds to a "
2428 "transition from LAUNCHING to the READY state)."
2432 #: ../src/guestfs.pod:1211
2433 msgid "guestfs_set_close_callback"
2437 #: ../src/guestfs.pod:1213
2440 " typedef void (*guestfs_close_cb) (guestfs_h *g, void *opaque);\n"
2441 " void guestfs_set_close_callback (guestfs_h *g,\n"
2442 " guestfs_close_cb cb,\n"
2448 #: ../src/guestfs.pod:1218
2450 "The callback function C<cb> will be called while the handle is being closed "
2451 "(synchronously from L</guestfs_close>)."
2455 #: ../src/guestfs.pod:1221
2457 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
2458 "handles that are open when the program exits. This means that this callback "
2459 "might be called indirectly from L<exit(3)>, which can cause unexpected "
2460 "problems in higher-level languages (eg. if your HLL interpreter has already "
2461 "been cleaned up by the time this is called, and if your callback then jumps "
2462 "into some HLL function)."
2466 #: ../src/guestfs.pod:1229
2467 msgid "guestfs_set_progress_callback"
2471 #: ../src/guestfs.pod:1231
2474 " typedef void (*guestfs_progress_cb) (guestfs_h *g, void *opaque,\n"
2475 " int proc_nr, int serial,\n"
2476 " uint64_t position, uint64_t total);\n"
2477 " void guestfs_set_progress_callback (guestfs_h *g,\n"
2478 " guestfs_progress_cb cb,\n"
2484 #: ../src/guestfs.pod:1238
2486 "Some long-running operations can generate progress messages. If this "
2487 "callback is registered, then it will be called each time a progress message "
2488 "is generated (usually two seconds after the operation started, and three "
2489 "times per second thereafter until it completes, although the frequency may "
2490 "change in future versions)."
2494 #: ../src/guestfs.pod:1244
2496 "The callback receives two numbers: C<position> and C<total>. The units of "
2497 "C<total> are not defined, although for some operations C<total> may relate "
2498 "in some way to the amount of data to be transferred (eg. in bytes or "
2499 "megabytes), and C<position> may be the portion which has been transferred."
2503 #: ../src/guestfs.pod:1250
2504 msgid "The only defined and stable parts of the API are:"
2508 #: ../src/guestfs.pod:1256
2510 "The callback can display to the user some type of progress bar or indicator "
2511 "which shows the ratio of C<position>:C<total>."
2515 #: ../src/guestfs.pod:1261
2516 msgid "0 E<lt>= C<position> E<lt>= C<total>"
2520 #: ../src/guestfs.pod:1265
2522 "If any progress notification is sent during a call, then a final progress "
2523 "notification is always sent when C<position> = C<total>."
2527 #: ../src/guestfs.pod:1268
2529 "This is to simplify caller code, so callers can easily set the progress "
2530 "indicator to \"100%\" at the end of the operation, without requiring special "
2531 "code to detect this case."
2535 #: ../src/guestfs.pod:1274
2537 "The callback also receives the procedure number and serial number of the "
2538 "call. These are only useful for debugging protocol issues, and the callback "
2539 "can normally ignore them. The callback may want to print these numbers in "
2540 "error messages or debugging messages."
2544 #: ../src/guestfs.pod:1279
2545 msgid "PRIVATE DATA AREA"
2549 #: ../src/guestfs.pod:1281
2551 "You can attach named pieces of private data to the libguestfs handle, and "
2552 "fetch them by name for the lifetime of the handle. This is called the "
2553 "private data area and is only available from the C API."
2557 #: ../src/guestfs.pod:1285
2558 msgid "To attach a named piece of data, use the following call:"
2562 #: ../src/guestfs.pod:1287
2565 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
2570 #: ../src/guestfs.pod:1289
2572 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
2573 "pointer (which can be C<NULL>). Any previous item with the same name is "
2578 #: ../src/guestfs.pod:1293
2580 "You can use any C<key> you want, but names beginning with an underscore "
2581 "character are reserved for internal libguestfs purposes (for implementing "
2582 "language bindings). It is recommended to prefix the name with some unique "
2583 "string to avoid collisions with other users."
2587 #: ../src/guestfs.pod:1298
2588 msgid "To retrieve the pointer, use:"
2592 #: ../src/guestfs.pod:1300
2595 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
2600 #: ../src/guestfs.pod:1302
2602 "This function returns C<NULL> if either no data is found associated with "
2603 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
2608 #: ../src/guestfs.pod:1306
2610 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
2611 "way. As far as libguestfs is concerned, it need not be a valid pointer at "
2612 "all. In particular, libguestfs does I<not> try to free the data when the "
2613 "handle is closed. If the data must be freed, then the caller must either "
2614 "free it before calling L</guestfs_close> or must set up a close callback to "
2615 "do it (see L</guestfs_set_close_callback>, and note that only one callback "
2616 "can be registered for a handle)."
2620 #: ../src/guestfs.pod:1314
2622 "The private data area is implemented using a hash table, and should be "
2623 "reasonably efficient for moderate numbers of keys."
2627 #: ../src/guestfs.pod:1317
2628 msgid "BLOCK DEVICE NAMING"
2632 #: ../src/guestfs.pod:1319
2634 "In the kernel there is now quite a profusion of schemata for naming block "
2635 "devices (in this context, by I<block device> I mean a physical or virtual "
2636 "hard drive). The original Linux IDE driver used names starting with "
2637 "C</dev/hd*>. SCSI devices have historically used a different naming scheme, "
2638 "C</dev/sd*>. When the Linux kernel I<libata> driver became a popular "
2639 "replacement for the old IDE driver (particularly for SATA devices) those "
2640 "devices also used the C</dev/sd*> scheme. Additionally we now have virtual "
2641 "machines with paravirtualized drivers. This has created several different "
2642 "naming systems, such as C</dev/vd*> for virtio disks and C</dev/xvd*> for "
2647 #: ../src/guestfs.pod:1331
2649 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2650 "Linux kernel to access block devices. We can run a variety of appliances "
2651 "based on a variety of Linux kernels."
2655 #: ../src/guestfs.pod:1335
2657 "This causes a problem for libguestfs because many API calls use device or "
2658 "partition names. Working scripts and the recipe (example) scripts that we "
2659 "make available over the internet could fail if the naming scheme changes."
2663 #: ../src/guestfs.pod:1340
2665 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>. "
2666 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2667 "required. For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2668 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2672 #: ../src/guestfs.pod:1346
2674 "Note that this I<only> applies to parameters. The L</guestfs_list_devices>, "
2675 "L</guestfs_list_partitions> and similar calls return the true names of the "
2676 "devices and partitions as known to the appliance."
2680 #: ../src/guestfs.pod:1351
2681 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
2685 #: ../src/guestfs.pod:1353
2687 "Usually this translation is transparent. However in some (very rare) cases "
2688 "you may need to know the exact algorithm. Such cases include where you use "
2689 "L</guestfs_config> to add a mixture of virtio and IDE devices to the "
2690 "qemu-based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> "
2695 #: ../src/guestfs.pod:1359
2697 "The algorithm is applied only to I<parameters> which are known to be either "
2698 "device or partition names. Return values from functions such as "
2699 "L</guestfs_list_devices> are never changed."
2703 #: ../src/guestfs.pod:1367
2704 msgid "Is the string a parameter which is a device or partition name?"
2708 #: ../src/guestfs.pod:1371
2709 msgid "Does the string begin with C</dev/sd>?"
2713 #: ../src/guestfs.pod:1375
2715 "Does the named device exist? If so, we use that device. However if I<not> "
2716 "then we continue with this algorithm."
2720 #: ../src/guestfs.pod:1380
2721 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
2725 #: ../src/guestfs.pod:1382
2726 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
2730 #: ../src/guestfs.pod:1384
2731 msgid "If that named device exists, use it. If not, continue."
2735 #: ../src/guestfs.pod:1388
2736 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
2740 #: ../src/guestfs.pod:1390
2741 msgid "If that named device exists, use it. If not, return an error."
2745 #: ../src/guestfs.pod:1394
2746 msgid "PORTABILITY CONCERNS"
2750 #: ../src/guestfs.pod:1396
2752 "Although the standard naming scheme and automatic translation is useful for "
2753 "simple programs and guestfish scripts, for larger programs it is best not to "
2754 "rely on this mechanism."
2758 #: ../src/guestfs.pod:1400
2760 "Where possible for maximum future portability programs using libguestfs "
2761 "should use these future-proof techniques:"
2765 #: ../src/guestfs.pod:1407
2767 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
2768 "device names, and then use those names directly."
2772 #: ../src/guestfs.pod:1410
2773 msgid "Since those device names exist by definition, they will never be translated."
2777 #: ../src/guestfs.pod:1415
2779 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
2780 "filesystem labels."
2784 #: ../src/guestfs.pod:1420
2789 #: ../src/guestfs.pod:1422
2790 msgid "COMMUNICATION PROTOCOL"
2794 #: ../src/guestfs.pod:1424
2796 "Don't rely on using this protocol directly. This section documents how it "
2797 "currently works, but it may change at any time."
2801 #: ../src/guestfs.pod:1427
2803 "The protocol used to talk between the library and the daemon running inside "
2804 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
2805 "1014, RFC 1832, RFC 4506)."
2809 #: ../src/guestfs.pod:1431
2811 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
2812 "this file is automatically generated)."
2816 #: ../src/guestfs.pod:1434
2818 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
2819 "and C<FileOut> parameters, which are handled with very simple request/reply "
2820 "messages. Then there are functions that have any C<FileIn> or C<FileOut> "
2821 "parameters, which use the same request and reply messages, but they may also "
2822 "be followed by files sent using a chunked encoding."
2826 #: ../src/guestfs.pod:1441
2827 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
2831 #: ../src/guestfs.pod:1443
2832 msgid "For ordinary functions, the request message is:"
2836 #: ../src/guestfs.pod:1445
2839 " total length (header + arguments,\n"
2840 " but not including the length word itself)\n"
2841 " struct guestfs_message_header (encoded as XDR)\n"
2842 " struct guestfs_<foo>_args (encoded as XDR)\n"
2847 #: ../src/guestfs.pod:1450
2849 "The total length field allows the daemon to allocate a fixed size buffer "
2850 "into which it slurps the rest of the message. As a result, the total length "
2851 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
2852 "effective size of any request is limited to somewhere under this size."
2856 #: ../src/guestfs.pod:1456
2858 "Note also that many functions don't take any arguments, in which case the "
2859 "C<guestfs_I<foo>_args> is completely omitted."
2863 #: ../src/guestfs.pod:1459
2865 "The header contains the procedure number (C<guestfs_proc>) which is how the "
2866 "receiver knows what type of args structure to expect, or none at all."
2870 #: ../src/guestfs.pod:1463
2871 msgid "The reply message for ordinary functions is:"
2875 #: ../src/guestfs.pod:1465
2878 " total length (header + ret,\n"
2879 " but not including the length word itself)\n"
2880 " struct guestfs_message_header (encoded as XDR)\n"
2881 " struct guestfs_<foo>_ret (encoded as XDR)\n"
2886 #: ../src/guestfs.pod:1470
2888 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
2889 "functions that return no formal return values."
2893 #: ../src/guestfs.pod:1473
2894 msgid "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
2898 #: ../src/guestfs.pod:1476
2900 "In the case of an error, a flag is set in the header, and the reply message "
2901 "is slightly changed:"
2905 #: ../src/guestfs.pod:1479
2908 " total length (header + error,\n"
2909 " but not including the length word itself)\n"
2910 " struct guestfs_message_header (encoded as XDR)\n"
2911 " struct guestfs_message_error (encoded as XDR)\n"
2916 #: ../src/guestfs.pod:1484
2918 "The C<guestfs_message_error> structure contains the error message as a "
2923 #: ../src/guestfs.pod:1487
2924 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
2928 #: ../src/guestfs.pod:1489
2930 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest. "
2931 "The normal request message is sent (see above). However this is followed by "
2932 "a sequence of file chunks."
2936 #: ../src/guestfs.pod:1493
2939 " total length (header + arguments,\n"
2940 " but not including the length word itself,\n"
2941 " and not including the chunks)\n"
2942 " struct guestfs_message_header (encoded as XDR)\n"
2943 " struct guestfs_<foo>_args (encoded as XDR)\n"
2944 " sequence of chunks for FileIn param #0\n"
2945 " sequence of chunks for FileIn param #1 etc.\n"
2950 #: ../src/guestfs.pod:1501
2951 msgid "The \"sequence of chunks\" is:"
2955 #: ../src/guestfs.pod:1503
2958 " length of chunk (not including length word itself)\n"
2959 " struct guestfs_chunk (encoded as XDR)\n"
2960 " length of chunk\n"
2961 " struct guestfs_chunk (encoded as XDR)\n"
2963 " length of chunk\n"
2964 " struct guestfs_chunk (with data.data_len == 0)\n"
2969 #: ../src/guestfs.pod:1511
2971 "The final chunk has the C<data_len> field set to zero. Additionally a flag "
2972 "is set in the final chunk to indicate either successful completion or early "
2977 #: ../src/guestfs.pod:1515
2979 "At time of writing there are no functions that have more than one FileIn "
2980 "parameter. However this is (theoretically) supported, by sending the "
2981 "sequence of chunks for each FileIn parameter one after another (from left to "
2986 #: ../src/guestfs.pod:1520
2988 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
2989 "transfer. The library does this by sending a chunk with a special flag set "
2990 "to indicate cancellation. When the daemon sees this, it cancels the whole "
2991 "RPC, does I<not> send any reply, and goes back to reading the next request."
2995 #: ../src/guestfs.pod:1526
2997 "The daemon may also cancel. It does this by writing a special word "
2998 "C<GUESTFS_CANCEL_FLAG> to the socket. The library listens for this during "
2999 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
3000 "cancel chunk). The special word is chosen so that even if cancellation "
3001 "happens right at the end of the transfer (after the library has finished "
3002 "writing and has started listening for the reply), the \"spurious\" cancel "
3003 "flag will not be confused with the reply message."
3007 #: ../src/guestfs.pod:1535
3009 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
3010 "limit), and also files where the size is not known in advance (eg. from "
3011 "pipes or sockets). However the chunks are rather small "
3012 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
3013 "to keep much in memory."
3017 #: ../src/guestfs.pod:1541
3018 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
3022 #: ../src/guestfs.pod:1543
3024 "The protocol for FileOut parameters is exactly the same as for FileIn "
3025 "parameters, but with the roles of daemon and library reversed."
3029 #: ../src/guestfs.pod:1546
3032 " total length (header + ret,\n"
3033 " but not including the length word itself,\n"
3034 " and not including the chunks)\n"
3035 " struct guestfs_message_header (encoded as XDR)\n"
3036 " struct guestfs_<foo>_ret (encoded as XDR)\n"
3037 " sequence of chunks for FileOut param #0\n"
3038 " sequence of chunks for FileOut param #1 etc.\n"
3043 #: ../src/guestfs.pod:1554
3044 msgid "INITIAL MESSAGE"
3048 #: ../src/guestfs.pod:1556
3050 "When the daemon launches it sends an initial word (C<GUESTFS_LAUNCH_FLAG>) "
3051 "which indicates that the guest and daemon is alive. This is what "
3052 "L</guestfs_launch> waits for."
3056 #: ../src/guestfs.pod:1560
3057 msgid "PROGRESS NOTIFICATION MESSAGES"
3061 #: ../src/guestfs.pod:1562
3063 "The daemon may send progress notification messages at any time. These are "
3064 "distinguished by the normal length word being replaced by "
3065 "C<GUESTFS_PROGRESS_FLAG>, followed by a fixed size progress message."
3069 #: ../src/guestfs.pod:1566
3071 "The library turns them into progress callbacks (see "
3072 "C<guestfs_set_progress_callback>) if there is a callback registered, or "
3073 "discards them if not."
3077 #: ../src/guestfs.pod:1570
3079 "The daemon self-limits the frequency of progress messages it sends (see "
3080 "C<daemon/proto.c:notify_progress>). Not all calls generate progress "
3085 #: ../src/guestfs.pod:1574
3086 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
3090 #: ../src/guestfs.pod:1576
3092 "All high-level libguestfs actions are synchronous. If you want to use "
3093 "libguestfs asynchronously then you must create a thread."
3097 #: ../src/guestfs.pod:1579
3099 "Only use the handle from a single thread. Either use the handle exclusively "
3100 "from one thread, or provide your own mutex so that two threads cannot issue "
3101 "calls on the same handle at the same time."
3105 #: ../src/guestfs.pod:1583
3107 "See the graphical program guestfs-browser for one possible architecture for "
3108 "multithreaded programs using libvirt and libguestfs."
3112 #: ../src/guestfs.pod:1586
3113 msgid "QEMU WRAPPERS"
3117 #: ../src/guestfs.pod:1588
3119 "If you want to compile your own qemu, run qemu from a non-standard location, "
3120 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
3125 #: ../src/guestfs.pod:1592
3127 "There is one important rule to remember: you I<must C<exec qemu>> as the "
3128 "last command in the shell script (so that qemu replaces the shell and "
3129 "becomes the direct child of the libguestfs-using program). If you don't do "
3130 "this, then the qemu process won't be cleaned up correctly."
3134 #: ../src/guestfs.pod:1597
3136 "Here is an example of a wrapper, where I have built my own copy of qemu from "
3141 #: ../src/guestfs.pod:1600
3145 " qemudir=/home/rjones/d/qemu\n"
3146 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "
3152 #: ../src/guestfs.pod:1604
3154 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
3155 "then use it by setting the LIBGUESTFS_QEMU environment variable. For "
3160 #: ../src/guestfs.pod:1608
3163 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
3168 #: ../src/guestfs.pod:1610
3170 "Note that libguestfs also calls qemu with the -help and -version options in "
3171 "order to determine features."
3175 #: ../src/guestfs.pod:1613
3176 msgid "LIBGUESTFS VERSION NUMBERS"
3180 #: ../src/guestfs.pod:1615
3182 "Since April 2010, libguestfs has started to make separate development and "
3183 "stable releases, along with corresponding branches in our git repository. "
3184 "These separate releases can be identified by version number:"
3188 #: ../src/guestfs.pod:1620
3191 " even numbers for stable: 1.2.x, 1.4.x, ...\n"
3192 " .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
3198 " | `-------- sub-version\n"
3200 " `------ always '1' because we don't change the ABI\n"
3205 #: ../src/guestfs.pod:1631
3206 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
3210 #: ../src/guestfs.pod:1633
3212 "As time passes we cherry pick fixes from the development branch and backport "
3213 "those into the stable branch, the effect being that the stable branch should "
3214 "get more stable and less buggy over time. So the stable releases are ideal "
3215 "for people who don't need new features but would just like the software to "
3220 #: ../src/guestfs.pod:1639
3221 msgid "Our criteria for backporting changes are:"
3225 #: ../src/guestfs.pod:1645
3227 "Documentation changes which don't affect any code are backported unless the "
3228 "documentation refers to a future feature which is not in stable."
3232 #: ../src/guestfs.pod:1651
3234 "Bug fixes which are not controversial, fix obvious problems, and have been "
3235 "well tested are backported."
3239 #: ../src/guestfs.pod:1656
3241 "Simple rearrangements of code which shouldn't affect how it works get "
3242 "backported. This is so that the code in the two branches doesn't get too "
3243 "far out of step, allowing us to backport future fixes more easily."
3247 #: ../src/guestfs.pod:1662
3249 "We I<don't> backport new features, new APIs, new tools etc, except in one "
3250 "exceptional case: the new feature is required in order to implement an "
3251 "important bug fix."
3255 #: ../src/guestfs.pod:1668
3257 "A new stable branch starts when we think the new features in development are "
3258 "substantial and compelling enough over the current stable branch to warrant "
3259 "it. When that happens we create new stable and development versions 1.N.0 "
3260 "and 1.(N+1).0 [N is even]. The new dot-oh release won't necessarily be so "
3261 "stable at this point, but by backporting fixes from development, that branch "
3262 "will stabilize over time."
3266 #: ../src/guestfs.pod:1676 ../fish/guestfish.pod:826 ../test-tool/libguestfs-test-tool.pod:104 ../tools/virt-edit.pl:312 ../tools/virt-rescue.pl:226
3267 msgid "ENVIRONMENT VARIABLES"
3271 #: ../src/guestfs.pod:1680 ../fish/guestfish.pod:852
3272 msgid "LIBGUESTFS_APPEND"
3276 #: ../src/guestfs.pod:1682 ../fish/guestfish.pod:854
3277 msgid "Pass additional options to the guest kernel."
3281 #: ../src/guestfs.pod:1684 ../fish/guestfish.pod:856
3282 msgid "LIBGUESTFS_DEBUG"
3286 #: ../src/guestfs.pod:1686
3288 "Set C<LIBGUESTFS_DEBUG=1> to enable verbose messages. This has the same "
3289 "effect as calling C<guestfs_set_verbose (g, 1)>."
3293 #: ../src/guestfs.pod:1689 ../fish/guestfish.pod:861
3294 msgid "LIBGUESTFS_MEMSIZE"
3298 #: ../src/guestfs.pod:1691 ../fish/guestfish.pod:863
3299 msgid "Set the memory allocated to the qemu process, in megabytes. For example:"
3303 #: ../src/guestfs.pod:1694 ../fish/guestfish.pod:866
3306 " LIBGUESTFS_MEMSIZE=700\n"
3311 #: ../src/guestfs.pod:1696 ../fish/guestfish.pod:868
3312 msgid "LIBGUESTFS_PATH"
3316 #: ../src/guestfs.pod:1698
3318 "Set the path that libguestfs uses to search for kernel and initrd.img. See "
3319 "the discussion of paths in section PATH above."
3323 #: ../src/guestfs.pod:1701 ../fish/guestfish.pod:873
3324 msgid "LIBGUESTFS_QEMU"
3328 #: ../src/guestfs.pod:1703 ../fish/guestfish.pod:875
3330 "Set the default qemu binary that libguestfs uses. If not set, then the qemu "
3331 "which was found at compile time by the configure script is used."
3335 #: ../src/guestfs.pod:1707
3336 msgid "See also L</QEMU WRAPPERS> above."
3340 #: ../src/guestfs.pod:1709 ../fish/guestfish.pod:879
3341 msgid "LIBGUESTFS_TRACE"
3345 #: ../src/guestfs.pod:1711
3347 "Set C<LIBGUESTFS_TRACE=1> to enable command traces. This has the same "
3348 "effect as calling C<guestfs_set_trace (g, 1)>."
3352 #: ../src/guestfs.pod:1714 ../fish/guestfish.pod:888
3357 #: ../src/guestfs.pod:1716 ../fish/guestfish.pod:890
3358 msgid "Location of temporary directory, defaults to C</tmp>."
3362 #: ../src/guestfs.pod:1718 ../fish/guestfish.pod:892
3364 "If libguestfs was compiled to use the supermin appliance then the real "
3365 "appliance is cached in this directory, shared between all handles belonging "
3366 "to the same EUID. You can use C<$TMPDIR> to configure another directory to "
3367 "use in case C</tmp> is not large enough."
3371 #: ../src/guestfs.pod:1726 ../fish/guestfish.pod:950 ../test-tool/libguestfs-test-tool.pod:109 ../fuse/guestmount.pod:178 ../inspector/virt-inspector.pl:846 ../tools/virt-edit.pl:325 ../tools/virt-win-reg.pl:461 ../tools/virt-df.pl:536 ../tools/virt-ls.pl:210 ../tools/virt-resize.pl:1390 ../tools/virt-list-filesystems.pl:191 ../tools/virt-cat.pl:163 ../tools/virt-tar.pl:257 ../tools/virt-rescue.pl:231 ../tools/virt-make-fs.pl:527 ../tools/virt-list-partitions.pl:229
3376 #: ../src/guestfs.pod:1728
3378 "L<guestfish(1)>, L<guestmount(1)>, L<virt-cat(1)>, L<virt-df(1)>, "
3379 "L<virt-edit(1)>, L<virt-inspector(1)>, L<virt-list-filesystems(1)>, "
3380 "L<virt-list-partitions(1)>, L<virt-ls(1)>, L<virt-make-fs(1)>, "
3381 "L<virt-rescue(1)>, L<virt-tar(1)>, L<virt-win-reg(1)>, L<qemu(1)>, "
3382 "L<febootstrap(1)>, L<hivex(3)>, L<http://libguestfs.org/>."
3386 #: ../src/guestfs.pod:1746
3388 "Tools with a similar purpose: L<fdisk(8)>, L<parted(8)>, L<kpartx(8)>, "
3389 "L<lvm(8)>, L<disktype(1)>."
3393 #: ../src/guestfs.pod:1753 ../tools/virt-win-reg.pl:476 ../tools/virt-make-fs.pl:541
3398 #: ../src/guestfs.pod:1755
3399 msgid "To get a list of bugs against libguestfs use this link:"
3403 #: ../src/guestfs.pod:1757
3404 msgid "L<https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools>"
3408 #: ../src/guestfs.pod:1759
3409 msgid "To report a new bug against libguestfs use this link:"
3413 #: ../src/guestfs.pod:1761
3414 msgid "L<https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools>"
3418 #: ../src/guestfs.pod:1763
3419 msgid "When reporting a bug, please check:"
3423 #: ../src/guestfs.pod:1769
3424 msgid "That the bug hasn't been reported already."
3428 #: ../src/guestfs.pod:1773
3429 msgid "That you are testing a recent version."
3433 #: ../src/guestfs.pod:1777
3434 msgid "Describe the bug accurately, and give a way to reproduce it."
3438 #: ../src/guestfs.pod:1781
3440 "Run libguestfs-test-tool and paste the B<complete, unedited> output into the "
3445 #: ../src/guestfs.pod:1786 ../fish/guestfish.pod:967 ../test-tool/libguestfs-test-tool.pod:115 ../fuse/guestmount.pod:189 ../inspector/virt-inspector.pl:855
3450 #: ../src/guestfs.pod:1788 ../fish/guestfish.pod:969 ../test-tool/libguestfs-test-tool.pod:117 ../fuse/guestmount.pod:191
3451 msgid "Richard W.M. Jones (C<rjones at redhat dot com>)"
3455 #: ../src/guestfs.pod:1790 ../fish/guestfish.pod:971 ../test-tool/libguestfs-test-tool.pod:119 ../fuse/guestmount.pod:193 ../inspector/virt-inspector.pl:861 ../tools/virt-edit.pl:341 ../tools/virt-win-reg.pl:491 ../tools/virt-df.pl:549 ../tools/virt-ls.pl:225 ../tools/virt-resize.pl:1411 ../tools/virt-list-filesystems.pl:207 ../tools/virt-cat.pl:177 ../tools/virt-tar.pl:272 ../tools/virt-rescue.pl:245 ../tools/virt-make-fs.pl:556 ../tools/virt-list-partitions.pl:244
3460 #: ../src/guestfs.pod:1792 ../fish/guestfish.pod:973
3461 msgid "Copyright (C) 2009-2010 Red Hat Inc. L<http://libguestfs.org/>"
3465 #: ../src/guestfs.pod:1795
3467 "This library is free software; you can redistribute it and/or modify it "
3468 "under the terms of the GNU Lesser General Public License as published by the "
3469 "Free Software Foundation; either version 2 of the License, or (at your "
3470 "option) any later version."
3474 #: ../src/guestfs.pod:1800
3476 "This library is distributed in the hope that it will be useful, but WITHOUT "
3477 "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or "
3478 "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
3483 #: ../src/guestfs.pod:1805
3485 "You should have received a copy of the GNU Lesser General Public License "
3486 "along with this library; if not, write to the Free Software Foundation, "
3487 "Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
3491 #: ../src/guestfs-actions.pod:1
3492 msgid "guestfs_add_cdrom"
3496 #: ../src/guestfs-actions.pod:3
3499 " int guestfs_add_cdrom (guestfs_h *g,\n"
3500 "\t\tconst char *filename);\n"
3505 #: ../src/guestfs-actions.pod:6 ../fish/guestfish-actions.pod:7
3506 msgid "This function adds a virtual CD-ROM disk image to the guest."
3510 #: ../src/guestfs-actions.pod:8 ../fish/guestfish-actions.pod:9
3511 msgid "This is equivalent to the qemu parameter C<-cdrom filename>."
3515 #: ../src/guestfs-actions.pod:10 ../src/guestfs-actions.pod:1516 ../fish/guestfish-actions.pod:11 ../fish/guestfish-actions.pod:1211
3520 #: ../src/guestfs-actions.pod:16
3522 "This call checks for the existence of C<filename>. This stops you from "
3523 "specifying other types of drive which are supported by qemu such as C<nbd:> "
3524 "and C<http:> URLs. To specify those, use the general C<guestfs_config> call "
3529 #: ../src/guestfs-actions.pod:23
3531 "If you just want to add an ISO file (often you use this as an efficient way "
3532 "to transfer large files into the guest), then you should probably use "
3533 "C<guestfs_add_drive_ro> instead."
3537 #: ../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:1002 ../src/guestfs-actions.pod:1024 ../src/guestfs-actions.pod:1055 ../src/guestfs-actions.pod:1143 ../src/guestfs-actions.pod:1174 ../src/guestfs-actions.pod:1374 ../src/guestfs-actions.pod:1393 ../src/guestfs-actions.pod:1474 ../src/guestfs-actions.pod:1822 ../src/guestfs-actions.pod:1945 ../src/guestfs-actions.pod:2000 ../src/guestfs-actions.pod:2030 ../src/guestfs-actions.pod:2439 ../src/guestfs-actions.pod:2451 ../src/guestfs-actions.pod:2468 ../src/guestfs-actions.pod:2576 ../src/guestfs-actions.pod:2587 ../src/guestfs-actions.pod:2597 ../src/guestfs-actions.pod:2608 ../src/guestfs-actions.pod:2620 ../src/guestfs-actions.pod:2650 ../src/guestfs-actions.pod:2714 ../src/guestfs-actions.pod:2731 ../src/guestfs-actions.pod:2745 ../src/guestfs-actions.pod:2765 ../src/guestfs-actions.pod:2785 ../src/guestfs-actions.pod:2814 ../src/guestfs-actions.pod:2830 ../src/guestfs-actions.pod:2846 ../src/guestfs-actions.pod:2858 ../src/guestfs-actions.pod:2867 ../src/guestfs-actions.pod:2900 ../src/guestfs-actions.pod:2913 ../src/guestfs-actions.pod:2923 ../src/guestfs-actions.pod:2935 ../src/guestfs-actions.pod:2949 ../src/guestfs-actions.pod:3029 ../src/guestfs-actions.pod:3046 ../src/guestfs-actions.pod:3056 ../src/guestfs-actions.pod:3101 ../src/guestfs-actions.pod:3116 ../src/guestfs-actions.pod:3131 ../src/guestfs-actions.pod:3144 ../src/guestfs-actions.pod:3155 ../src/guestfs-actions.pod:3166 ../src/guestfs-actions.pod:3180 ../src/guestfs-actions.pod:3192 ../src/guestfs-actions.pod:3209 ../src/guestfs-actions.pod:3240 ../src/guestfs-actions.pod:3268 ../src/guestfs-actions.pod:3284 ../src/guestfs-actions.pod:3300 ../src/guestfs-actions.pod:3309 ../src/guestfs-actions.pod:3323 ../src/guestfs-actions.pod:3333 ../src/guestfs-actions.pod:3345 ../src/guestfs-actions.pod:3357 ../src/guestfs-actions.pod:3389 ../src/guestfs-actions.pod:3401 ../src/guestfs-actions.pod:3418 ../src/guestfs-actions.pod:3429 ../src/guestfs-actions.pod:3443 ../src/guestfs-actions.pod:3483 ../src/guestfs-actions.pod:3514 ../src/guestfs-actions.pod:3525 ../src/guestfs-actions.pod:3550 ../src/guestfs-actions.pod:3564 ../src/guestfs-actions.pod:3579 ../src/guestfs-actions.pod:3701 ../src/guestfs-actions.pod:3753 ../src/guestfs-actions.pod:3772 ../src/guestfs-actions.pod:3787 ../src/guestfs-actions.pod:3813 ../src/guestfs-actions.pod:3847 ../src/guestfs-actions.pod:3861 ../src/guestfs-actions.pod:3871 ../src/guestfs-actions.pod:3882 ../src/guestfs-actions.pod:4137 ../src/guestfs-actions.pod:4153 ../src/guestfs-actions.pod:4164 ../src/guestfs-actions.pod:4173 ../src/guestfs-actions.pod:4184 ../src/guestfs-actions.pod:4193 ../src/guestfs-actions.pod:4204 ../src/guestfs-actions.pod:4217 ../src/guestfs-actions.pod:4235 ../src/guestfs-actions.pod:4251 ../src/guestfs-actions.pod:4267 ../src/guestfs-actions.pod:4282 ../src/guestfs-actions.pod:4302 ../src/guestfs-actions.pod:4317 ../src/guestfs-actions.pod:4333 ../src/guestfs-actions.pod:4351 ../src/guestfs-actions.pod:4367 ../src/guestfs-actions.pod:4381 ../src/guestfs-actions.pod:4406 ../src/guestfs-actions.pod:4427 ../src/guestfs-actions.pod:4443 ../src/guestfs-actions.pod:4464 ../src/guestfs-actions.pod:4476 ../src/guestfs-actions.pod:4488 ../src/guestfs-actions.pod:4504 ../src/guestfs-actions.pod:4538 ../src/guestfs-actions.pod:4558 ../src/guestfs-actions.pod:4581 ../src/guestfs-actions.pod:4671 ../src/guestfs-actions.pod:4777 ../src/guestfs-actions.pod:4786 ../src/guestfs-actions.pod:4796 ../src/guestfs-actions.pod:4806 ../src/guestfs-actions.pod:4825 ../src/guestfs-actions.pod:4835 ../src/guestfs-actions.pod:4845 ../src/guestfs-actions.pod:4855 ../src/guestfs-actions.pod:4867 ../src/guestfs-actions.pod:4917 ../src/guestfs-actions.pod:4931 ../src/guestfs-actions.pod:4944 ../src/guestfs-actions.pod:4957 ../src/guestfs-actions.pod:4971 ../src/guestfs-actions.pod:4981 ../src/guestfs-actions.pod:4998 ../src/guestfs-actions.pod:5028 ../src/guestfs-actions.pod:5039 ../src/guestfs-actions.pod:5074 ../src/guestfs-actions.pod:5084 ../src/guestfs-actions.pod:5099 ../src/guestfs-actions.pod:5125 ../src/guestfs-actions.pod:5153 ../src/guestfs-actions.pod:5257 ../src/guestfs-actions.pod:5272 ../src/guestfs-actions.pod:5283 ../src/guestfs-actions.pod:5329 ../src/guestfs-actions.pod:5339 ../src/guestfs-actions.pod:5376 ../src/guestfs-actions.pod:5403 ../src/guestfs-actions.pod:5445 ../src/guestfs-actions.pod:5468 ../src/guestfs-actions.pod:5525 ../src/guestfs-actions.pod:5541 ../src/guestfs-actions.pod:5567
3538 msgid "This function returns 0 on success or -1 on error."
3542 #: ../src/guestfs-actions.pod:31
3543 msgid "guestfs_add_drive"
3547 #: ../src/guestfs-actions.pod:33
3550 " int guestfs_add_drive (guestfs_h *g,\n"
3551 "\t\tconst char *filename);\n"
3556 #: ../src/guestfs-actions.pod:36 ../fish/guestfish-actions.pod:36
3558 "This function adds a virtual machine disk image C<filename> to the guest. "
3559 "The first time you call this function, the disk appears as IDE disk 0 "
3560 "(C</dev/sda>) in the guest, the second time as C</dev/sdb>, and so on."
3564 #: ../src/guestfs-actions.pod:41 ../fish/guestfish-actions.pod:41
3566 "You don't necessarily need to be root when using libguestfs. However you "
3567 "obviously do need sufficient permissions to access the filename for whatever "
3568 "operations you want to perform (ie. read access if you just want to read the "
3569 "image or write access if you want to modify the image)."
3573 #: ../src/guestfs-actions.pod:47 ../fish/guestfish-actions.pod:47
3575 "This is equivalent to the qemu parameter C<-drive "
3576 "file=filename,cache=off,if=...>."
3580 #: ../src/guestfs-actions.pod:50 ../fish/guestfish-actions.pod:50
3582 "C<cache=off> is omitted in cases where it is not supported by the underlying "
3587 #: ../src/guestfs-actions.pod:53 ../src/guestfs-actions.pod:82
3589 "C<if=...> is set at compile time by the configuration option C<./configure "
3590 "--with-drive-if=...>. In the rare case where you might need to change this "
3591 "at run time, use C<guestfs_add_drive_with_if> or "
3592 "C<guestfs_add_drive_ro_with_if>."
3596 #: ../src/guestfs-actions.pod:58 ../src/guestfs-actions.pod:87
3598 "Note that this call checks for the existence of C<filename>. This stops you "
3599 "from specifying other types of drive which are supported by qemu such as "
3600 "C<nbd:> and C<http:> URLs. To specify those, use the general "
3601 "C<guestfs_config> call instead."
3605 #: ../src/guestfs-actions.pod:65
3606 msgid "guestfs_add_drive_ro"
3610 #: ../src/guestfs-actions.pod:67
3613 " int guestfs_add_drive_ro (guestfs_h *g,\n"
3614 "\t\tconst char *filename);\n"
3619 #: ../src/guestfs-actions.pod:70 ../fish/guestfish-actions.pod:69
3620 msgid "This adds a drive in snapshot mode, making it effectively read-only."
3624 #: ../src/guestfs-actions.pod:73 ../fish/guestfish-actions.pod:72
3626 "Note that writes to the device are allowed, and will be seen for the "
3627 "duration of the guestfs handle, but they are written to a temporary file "
3628 "which is discarded as soon as the guestfs handle is closed. We don't "
3629 "currently have any method to enable changes to be committed, although qemu "
3634 #: ../src/guestfs-actions.pod:79 ../fish/guestfish-actions.pod:78
3636 "This is equivalent to the qemu parameter C<-drive "
3637 "file=filename,snapshot=on,if=...>."
3641 #: ../src/guestfs-actions.pod:94
3642 msgid "guestfs_add_drive_ro_with_if"
3646 #: ../src/guestfs-actions.pod:96
3649 " int guestfs_add_drive_ro_with_if (guestfs_h *g,\n"
3650 "\t\tconst char *filename,\n"
3651 "\t\tconst char *iface);\n"
3656 #: ../src/guestfs-actions.pod:100
3658 "This is the same as C<guestfs_add_drive_ro> but it allows you to specify the "
3659 "QEMU interface emulation to use at run time."
3663 #: ../src/guestfs-actions.pod:105
3664 msgid "guestfs_add_drive_with_if"
3668 #: ../src/guestfs-actions.pod:107
3671 " int guestfs_add_drive_with_if (guestfs_h *g,\n"
3672 "\t\tconst char *filename,\n"
3673 "\t\tconst char *iface);\n"
3678 #: ../src/guestfs-actions.pod:111
3680 "This is the same as C<guestfs_add_drive> but it allows you to specify the "
3681 "QEMU interface emulation to use at run time."
3685 #: ../src/guestfs-actions.pod:116
3686 msgid "guestfs_aug_clear"
3690 #: ../src/guestfs-actions.pod:118
3693 " int guestfs_aug_clear (guestfs_h *g,\n"
3694 "\t\tconst char *augpath);\n"
3699 #: ../src/guestfs-actions.pod:121 ../fish/guestfish-actions.pod:109
3701 "Set the value associated with C<path> to C<NULL>. This is the same as the "
3702 "L<augtool(1)> C<clear> command."
3706 #: ../src/guestfs-actions.pod:126
3707 msgid "guestfs_aug_close"
3711 #: ../src/guestfs-actions.pod:128
3714 " int guestfs_aug_close (guestfs_h *g);\n"
3719 #: ../src/guestfs-actions.pod:130
3721 "Close the current Augeas handle and free up any resources used by it. After "
3722 "calling this, you have to call C<guestfs_aug_init> again before you can use "
3723 "any other Augeas functions."
3727 #: ../src/guestfs-actions.pod:137
3728 msgid "guestfs_aug_defnode"
3732 #: ../src/guestfs-actions.pod:139
3735 " struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,\n"
3736 "\t\tconst char *name,\n"
3737 "\t\tconst char *expr,\n"
3738 "\t\tconst char *val);\n"
3743 #: ../src/guestfs-actions.pod:144 ../fish/guestfish-actions.pod:125
3744 msgid "Defines a variable C<name> whose value is the result of evaluating C<expr>."
3748 #: ../src/guestfs-actions.pod:147
3750 "If C<expr> evaluates to an empty nodeset, a node is created, equivalent to "
3751 "calling C<guestfs_aug_set> C<expr>, C<value>. C<name> will be the nodeset "
3752 "containing that single node."
3756 #: ../src/guestfs-actions.pod:151 ../fish/guestfish-actions.pod:132
3758 "On success this returns a pair containing the number of nodes in the "
3759 "nodeset, and a boolean flag if a node was created."
3763 #: ../src/guestfs-actions.pod:155
3765 "This function returns a C<struct guestfs_int_bool *>, or NULL if there was "
3766 "an error. I<The caller must call C<guestfs_free_int_bool> after use>."
3770 #: ../src/guestfs-actions.pod:159
3771 msgid "guestfs_aug_defvar"
3775 #: ../src/guestfs-actions.pod:161
3778 " int guestfs_aug_defvar (guestfs_h *g,\n"
3779 "\t\tconst char *name,\n"
3780 "\t\tconst char *expr);\n"
3785 #: ../src/guestfs-actions.pod:165 ../fish/guestfish-actions.pod:140
3787 "Defines an Augeas variable C<name> whose value is the result of evaluating "
3788 "C<expr>. If C<expr> is NULL, then C<name> is undefined."
3792 #: ../src/guestfs-actions.pod:169 ../fish/guestfish-actions.pod:144
3794 "On success this returns the number of nodes in C<expr>, or C<0> if C<expr> "
3795 "evaluates to something which is not a nodeset."
3799 #: ../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:1041 ../src/guestfs-actions.pod:1356 ../src/guestfs-actions.pod:1538 ../src/guestfs-actions.pod:1619 ../src/guestfs-actions.pod:1650 ../src/guestfs-actions.pod:1693 ../src/guestfs-actions.pod:1710 ../src/guestfs-actions.pod:1935 ../src/guestfs-actions.pod:2147 ../src/guestfs-actions.pod:2165 ../src/guestfs-actions.pod:3503 ../src/guestfs-actions.pod:3610 ../src/guestfs-actions.pod:3941 ../src/guestfs-actions.pod:3964 ../src/guestfs-actions.pod:5063 ../src/guestfs-actions.pod:5413 ../src/guestfs-actions.pod:5423 ../src/guestfs-actions.pod:5433
3800 msgid "On error this function returns -1."
3804 #: ../src/guestfs-actions.pod:174
3805 msgid "guestfs_aug_get"
3809 #: ../src/guestfs-actions.pod:176
3812 " char *guestfs_aug_get (guestfs_h *g,\n"
3813 "\t\tconst char *augpath);\n"
3818 #: ../src/guestfs-actions.pod:179 ../fish/guestfish-actions.pod:151
3820 "Look up the value associated with C<path>. If C<path> matches exactly one "
3821 "node, the C<value> is returned."
3825 #: ../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:1069 ../src/guestfs-actions.pod:1233 ../src/guestfs-actions.pod:1342 ../src/guestfs-actions.pod:1487 ../src/guestfs-actions.pod:1501 ../src/guestfs-actions.pod:1577 ../src/guestfs-actions.pod:1595 ../src/guestfs-actions.pod:1729 ../src/guestfs-actions.pod:1868 ../src/guestfs-actions.pod:2049 ../src/guestfs-actions.pod:2099 ../src/guestfs-actions.pod:2215 ../src/guestfs-actions.pod:2250 ../src/guestfs-actions.pod:2565 ../src/guestfs-actions.pod:2986 ../src/guestfs-actions.pod:3082 ../src/guestfs-actions.pod:3625 ../src/guestfs-actions.pod:3801 ../src/guestfs-actions.pod:3919 ../src/guestfs-actions.pod:4080 ../src/guestfs-actions.pod:4123 ../src/guestfs-actions.pod:4599 ../src/guestfs-actions.pod:4612 ../src/guestfs-actions.pod:4626 ../src/guestfs-actions.pod:4647 ../src/guestfs-actions.pod:5206 ../src/guestfs-actions.pod:5222 ../src/guestfs-actions.pod:5237 ../src/guestfs-actions.pod:5385 ../src/guestfs-actions.pod:5615
3827 "This function returns a string, or NULL on error. I<The caller must free "
3828 "the returned string after use>."
3832 #: ../src/guestfs-actions.pod:185
3833 msgid "guestfs_aug_init"
3837 #: ../src/guestfs-actions.pod:187
3840 " int guestfs_aug_init (guestfs_h *g,\n"
3841 "\t\tconst char *root,\n"
3847 #: ../src/guestfs-actions.pod:191 ../fish/guestfish-actions.pod:158
3849 "Create a new Augeas handle for editing configuration files. If there was "
3850 "any previous Augeas handle associated with this guestfs session, then it is "
3855 #: ../src/guestfs-actions.pod:195
3856 msgid "You must call this before using any other C<guestfs_aug_*> commands."
3860 #: ../src/guestfs-actions.pod:198 ../fish/guestfish-actions.pod:165
3861 msgid "C<root> is the filesystem root. C<root> must not be NULL, use C</> instead."
3865 #: ../src/guestfs-actions.pod:201 ../fish/guestfish-actions.pod:168
3867 "The flags are the same as the flags defined in E<lt>augeas.hE<gt>, the "
3868 "logical I<or> of the following integers:"
3872 #: ../src/guestfs-actions.pod:207 ../fish/guestfish-actions.pod:174
3873 msgid "C<AUG_SAVE_BACKUP> = 1"
3877 #: ../src/guestfs-actions.pod:209 ../fish/guestfish-actions.pod:176
3878 msgid "Keep the original file with a C<.augsave> extension."
3882 #: ../src/guestfs-actions.pod:211 ../fish/guestfish-actions.pod:178
3883 msgid "C<AUG_SAVE_NEWFILE> = 2"
3887 #: ../src/guestfs-actions.pod:213 ../fish/guestfish-actions.pod:180
3889 "Save changes into a file with extension C<.augnew>, and do not overwrite "
3890 "original. Overrides C<AUG_SAVE_BACKUP>."
3894 #: ../src/guestfs-actions.pod:216 ../fish/guestfish-actions.pod:183
3895 msgid "C<AUG_TYPE_CHECK> = 4"
3899 #: ../src/guestfs-actions.pod:218 ../fish/guestfish-actions.pod:185
3900 msgid "Typecheck lenses (can be expensive)."
3904 #: ../src/guestfs-actions.pod:220 ../fish/guestfish-actions.pod:187
3905 msgid "C<AUG_NO_STDINC> = 8"
3909 #: ../src/guestfs-actions.pod:222 ../fish/guestfish-actions.pod:189
3910 msgid "Do not use standard load path for modules."
3914 #: ../src/guestfs-actions.pod:224 ../fish/guestfish-actions.pod:191
3915 msgid "C<AUG_SAVE_NOOP> = 16"
3919 #: ../src/guestfs-actions.pod:226 ../fish/guestfish-actions.pod:193
3920 msgid "Make save a no-op, just record what would have been changed."
3924 #: ../src/guestfs-actions.pod:228 ../fish/guestfish-actions.pod:195
3925 msgid "C<AUG_NO_LOAD> = 32"
3929 #: ../src/guestfs-actions.pod:230
3930 msgid "Do not load the tree in C<guestfs_aug_init>."
3934 #: ../src/guestfs-actions.pod:234
3935 msgid "To close the handle, you can call C<guestfs_aug_close>."
3939 #: ../src/guestfs-actions.pod:236 ../fish/guestfish-actions.pod:203
3940 msgid "To find out more about Augeas, see L<http://augeas.net/>."
3944 #: ../src/guestfs-actions.pod:240
3945 msgid "guestfs_aug_insert"
3949 #: ../src/guestfs-actions.pod:242
3952 " int guestfs_aug_insert (guestfs_h *g,\n"
3953 "\t\tconst char *augpath,\n"
3954 "\t\tconst char *label,\n"
3955 "\t\tint before);\n"
3960 #: ../src/guestfs-actions.pod:247 ../fish/guestfish-actions.pod:209
3962 "Create a new sibling C<label> for C<path>, inserting it into the tree before "
3963 "or after C<path> (depending on the boolean flag C<before>)."
3967 #: ../src/guestfs-actions.pod:251 ../fish/guestfish-actions.pod:213
3969 "C<path> must match exactly one existing node in the tree, and C<label> must "
3970 "be a label, ie. not contain C</>, C<*> or end with a bracketed index C<[N]>."
3974 #: ../src/guestfs-actions.pod:257
3975 msgid "guestfs_aug_load"
3979 #: ../src/guestfs-actions.pod:259
3982 " int guestfs_aug_load (guestfs_h *g);\n"
3987 #: ../src/guestfs-actions.pod:261 ../fish/guestfish-actions.pod:221
3988 msgid "Load files into the tree."
3992 #: ../src/guestfs-actions.pod:263 ../fish/guestfish-actions.pod:223
3993 msgid "See C<aug_load> in the Augeas documentation for the full gory details."
3997 #: ../src/guestfs-actions.pod:268
3998 msgid "guestfs_aug_ls"
4002 #: ../src/guestfs-actions.pod:270
4005 " char **guestfs_aug_ls (guestfs_h *g,\n"
4006 "\t\tconst char *augpath);\n"
4011 #: ../src/guestfs-actions.pod:273
4013 "This is just a shortcut for listing C<guestfs_aug_match> C<path/*> and "
4014 "sorting the resulting nodes into alphabetical order."
4018 #: ../src/guestfs-actions.pod:276 ../src/guestfs-actions.pod:289 ../src/guestfs-actions.pod:417 ../src/guestfs-actions.pod:802 ../src/guestfs-actions.pod:1081 ../src/guestfs-actions.pod:1097 ../src/guestfs-actions.pod:1185 ../src/guestfs-actions.pod:1201 ../src/guestfs-actions.pod:1432 ../src/guestfs-actions.pod:1766 ../src/guestfs-actions.pod:1779 ../src/guestfs-actions.pod:1795 ../src/guestfs-actions.pod:1832 ../src/guestfs-actions.pod:1853 ../src/guestfs-actions.pod:1915 ../src/guestfs-actions.pod:1955 ../src/guestfs-actions.pod:2121 ../src/guestfs-actions.pod:2289 ../src/guestfs-actions.pod:2494 ../src/guestfs-actions.pod:2550 ../src/guestfs-actions.pod:2634 ../src/guestfs-actions.pod:2963 ../src/guestfs-actions.pod:3470 ../src/guestfs-actions.pod:3896 ../src/guestfs-actions.pod:4005 ../src/guestfs-actions.pod:4111 ../src/guestfs-actions.pod:4660 ../src/guestfs-actions.pod:4709 ../src/guestfs-actions.pod:4761 ../src/guestfs-actions.pod:4877 ../src/guestfs-actions.pod:4898 ../src/guestfs-actions.pod:5298 ../src/guestfs-actions.pod:5315 ../src/guestfs-actions.pod:5353 ../src/guestfs-actions.pod:5489 ../src/guestfs-actions.pod:5505 ../src/guestfs-actions.pod:5578 ../src/guestfs-actions.pod:5594 ../src/guestfs-actions.pod:5634 ../src/guestfs-actions.pod:5650
4020 "This function returns a NULL-terminated array of strings (like "
4021 "L<environ(3)>), or NULL if there was an error. I<The caller must free the "
4022 "strings and the array after use>."
4026 #: ../src/guestfs-actions.pod:280
4027 msgid "guestfs_aug_match"
4031 #: ../src/guestfs-actions.pod:282
4034 " char **guestfs_aug_match (guestfs_h *g,\n"
4035 "\t\tconst char *augpath);\n"
4040 #: ../src/guestfs-actions.pod:285 ../fish/guestfish-actions.pod:237
4042 "Returns a list of paths which match the path expression C<path>. The "
4043 "returned paths are sufficiently qualified so that they match exactly one "
4044 "node in the current tree."
4048 #: ../src/guestfs-actions.pod:293
4049 msgid "guestfs_aug_mv"
4053 #: ../src/guestfs-actions.pod:295
4056 " int guestfs_aug_mv (guestfs_h *g,\n"
4057 "\t\tconst char *src,\n"
4058 "\t\tconst char *dest);\n"
4063 #: ../src/guestfs-actions.pod:299 ../fish/guestfish-actions.pod:245
4065 "Move the node C<src> to C<dest>. C<src> must match exactly one node. "
4066 "C<dest> is overwritten if it exists."
4070 #: ../src/guestfs-actions.pod:304
4071 msgid "guestfs_aug_rm"
4075 #: ../src/guestfs-actions.pod:306
4078 " int guestfs_aug_rm (guestfs_h *g,\n"
4079 "\t\tconst char *augpath);\n"
4084 #: ../src/guestfs-actions.pod:309 ../fish/guestfish-actions.pod:252
4085 msgid "Remove C<path> and all of its children."
4089 #: ../src/guestfs-actions.pod:311 ../fish/guestfish-actions.pod:254
4090 msgid "On success this returns the number of entries which were removed."
4094 #: ../src/guestfs-actions.pod:315
4095 msgid "guestfs_aug_save"
4099 #: ../src/guestfs-actions.pod:317
4102 " int guestfs_aug_save (guestfs_h *g);\n"
4107 #: ../src/guestfs-actions.pod:319 ../fish/guestfish-actions.pod:260
4108 msgid "This writes all pending changes to disk."
4112 #: ../src/guestfs-actions.pod:321
4114 "The flags which were passed to C<guestfs_aug_init> affect exactly how files "
4119 #: ../src/guestfs-actions.pod:326
4120 msgid "guestfs_aug_set"
4124 #: ../src/guestfs-actions.pod:328
4127 " int guestfs_aug_set (guestfs_h *g,\n"
4128 "\t\tconst char *augpath,\n"
4129 "\t\tconst char *val);\n"
4134 #: ../src/guestfs-actions.pod:332 ../fish/guestfish-actions.pod:269
4135 msgid "Set the value associated with C<path> to C<val>."
4139 #: ../src/guestfs-actions.pod:334
4141 "In the Augeas API, it is possible to clear a node by setting the value to "
4142 "NULL. Due to an oversight in the libguestfs API you cannot do that with "
4143 "this call. Instead you must use the C<guestfs_aug_clear> call."
4147 #: ../src/guestfs-actions.pod:341
4148 msgid "guestfs_available"
4152 #: ../src/guestfs-actions.pod:343
4155 " int guestfs_available (guestfs_h *g,\n"
4156 "\t\tchar *const *groups);\n"
4161 #: ../src/guestfs-actions.pod:346 ../fish/guestfish-actions.pod:280
4163 "This command is used to check the availability of some groups of "
4164 "functionality in the appliance, which not all builds of the libguestfs "
4165 "appliance will be able to provide."
4169 #: ../src/guestfs-actions.pod:350
4171 "The libguestfs groups, and the functions that those groups correspond to, "
4172 "are listed in L<guestfs(3)/AVAILABILITY>. You can also fetch this list at "
4173 "runtime by calling C<guestfs_available_all_groups>."
4177 #: ../src/guestfs-actions.pod:355 ../fish/guestfish-actions.pod:289
4179 "The argument C<groups> is a list of group names, eg: C<[\"inotify\", "
4180 "\"augeas\"]> would check for the availability of the Linux inotify functions "
4181 "and Augeas (configuration file editing) functions."
4185 #: ../src/guestfs-actions.pod:360 ../fish/guestfish-actions.pod:294
4186 msgid "The command returns no error if I<all> requested groups are available."
4190 #: ../src/guestfs-actions.pod:362 ../fish/guestfish-actions.pod:296
4192 "It fails with an error if one or more of the requested groups is unavailable "
4197 #: ../src/guestfs-actions.pod:365 ../fish/guestfish-actions.pod:299
4199 "If an unknown group name is included in the list of groups then an error is "
4204 #: ../src/guestfs-actions.pod:368 ../fish/guestfish-actions.pod:302
4209 #: ../src/guestfs-actions.pod:374
4210 msgid "You must call C<guestfs_launch> before calling this function."
4214 #: ../src/guestfs-actions.pod:376 ../fish/guestfish-actions.pod:310
4216 "The reason is because we don't know what groups are supported by the "
4217 "appliance/daemon until it is running and can be queried."
4221 #: ../src/guestfs-actions.pod:382 ../fish/guestfish-actions.pod:316
4223 "If a group of functions is available, this does not necessarily mean that "
4224 "they will work. You still have to check for errors when calling individual "
4225 "API functions even if they are available."
4229 #: ../src/guestfs-actions.pod:389 ../fish/guestfish-actions.pod:323
4231 "It is usually the job of distro packagers to build complete functionality "
4232 "into the libguestfs appliance. Upstream libguestfs, if built from source "
4233 "with all requirements satisfied, will support everything."
4237 #: ../src/guestfs-actions.pod:396
4239 "This call was added in version C<1.0.80>. In previous versions of "
4240 "libguestfs all you could do would be to speculatively execute a command to "
4241 "find out if the daemon implemented it. See also C<guestfs_version>."
4245 #: ../src/guestfs-actions.pod:405
4246 msgid "guestfs_available_all_groups"
4250 #: ../src/guestfs-actions.pod:407
4253 " char **guestfs_available_all_groups (guestfs_h *g);\n"
4258 #: ../src/guestfs-actions.pod:409
4260 "This command returns a list of all optional groups that this daemon knows "
4261 "about. Note this returns both supported and unsupported groups. To find "
4262 "out which ones the daemon can actually support you have to call "
4263 "C<guestfs_available> on each member of the returned list."
4267 #: ../src/guestfs-actions.pod:415
4268 msgid "See also C<guestfs_available> and L<guestfs(3)/AVAILABILITY>."
4272 #: ../src/guestfs-actions.pod:421
4273 msgid "guestfs_base64_in"
4277 #: ../src/guestfs-actions.pod:423
4280 " int guestfs_base64_in (guestfs_h *g,\n"
4281 "\t\tconst char *base64file,\n"
4282 "\t\tconst char *filename);\n"
4287 #: ../src/guestfs-actions.pod:427 ../fish/guestfish-actions.pod:353
4288 msgid "This command uploads base64-encoded data from C<base64file> to C<filename>."
4292 #: ../src/guestfs-actions.pod:432
4293 msgid "guestfs_base64_out"
4297 #: ../src/guestfs-actions.pod:434
4300 " int guestfs_base64_out (guestfs_h *g,\n"
4301 "\t\tconst char *filename,\n"
4302 "\t\tconst char *base64file);\n"
4307 #: ../src/guestfs-actions.pod:438 ../fish/guestfish-actions.pod:362
4309 "This command downloads the contents of C<filename>, writing it out to local "
4310 "file C<base64file> encoded as base64."
4314 #: ../src/guestfs-actions.pod:443
4315 msgid "guestfs_blockdev_flushbufs"
4319 #: ../src/guestfs-actions.pod:445
4322 " int guestfs_blockdev_flushbufs (guestfs_h *g,\n"
4323 "\t\tconst char *device);\n"
4328 #: ../src/guestfs-actions.pod:448 ../fish/guestfish-actions.pod:371
4329 msgid "This tells the kernel to flush internal buffers associated with C<device>."
4333 #: ../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:374 ../fish/guestfish-actions.pod:385 ../fish/guestfish-actions.pod:394 ../fish/guestfish-actions.pod:404 ../fish/guestfish-actions.pod:416 ../fish/guestfish-actions.pod:429 ../fish/guestfish-actions.pod:437 ../fish/guestfish-actions.pod:448 ../fish/guestfish-actions.pod:456 ../fish/guestfish-actions.pod:464
4334 msgid "This uses the L<blockdev(8)> command."
4338 #: ../src/guestfs-actions.pod:455
4339 msgid "guestfs_blockdev_getbsz"
4343 #: ../src/guestfs-actions.pod:457
4346 " int guestfs_blockdev_getbsz (guestfs_h *g,\n"
4347 "\t\tconst char *device);\n"
4352 #: ../src/guestfs-actions.pod:460 ../fish/guestfish-actions.pod:380
4353 msgid "This returns the block size of a device."
4357 #: ../src/guestfs-actions.pod:462 ../src/guestfs-actions.pod:544 ../fish/guestfish-actions.pod:382 ../fish/guestfish-actions.pod:445
4359 "(Note this is different from both I<size in blocks> and I<filesystem block "
4364 #: ../src/guestfs-actions.pod:469
4365 msgid "guestfs_blockdev_getro"
4369 #: ../src/guestfs-actions.pod:471
4372 " int guestfs_blockdev_getro (guestfs_h *g,\n"
4373 "\t\tconst char *device);\n"
4378 #: ../src/guestfs-actions.pod:474 ../fish/guestfish-actions.pod:391
4380 "Returns a boolean indicating if the block device is read-only (true if "
4381 "read-only, false if not)."
4385 #: ../src/guestfs-actions.pod:479 ../src/guestfs-actions.pod:1115 ../src/guestfs-actions.pod:1127 ../src/guestfs-actions.pod:1559 ../src/guestfs-actions.pod:1567 ../src/guestfs-actions.pod:1627 ../src/guestfs-actions.pod:1670 ../src/guestfs-actions.pod:1682 ../src/guestfs-actions.pod:1701 ../src/guestfs-actions.pod:1718 ../src/guestfs-actions.pod:2303 ../src/guestfs-actions.pod:2314 ../src/guestfs-actions.pod:2326 ../src/guestfs-actions.pod:2337 ../src/guestfs-actions.pod:2350 ../src/guestfs-actions.pod:2362 ../src/guestfs-actions.pod:2375 ../src/guestfs-actions.pod:2386 ../src/guestfs-actions.pod:2396 ../src/guestfs-actions.pod:2407 ../src/guestfs-actions.pod:2419 ../src/guestfs-actions.pod:2431 ../src/guestfs-actions.pod:3595
4386 msgid "This function returns a C truth value on success or -1 on error."
4390 #: ../src/guestfs-actions.pod:481
4391 msgid "guestfs_blockdev_getsize64"
4395 #: ../src/guestfs-actions.pod:483
4398 " int64_t guestfs_blockdev_getsize64 (guestfs_h *g,\n"
4399 "\t\tconst char *device);\n"
4404 #: ../src/guestfs-actions.pod:486 ../fish/guestfish-actions.pod:400
4405 msgid "This returns the size of the device in bytes."
4409 #: ../src/guestfs-actions.pod:488
4410 msgid "See also C<guestfs_blockdev_getsz>."
4414 #: ../src/guestfs-actions.pod:494
4415 msgid "guestfs_blockdev_getss"
4419 #: ../src/guestfs-actions.pod:496
4422 " int guestfs_blockdev_getss (guestfs_h *g,\n"
4423 "\t\tconst char *device);\n"
4428 #: ../src/guestfs-actions.pod:499 ../fish/guestfish-actions.pod:410
4430 "This returns the size of sectors on a block device. Usually 512, but can be "
4431 "larger for modern devices."
4435 #: ../src/guestfs-actions.pod:502
4437 "(Note, this is not the size in sectors, use C<guestfs_blockdev_getsz> for "
4442 #: ../src/guestfs-actions.pod:509
4443 msgid "guestfs_blockdev_getsz"
4447 #: ../src/guestfs-actions.pod:511
4450 " int64_t guestfs_blockdev_getsz (guestfs_h *g,\n"
4451 "\t\tconst char *device);\n"
4456 #: ../src/guestfs-actions.pod:514 ../fish/guestfish-actions.pod:422
4458 "This returns the size of the device in units of 512-byte sectors (even if "
4459 "the sectorsize isn't 512 bytes ... weird)."
4463 #: ../src/guestfs-actions.pod:517
4465 "See also C<guestfs_blockdev_getss> for the real sector size of the device, "
4466 "and C<guestfs_blockdev_getsize64> for the more useful I<size in bytes>."
4470 #: ../src/guestfs-actions.pod:525
4471 msgid "guestfs_blockdev_rereadpt"
4475 #: ../src/guestfs-actions.pod:527
4478 " int guestfs_blockdev_rereadpt (guestfs_h *g,\n"
4479 "\t\tconst char *device);\n"
4484 #: ../src/guestfs-actions.pod:530 ../fish/guestfish-actions.pod:435
4485 msgid "Reread the partition table on C<device>."
4489 #: ../src/guestfs-actions.pod:536
4490 msgid "guestfs_blockdev_setbsz"
4494 #: ../src/guestfs-actions.pod:538
4497 " int guestfs_blockdev_setbsz (guestfs_h *g,\n"
4498 "\t\tconst char *device,\n"
4499 "\t\tint blocksize);\n"
4504 #: ../src/guestfs-actions.pod:542 ../fish/guestfish-actions.pod:443
4505 msgid "This sets the block size of a device."
4509 #: ../src/guestfs-actions.pod:551
4510 msgid "guestfs_blockdev_setro"
4514 #: ../src/guestfs-actions.pod:553
4517 " int guestfs_blockdev_setro (guestfs_h *g,\n"
4518 "\t\tconst char *device);\n"
4523 #: ../src/guestfs-actions.pod:556 ../fish/guestfish-actions.pod:454
4524 msgid "Sets the block device named C<device> to read-only."
4528 #: ../src/guestfs-actions.pod:562
4529 msgid "guestfs_blockdev_setrw"
4533 #: ../src/guestfs-actions.pod:564
4536 " int guestfs_blockdev_setrw (guestfs_h *g,\n"
4537 "\t\tconst char *device);\n"
4542 #: ../src/guestfs-actions.pod:567 ../fish/guestfish-actions.pod:462
4543 msgid "Sets the block device named C<device> to read-write."
4547 #: ../src/guestfs-actions.pod:573
4548 msgid "guestfs_case_sensitive_path"
4552 #: ../src/guestfs-actions.pod:575
4555 " char *guestfs_case_sensitive_path (guestfs_h *g,\n"
4556 "\t\tconst char *path);\n"
4561 #: ../src/guestfs-actions.pod:578 ../fish/guestfish-actions.pod:470
4563 "This can be used to resolve case insensitive paths on a filesystem which is "
4564 "case sensitive. The use case is to resolve paths which you have read from "
4565 "Windows configuration files or the Windows Registry, to the true path."
4569 #: ../src/guestfs-actions.pod:583 ../fish/guestfish-actions.pod:475