Version 1.11.2.
[libguestfs.git] / po-docs / libguestfs-docs.pot
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.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: libguestfs 1.11.2\n"
10 "Report-Msgid-Bugs-To: libguestfs@redhat.com\n"
11 "POT-Creation-Date: 2011-04-18 20:45+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"
15 "Language: \n"
16 "MIME-Version: 1.0\n"
17 "Content-Type: text/plain; charset=UTF-8\n"
18 "Content-Transfer-Encoding: 8bit\n"
19
20 #. type: =head1
21 #: ../src/guestfs.pod:3 ../fish/guestfish.pod:3 ../test-tool/libguestfs-test-tool.pod:3 ../fuse/guestmount.pod:3 ../tools/virt-edit.pl:32 ../tools/virt-win-reg.pl:35 ../tools/virt-list-filesystems.pl:30 ../tools/virt-tar.pl:31 ../tools/virt-make-fs.pl:35 ../tools/virt-list-partitions.pl:30
22 msgid "NAME"
23 msgstr ""
24
25 #. type: textblock
26 #: ../src/guestfs.pod:5
27 msgid "guestfs - Library for accessing and modifying virtual machine images"
28 msgstr ""
29
30 #. type: =head1
31 #: ../src/guestfs.pod:7 ../fish/guestfish.pod:7 ../test-tool/libguestfs-test-tool.pod:7 ../fuse/guestmount.pod:7 ../tools/virt-edit.pl:36 ../tools/virt-win-reg.pl:39 ../tools/virt-list-filesystems.pl:34 ../tools/virt-tar.pl:35 ../tools/virt-make-fs.pl:39 ../tools/virt-list-partitions.pl:34
32 msgid "SYNOPSIS"
33 msgstr ""
34
35 #. type: verbatim
36 #: ../src/guestfs.pod:9
37 #, no-wrap
38 msgid ""
39 " #include <guestfs.h>\n"
40 " \n"
41 msgstr ""
42
43 #. type: verbatim
44 #: ../src/guestfs.pod:11
45 #, no-wrap
46 msgid ""
47 " guestfs_h *g = guestfs_create ();\n"
48 " guestfs_add_drive (g, \"guest.img\");\n"
49 " guestfs_launch (g);\n"
50 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
51 " guestfs_touch (g, \"/hello\");\n"
52 " guestfs_umount (g, \"/\");\n"
53 " guestfs_close (g);\n"
54 "\n"
55 msgstr ""
56
57 #. type: verbatim
58 #: ../src/guestfs.pod:19
59 #, no-wrap
60 msgid ""
61 " cc prog.c -o prog -lguestfs\n"
62 "or:\n"
63 " cc prog.c -o prog `pkg-config libguestfs --cflags --libs`\n"
64 "\n"
65 msgstr ""
66
67 #. type: =head1
68 #: ../src/guestfs.pod:23 ../fish/guestfish.pod:30 ../test-tool/libguestfs-test-tool.pod:11 ../fuse/guestmount.pod:20 ../tools/virt-edit.pl:50 ../tools/virt-win-reg.pl:63 ../tools/virt-list-filesystems.pl:40 ../tools/virt-tar.pl:77 ../tools/virt-make-fs.pl:47 ../tools/virt-list-partitions.pl:40
69 msgid "DESCRIPTION"
70 msgstr ""
71
72 #. type: textblock
73 #: ../src/guestfs.pod:25
74 msgid ""
75 "Libguestfs is a library for accessing and modifying guest disk images.  "
76 "Amongst the things this is good for: making batch configuration changes to "
77 "guests, getting disk used/free statistics (see also: virt-df), migrating "
78 "between virtualization systems (see also: virt-p2v), performing partial "
79 "backups, performing partial guest clones, cloning guests and changing "
80 "registry/UUID/hostname info, and much else besides."
81 msgstr ""
82
83 #. type: textblock
84 #: ../src/guestfs.pod:33
85 msgid ""
86 "Libguestfs uses Linux kernel and qemu code, and can access any type of guest "
87 "filesystem that Linux and qemu can, including but not limited to: ext2/3/4, "
88 "btrfs, FAT and NTFS, LVM, many different disk partition schemes, qcow, "
89 "qcow2, vmdk."
90 msgstr ""
91
92 #. type: textblock
93 #: ../src/guestfs.pod:38
94 msgid ""
95 "Libguestfs provides ways to enumerate guest storage (eg. partitions, LVs, "
96 "what filesystem is in each LV, etc.).  It can also run commands in the "
97 "context of the guest.  Also you can access filesystems over FUSE."
98 msgstr ""
99
100 #. type: textblock
101 #: ../src/guestfs.pod:43
102 msgid ""
103 "Libguestfs is a library that can be linked with C and C++ management "
104 "programs (or management programs written in OCaml, Perl, Python, Ruby, Java, "
105 "PHP, Haskell or C#).  You can also use it from shell scripts or the command "
106 "line."
107 msgstr ""
108
109 #. type: textblock
110 #: ../src/guestfs.pod:48
111 msgid ""
112 "You don't need to be root to use libguestfs, although obviously you do need "
113 "enough permissions to access the disk images."
114 msgstr ""
115
116 #. type: textblock
117 #: ../src/guestfs.pod:51
118 msgid ""
119 "Libguestfs is a large API because it can do many things.  For a gentle "
120 "introduction, please read the L</API OVERVIEW> section next."
121 msgstr ""
122
123 #. type: textblock
124 #: ../src/guestfs.pod:54
125 msgid ""
126 "There are also some example programs in the L<guestfs-examples(3)> manual "
127 "page."
128 msgstr ""
129
130 #. type: =head1
131 #: ../src/guestfs.pod:57
132 msgid "API OVERVIEW"
133 msgstr ""
134
135 #. type: textblock
136 #: ../src/guestfs.pod:59
137 msgid ""
138 "This section provides a gentler overview of the libguestfs API.  We also try "
139 "to group API calls together, where that may not be obvious from reading "
140 "about the individual calls in the main section of this manual."
141 msgstr ""
142
143 #. type: =head2
144 #: ../src/guestfs.pod:64
145 msgid "HANDLES"
146 msgstr ""
147
148 #. type: textblock
149 #: ../src/guestfs.pod:66
150 msgid ""
151 "Before you can use libguestfs calls, you have to create a handle.  Then you "
152 "must add at least one disk image to the handle, followed by launching the "
153 "handle, then performing whatever operations you want, and finally closing "
154 "the handle.  By convention we use the single letter C<g> for the name of the "
155 "handle variable, although of course you can use any name you want."
156 msgstr ""
157
158 #. type: textblock
159 #: ../src/guestfs.pod:73
160 msgid "The general structure of all libguestfs-using programs looks like this:"
161 msgstr ""
162
163 #. type: verbatim
164 #: ../src/guestfs.pod:76
165 #, no-wrap
166 msgid ""
167 " guestfs_h *g = guestfs_create ();\n"
168 " \n"
169 msgstr ""
170
171 #. type: verbatim
172 #: ../src/guestfs.pod:78
173 #, no-wrap
174 msgid ""
175 " /* Call guestfs_add_drive additional times if there are\n"
176 "  * multiple disk images.\n"
177 "  */\n"
178 " guestfs_add_drive (g, \"guest.img\");\n"
179 " \n"
180 msgstr ""
181
182 #. type: verbatim
183 #: ../src/guestfs.pod:83
184 #, no-wrap
185 msgid ""
186 " /* Most manipulation calls won't work until you've launched\n"
187 "  * the handle 'g'.  You have to do this _after_ adding drives\n"
188 "  * and _before_ other commands.\n"
189 "  */\n"
190 " guestfs_launch (g);\n"
191 " \n"
192 msgstr ""
193
194 #. type: verbatim
195 #: ../src/guestfs.pod:89
196 #, no-wrap
197 msgid ""
198 " /* Now you can examine what partitions, LVs etc are available.\n"
199 "  */\n"
200 " char **partitions = guestfs_list_partitions (g);\n"
201 " char **logvols = guestfs_lvs (g);\n"
202 " \n"
203 msgstr ""
204
205 #. type: verbatim
206 #: ../src/guestfs.pod:94
207 #, no-wrap
208 msgid ""
209 " /* To access a filesystem in the image, you must mount it.\n"
210 "  */\n"
211 " guestfs_mount (g, \"/dev/sda1\", \"/\");\n"
212 " \n"
213 msgstr ""
214
215 #. type: verbatim
216 #: ../src/guestfs.pod:98
217 #, no-wrap
218 msgid ""
219 " /* Now you can perform filesystem actions on the guest\n"
220 "  * disk image.\n"
221 "  */\n"
222 " guestfs_touch (g, \"/hello\");\n"
223 " \n"
224 msgstr ""
225
226 #. type: verbatim
227 #: ../src/guestfs.pod:103
228 #, no-wrap
229 msgid ""
230 " /* This is only needed for libguestfs < 1.5.24.  Since then\n"
231 "  * it is done automatically when you close the handle.  See\n"
232 "  * discussion of autosync in this page.\n"
233 "  */\n"
234 " guestfs_sync (g);\n"
235 " \n"
236 msgstr ""
237
238 #. type: verbatim
239 #: ../src/guestfs.pod:109
240 #, no-wrap
241 msgid ""
242 " /* Close the handle 'g'. */\n"
243 " guestfs_close (g);\n"
244 "\n"
245 msgstr ""
246
247 #. type: textblock
248 #: ../src/guestfs.pod:112
249 msgid ""
250 "The code above doesn't include any error checking.  In real code you should "
251 "check return values carefully for errors.  In general all functions that "
252 "return integers return C<-1> on error, and all functions that return "
253 "pointers return C<NULL> on error.  See section L</ERROR HANDLING> below for "
254 "how to handle errors, and consult the documentation for each function call "
255 "below to see precisely how they return error indications.  See "
256 "L<guestfs-examples(3)> for fully worked examples."
257 msgstr ""
258
259 #. type: =head2
260 #: ../src/guestfs.pod:121
261 msgid "DISK IMAGES"
262 msgstr ""
263
264 #. type: textblock
265 #: ../src/guestfs.pod:123
266 msgid ""
267 "The image filename (C<\"guest.img\"> in the example above) could be a disk "
268 "image from a virtual machine, a L<dd(1)> copy of a physical hard disk, an "
269 "actual block device, or simply an empty file of zeroes that you have created "
270 "through L<posix_fallocate(3)>.  Libguestfs lets you do useful things to all "
271 "of these."
272 msgstr ""
273
274 #. type: textblock
275 #: ../src/guestfs.pod:129
276 msgid ""
277 "The call you should use in modern code for adding drives is "
278 "L</guestfs_add_drive_opts>.  To add a disk image, allowing writes, and "
279 "specifying that the format is raw, do:"
280 msgstr ""
281
282 #. type: verbatim
283 #: ../src/guestfs.pod:133
284 #, no-wrap
285 msgid ""
286 " guestfs_add_drive_opts (g, filename,\n"
287 "                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
288 "                         -1);\n"
289 "\n"
290 msgstr ""
291
292 #. type: textblock
293 #: ../src/guestfs.pod:137
294 msgid "You can add a disk read-only using:"
295 msgstr ""
296
297 #. type: verbatim
298 #: ../src/guestfs.pod:139
299 #, no-wrap
300 msgid ""
301 " guestfs_add_drive_opts (g, filename,\n"
302 "                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"raw\",\n"
303 "                         GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
304 "                         -1);\n"
305 "\n"
306 msgstr ""
307
308 #. type: textblock
309 #: ../src/guestfs.pod:144
310 msgid ""
311 "or by calling the older function L</guestfs_add_drive_ro>.  In either case "
312 "libguestfs won't modify the file."
313 msgstr ""
314
315 #. type: textblock
316 #: ../src/guestfs.pod:147
317 msgid ""
318 "Be extremely cautious if the disk image is in use, eg. if it is being used "
319 "by a virtual machine.  Adding it read-write will almost certainly cause disk "
320 "corruption, but adding it read-only is safe."
321 msgstr ""
322
323 #. type: textblock
324 #: ../src/guestfs.pod:151
325 msgid ""
326 "You must add at least one disk image, and you may add multiple disk images.  "
327 "In the API, the disk images are usually referred to as C</dev/sda> (for the "
328 "first one you added), C</dev/sdb> (for the second one you added), etc."
329 msgstr ""
330
331 #. type: textblock
332 #: ../src/guestfs.pod:156
333 msgid ""
334 "Once L</guestfs_launch> has been called you cannot add any more images.  You "
335 "can call L</guestfs_list_devices> to get a list of the device names, in the "
336 "order that you added them.  See also L</BLOCK DEVICE NAMING> below."
337 msgstr ""
338
339 #. type: =head2
340 #: ../src/guestfs.pod:161
341 msgid "MOUNTING"
342 msgstr ""
343
344 #. type: textblock
345 #: ../src/guestfs.pod:163
346 msgid ""
347 "Before you can read or write files, create directories and so on in a disk "
348 "image that contains filesystems, you have to mount those filesystems using "
349 "L</guestfs_mount_options> or L</guestfs_mount_ro>.  If you already know that "
350 "a disk image contains (for example) one partition with a filesystem on that "
351 "partition, then you can mount it directly:"
352 msgstr ""
353
354 #. type: verbatim
355 #: ../src/guestfs.pod:170
356 #, no-wrap
357 msgid ""
358 " guestfs_mount_options (g, \"\", \"/dev/sda1\", \"/\");\n"
359 "\n"
360 msgstr ""
361
362 #. type: textblock
363 #: ../src/guestfs.pod:172
364 msgid ""
365 "where C</dev/sda1> means literally the first partition (C<1>) of the first "
366 "disk image that we added (C</dev/sda>).  If the disk contains Linux LVM2 "
367 "logical volumes you could refer to those instead (eg. C</dev/VG/LV>).  Note "
368 "that these are libguestfs virtual devices, and are nothing to do with host "
369 "devices."
370 msgstr ""
371
372 #. type: textblock
373 #: ../src/guestfs.pod:178
374 msgid ""
375 "If you are given a disk image and you don't know what it contains then you "
376 "have to find out.  Libguestfs can do that too: use "
377 "L</guestfs_list_partitions> and L</guestfs_lvs> to list possible partitions "
378 "and LVs, and either try mounting each to see what is mountable, or else "
379 "examine them with L</guestfs_vfs_type> or L</guestfs_file>.  To list just "
380 "filesystems, use L</guestfs_list_filesystems>."
381 msgstr ""
382
383 #. type: textblock
384 #: ../src/guestfs.pod:186
385 msgid ""
386 "Libguestfs also has a set of APIs for inspection of unknown disk images (see "
387 "L</INSPECTION> below).  But you might find it easier to look at higher level "
388 "programs built on top of libguestfs, in particular L<virt-inspector(1)>."
389 msgstr ""
390
391 #. type: textblock
392 #: ../src/guestfs.pod:191
393 msgid ""
394 "To mount a filesystem read-only, use L</guestfs_mount_ro>.  There are "
395 "several other variations of the C<guestfs_mount_*> call."
396 msgstr ""
397
398 #. type: =head2
399 #: ../src/guestfs.pod:194
400 msgid "FILESYSTEM ACCESS AND MODIFICATION"
401 msgstr ""
402
403 #. type: textblock
404 #: ../src/guestfs.pod:196
405 msgid ""
406 "The majority of the libguestfs API consists of fairly low-level calls for "
407 "accessing and modifying the files, directories, symlinks etc on mounted "
408 "filesystems.  There are over a hundred such calls which you can find listed "
409 "in detail below in this man page, and we don't even pretend to cover them "
410 "all in this overview."
411 msgstr ""
412
413 #. type: textblock
414 #: ../src/guestfs.pod:202
415 msgid ""
416 "Specify filenames as full paths, starting with C<\"/\"> and including the "
417 "mount point."
418 msgstr ""
419
420 #. type: textblock
421 #: ../src/guestfs.pod:205
422 msgid ""
423 "For example, if you mounted a filesystem at C<\"/\"> and you want to read "
424 "the file called C<\"etc/passwd\"> then you could do:"
425 msgstr ""
426
427 #. type: verbatim
428 #: ../src/guestfs.pod:208
429 #, no-wrap
430 msgid ""
431 " char *data = guestfs_cat (g, \"/etc/passwd\");\n"
432 "\n"
433 msgstr ""
434
435 #. type: textblock
436 #: ../src/guestfs.pod:210
437 msgid ""
438 "This would return C<data> as a newly allocated buffer containing the full "
439 "content of that file (with some conditions: see also L</DOWNLOADING> below), "
440 "or C<NULL> if there was an error."
441 msgstr ""
442
443 #. type: textblock
444 #: ../src/guestfs.pod:214
445 msgid ""
446 "As another example, to create a top-level directory on that filesystem "
447 "called C<\"var\"> you would do:"
448 msgstr ""
449
450 #. type: verbatim
451 #: ../src/guestfs.pod:217
452 #, no-wrap
453 msgid ""
454 " guestfs_mkdir (g, \"/var\");\n"
455 "\n"
456 msgstr ""
457
458 #. type: textblock
459 #: ../src/guestfs.pod:219
460 msgid "To create a symlink you could do:"
461 msgstr ""
462
463 #. type: verbatim
464 #: ../src/guestfs.pod:221
465 #, no-wrap
466 msgid ""
467 " guestfs_ln_s (g, \"/etc/init.d/portmap\",\n"
468 "               \"/etc/rc3.d/S30portmap\");\n"
469 "\n"
470 msgstr ""
471
472 #. type: textblock
473 #: ../src/guestfs.pod:224
474 msgid ""
475 "Libguestfs will reject attempts to use relative paths and there is no "
476 "concept of a current working directory."
477 msgstr ""
478
479 #. type: textblock
480 #: ../src/guestfs.pod:227
481 msgid ""
482 "Libguestfs can return errors in many situations: for example if the "
483 "filesystem isn't writable, or if a file or directory that you requested "
484 "doesn't exist.  If you are using the C API (documented here)  you have to "
485 "check for those error conditions after each call.  (Other language bindings "
486 "turn these errors into exceptions)."
487 msgstr ""
488
489 #. type: textblock
490 #: ../src/guestfs.pod:233
491 msgid ""
492 "File writes are affected by the per-handle umask, set by calling "
493 "L</guestfs_umask> and defaulting to 022.  See L</UMASK>."
494 msgstr ""
495
496 #. type: =head2
497 #: ../src/guestfs.pod:236
498 msgid "PARTITIONING"
499 msgstr ""
500
501 #. type: textblock
502 #: ../src/guestfs.pod:238
503 msgid ""
504 "Libguestfs contains API calls to read, create and modify partition tables on "
505 "disk images."
506 msgstr ""
507
508 #. type: textblock
509 #: ../src/guestfs.pod:241
510 msgid ""
511 "In the common case where you want to create a single partition covering the "
512 "whole disk, you should use the L</guestfs_part_disk> call:"
513 msgstr ""
514
515 #. type: verbatim
516 #: ../src/guestfs.pod:245
517 #, no-wrap
518 msgid ""
519 " const char *parttype = \"mbr\";\n"
520 " if (disk_is_larger_than_2TB)\n"
521 "   parttype = \"gpt\";\n"
522 " guestfs_part_disk (g, \"/dev/sda\", parttype);\n"
523 "\n"
524 msgstr ""
525
526 #. type: textblock
527 #: ../src/guestfs.pod:250
528 msgid ""
529 "Obviously this effectively wipes anything that was on that disk image "
530 "before."
531 msgstr ""
532
533 #. type: =head2
534 #: ../src/guestfs.pod:253
535 msgid "LVM2"
536 msgstr ""
537
538 #. type: textblock
539 #: ../src/guestfs.pod:255
540 msgid ""
541 "Libguestfs provides access to a large part of the LVM2 API, such as "
542 "L</guestfs_lvcreate> and L</guestfs_vgremove>.  It won't make much sense "
543 "unless you familiarize yourself with the concepts of physical volumes, "
544 "volume groups and logical volumes."
545 msgstr ""
546
547 #. type: textblock
548 #: ../src/guestfs.pod:260
549 msgid ""
550 "This author strongly recommends reading the LVM HOWTO, online at "
551 "L<http://tldp.org/HOWTO/LVM-HOWTO/>."
552 msgstr ""
553
554 #. type: =head2
555 #: ../src/guestfs.pod:263
556 msgid "DOWNLOADING"
557 msgstr ""
558
559 #. type: textblock
560 #: ../src/guestfs.pod:265
561 msgid ""
562 "Use L</guestfs_cat> to download small, text only files.  This call is "
563 "limited to files which are less than 2 MB and which cannot contain any ASCII "
564 "NUL (C<\\0>) characters.  However the API is very simple to use."
565 msgstr ""
566
567 #. type: textblock
568 #: ../src/guestfs.pod:269
569 msgid ""
570 "L</guestfs_read_file> can be used to read files which contain arbitrary 8 "
571 "bit data, since it returns a (pointer, size) pair.  However it is still "
572 "limited to \"small\" files, less than 2 MB."
573 msgstr ""
574
575 #. type: textblock
576 #: ../src/guestfs.pod:273
577 msgid ""
578 "L</guestfs_download> can be used to download any file, with no limits on "
579 "content or size (even files larger than 4 GB)."
580 msgstr ""
581
582 #. type: textblock
583 #: ../src/guestfs.pod:276
584 msgid "To download multiple files, see L</guestfs_tar_out> and L</guestfs_tgz_out>."
585 msgstr ""
586
587 #. type: =head2
588 #: ../src/guestfs.pod:279
589 msgid "UPLOADING"
590 msgstr ""
591
592 #. type: textblock
593 #: ../src/guestfs.pod:281
594 msgid ""
595 "It's often the case that you want to write a file or files to the disk "
596 "image."
597 msgstr ""
598
599 #. type: textblock
600 #: ../src/guestfs.pod:284
601 msgid ""
602 "To write a small file with fixed content, use L</guestfs_write>.  To create "
603 "a file of all zeroes, use L</guestfs_truncate_size> (sparse) or "
604 "L</guestfs_fallocate64> (with all disk blocks allocated).  There are a "
605 "variety of other functions for creating test files, for example "
606 "L</guestfs_fill> and L</guestfs_fill_pattern>."
607 msgstr ""
608
609 #. type: textblock
610 #: ../src/guestfs.pod:290
611 msgid ""
612 "To upload a single file, use L</guestfs_upload>.  This call has no limits on "
613 "file content or size (even files larger than 4 GB)."
614 msgstr ""
615
616 #. type: textblock
617 #: ../src/guestfs.pod:293
618 msgid "To upload multiple files, see L</guestfs_tar_in> and L</guestfs_tgz_in>."
619 msgstr ""
620
621 #. type: textblock
622 #: ../src/guestfs.pod:295
623 msgid ""
624 "However the fastest way to upload I<large numbers of arbitrary files> is to "
625 "turn them into a squashfs or CD ISO (see L<mksquashfs(8)> and "
626 "L<mkisofs(8)>), then attach this using L</guestfs_add_drive_ro>.  If you add "
627 "the drive in a predictable way (eg. adding it last after all other drives) "
628 "then you can get the device name from L</guestfs_list_devices> and mount it "
629 "directly using L</guestfs_mount_ro>.  Note that squashfs images are "
630 "sometimes non-portable between kernel versions, and they don't support "
631 "labels or UUIDs.  If you want to pre-build an image or you need to mount it "
632 "using a label or UUID, use an ISO image instead."
633 msgstr ""
634
635 #. type: =head2
636 #: ../src/guestfs.pod:306
637 msgid "COPYING"
638 msgstr ""
639
640 #. type: textblock
641 #: ../src/guestfs.pod:308
642 msgid ""
643 "There are various different commands for copying between files and devices "
644 "and in and out of the guest filesystem.  These are summarised in the table "
645 "below."
646 msgstr ""
647
648 #. type: =item
649 #: ../src/guestfs.pod:314
650 msgid "B<file> to B<file>"
651 msgstr ""
652
653 #. type: textblock
654 #: ../src/guestfs.pod:316
655 msgid ""
656 "Use L</guestfs_cp> to copy a single file, or L</guestfs_cp_a> to copy "
657 "directories recursively."
658 msgstr ""
659
660 #. type: =item
661 #: ../src/guestfs.pod:319
662 msgid "B<file or device> to B<file or device>"
663 msgstr ""
664
665 #. type: textblock
666 #: ../src/guestfs.pod:321
667 msgid ""
668 "Use L</guestfs_dd> which efficiently uses L<dd(1)> to copy between files and "
669 "devices in the guest."
670 msgstr ""
671
672 #. type: textblock
673 #: ../src/guestfs.pod:324
674 msgid "Example: duplicate the contents of an LV:"
675 msgstr ""
676
677 #. type: verbatim
678 #: ../src/guestfs.pod:326
679 #, no-wrap
680 msgid ""
681 " guestfs_dd (g, \"/dev/VG/Original\", \"/dev/VG/Copy\");\n"
682 "\n"
683 msgstr ""
684
685 #. type: textblock
686 #: ../src/guestfs.pod:328
687 msgid ""
688 "The destination (C</dev/VG/Copy>) must be at least as large as the source "
689 "(C</dev/VG/Original>).  To copy less than the whole source device, use "
690 "L</guestfs_copy_size>."
691 msgstr ""
692
693 #. type: =item
694 #: ../src/guestfs.pod:332
695 msgid "B<file on the host> to B<file or device>"
696 msgstr ""
697
698 #. type: textblock
699 #: ../src/guestfs.pod:334
700 msgid "Use L</guestfs_upload>.  See L</UPLOADING> above."
701 msgstr ""
702
703 #. type: =item
704 #: ../src/guestfs.pod:336
705 msgid "B<file or device> to B<file on the host>"
706 msgstr ""
707
708 #. type: textblock
709 #: ../src/guestfs.pod:338
710 msgid "Use L</guestfs_download>.  See L</DOWNLOADING> above."
711 msgstr ""
712
713 #. type: =head2
714 #: ../src/guestfs.pod:342
715 msgid "UPLOADING AND DOWNLOADING TO PIPES AND FILE DESCRIPTORS"
716 msgstr ""
717
718 #. type: textblock
719 #: ../src/guestfs.pod:344
720 msgid ""
721 "Calls like L</guestfs_upload>, L</guestfs_download>, L</guestfs_tar_in>, "
722 "L</guestfs_tar_out> etc appear to only take filenames as arguments, so it "
723 "appears you can only upload and download to files.  However many Un*x-like "
724 "hosts let you use the special device files C</dev/stdin>, C</dev/stdout>, "
725 "C</dev/stderr> and C</dev/fd/N> to read and write from stdin, stdout, "
726 "stderr, and arbitrary file descriptor N."
727 msgstr ""
728
729 #. type: textblock
730 #: ../src/guestfs.pod:352
731 msgid "For example, L<virt-cat(1)> writes its output to stdout by doing:"
732 msgstr ""
733
734 #. type: verbatim
735 #: ../src/guestfs.pod:355
736 #, no-wrap
737 msgid ""
738 " guestfs_download (g, filename, \"/dev/stdout\");\n"
739 "\n"
740 msgstr ""
741
742 #. type: textblock
743 #: ../src/guestfs.pod:357
744 msgid "and you can write tar output to a pipe C<fd> by doing:"
745 msgstr ""
746
747 #. type: verbatim
748 #: ../src/guestfs.pod:359
749 #, no-wrap
750 msgid ""
751 " char devfd[64];\n"
752 " snprintf (devfd, sizeof devfd, \"/dev/fd/%d\", fd);\n"
753 " guestfs_tar_out (g, \"/\", devfd);\n"
754 "\n"
755 msgstr ""
756
757 #. type: =head2
758 #: ../src/guestfs.pod:363
759 msgid "LISTING FILES"
760 msgstr ""
761
762 #. type: textblock
763 #: ../src/guestfs.pod:365
764 msgid ""
765 "L</guestfs_ll> is just designed for humans to read (mainly when using the "
766 "L<guestfish(1)>-equivalent command C<ll>)."
767 msgstr ""
768
769 #. type: textblock
770 #: ../src/guestfs.pod:368
771 msgid ""
772 "L</guestfs_ls> is a quick way to get a list of files in a directory from "
773 "programs, as a flat list of strings."
774 msgstr ""
775
776 #. type: textblock
777 #: ../src/guestfs.pod:371
778 msgid ""
779 "L</guestfs_readdir> is a programmatic way to get a list of files in a "
780 "directory, plus additional information about each one.  It is more "
781 "equivalent to using the L<readdir(3)> call on a local filesystem."
782 msgstr ""
783
784 #. type: textblock
785 #: ../src/guestfs.pod:375
786 msgid ""
787 "L</guestfs_find> and L</guestfs_find0> can be used to recursively list "
788 "files."
789 msgstr ""
790
791 #. type: =head2
792 #: ../src/guestfs.pod:378
793 msgid "RUNNING COMMANDS"
794 msgstr ""
795
796 #. type: textblock
797 #: ../src/guestfs.pod:380
798 msgid ""
799 "Although libguestfs is primarily an API for manipulating files inside guest "
800 "images, we also provide some limited facilities for running commands inside "
801 "guests."
802 msgstr ""
803
804 #. type: textblock
805 #: ../src/guestfs.pod:384
806 msgid "There are many limitations to this:"
807 msgstr ""
808
809 #. type: =item
810 #: ../src/guestfs.pod:388 ../src/guestfs.pod:393 ../src/guestfs.pod:398 ../src/guestfs.pod:402 ../src/guestfs.pod:407 ../src/guestfs.pod:411 ../src/guestfs.pod:416 ../src/guestfs.pod:421 ../src/guestfs.pod:1087 ../src/guestfs.pod:1091 ../src/guestfs.pod:1095 ../src/guestfs.pod:1100 ../src/guestfs.pod:1108 ../src/guestfs.pod:1127 ../src/guestfs.pod:1135 ../src/guestfs.pod:1157 ../src/guestfs.pod:1161 ../src/guestfs.pod:1165 ../src/guestfs.pod:1169 ../src/guestfs.pod:1173 ../src/guestfs.pod:1177 ../src/guestfs.pod:1659 ../src/guestfs.pod:1664 ../src/guestfs.pod:1668 ../src/guestfs.pod:1769 ../src/guestfs.pod:1774 ../src/guestfs.pod:1778 ../src/guestfs.pod:1788 ../src/guestfs.pod:2022 ../src/guestfs.pod:2027 ../src/guestfs.pod:2033 ../src/guestfs.pod:2041 ../src/guestfs.pod:2395 ../src/guestfs.pod:2401 ../src/guestfs.pod:2406 ../src/guestfs.pod:2412 ../src/guestfs.pod:2877 ../src/guestfs.pod:2881 ../src/guestfs.pod:2885 ../src/guestfs.pod:2889 ../src/guestfs-actions.pod:15 ../src/guestfs-actions.pod:22 ../src/guestfs-actions.pod:577 ../src/guestfs-actions.pod:585 ../src/guestfs-actions.pod:592 ../src/guestfs-actions.pod:599 ../src/guestfs-actions.pod:1600 ../src/guestfs-actions.pod:1604 ../src/guestfs-actions.pod:1608 ../src/guestfs-actions.pod:1612 ../src/guestfs-actions.pod:1620 ../src/guestfs-actions.pod:1624 ../src/guestfs-actions.pod:1628 ../src/guestfs-actions.pod:1638 ../src/guestfs-actions.pod:1642 ../src/guestfs-actions.pod:1646 ../src/guestfs-actions.pod:1784 ../src/guestfs-actions.pod:1788 ../src/guestfs-actions.pod:1793 ../src/guestfs-actions.pod:1798 ../src/guestfs-actions.pod:1859 ../src/guestfs-actions.pod:1863 ../src/guestfs-actions.pod:1868 ../fish/guestfish.pod:443 ../fish/guestfish.pod:447 ../fish/guestfish.pod:451 ../fish/guestfish.pod:455 ../fish/guestfish-actions.pod:13 ../fish/guestfish-actions.pod:20 ../fish/guestfish-actions.pod:380 ../fish/guestfish-actions.pod:388 ../fish/guestfish-actions.pod:395 ../fish/guestfish-actions.pod:402 ../fish/guestfish-actions.pod:1072 ../fish/guestfish-actions.pod:1076 ../fish/guestfish-actions.pod:1080 ../fish/guestfish-actions.pod:1084 ../fish/guestfish-actions.pod:1092 ../fish/guestfish-actions.pod:1096 ../fish/guestfish-actions.pod:1100 ../fish/guestfish-actions.pod:1110 ../fish/guestfish-actions.pod:1114 ../fish/guestfish-actions.pod:1118 ../fish/guestfish-actions.pod:1208 ../fish/guestfish-actions.pod:1212 ../fish/guestfish-actions.pod:1217 ../fish/guestfish-actions.pod:1222 ../fish/guestfish-actions.pod:1264 ../fish/guestfish-actions.pod:1268 ../fish/guestfish-actions.pod:1273 ../tools/virt-edit.pl:351 ../tools/virt-edit.pl:356 ../tools/virt-edit.pl:361 ../tools/virt-edit.pl:372 ../tools/virt-edit.pl:376 ../tools/virt-win-reg.pl:536 ../tools/virt-win-reg.pl:542 ../tools/virt-win-reg.pl:548
811 msgid "*"
812 msgstr ""
813
814 #. type: textblock
815 #: ../src/guestfs.pod:390
816 msgid ""
817 "The kernel version that the command runs under will be different from what "
818 "it expects."
819 msgstr ""
820
821 #. type: textblock
822 #: ../src/guestfs.pod:395
823 msgid ""
824 "If the command needs to communicate with daemons, then most likely they "
825 "won't be running."
826 msgstr ""
827
828 #. type: textblock
829 #: ../src/guestfs.pod:400
830 msgid "The command will be running in limited memory."
831 msgstr ""
832
833 #. type: textblock
834 #: ../src/guestfs.pod:404
835 msgid ""
836 "The network may not be available unless you enable it (see "
837 "L</guestfs_set_network>)."
838 msgstr ""
839
840 #. type: textblock
841 #: ../src/guestfs.pod:409
842 msgid "Only supports Linux guests (not Windows, BSD, etc)."
843 msgstr ""
844
845 #. type: textblock
846 #: ../src/guestfs.pod:413
847 msgid "Architecture limitations (eg. won't work for a PPC guest on an X86 host)."
848 msgstr ""
849
850 #. type: textblock
851 #: ../src/guestfs.pod:418
852 msgid ""
853 "For SELinux guests, you may need to enable SELinux and load policy first.  "
854 "See L</SELINUX> in this manpage."
855 msgstr ""
856
857 #. type: textblock
858 #: ../src/guestfs.pod:423
859 msgid ""
860 "I<Security:> It is not safe to run commands from untrusted, possibly "
861 "malicious guests.  These commands may attempt to exploit your program by "
862 "sending unexpected output.  They could also try to exploit the Linux kernel "
863 "or qemu provided by the libguestfs appliance.  They could use the network "
864 "provided by the libguestfs appliance to bypass ordinary network partitions "
865 "and firewalls.  They could use the elevated privileges or different SELinux "
866 "context of your program to their advantage."
867 msgstr ""
868
869 #. type: textblock
870 #: ../src/guestfs.pod:432
871 msgid ""
872 "A secure alternative is to use libguestfs to install a \"firstboot\" script "
873 "(a script which runs when the guest next boots normally), and to have this "
874 "script run the commands you want in the normal context of the running guest, "
875 "network security and so on.  For information about other security issues, "
876 "see L</SECURITY>."
877 msgstr ""
878
879 #. type: textblock
880 #: ../src/guestfs.pod:440
881 msgid ""
882 "The two main API calls to run commands are L</guestfs_command> and "
883 "L</guestfs_sh> (there are also variations)."
884 msgstr ""
885
886 #. type: textblock
887 #: ../src/guestfs.pod:443
888 msgid ""
889 "The difference is that L</guestfs_sh> runs commands using the shell, so any "
890 "shell globs, redirections, etc will work."
891 msgstr ""
892
893 #. type: =head2
894 #: ../src/guestfs.pod:446
895 msgid "CONFIGURATION FILES"
896 msgstr ""
897
898 #. type: textblock
899 #: ../src/guestfs.pod:448
900 msgid ""
901 "To read and write configuration files in Linux guest filesystems, we "
902 "strongly recommend using Augeas.  For example, Augeas understands how to "
903 "read and write, say, a Linux shadow password file or X.org configuration "
904 "file, and so avoids you having to write that code."
905 msgstr ""
906
907 #. type: textblock
908 #: ../src/guestfs.pod:453
909 msgid ""
910 "The main Augeas calls are bound through the C<guestfs_aug_*> APIs.  We don't "
911 "document Augeas itself here because there is excellent documentation on the "
912 "L<http://augeas.net/> website."
913 msgstr ""
914
915 #. type: textblock
916 #: ../src/guestfs.pod:457
917 msgid ""
918 "If you don't want to use Augeas (you fool!) then try calling "
919 "L</guestfs_read_lines> to get the file as a list of lines which you can "
920 "iterate over."
921 msgstr ""
922
923 #. type: =head2
924 #: ../src/guestfs.pod:461
925 msgid "SELINUX"
926 msgstr ""
927
928 #. type: textblock
929 #: ../src/guestfs.pod:463
930 msgid ""
931 "We support SELinux guests.  To ensure that labeling happens correctly in "
932 "SELinux guests, you need to enable SELinux and load the guest's policy:"
933 msgstr ""
934
935 #. type: =item
936 #: ../src/guestfs.pod:469 ../src/guestfs.pod:1280 ../src/guestfs.pod:1411 ../src/guestfs.pod:2440
937 msgid "1."
938 msgstr ""
939
940 #. type: textblock
941 #: ../src/guestfs.pod:471
942 msgid "Before launching, do:"
943 msgstr ""
944
945 #. type: verbatim
946 #: ../src/guestfs.pod:473
947 #, no-wrap
948 msgid ""
949 " guestfs_set_selinux (g, 1);\n"
950 "\n"
951 msgstr ""
952
953 #. type: =item
954 #: ../src/guestfs.pod:475 ../src/guestfs.pod:1284 ../src/guestfs.pod:1415 ../src/guestfs.pod:2465
955 msgid "2."
956 msgstr ""
957
958 #. type: textblock
959 #: ../src/guestfs.pod:477
960 msgid ""
961 "After mounting the guest's filesystem(s), load the policy.  This is best "
962 "done by running the L<load_policy(8)> command in the guest itself:"
963 msgstr ""
964
965 #. type: verbatim
966 #: ../src/guestfs.pod:481
967 #, no-wrap
968 msgid ""
969 " guestfs_sh (g, \"/usr/sbin/load_policy\");\n"
970 "\n"
971 msgstr ""
972
973 #. type: textblock
974 #: ../src/guestfs.pod:483
975 msgid ""
976 "(Older versions of C<load_policy> require you to specify the name of the "
977 "policy file)."
978 msgstr ""
979
980 #. type: =item
981 #: ../src/guestfs.pod:486 ../src/guestfs.pod:1421
982 msgid "3."
983 msgstr ""
984
985 #. type: textblock
986 #: ../src/guestfs.pod:488
987 msgid ""
988 "Optionally, set the security context for the API.  The correct security "
989 "context to use can only be known by inspecting the guest.  As an example:"
990 msgstr ""
991
992 #. type: verbatim
993 #: ../src/guestfs.pod:492
994 #, no-wrap
995 msgid ""
996 " guestfs_setcon (g, \"unconfined_u:unconfined_r:unconfined_t:s0\");\n"
997 "\n"
998 msgstr ""
999
1000 #. type: textblock
1001 #: ../src/guestfs.pod:496
1002 msgid "This will work for running commands and editing existing files."
1003 msgstr ""
1004
1005 #. type: textblock
1006 #: ../src/guestfs.pod:498
1007 msgid ""
1008 "When new files are created, you may need to label them explicitly, for "
1009 "example by running the external command C<restorecon pathname>."
1010 msgstr ""
1011
1012 #. type: =head2
1013 #: ../src/guestfs.pod:502
1014 msgid "UMASK"
1015 msgstr ""
1016
1017 #. type: textblock
1018 #: ../src/guestfs.pod:504
1019 msgid ""
1020 "Certain calls are affected by the current file mode creation mask (the "
1021 "\"umask\").  In particular ones which create files or directories, such as "
1022 "L</guestfs_touch>, L</guestfs_mknod> or L</guestfs_mkdir>.  This affects "
1023 "either the default mode that the file is created with or modifies the mode "
1024 "that you supply."
1025 msgstr ""
1026
1027 #. type: textblock
1028 #: ../src/guestfs.pod:510
1029 msgid ""
1030 "The default umask is C<022>, so files are created with modes such as C<0644> "
1031 "and directories with C<0755>."
1032 msgstr ""
1033
1034 #. type: textblock
1035 #: ../src/guestfs.pod:513
1036 msgid ""
1037 "There are two ways to avoid being affected by umask.  Either set umask to 0 "
1038 "(call C<guestfs_umask (g, 0)> early after launching).  Or call "
1039 "L</guestfs_chmod> after creating each file or directory."
1040 msgstr ""
1041
1042 #. type: textblock
1043 #: ../src/guestfs.pod:517
1044 msgid "For more information about umask, see L<umask(2)>."
1045 msgstr ""
1046
1047 #. type: =head1
1048 #: ../src/guestfs.pod:519 ../fish/guestfish.pod:765
1049 msgid "ENCRYPTED DISKS"
1050 msgstr ""
1051
1052 #. type: textblock
1053 #: ../src/guestfs.pod:521
1054 msgid ""
1055 "Libguestfs allows you to access Linux guests which have been encrypted using "
1056 "whole disk encryption that conforms to the Linux Unified Key Setup (LUKS) "
1057 "standard.  This includes nearly all whole disk encryption systems used by "
1058 "modern Linux guests."
1059 msgstr ""
1060
1061 #. type: textblock
1062 #: ../src/guestfs.pod:527
1063 msgid ""
1064 "Use L</guestfs_vfs_type> to identify LUKS-encrypted block devices (it "
1065 "returns the string C<crypto_LUKS>)."
1066 msgstr ""
1067
1068 #. type: textblock
1069 #: ../src/guestfs.pod:530
1070 msgid ""
1071 "Then open these devices by calling L</guestfs_luks_open>.  Obviously you "
1072 "will require the passphrase!"
1073 msgstr ""
1074
1075 #. type: textblock
1076 #: ../src/guestfs.pod:533
1077 msgid ""
1078 "Opening a LUKS device creates a new device mapper device called "
1079 "C</dev/mapper/mapname> (where C<mapname> is the string you supply to "
1080 "L</guestfs_luks_open>).  Reads and writes to this mapper device are "
1081 "decrypted from and encrypted to the underlying block device respectively."
1082 msgstr ""
1083
1084 #. type: textblock
1085 #: ../src/guestfs.pod:539
1086 msgid ""
1087 "LVM volume groups on the device can be made visible by calling "
1088 "L</guestfs_vgscan> followed by L</guestfs_vg_activate_all>.  The logical "
1089 "volume(s) can now be mounted in the usual way."
1090 msgstr ""
1091
1092 #. type: textblock
1093 #: ../src/guestfs.pod:543
1094 msgid ""
1095 "Use the reverse process to close a LUKS device.  Unmount any logical volumes "
1096 "on it, deactivate the volume groups by caling C<guestfs_vg_activate (g, 0, "
1097 "[\"/dev/VG\"])>.  Then close the mapper device by calling "
1098 "L</guestfs_luks_close> on the C</dev/mapper/mapname> device (I<not> the "
1099 "underlying encrypted block device)."
1100 msgstr ""
1101
1102 #. type: =head2
1103 #: ../src/guestfs.pod:550
1104 msgid "INSPECTION"
1105 msgstr ""
1106
1107 #. type: textblock
1108 #: ../src/guestfs.pod:552
1109 msgid ""
1110 "Libguestfs has APIs for inspecting an unknown disk image to find out if it "
1111 "contains operating systems, an install CD or a live CD.  (These APIs used to "
1112 "be in a separate Perl-only library called L<Sys::Guestfs::Lib(3)> but since "
1113 "version 1.5.3 the most frequently used part of this library has been "
1114 "rewritten in C and moved into the core code)."
1115 msgstr ""
1116
1117 #. type: textblock
1118 #: ../src/guestfs.pod:559
1119 msgid ""
1120 "Add all disks belonging to the unknown virtual machine and call "
1121 "L</guestfs_launch> in the usual way."
1122 msgstr ""
1123
1124 #. type: textblock
1125 #: ../src/guestfs.pod:562
1126 msgid ""
1127 "Then call L</guestfs_inspect_os>.  This function uses other libguestfs calls "
1128 "and certain heuristics, and returns a list of operating systems that were "
1129 "found.  An empty list means none were found.  A single element is the root "
1130 "filesystem of the operating system.  For dual- or multi-boot guests, "
1131 "multiple roots can be returned, each one corresponding to a separate "
1132 "operating system.  (Multi-boot virtual machines are extremely rare in the "
1133 "world of virtualization, but since this scenario can happen, we have built "
1134 "libguestfs to deal with it.)"
1135 msgstr ""
1136
1137 #. type: textblock
1138 #: ../src/guestfs.pod:571
1139 msgid ""
1140 "For each root, you can then call various C<guestfs_inspect_get_*> functions "
1141 "to get additional details about that operating system.  For example, call "
1142 "L</guestfs_inspect_get_type> to return the string C<windows> or C<linux> for "
1143 "Windows and Linux-based operating systems respectively."
1144 msgstr ""
1145
1146 #. type: textblock
1147 #: ../src/guestfs.pod:577
1148 msgid ""
1149 "Un*x-like and Linux-based operating systems usually consist of several "
1150 "filesystems which are mounted at boot time (for example, a separate boot "
1151 "partition mounted on C</boot>).  The inspection rules are able to detect how "
1152 "filesystems correspond to mount points.  Call "
1153 "C<guestfs_inspect_get_mountpoints> to get this mapping.  It might return a "
1154 "hash table like this example:"
1155 msgstr ""
1156
1157 #. type: verbatim
1158 #: ../src/guestfs.pod:584
1159 #, no-wrap
1160 msgid ""
1161 " /boot => /dev/sda1\n"
1162 " /     => /dev/vg_guest/lv_root\n"
1163 " /usr  => /dev/vg_guest/lv_usr\n"
1164 "\n"
1165 msgstr ""
1166
1167 #. type: textblock
1168 #: ../src/guestfs.pod:588
1169 msgid ""
1170 "The caller can then make calls to L</guestfs_mount_options> to mount the "
1171 "filesystems as suggested."
1172 msgstr ""
1173
1174 #. type: textblock
1175 #: ../src/guestfs.pod:591
1176 msgid ""
1177 "Be careful to mount filesystems in the right order (eg. C</> before "
1178 "C</usr>).  Sorting the keys of the hash by length, shortest first, should "
1179 "work."
1180 msgstr ""
1181
1182 #. type: textblock
1183 #: ../src/guestfs.pod:595
1184 msgid ""
1185 "Inspection currently only works for some common operating systems.  "
1186 "Contributors are welcome to send patches for other operating systems that we "
1187 "currently cannot detect."
1188 msgstr ""
1189
1190 #. type: textblock
1191 #: ../src/guestfs.pod:599
1192 msgid ""
1193 "Encrypted disks must be opened before inspection.  See L</ENCRYPTED DISKS> "
1194 "for more details.  The L</guestfs_inspect_os> function just ignores any "
1195 "encrypted devices."
1196 msgstr ""
1197
1198 #. type: textblock
1199 #: ../src/guestfs.pod:603
1200 msgid ""
1201 "A note on the implementation: The call L</guestfs_inspect_os> performs "
1202 "inspection and caches the results in the guest handle.  Subsequent calls to "
1203 "C<guestfs_inspect_get_*> return this cached information, but I<do not> "
1204 "re-read the disks.  If you change the content of the guest disks, you can "
1205 "redo inspection by calling L</guestfs_inspect_os> again.  "
1206 "(L</guestfs_inspect_list_applications> works a little differently from the "
1207 "other calls and does read the disks.  See documentation for that function "
1208 "for details)."
1209 msgstr ""
1210
1211 #. type: =head3
1212 #: ../src/guestfs.pod:612
1213 msgid "INSPECTING INSTALL DISKS"
1214 msgstr ""
1215
1216 #. type: textblock
1217 #: ../src/guestfs.pod:614
1218 msgid ""
1219 "Libguestfs (since 1.9.4) can detect some install disks, install CDs, live "
1220 "CDs and more."
1221 msgstr ""
1222
1223 #. type: textblock
1224 #: ../src/guestfs.pod:617
1225 msgid ""
1226 "Call L</guestfs_inspect_get_format> to return the format of the operating "
1227 "system, which currently can be C<installed> (a regular operating system) or "
1228 "C<installer> (some sort of install disk)."
1229 msgstr ""
1230
1231 #. type: textblock
1232 #: ../src/guestfs.pod:621
1233 msgid ""
1234 "Further information is available about the operating system that can be "
1235 "installed using the regular inspection APIs like "
1236 "L</guestfs_inspect_get_product_name>, L</guestfs_inspect_get_major_version> "
1237 "etc."
1238 msgstr ""
1239
1240 #. type: textblock
1241 #: ../src/guestfs.pod:626
1242 msgid ""
1243 "Some additional information specific to installer disks is also available "
1244 "from the L</guestfs_inspect_is_live>, L</guestfs_inspect_is_netinst> and "
1245 "L</guestfs_inspect_is_multipart> calls."
1246 msgstr ""
1247
1248 #. type: =head2
1249 #: ../src/guestfs.pod:631
1250 msgid "SPECIAL CONSIDERATIONS FOR WINDOWS GUESTS"
1251 msgstr ""
1252
1253 #. type: textblock
1254 #: ../src/guestfs.pod:633
1255 msgid ""
1256 "Libguestfs can mount NTFS partitions.  It does this using the "
1257 "L<http://www.ntfs-3g.org/> driver."
1258 msgstr ""
1259
1260 #. type: =head3
1261 #: ../src/guestfs.pod:636
1262 msgid "DRIVE LETTERS AND PATHS"
1263 msgstr ""
1264
1265 #. type: textblock
1266 #: ../src/guestfs.pod:638
1267 msgid ""
1268 "DOS and Windows still use drive letters, and the filesystems are always "
1269 "treated as case insensitive by Windows itself, and therefore you might find "
1270 "a Windows configuration file referring to a path like "
1271 "C<c:\\windows\\system32>.  When the filesystem is mounted in libguestfs, "
1272 "that directory might be referred to as C</WINDOWS/System32>."
1273 msgstr ""
1274
1275 #. type: textblock
1276 #: ../src/guestfs.pod:644
1277 msgid ""
1278 "Drive letter mappings can be found using inspection (see L</INSPECTION> and "
1279 "L</guestfs_inspect_get_drive_mappings>)"
1280 msgstr ""
1281
1282 #. type: textblock
1283 #: ../src/guestfs.pod:647
1284 msgid ""
1285 "Dealing with separator characters (backslash vs forward slash) is outside "
1286 "the scope of libguestfs, but usually a simple character replacement will "
1287 "work."
1288 msgstr ""
1289
1290 #. type: textblock
1291 #: ../src/guestfs.pod:651
1292 msgid ""
1293 "To resolve the case insensitivity of paths, call "
1294 "L</guestfs_case_sensitive_path>."
1295 msgstr ""
1296
1297 #. type: =head3
1298 #: ../src/guestfs.pod:654
1299 msgid "ACCESSING THE WINDOWS REGISTRY"
1300 msgstr ""
1301
1302 #. type: textblock
1303 #: ../src/guestfs.pod:656
1304 msgid ""
1305 "Libguestfs also provides some help for decoding Windows Registry \"hive\" "
1306 "files, through the library C<hivex> which is part of the libguestfs project "
1307 "although ships as a separate tarball.  You have to locate and download the "
1308 "hive file(s) yourself, and then pass them to C<hivex> functions.  See also "
1309 "the programs L<hivexml(1)>, L<hivexsh(1)>, L<hivexregedit(1)> and "
1310 "L<virt-win-reg(1)> for more help on this issue."
1311 msgstr ""
1312
1313 #. type: =head3
1314 #: ../src/guestfs.pod:664
1315 msgid "SYMLINKS ON NTFS-3G FILESYSTEMS"
1316 msgstr ""
1317
1318 #. type: textblock
1319 #: ../src/guestfs.pod:666
1320 msgid ""
1321 "Ntfs-3g tries to rewrite \"Junction Points\" and NTFS \"symbolic links\" to "
1322 "provide something which looks like a Linux symlink.  The way it tries to do "
1323 "the rewriting is described here:"
1324 msgstr ""
1325
1326 #. type: textblock
1327 #: ../src/guestfs.pod:670
1328 msgid "L<http://www.tuxera.com/community/ntfs-3g-advanced/junction-points-and-symbolic-links/>"
1329 msgstr ""
1330
1331 #. type: textblock
1332 #: ../src/guestfs.pod:672
1333 msgid ""
1334 "The essential problem is that ntfs-3g simply does not have enough "
1335 "information to do a correct job.  NTFS links can contain drive letters and "
1336 "references to external device GUIDs that ntfs-3g has no way of resolving.  "
1337 "It is almost certainly the case that libguestfs callers should ignore what "
1338 "ntfs-3g does (ie. don't use L</guestfs_readlink> on NTFS volumes)."
1339 msgstr ""
1340
1341 #. type: textblock
1342 #: ../src/guestfs.pod:679
1343 msgid ""
1344 "Instead if you encounter a symbolic link on an ntfs-3g filesystem, use "
1345 "L</guestfs_lgetxattr> to read the C<system.ntfs_reparse_data> extended "
1346 "attribute, and read the raw reparse data from that (you can find the format "
1347 "documented in various places around the web)."
1348 msgstr ""
1349
1350 #. type: =head3
1351 #: ../src/guestfs.pod:684
1352 msgid "EXTENDED ATTRIBUTES ON NTFS-3G FILESYSTEMS"
1353 msgstr ""
1354
1355 #. type: textblock
1356 #: ../src/guestfs.pod:686
1357 msgid ""
1358 "There are other useful extended attributes that can be read from ntfs-3g "
1359 "filesystems (using L</guestfs_getxattr>).  See:"
1360 msgstr ""
1361
1362 #. type: textblock
1363 #: ../src/guestfs.pod:689
1364 msgid "L<http://www.tuxera.com/community/ntfs-3g-advanced/extended-attributes/>"
1365 msgstr ""
1366
1367 #. type: =head2
1368 #: ../src/guestfs.pod:691
1369 msgid "USING LIBGUESTFS WITH OTHER PROGRAMMING LANGUAGES"
1370 msgstr ""
1371
1372 #. type: textblock
1373 #: ../src/guestfs.pod:693
1374 msgid ""
1375 "Although we don't want to discourage you from using the C API, we will "
1376 "mention here that the same API is also available in other languages."
1377 msgstr ""
1378
1379 #. type: textblock
1380 #: ../src/guestfs.pod:696
1381 msgid ""
1382 "The API is broadly identical in all supported languages.  This means that "
1383 "the C call C<guestfs_add_drive_ro(g,file)> is C<$g-E<gt>add_drive_ro($file)> "
1384 "in Perl, C<g.add_drive_ro(file)> in Python, and C<g#add_drive_ro file> in "
1385 "OCaml.  In other words, a straightforward, predictable isomorphism between "
1386 "each language."
1387 msgstr ""
1388
1389 #. type: textblock
1390 #: ../src/guestfs.pod:702
1391 msgid ""
1392 "Error messages are automatically transformed into exceptions if the language "
1393 "supports it."
1394 msgstr ""
1395
1396 #. type: textblock
1397 #: ../src/guestfs.pod:705
1398 msgid ""
1399 "We don't try to \"object orientify\" parts of the API in OO languages, "
1400 "although contributors are welcome to write higher level APIs above what we "
1401 "provide in their favourite languages if they wish."
1402 msgstr ""
1403
1404 #. type: =item
1405 #: ../src/guestfs.pod:711
1406 msgid "B<C++>"
1407 msgstr ""
1408
1409 #. type: textblock
1410 #: ../src/guestfs.pod:713
1411 msgid ""
1412 "You can use the I<guestfs.h> header file from C++ programs.  The C++ API is "
1413 "identical to the C API.  C++ classes and exceptions are not used."
1414 msgstr ""
1415
1416 #. type: =item
1417 #: ../src/guestfs.pod:717
1418 msgid "B<C#>"
1419 msgstr ""
1420
1421 #. type: textblock
1422 #: ../src/guestfs.pod:719
1423 msgid ""
1424 "The C# bindings are highly experimental.  Please read the warnings at the "
1425 "top of C<csharp/Libguestfs.cs>."
1426 msgstr ""
1427
1428 #. type: =item
1429 #: ../src/guestfs.pod:722
1430 msgid "B<Haskell>"
1431 msgstr ""
1432
1433 #. type: textblock
1434 #: ../src/guestfs.pod:724
1435 msgid ""
1436 "This is the only language binding that is working but incomplete.  Only "
1437 "calls which return simple integers have been bound in Haskell, and we are "
1438 "looking for help to complete this binding."
1439 msgstr ""
1440
1441 #. type: =item
1442 #: ../src/guestfs.pod:728
1443 msgid "B<Java>"
1444 msgstr ""
1445
1446 #. type: textblock
1447 #: ../src/guestfs.pod:730
1448 msgid ""
1449 "Full documentation is contained in the Javadoc which is distributed with "
1450 "libguestfs."
1451 msgstr ""
1452
1453 #. type: =item
1454 #: ../src/guestfs.pod:733
1455 msgid "B<OCaml>"
1456 msgstr ""
1457
1458 #. type: textblock
1459 #: ../src/guestfs.pod:735
1460 msgid "See L<guestfs-ocaml(3)>."
1461 msgstr ""
1462
1463 #. type: =item
1464 #: ../src/guestfs.pod:737
1465 msgid "B<Perl>"
1466 msgstr ""
1467
1468 #. type: textblock
1469 #: ../src/guestfs.pod:739
1470 msgid "See L<guestfs-perl(3)> and L<Sys::Guestfs(3)>."
1471 msgstr ""
1472
1473 #. type: =item
1474 #: ../src/guestfs.pod:741
1475 msgid "B<PHP>"
1476 msgstr ""
1477
1478 #. type: textblock
1479 #: ../src/guestfs.pod:743
1480 msgid ""
1481 "For documentation see C<README-PHP> supplied with libguestfs sources or in "
1482 "the php-libguestfs package for your distribution."
1483 msgstr ""
1484
1485 #. type: textblock
1486 #: ../src/guestfs.pod:746
1487 msgid "The PHP binding only works correctly on 64 bit machines."
1488 msgstr ""
1489
1490 #. type: =item
1491 #: ../src/guestfs.pod:748
1492 msgid "B<Python>"
1493 msgstr ""
1494
1495 #. type: textblock
1496 #: ../src/guestfs.pod:750
1497 msgid "See L<guestfs-python(3)>."
1498 msgstr ""
1499
1500 #. type: =item
1501 #: ../src/guestfs.pod:752
1502 msgid "B<Ruby>"
1503 msgstr ""
1504
1505 #. type: textblock
1506 #: ../src/guestfs.pod:754
1507 msgid "See L<guestfs-ruby(3)>."
1508 msgstr ""
1509
1510 #. type: =item
1511 #: ../src/guestfs.pod:756
1512 msgid "B<shell scripts>"
1513 msgstr ""
1514
1515 #. type: textblock
1516 #: ../src/guestfs.pod:758
1517 msgid "See L<guestfish(1)>."
1518 msgstr ""
1519
1520 #. type: =head2
1521 #: ../src/guestfs.pod:762
1522 msgid "LIBGUESTFS GOTCHAS"
1523 msgstr ""
1524
1525 #. type: textblock
1526 #: ../src/guestfs.pod:764
1527 msgid ""
1528 "L<http://en.wikipedia.org/wiki/Gotcha_(programming)>: \"A feature of a "
1529 "system [...] that works in the way it is documented but is counterintuitive "
1530 "and almost invites mistakes.\""
1531 msgstr ""
1532
1533 #. type: textblock
1534 #: ../src/guestfs.pod:768
1535 msgid ""
1536 "Since we developed libguestfs and the associated tools, there are several "
1537 "things we would have designed differently, but are now stuck with for "
1538 "backwards compatibility or other reasons.  If there is ever a libguestfs 2.0 "
1539 "release, you can expect these to change.  Beware of them."
1540 msgstr ""
1541
1542 #. type: =item
1543 #: ../src/guestfs.pod:776
1544 msgid "Autosync / forgetting to sync."
1545 msgstr ""
1546
1547 #. type: textblock
1548 #: ../src/guestfs.pod:778
1549 msgid ""
1550 "When modifying a filesystem from C or another language, you B<must> unmount "
1551 "all filesystems and call L</guestfs_sync> explicitly before you close the "
1552 "libguestfs handle.  You can also call:"
1553 msgstr ""
1554
1555 #. type: verbatim
1556 #: ../src/guestfs.pod:782
1557 #, no-wrap
1558 msgid ""
1559 " guestfs_set_autosync (g, 1);\n"
1560 "\n"
1561 msgstr ""
1562
1563 #. type: textblock
1564 #: ../src/guestfs.pod:784
1565 msgid ""
1566 "to have the unmount/sync done automatically for you when the handle 'g' is "
1567 "closed.  (This feature is called \"autosync\", L</guestfs_set_autosync> "
1568 "q.v.)"
1569 msgstr ""
1570
1571 #. type: textblock
1572 #: ../src/guestfs.pod:788
1573 msgid ""
1574 "If you forget to do this, then it is entirely possible that your changes "
1575 "won't be written out, or will be partially written, or (very rarely) that "
1576 "you'll get disk corruption."
1577 msgstr ""
1578
1579 #. type: textblock
1580 #: ../src/guestfs.pod:792
1581 msgid ""
1582 "Note that in L<guestfish(3)> autosync is the default.  So quick and dirty "
1583 "guestfish scripts that forget to sync will work just fine, which can make "
1584 "this very puzzling if you are trying to debug a problem."
1585 msgstr ""
1586
1587 #. type: textblock
1588 #: ../src/guestfs.pod:796
1589 msgid ""
1590 "Update: Autosync is enabled by default for all API users starting from "
1591 "libguestfs 1.5.24."
1592 msgstr ""
1593
1594 #. type: =item
1595 #: ../src/guestfs.pod:799
1596 msgid "Mount option C<-o sync> should not be the default."
1597 msgstr ""
1598
1599 #. type: textblock
1600 #: ../src/guestfs.pod:801
1601 msgid ""
1602 "If you use L</guestfs_mount>, then C<-o sync,noatime> are added implicitly.  "
1603 "However C<-o sync> does not add any reliability benefit, but does have a "
1604 "very large performance impact."
1605 msgstr ""
1606
1607 #. type: textblock
1608 #: ../src/guestfs.pod:805
1609 msgid ""
1610 "The work around is to use L</guestfs_mount_options> and set the mount "
1611 "options that you actually want to use."
1612 msgstr ""
1613
1614 #. type: =item
1615 #: ../src/guestfs.pod:808
1616 msgid "Read-only should be the default."
1617 msgstr ""
1618
1619 #. type: textblock
1620 #: ../src/guestfs.pod:810
1621 msgid ""
1622 "In L<guestfish(3)>, I<--ro> should be the default, and you should have to "
1623 "specify I<--rw> if you want to make changes to the image."
1624 msgstr ""
1625
1626 #. type: textblock
1627 #: ../src/guestfs.pod:813
1628 msgid "This would reduce the potential to corrupt live VM images."
1629 msgstr ""
1630
1631 #. type: textblock
1632 #: ../src/guestfs.pod:815
1633 msgid ""
1634 "Note that many filesystems change the disk when you just mount and unmount, "
1635 "even if you didn't perform any writes.  You need to use "
1636 "L</guestfs_add_drive_ro> to guarantee that the disk is not changed."
1637 msgstr ""
1638
1639 #. type: =item
1640 #: ../src/guestfs.pod:819
1641 msgid "guestfish command line is hard to use."
1642 msgstr ""
1643
1644 #. type: textblock
1645 #: ../src/guestfs.pod:821
1646 msgid ""
1647 "C<guestfish disk.img> doesn't do what people expect (open C<disk.img> for "
1648 "examination).  It tries to run a guestfish command C<disk.img> which doesn't "
1649 "exist, so it fails.  In earlier versions of guestfish the error message was "
1650 "also unintuitive, but we have corrected this since.  Like the Bourne shell, "
1651 "we should have used C<guestfish -c command> to run commands."
1652 msgstr ""
1653
1654 #. type: =item
1655 #: ../src/guestfs.pod:828
1656 msgid "guestfish megabyte modifiers don't work right on all commands"
1657 msgstr ""
1658
1659 #. type: textblock
1660 #: ../src/guestfs.pod:830
1661 msgid ""
1662 "In recent guestfish you can use C<1M> to mean 1 megabyte (and similarly for "
1663 "other modifiers).  What guestfish actually does is to multiply the number "
1664 "part by the modifier part and pass the result to the C API.  However this "
1665 "doesn't work for a few APIs which aren't expecting bytes, but are already "
1666 "expecting some other unit (eg. megabytes)."
1667 msgstr ""
1668
1669 #. type: textblock
1670 #: ../src/guestfs.pod:837
1671 msgid "The most common is L</guestfs_lvcreate>.  The guestfish command:"
1672 msgstr ""
1673
1674 #. type: verbatim
1675 #: ../src/guestfs.pod:839
1676 #, no-wrap
1677 msgid ""
1678 " lvcreate LV VG 100M\n"
1679 "\n"
1680 msgstr ""
1681
1682 #. type: textblock
1683 #: ../src/guestfs.pod:841
1684 msgid ""
1685 "does not do what you might expect.  Instead because L</guestfs_lvcreate> is "
1686 "already expecting megabytes, this tries to create a 100 I<terabyte> (100 "
1687 "megabytes * megabytes) logical volume.  The error message you get from this "
1688 "is also a little obscure."
1689 msgstr ""
1690
1691 #. type: textblock
1692 #: ../src/guestfs.pod:846
1693 msgid ""
1694 "This could be fixed in the generator by specially marking parameters and "
1695 "return values which take bytes or other units."
1696 msgstr ""
1697
1698 #. type: =item
1699 #: ../src/guestfs.pod:849
1700 msgid "Ambiguity between devices and paths"
1701 msgstr ""
1702
1703 #. type: textblock
1704 #: ../src/guestfs.pod:851
1705 msgid ""
1706 "There is a subtle ambiguity in the API between a device name "
1707 "(eg. C</dev/sdb2>) and a similar pathname.  A file might just happen to be "
1708 "called C<sdb2> in the directory C</dev> (consider some non-Unix VM image)."
1709 msgstr ""
1710
1711 #. type: textblock
1712 #: ../src/guestfs.pod:856
1713 msgid ""
1714 "In the current API we usually resolve this ambiguity by having two separate "
1715 "calls, for example L</guestfs_checksum> and L</guestfs_checksum_device>.  "
1716 "Some API calls are ambiguous and (incorrectly) resolve the problem by "
1717 "detecting if the path supplied begins with C</dev/>."
1718 msgstr ""
1719
1720 #. type: textblock
1721 #: ../src/guestfs.pod:862
1722 msgid ""
1723 "To avoid both the ambiguity and the need to duplicate some calls, we could "
1724 "make paths/devices into structured names.  One way to do this would be to "
1725 "use a notation like grub (C<hd(0,0)>), although nobody really likes this "
1726 "aspect of grub.  Another way would be to use a structured type, equivalent "
1727 "to this OCaml type:"
1728 msgstr ""
1729
1730 #. type: verbatim
1731 #: ../src/guestfs.pod:868
1732 #, no-wrap
1733 msgid ""
1734 " type path = Path of string | Device of int | Partition of int * int\n"
1735 "\n"
1736 msgstr ""
1737
1738 #. type: textblock
1739 #: ../src/guestfs.pod:870
1740 msgid "which would allow you to pass arguments like:"
1741 msgstr ""
1742
1743 #. type: verbatim
1744 #: ../src/guestfs.pod:872
1745 #, no-wrap
1746 msgid ""
1747 " Path \"/foo/bar\"\n"
1748 " Device 1            (* /dev/sdb, or perhaps /dev/sda *)\n"
1749 " Partition (1, 2)    (* /dev/sdb2 (or is it /dev/sda2 or /dev/sdb3?) *)\n"
1750 " Path \"/dev/sdb2\"    (* not a device *)\n"
1751 "\n"
1752 msgstr ""
1753
1754 #. type: textblock
1755 #: ../src/guestfs.pod:877
1756 msgid ""
1757 "As you can see there are still problems to resolve even with this "
1758 "representation.  Also consider how it might work in guestfish."
1759 msgstr ""
1760
1761 #. type: =head2
1762 #: ../src/guestfs.pod:882
1763 msgid "PROTOCOL LIMITS"
1764 msgstr ""
1765
1766 #. type: textblock
1767 #: ../src/guestfs.pod:884
1768 msgid ""
1769 "Internally libguestfs uses a message-based protocol to pass API calls and "
1770 "their responses to and from a small \"appliance\" (see L</INTERNALS> for "
1771 "plenty more detail about this).  The maximum message size used by the "
1772 "protocol is slightly less than 4 MB.  For some API calls you may need to be "
1773 "aware of this limit.  The API calls which may be affected are individually "
1774 "documented, with a link back to this section of the documentation."
1775 msgstr ""
1776
1777 #. type: textblock
1778 #: ../src/guestfs.pod:892
1779 msgid ""
1780 "A simple call such as L</guestfs_cat> returns its result (the file data) in "
1781 "a simple string.  Because this string is at some point internally encoded as "
1782 "a message, the maximum size that it can return is slightly under 4 MB.  If "
1783 "the requested file is larger than this then you will get an error."
1784 msgstr ""
1785
1786 #. type: textblock
1787 #: ../src/guestfs.pod:898
1788 msgid ""
1789 "In order to transfer large files into and out of the guest filesystem, you "
1790 "need to use particular calls that support this.  The sections L</UPLOADING> "
1791 "and L</DOWNLOADING> document how to do this."
1792 msgstr ""
1793
1794 #. type: textblock
1795 #: ../src/guestfs.pod:902
1796 msgid ""
1797 "You might also consider mounting the disk image using our FUSE filesystem "
1798 "support (L<guestmount(1)>)."
1799 msgstr ""
1800
1801 #. type: =head2
1802 #: ../src/guestfs.pod:905
1803 msgid "KEYS AND PASSPHRASES"
1804 msgstr ""
1805
1806 #. type: textblock
1807 #: ../src/guestfs.pod:907
1808 msgid ""
1809 "Certain libguestfs calls take a parameter that contains sensitive key "
1810 "material, passed in as a C string."
1811 msgstr ""
1812
1813 #. type: textblock
1814 #: ../src/guestfs.pod:910
1815 msgid ""
1816 "In the future we would hope to change the libguestfs implementation so that "
1817 "keys are L<mlock(2)>-ed into physical RAM, and thus can never end up in "
1818 "swap.  However this is I<not> done at the moment, because of the complexity "
1819 "of such an implementation."
1820 msgstr ""
1821
1822 #. type: textblock
1823 #: ../src/guestfs.pod:915
1824 msgid ""
1825 "Therefore you should be aware that any key parameter you pass to libguestfs "
1826 "might end up being written out to the swap partition.  If this is a concern, "
1827 "scrub the swap partition or don't use libguestfs on encrypted devices."
1828 msgstr ""
1829
1830 #. type: =head2
1831 #: ../src/guestfs.pod:920
1832 msgid "MULTIPLE HANDLES AND MULTIPLE THREADS"
1833 msgstr ""
1834
1835 #. type: textblock
1836 #: ../src/guestfs.pod:922
1837 msgid ""
1838 "All high-level libguestfs actions are synchronous.  If you want to use "
1839 "libguestfs asynchronously then you must create a thread."
1840 msgstr ""
1841
1842 #. type: textblock
1843 #: ../src/guestfs.pod:925
1844 msgid ""
1845 "Only use the handle from a single thread.  Either use the handle exclusively "
1846 "from one thread, or provide your own mutex so that two threads cannot issue "
1847 "calls on the same handle at the same time."
1848 msgstr ""
1849
1850 #. type: textblock
1851 #: ../src/guestfs.pod:929
1852 msgid ""
1853 "See the graphical program guestfs-browser for one possible architecture for "
1854 "multithreaded programs using libvirt and libguestfs."
1855 msgstr ""
1856
1857 #. type: =head2
1858 #: ../src/guestfs.pod:932
1859 msgid "PATH"
1860 msgstr ""
1861
1862 #. type: textblock
1863 #: ../src/guestfs.pod:934
1864 msgid ""
1865 "Libguestfs needs a supermin appliance, which it finds by looking along an "
1866 "internal path."
1867 msgstr ""
1868
1869 #. type: textblock
1870 #: ../src/guestfs.pod:937
1871 msgid ""
1872 "By default it looks for these in the directory C<$libdir/guestfs> "
1873 "(eg. C</usr/local/lib/guestfs> or C</usr/lib64/guestfs>)."
1874 msgstr ""
1875
1876 #. type: textblock
1877 #: ../src/guestfs.pod:940
1878 msgid ""
1879 "Use L</guestfs_set_path> or set the environment variable L</LIBGUESTFS_PATH> "
1880 "to change the directories that libguestfs will search in.  The value is a "
1881 "colon-separated list of paths.  The current directory is I<not> searched "
1882 "unless the path contains an empty element or C<.>.  For example "
1883 "C<LIBGUESTFS_PATH=:/usr/lib/guestfs> would search the current directory and "
1884 "then C</usr/lib/guestfs>."
1885 msgstr ""
1886
1887 #. type: =head2
1888 #: ../src/guestfs.pod:947
1889 msgid "QEMU WRAPPERS"
1890 msgstr ""
1891
1892 #. type: textblock
1893 #: ../src/guestfs.pod:949
1894 msgid ""
1895 "If you want to compile your own qemu, run qemu from a non-standard location, "
1896 "or pass extra arguments to qemu, then you can write a shell-script wrapper "
1897 "around qemu."
1898 msgstr ""
1899
1900 #. type: textblock
1901 #: ../src/guestfs.pod:953
1902 msgid ""
1903 "There is one important rule to remember: you I<must C<exec qemu>> as the "
1904 "last command in the shell script (so that qemu replaces the shell and "
1905 "becomes the direct child of the libguestfs-using program).  If you don't do "
1906 "this, then the qemu process won't be cleaned up correctly."
1907 msgstr ""
1908
1909 #. type: textblock
1910 #: ../src/guestfs.pod:958
1911 msgid ""
1912 "Here is an example of a wrapper, where I have built my own copy of qemu from "
1913 "source:"
1914 msgstr ""
1915
1916 #. type: verbatim
1917 #: ../src/guestfs.pod:961
1918 #, no-wrap
1919 msgid ""
1920 " #!/bin/sh -\n"
1921 " qemudir=/home/rjones/d/qemu\n"
1922 " exec $qemudir/x86_64-softmmu/qemu-system-x86_64 -L $qemudir/pc-bios "
1923 "\"$@\"\n"
1924 "\n"
1925 msgstr ""
1926
1927 #. type: textblock
1928 #: ../src/guestfs.pod:965
1929 msgid ""
1930 "Save this script as C</tmp/qemu.wrapper> (or wherever), C<chmod +x>, and "
1931 "then use it by setting the LIBGUESTFS_QEMU environment variable.  For "
1932 "example:"
1933 msgstr ""
1934
1935 #. type: verbatim
1936 #: ../src/guestfs.pod:969
1937 #, no-wrap
1938 msgid ""
1939 " LIBGUESTFS_QEMU=/tmp/qemu.wrapper guestfish\n"
1940 "\n"
1941 msgstr ""
1942
1943 #. type: textblock
1944 #: ../src/guestfs.pod:971
1945 msgid ""
1946 "Note that libguestfs also calls qemu with the -help and -version options in "
1947 "order to determine features."
1948 msgstr ""
1949
1950 #. type: =head2
1951 #: ../src/guestfs.pod:974
1952 msgid "ATTACHING TO RUNNING DAEMONS"
1953 msgstr ""
1954
1955 #. type: textblock
1956 #: ../src/guestfs.pod:976
1957 msgid ""
1958 "I<Note (1):> This is B<highly experimental> and has a tendency to eat "
1959 "babies.  Use with caution."
1960 msgstr ""
1961
1962 #. type: textblock
1963 #: ../src/guestfs.pod:979
1964 msgid ""
1965 "I<Note (2):> This section explains how to attach to a running daemon from a "
1966 "low level perspective.  For most users, simply using virt tools such as "
1967 "L<guestfish(1)> with the I<--live> option will \"just work\"."
1968 msgstr ""
1969
1970 #. type: =head3
1971 #: ../src/guestfs.pod:983
1972 msgid "Using guestfs_set_attach_method"
1973 msgstr ""
1974
1975 #. type: textblock
1976 #: ../src/guestfs.pod:985
1977 msgid ""
1978 "By calling L</guestfs_set_attach_method> you can change how the library "
1979 "connects to the C<guestfsd> daemon in L</guestfs_launch> (read "
1980 "L</ARCHITECTURE> for some background)."
1981 msgstr ""
1982
1983 #. type: textblock
1984 #: ../src/guestfs.pod:989
1985 msgid ""
1986 "The normal attach method is C<appliance>, where a small appliance is created "
1987 "containing the daemon, and then the library connects to this."
1988 msgstr ""
1989
1990 #. type: textblock
1991 #: ../src/guestfs.pod:992
1992 msgid ""
1993 "Setting attach method to C<unix:I<path>> (where I<path> is the path of a "
1994 "Unix domain socket) causes L</guestfs_launch> to connect to an existing "
1995 "daemon over the Unix domain socket."
1996 msgstr ""
1997
1998 #. type: textblock
1999 #: ../src/guestfs.pod:996
2000 msgid ""
2001 "The normal use for this is to connect to a running virtual machine that "
2002 "contains a C<guestfsd> daemon, and send commands so you can read and write "
2003 "files inside the live virtual machine."
2004 msgstr ""
2005
2006 #. type: =head3
2007 #: ../src/guestfs.pod:1000
2008 msgid "Using guestfs_add_domain with live flag"
2009 msgstr ""
2010
2011 #. type: textblock
2012 #: ../src/guestfs.pod:1002
2013 msgid ""
2014 "L</guestfs_add_domain> provides some help for getting the correct attach "
2015 "method.  If you pass the C<live> option to this function, then (if the "
2016 "virtual machine is running) it will examine the libvirt XML looking for a "
2017 "virtio-serial channel to connect to:"
2018 msgstr ""
2019
2020 #. type: verbatim
2021 #: ../src/guestfs.pod:1008
2022 #, no-wrap
2023 msgid ""
2024 " <domain>\n"
2025 "   ...\n"
2026 "   <devices>\n"
2027 "     ...\n"
2028 "     <channel type='unix'>\n"
2029 "       <source mode='bind' path='/path/to/socket'/>\n"
2030 "       <target type='virtio' name='org.libguestfs.channel.0'/>\n"
2031 "     </channel>\n"
2032 "     ...\n"
2033 "   </devices>\n"
2034 " </domain>\n"
2035 "\n"
2036 msgstr ""
2037
2038 #. type: textblock
2039 #: ../src/guestfs.pod:1020
2040 msgid ""
2041 "L</guestfs_add_domain> extracts C</path/to/socket> and sets the attach "
2042 "method to C<unix:/path/to/socket>."
2043 msgstr ""
2044
2045 #. type: textblock
2046 #: ../src/guestfs.pod:1023
2047 msgid ""
2048 "Some of the libguestfs tools (including guestfish) support a I<--live> "
2049 "option which is passed through to L</guestfs_add_domain> thus allowing you "
2050 "to attach to and modify live virtual machines."
2051 msgstr ""
2052
2053 #. type: textblock
2054 #: ../src/guestfs.pod:1027
2055 msgid ""
2056 "The virtual machine needs to have been set up beforehand so that it has the "
2057 "virtio-serial channel and so that guestfsd is running inside it."
2058 msgstr ""
2059
2060 #. type: =head2
2061 #: ../src/guestfs.pod:1031
2062 msgid "ABI GUARANTEE"
2063 msgstr ""
2064
2065 #. type: textblock
2066 #: ../src/guestfs.pod:1033
2067 msgid ""
2068 "We guarantee the libguestfs ABI (binary interface), for public, high-level "
2069 "actions as outlined in this section.  Although we will deprecate some "
2070 "actions, for example if they get replaced by newer calls, we will keep the "
2071 "old actions forever.  This allows you the developer to program in confidence "
2072 "against the libguestfs API."
2073 msgstr ""
2074
2075 #. type: =head2
2076 #: ../src/guestfs.pod:1039
2077 msgid "BLOCK DEVICE NAMING"
2078 msgstr ""
2079
2080 #. type: textblock
2081 #: ../src/guestfs.pod:1041
2082 msgid ""
2083 "In the kernel there is now quite a profusion of schemata for naming block "
2084 "devices (in this context, by I<block device> I mean a physical or virtual "
2085 "hard drive).  The original Linux IDE driver used names starting with "
2086 "C</dev/hd*>.  SCSI devices have historically used a different naming scheme, "
2087 "C</dev/sd*>.  When the Linux kernel I<libata> driver became a popular "
2088 "replacement for the old IDE driver (particularly for SATA devices) those "
2089 "devices also used the C</dev/sd*> scheme.  Additionally we now have virtual "
2090 "machines with paravirtualized drivers.  This has created several different "
2091 "naming systems, such as C</dev/vd*> for virtio disks and C</dev/xvd*> for "
2092 "Xen PV disks."
2093 msgstr ""
2094
2095 #. type: textblock
2096 #: ../src/guestfs.pod:1053
2097 msgid ""
2098 "As discussed above, libguestfs uses a qemu appliance running an embedded "
2099 "Linux kernel to access block devices.  We can run a variety of appliances "
2100 "based on a variety of Linux kernels."
2101 msgstr ""
2102
2103 #. type: textblock
2104 #: ../src/guestfs.pod:1057
2105 msgid ""
2106 "This causes a problem for libguestfs because many API calls use device or "
2107 "partition names.  Working scripts and the recipe (example) scripts that we "
2108 "make available over the internet could fail if the naming scheme changes."
2109 msgstr ""
2110
2111 #. type: textblock
2112 #: ../src/guestfs.pod:1062
2113 msgid ""
2114 "Therefore libguestfs defines C</dev/sd*> as the I<standard naming scheme>.  "
2115 "Internally C</dev/sd*> names are translated, if necessary, to other names as "
2116 "required.  For example, under RHEL 5 which uses the C</dev/hd*> scheme, any "
2117 "device parameter C</dev/sda2> is translated to C</dev/hda2> transparently."
2118 msgstr ""
2119
2120 #. type: textblock
2121 #: ../src/guestfs.pod:1068
2122 msgid ""
2123 "Note that this I<only> applies to parameters.  The L</guestfs_list_devices>, "
2124 "L</guestfs_list_partitions> and similar calls return the true names of the "
2125 "devices and partitions as known to the appliance."
2126 msgstr ""
2127
2128 #. type: =head3
2129 #: ../src/guestfs.pod:1073
2130 msgid "ALGORITHM FOR BLOCK DEVICE NAME TRANSLATION"
2131 msgstr ""
2132
2133 #. type: textblock
2134 #: ../src/guestfs.pod:1075
2135 msgid ""
2136 "Usually this translation is transparent.  However in some (very rare)  cases "
2137 "you may need to know the exact algorithm.  Such cases include where you use "
2138 "L</guestfs_config> to add a mixture of virtio and IDE devices to the "
2139 "qemu-based appliance, so have a mixture of C</dev/sd*> and C</dev/vd*> "
2140 "devices."
2141 msgstr ""
2142
2143 #. type: textblock
2144 #: ../src/guestfs.pod:1081
2145 msgid ""
2146 "The algorithm is applied only to I<parameters> which are known to be either "
2147 "device or partition names.  Return values from functions such as "
2148 "L</guestfs_list_devices> are never changed."
2149 msgstr ""
2150
2151 #. type: textblock
2152 #: ../src/guestfs.pod:1089
2153 msgid "Is the string a parameter which is a device or partition name?"
2154 msgstr ""
2155
2156 #. type: textblock
2157 #: ../src/guestfs.pod:1093
2158 msgid "Does the string begin with C</dev/sd>?"
2159 msgstr ""
2160
2161 #. type: textblock
2162 #: ../src/guestfs.pod:1097
2163 msgid ""
2164 "Does the named device exist? If so, we use that device.  However if I<not> "
2165 "then we continue with this algorithm."
2166 msgstr ""
2167
2168 #. type: textblock
2169 #: ../src/guestfs.pod:1102
2170 msgid "Replace initial C</dev/sd> string with C</dev/hd>."
2171 msgstr ""
2172
2173 #. type: textblock
2174 #: ../src/guestfs.pod:1104
2175 msgid "For example, change C</dev/sda2> to C</dev/hda2>."
2176 msgstr ""
2177
2178 #. type: textblock
2179 #: ../src/guestfs.pod:1106
2180 msgid "If that named device exists, use it.  If not, continue."
2181 msgstr ""
2182
2183 #. type: textblock
2184 #: ../src/guestfs.pod:1110
2185 msgid "Replace initial C</dev/sd> string with C</dev/vd>."
2186 msgstr ""
2187
2188 #. type: textblock
2189 #: ../src/guestfs.pod:1112
2190 msgid "If that named device exists, use it.  If not, return an error."
2191 msgstr ""
2192
2193 #. type: =head3
2194 #: ../src/guestfs.pod:1116
2195 msgid "PORTABILITY CONCERNS WITH BLOCK DEVICE NAMING"
2196 msgstr ""
2197
2198 #. type: textblock
2199 #: ../src/guestfs.pod:1118
2200 msgid ""
2201 "Although the standard naming scheme and automatic translation is useful for "
2202 "simple programs and guestfish scripts, for larger programs it is best not to "
2203 "rely on this mechanism."
2204 msgstr ""
2205
2206 #. type: textblock
2207 #: ../src/guestfs.pod:1122
2208 msgid ""
2209 "Where possible for maximum future portability programs using libguestfs "
2210 "should use these future-proof techniques:"
2211 msgstr ""
2212
2213 #. type: textblock
2214 #: ../src/guestfs.pod:1129
2215 msgid ""
2216 "Use L</guestfs_list_devices> or L</guestfs_list_partitions> to list actual "
2217 "device names, and then use those names directly."
2218 msgstr ""
2219
2220 #. type: textblock
2221 #: ../src/guestfs.pod:1132
2222 msgid "Since those device names exist by definition, they will never be translated."
2223 msgstr ""
2224
2225 #. type: textblock
2226 #: ../src/guestfs.pod:1137
2227 msgid ""
2228 "Use higher level ways to identify filesystems, such as LVM names, UUIDs and "
2229 "filesystem labels."
2230 msgstr ""
2231
2232 #. type: =head1
2233 #: ../src/guestfs.pod:1142
2234 msgid "SECURITY"
2235 msgstr ""
2236
2237 #. type: textblock
2238 #: ../src/guestfs.pod:1144
2239 msgid ""
2240 "This section discusses security implications of using libguestfs, "
2241 "particularly with untrusted or malicious guests or disk images."
2242 msgstr ""
2243
2244 #. type: =head2
2245 #: ../src/guestfs.pod:1147
2246 msgid "GENERAL SECURITY CONSIDERATIONS"
2247 msgstr ""
2248
2249 #. type: textblock
2250 #: ../src/guestfs.pod:1149
2251 msgid ""
2252 "Be careful with any files or data that you download from a guest (by "
2253 "\"download\" we mean not just the L</guestfs_download> command but any "
2254 "command that reads files, filenames, directories or anything else from a "
2255 "disk image).  An attacker could manipulate the data to fool your program "
2256 "into doing the wrong thing.  Consider cases such as:"
2257 msgstr ""
2258
2259 #. type: textblock
2260 #: ../src/guestfs.pod:1159
2261 msgid "the data (file etc) not being present"
2262 msgstr ""
2263
2264 #. type: textblock
2265 #: ../src/guestfs.pod:1163
2266 msgid "being present but empty"
2267 msgstr ""
2268
2269 #. type: textblock
2270 #: ../src/guestfs.pod:1167
2271 msgid "being much larger than normal"
2272 msgstr ""
2273
2274 #. type: textblock
2275 #: ../src/guestfs.pod:1171
2276 msgid "containing arbitrary 8 bit data"
2277 msgstr ""
2278
2279 #. type: textblock
2280 #: ../src/guestfs.pod:1175
2281 msgid "being in an unexpected character encoding"
2282 msgstr ""
2283
2284 #. type: textblock
2285 #: ../src/guestfs.pod:1179
2286 msgid "containing homoglyphs."
2287 msgstr ""
2288
2289 #. type: =head2
2290 #: ../src/guestfs.pod:1183
2291 msgid "SECURITY OF MOUNTING FILESYSTEMS"
2292 msgstr ""
2293
2294 #. type: textblock
2295 #: ../src/guestfs.pod:1185
2296 msgid ""
2297 "When you mount a filesystem under Linux, mistakes in the kernel filesystem "
2298 "(VFS) module can sometimes be escalated into exploits by deliberately "
2299 "creating a malicious, malformed filesystem.  These exploits are very severe "
2300 "for two reasons.  Firstly there are very many filesystem drivers in the "
2301 "kernel, and many of them are infrequently used and not much developer "
2302 "attention has been paid to the code.  Linux userspace helps potential "
2303 "crackers by detecting the filesystem type and automatically choosing the "
2304 "right VFS driver, even if that filesystem type is obscure or unexpected for "
2305 "the administrator.  Secondly, a kernel-level exploit is like a local root "
2306 "exploit (worse in some ways), giving immediate and total access to the "
2307 "system right down to the hardware level."
2308 msgstr ""
2309
2310 #. type: textblock
2311 #: ../src/guestfs.pod:1198
2312 msgid ""
2313 "That explains why you should never mount a filesystem from an untrusted "
2314 "guest on your host kernel.  How about libguestfs? We run a Linux kernel "
2315 "inside a qemu virtual machine, usually running as a non-root user.  The "
2316 "attacker would need to write a filesystem which first exploited the kernel, "
2317 "and then exploited either qemu virtualization (eg. a faulty qemu driver) or "
2318 "the libguestfs protocol, and finally to be as serious as the host kernel "
2319 "exploit it would need to escalate its privileges to root.  This multi-step "
2320 "escalation, performed by a static piece of data, is thought to be extremely "
2321 "hard to do, although we never say 'never' about security issues."
2322 msgstr ""
2323
2324 #. type: textblock
2325 #: ../src/guestfs.pod:1209
2326 msgid ""
2327 "In any case callers can reduce the attack surface by forcing the filesystem "
2328 "type when mounting (use L</guestfs_mount_vfs>)."
2329 msgstr ""
2330
2331 #. type: =head2
2332 #: ../src/guestfs.pod:1212
2333 msgid "PROTOCOL SECURITY"
2334 msgstr ""
2335
2336 #. type: textblock
2337 #: ../src/guestfs.pod:1214
2338 msgid ""
2339 "The protocol is designed to be secure, being based on RFC 4506 (XDR)  with a "
2340 "defined upper message size.  However a program that uses libguestfs must "
2341 "also take care - for example you can write a program that downloads a binary "
2342 "from a disk image and executes it locally, and no amount of protocol "
2343 "security will save you from the consequences."
2344 msgstr ""
2345
2346 #. type: =head2
2347 #: ../src/guestfs.pod:1220
2348 msgid "INSPECTION SECURITY"
2349 msgstr ""
2350
2351 #. type: textblock
2352 #: ../src/guestfs.pod:1222
2353 msgid ""
2354 "Parts of the inspection API (see L</INSPECTION>) return untrusted strings "
2355 "directly from the guest, and these could contain any 8 bit data.  Callers "
2356 "should be careful to escape these before printing them to a structured file "
2357 "(for example, use HTML escaping if creating a web page)."
2358 msgstr ""
2359
2360 #. type: textblock
2361 #: ../src/guestfs.pod:1228
2362 msgid ""
2363 "Guest configuration may be altered in unusual ways by the administrator of "
2364 "the virtual machine, and may not reflect reality (particularly for untrusted "
2365 "or actively malicious guests).  For example we parse the hostname from "
2366 "configuration files like C</etc/sysconfig/network> that we find in the "
2367 "guest, but the guest administrator can easily manipulate these files to "
2368 "provide the wrong hostname."
2369 msgstr ""
2370
2371 #. type: textblock
2372 #: ../src/guestfs.pod:1236
2373 msgid ""
2374 "The inspection API parses guest configuration using two external libraries: "
2375 "Augeas (Linux configuration) and hivex (Windows Registry).  Both are "
2376 "designed to be robust in the face of malicious data, although denial of "
2377 "service attacks are still possible, for example with oversized configuration "
2378 "files."
2379 msgstr ""
2380
2381 #. type: =head2
2382 #: ../src/guestfs.pod:1242
2383 msgid "RUNNING UNTRUSTED GUEST COMMANDS"
2384 msgstr ""
2385
2386 #. type: textblock
2387 #: ../src/guestfs.pod:1244
2388 msgid ""
2389 "Be very cautious about running commands from the guest.  By running a "
2390 "command in the guest, you are giving CPU time to a binary that you do not "
2391 "control, under the same user account as the library, albeit wrapped in qemu "
2392 "virtualization.  More information and alternatives can be found in the "
2393 "section L</RUNNING COMMANDS>."
2394 msgstr ""
2395
2396 #. type: =head2
2397 #: ../src/guestfs.pod:1250
2398 msgid "CVE-2010-3851"
2399 msgstr ""
2400
2401 #. type: textblock
2402 #: ../src/guestfs.pod:1252
2403 msgid "https://bugzilla.redhat.com/642934"
2404 msgstr ""
2405
2406 #. type: textblock
2407 #: ../src/guestfs.pod:1254
2408 msgid ""
2409 "This security bug concerns the automatic disk format detection that qemu "
2410 "does on disk images."
2411 msgstr ""
2412
2413 #. type: textblock
2414 #: ../src/guestfs.pod:1257
2415 msgid ""
2416 "A raw disk image is just the raw bytes, there is no header.  Other disk "
2417 "images like qcow2 contain a special header.  Qemu deals with this by looking "
2418 "for one of the known headers, and if none is found then assuming the disk "
2419 "image must be raw."
2420 msgstr ""
2421
2422 #. type: textblock
2423 #: ../src/guestfs.pod:1262
2424 msgid ""
2425 "This allows a guest which has been given a raw disk image to write some "
2426 "other header.  At next boot (or when the disk image is accessed by "
2427 "libguestfs) qemu would do autodetection and think the disk image format was, "
2428 "say, qcow2 based on the header written by the guest."
2429 msgstr ""
2430
2431 #. type: textblock
2432 #: ../src/guestfs.pod:1267
2433 msgid ""
2434 "This in itself would not be a problem, but qcow2 offers many features, one "
2435 "of which is to allow a disk image to refer to another image (called the "
2436 "\"backing disk\").  It does this by placing the path to the backing disk "
2437 "into the qcow2 header.  This path is not validated and could point to any "
2438 "host file (eg. \"/etc/passwd\").  The backing disk is then exposed through "
2439 "\"holes\" in the qcow2 disk image, which of course is completely under the "
2440 "control of the attacker."
2441 msgstr ""
2442
2443 #. type: textblock
2444 #: ../src/guestfs.pod:1275
2445 msgid "In libguestfs this is rather hard to exploit except under two circumstances:"
2446 msgstr ""
2447
2448 #. type: textblock
2449 #: ../src/guestfs.pod:1282
2450 msgid "You have enabled the network or have opened the disk in write mode."
2451 msgstr ""
2452
2453 #. type: textblock
2454 #: ../src/guestfs.pod:1286
2455 msgid ""
2456 "You are also running untrusted code from the guest (see L</RUNNING "
2457 "COMMANDS>)."
2458 msgstr ""
2459
2460 #. type: textblock
2461 #: ../src/guestfs.pod:1291
2462 msgid ""
2463 "The way to avoid this is to specify the expected disk format when adding "
2464 "disks (the optional C<format> option to L</guestfs_add_drive_opts>).  You "
2465 "should always do this if the disk is raw format, and it's a good idea for "
2466 "other cases too."
2467 msgstr ""
2468
2469 #. type: textblock
2470 #: ../src/guestfs.pod:1296
2471 msgid ""
2472 "For disks added from libvirt using calls like L</guestfs_add_domain>, the "
2473 "format is fetched from libvirt and passed through."
2474 msgstr ""
2475
2476 #. type: textblock
2477 #: ../src/guestfs.pod:1299
2478 msgid ""
2479 "For libguestfs tools, use the I<--format> command line parameter as "
2480 "appropriate."
2481 msgstr ""
2482
2483 #. type: =head1
2484 #: ../src/guestfs.pod:1302
2485 msgid "CONNECTION MANAGEMENT"
2486 msgstr ""
2487
2488 #. type: =head2
2489 #: ../src/guestfs.pod:1304
2490 msgid "guestfs_h *"
2491 msgstr ""
2492
2493 #. type: textblock
2494 #: ../src/guestfs.pod:1306
2495 msgid ""
2496 "C<guestfs_h> is the opaque type representing a connection handle.  Create a "
2497 "handle by calling L</guestfs_create>.  Call L</guestfs_close> to free the "
2498 "handle and release all resources used."
2499 msgstr ""
2500
2501 #. type: textblock
2502 #: ../src/guestfs.pod:1310
2503 msgid ""
2504 "For information on using multiple handles and threads, see the section "
2505 "L</MULTIPLE HANDLES AND MULTIPLE THREADS> below."
2506 msgstr ""
2507
2508 #. type: =head2
2509 #: ../src/guestfs.pod:1313
2510 msgid "guestfs_create"
2511 msgstr ""
2512
2513 #. type: verbatim
2514 #: ../src/guestfs.pod:1315
2515 #, no-wrap
2516 msgid ""
2517 " guestfs_h *guestfs_create (void);\n"
2518 "\n"
2519 msgstr ""
2520
2521 #. type: textblock
2522 #: ../src/guestfs.pod:1317
2523 msgid "Create a connection handle."
2524 msgstr ""
2525
2526 #. type: textblock
2527 #: ../src/guestfs.pod:1319
2528 msgid ""
2529 "You have to call L</guestfs_add_drive_opts> (or one of the equivalent calls) "
2530 "on the handle at least once."
2531 msgstr ""
2532
2533 #. type: textblock
2534 #: ../src/guestfs.pod:1322
2535 msgid ""
2536 "This function returns a non-NULL pointer to a handle on success or NULL on "
2537 "error."
2538 msgstr ""
2539
2540 #. type: textblock
2541 #: ../src/guestfs.pod:1325
2542 msgid "After configuring the handle, you have to call L</guestfs_launch>."
2543 msgstr ""
2544
2545 #. type: textblock
2546 #: ../src/guestfs.pod:1327
2547 msgid ""
2548 "You may also want to configure error handling for the handle.  See L</ERROR "
2549 "HANDLING> section below."
2550 msgstr ""
2551
2552 #. type: =head2
2553 #: ../src/guestfs.pod:1330
2554 msgid "guestfs_close"
2555 msgstr ""
2556
2557 #. type: verbatim
2558 #: ../src/guestfs.pod:1332
2559 #, no-wrap
2560 msgid ""
2561 " void guestfs_close (guestfs_h *g);\n"
2562 "\n"
2563 msgstr ""
2564
2565 #. type: textblock
2566 #: ../src/guestfs.pod:1334
2567 msgid "This closes the connection handle and frees up all resources used."
2568 msgstr ""
2569
2570 #. type: =head1
2571 #: ../src/guestfs.pod:1336
2572 msgid "ERROR HANDLING"
2573 msgstr ""
2574
2575 #. type: textblock
2576 #: ../src/guestfs.pod:1338
2577 msgid ""
2578 "API functions can return errors.  For example, almost all functions that "
2579 "return C<int> will return C<-1> to indicate an error."
2580 msgstr ""
2581
2582 #. type: textblock
2583 #: ../src/guestfs.pod:1341
2584 msgid ""
2585 "Additional information is available for errors: an error message string and "
2586 "optionally an error number (errno) if the thing that failed was a system "
2587 "call."
2588 msgstr ""
2589
2590 #. type: textblock
2591 #: ../src/guestfs.pod:1345
2592 msgid ""
2593 "You can get at the additional information about the last error on the handle "
2594 "by calling L</guestfs_last_error>, L</guestfs_last_errno>, and/or by setting "
2595 "up an error handler with L</guestfs_set_error_handler>."
2596 msgstr ""
2597
2598 #. type: textblock
2599 #: ../src/guestfs.pod:1350
2600 msgid ""
2601 "When the handle is created, a default error handler is installed which "
2602 "prints the error message string to C<stderr>.  For small short-running "
2603 "command line programs it is sufficient to do:"
2604 msgstr ""
2605
2606 #. type: verbatim
2607 #: ../src/guestfs.pod:1354
2608 #, no-wrap
2609 msgid ""
2610 " if (guestfs_launch (g) == -1)\n"
2611 "   exit (EXIT_FAILURE);\n"
2612 "\n"
2613 msgstr ""
2614
2615 #. type: textblock
2616 #: ../src/guestfs.pod:1357
2617 msgid ""
2618 "since the default error handler will ensure that an error message has been "
2619 "printed to C<stderr> before the program exits."
2620 msgstr ""
2621
2622 #. type: textblock
2623 #: ../src/guestfs.pod:1360
2624 msgid ""
2625 "For other programs the caller will almost certainly want to install an "
2626 "alternate error handler or do error handling in-line like this:"
2627 msgstr ""
2628
2629 #. type: verbatim
2630 #: ../src/guestfs.pod:1363
2631 #, no-wrap
2632 msgid ""
2633 " g = guestfs_create ();\n"
2634 " \n"
2635 msgstr ""
2636
2637 #. type: verbatim
2638 #: ../src/guestfs.pod:1365
2639 #, no-wrap
2640 msgid ""
2641 " /* This disables the default behaviour of printing errors\n"
2642 "    on stderr. */\n"
2643 " guestfs_set_error_handler (g, NULL, NULL);\n"
2644 " \n"
2645 msgstr ""
2646
2647 #. type: verbatim
2648 #: ../src/guestfs.pod:1369
2649 #, no-wrap
2650 msgid ""
2651 " if (guestfs_launch (g) == -1) {\n"
2652 "   /* Examine the error message and print it etc. */\n"
2653 "   char *msg = guestfs_last_error (g);\n"
2654 "   int errnum = guestfs_last_errno (g);\n"
2655 "   fprintf (stderr, \"%s\\n\", msg);\n"
2656 "   /* ... */\n"
2657 "  }\n"
2658 "\n"
2659 msgstr ""
2660
2661 #. type: textblock
2662 #: ../src/guestfs.pod:1377
2663 msgid ""
2664 "Out of memory errors are handled differently.  The default action is to call "
2665 "L<abort(3)>.  If this is undesirable, then you can set a handler using "
2666 "L</guestfs_set_out_of_memory_handler>."
2667 msgstr ""
2668
2669 #. type: textblock
2670 #: ../src/guestfs.pod:1381
2671 msgid ""
2672 "L</guestfs_create> returns C<NULL> if the handle cannot be created, and "
2673 "because there is no handle if this happens there is no way to get additional "
2674 "error information.  However L</guestfs_create> is supposed to be a "
2675 "lightweight operation which can only fail because of insufficient memory (it "
2676 "returns NULL in this case)."
2677 msgstr ""
2678
2679 #. type: =head2
2680 #: ../src/guestfs.pod:1387
2681 msgid "guestfs_last_error"
2682 msgstr ""
2683
2684 #. type: verbatim
2685 #: ../src/guestfs.pod:1389
2686 #, no-wrap
2687 msgid ""
2688 " const char *guestfs_last_error (guestfs_h *g);\n"
2689 "\n"
2690 msgstr ""
2691
2692 #. type: textblock
2693 #: ../src/guestfs.pod:1391
2694 msgid ""
2695 "This returns the last error message that happened on C<g>.  If there has not "
2696 "been an error since the handle was created, then this returns C<NULL>."
2697 msgstr ""
2698
2699 #. type: textblock
2700 #: ../src/guestfs.pod:1395
2701 msgid ""
2702 "The lifetime of the returned string is until the next error occurs, or "
2703 "L</guestfs_close> is called."
2704 msgstr ""
2705
2706 #. type: =head2
2707 #: ../src/guestfs.pod:1398
2708 msgid "guestfs_last_errno"
2709 msgstr ""
2710
2711 #. type: verbatim
2712 #: ../src/guestfs.pod:1400
2713 #, no-wrap
2714 msgid ""
2715 " int guestfs_last_errno (guestfs_h *g);\n"
2716 "\n"
2717 msgstr ""
2718
2719 #. type: textblock
2720 #: ../src/guestfs.pod:1402
2721 msgid "This returns the last error number (errno) that happened on C<g>."
2722 msgstr ""
2723
2724 #. type: textblock
2725 #: ../src/guestfs.pod:1404
2726 msgid "If successful, an errno integer not equal to zero is returned."
2727 msgstr ""
2728
2729 #. type: textblock
2730 #: ../src/guestfs.pod:1406
2731 msgid "If no error, this returns 0.  This call can return 0 in three situations:"
2732 msgstr ""
2733
2734 #. type: textblock
2735 #: ../src/guestfs.pod:1413
2736 msgid "There has not been any error on the handle."
2737 msgstr ""
2738
2739 #. type: textblock
2740 #: ../src/guestfs.pod:1417
2741 msgid ""
2742 "There has been an error but the errno was meaningless.  This corresponds to "
2743 "the case where the error did not come from a failed system call, but for "
2744 "some other reason."
2745 msgstr ""
2746
2747 #. type: textblock
2748 #: ../src/guestfs.pod:1423
2749 msgid ""
2750 "There was an error from a failed system call, but for some reason the errno "
2751 "was not captured and returned.  This usually indicates a bug in libguestfs."
2752 msgstr ""
2753
2754 #. type: textblock
2755 #: ../src/guestfs.pod:1429
2756 msgid ""
2757 "Libguestfs tries to convert the errno from inside the applicance into a "
2758 "corresponding errno for the caller (not entirely trivial: the appliance "
2759 "might be running a completely different operating system from the library "
2760 "and error numbers are not standardized across Un*xen).  If this could not be "
2761 "done, then the error is translated to C<EINVAL>.  In practice this should "
2762 "only happen in very rare circumstances."
2763 msgstr ""
2764
2765 #. type: =head2
2766 #: ../src/guestfs.pod:1437
2767 msgid "guestfs_set_error_handler"
2768 msgstr ""
2769
2770 #. type: verbatim
2771 #: ../src/guestfs.pod:1439
2772 #, no-wrap
2773 msgid ""
2774 " typedef void (*guestfs_error_handler_cb) (guestfs_h *g,\n"
2775 "                                           void *opaque,\n"
2776 "                                           const char *msg);\n"
2777 " void guestfs_set_error_handler (guestfs_h *g,\n"
2778 "                                 guestfs_error_handler_cb cb,\n"
2779 "                                 void *opaque);\n"
2780 "\n"
2781 msgstr ""
2782
2783 #. type: textblock
2784 #: ../src/guestfs.pod:1446
2785 msgid ""
2786 "The callback C<cb> will be called if there is an error.  The parameters "
2787 "passed to the callback are an opaque data pointer and the error message "
2788 "string."
2789 msgstr ""
2790
2791 #. type: textblock
2792 #: ../src/guestfs.pod:1450
2793 msgid ""
2794 "C<errno> is not passed to the callback.  To get that the callback must call "
2795 "L</guestfs_last_errno>."
2796 msgstr ""
2797
2798 #. type: textblock
2799 #: ../src/guestfs.pod:1453
2800 msgid ""
2801 "Note that the message string C<msg> is freed as soon as the callback "
2802 "function returns, so if you want to stash it somewhere you must make your "
2803 "own copy."
2804 msgstr ""
2805
2806 #. type: textblock
2807 #: ../src/guestfs.pod:1457
2808 msgid "The default handler prints messages on C<stderr>."
2809 msgstr ""
2810
2811 #. type: textblock
2812 #: ../src/guestfs.pod:1459
2813 msgid "If you set C<cb> to C<NULL> then I<no> handler is called."
2814 msgstr ""
2815
2816 #. type: =head2
2817 #: ../src/guestfs.pod:1461
2818 msgid "guestfs_get_error_handler"
2819 msgstr ""
2820
2821 #. type: verbatim
2822 #: ../src/guestfs.pod:1463
2823 #, no-wrap
2824 msgid ""
2825 " guestfs_error_handler_cb guestfs_get_error_handler (guestfs_h *g,\n"
2826 "                                                     void **opaque_rtn);\n"
2827 "\n"
2828 msgstr ""
2829
2830 #. type: textblock
2831 #: ../src/guestfs.pod:1466
2832 msgid "Returns the current error handler callback."
2833 msgstr ""
2834
2835 #. type: =head2
2836 #: ../src/guestfs.pod:1468
2837 msgid "guestfs_set_out_of_memory_handler"
2838 msgstr ""
2839
2840 #. type: verbatim
2841 #: ../src/guestfs.pod:1470
2842 #, no-wrap
2843 msgid ""
2844 " typedef void (*guestfs_abort_cb) (void);\n"
2845 " int guestfs_set_out_of_memory_handler (guestfs_h *g,\n"
2846 "                                        guestfs_abort_cb);\n"
2847 "\n"
2848 msgstr ""
2849
2850 #. type: textblock
2851 #: ../src/guestfs.pod:1474
2852 msgid ""
2853 "The callback C<cb> will be called if there is an out of memory situation.  "
2854 "I<Note this callback must not return>."
2855 msgstr ""
2856
2857 #. type: textblock
2858 #: ../src/guestfs.pod:1477
2859 msgid "The default is to call L<abort(3)>."
2860 msgstr ""
2861
2862 #. type: textblock
2863 #: ../src/guestfs.pod:1479
2864 msgid "You cannot set C<cb> to C<NULL>.  You can't ignore out of memory situations."
2865 msgstr ""
2866
2867 #. type: =head2
2868 #: ../src/guestfs.pod:1482
2869 msgid "guestfs_get_out_of_memory_handler"
2870 msgstr ""
2871
2872 #. type: verbatim
2873 #: ../src/guestfs.pod:1484
2874 #, no-wrap
2875 msgid ""
2876 " guestfs_abort_fn guestfs_get_out_of_memory_handler (guestfs_h *g);\n"
2877 "\n"
2878 msgstr ""
2879
2880 #. type: textblock
2881 #: ../src/guestfs.pod:1486
2882 msgid "This returns the current out of memory handler."
2883 msgstr ""
2884
2885 #. type: =head1
2886 #: ../src/guestfs.pod:1488
2887 msgid "API CALLS"
2888 msgstr ""
2889
2890 #. type: textblock
2891 #: ../src/guestfs.pod:1490 ../fish/guestfish.pod:1008
2892 msgid "@ACTIONS@"
2893 msgstr ""
2894
2895 #. type: =head1
2896 #: ../src/guestfs.pod:1492
2897 msgid "STRUCTURES"
2898 msgstr ""
2899
2900 #. type: textblock
2901 #: ../src/guestfs.pod:1494
2902 msgid "@STRUCTS@"
2903 msgstr ""
2904
2905 #. type: =head1
2906 #: ../src/guestfs.pod:1496
2907 msgid "AVAILABILITY"
2908 msgstr ""
2909
2910 #. type: =head2
2911 #: ../src/guestfs.pod:1498
2912 msgid "GROUPS OF FUNCTIONALITY IN THE APPLIANCE"
2913 msgstr ""
2914
2915 #. type: textblock
2916 #: ../src/guestfs.pod:1500
2917 msgid ""
2918 "Using L</guestfs_available> you can test availability of the following "
2919 "groups of functions.  This test queries the appliance to see if the "
2920 "appliance you are currently using supports the functionality."
2921 msgstr ""
2922
2923 #. type: textblock
2924 #: ../src/guestfs.pod:1505
2925 msgid "@AVAILABILITY@"
2926 msgstr ""
2927
2928 #. type: =head2
2929 #: ../src/guestfs.pod:1507
2930 msgid "GUESTFISH supported COMMAND"
2931 msgstr ""
2932
2933 #. type: textblock
2934 #: ../src/guestfs.pod:1509
2935 msgid ""
2936 "In L<guestfish(3)> there is a handy interactive command C<supported> which "
2937 "prints out the available groups and whether they are supported by this build "
2938 "of libguestfs.  Note however that you have to do C<run> first."
2939 msgstr ""
2940
2941 #. type: =head2
2942 #: ../src/guestfs.pod:1514
2943 msgid "SINGLE CALLS AT COMPILE TIME"
2944 msgstr ""
2945
2946 #. type: textblock
2947 #: ../src/guestfs.pod:1516
2948 msgid ""
2949 "Since version 1.5.8, C<E<lt>guestfs.hE<gt>> defines symbols for each C API "
2950 "function, such as:"
2951 msgstr ""
2952
2953 #. type: verbatim
2954 #: ../src/guestfs.pod:1519
2955 #, no-wrap
2956 msgid ""
2957 " #define LIBGUESTFS_HAVE_DD 1\n"
2958 "\n"
2959 msgstr ""
2960
2961 #. type: textblock
2962 #: ../src/guestfs.pod:1521
2963 msgid "if L</guestfs_dd> is available."
2964 msgstr ""
2965
2966 #. type: textblock
2967 #: ../src/guestfs.pod:1523
2968 msgid ""
2969 "Before version 1.5.8, if you needed to test whether a single libguestfs "
2970 "function is available at compile time, we recommended using build tools such "
2971 "as autoconf or cmake.  For example in autotools you could use:"
2972 msgstr ""
2973
2974 #. type: verbatim
2975 #: ../src/guestfs.pod:1528
2976 #, no-wrap
2977 msgid ""
2978 " AC_CHECK_LIB([guestfs],[guestfs_create])\n"
2979 " AC_CHECK_FUNCS([guestfs_dd])\n"
2980 "\n"
2981 msgstr ""
2982
2983 #. type: textblock
2984 #: ../src/guestfs.pod:1531
2985 msgid ""
2986 "which would result in C<HAVE_GUESTFS_DD> being either defined or not defined "
2987 "in your program."
2988 msgstr ""
2989
2990 #. type: =head2
2991 #: ../src/guestfs.pod:1534
2992 msgid "SINGLE CALLS AT RUN TIME"
2993 msgstr ""
2994
2995 #. type: textblock
2996 #: ../src/guestfs.pod:1536
2997 msgid ""
2998 "Testing at compile time doesn't guarantee that a function really exists in "
2999 "the library.  The reason is that you might be dynamically linked against a "
3000 "previous I<libguestfs.so> (dynamic library)  which doesn't have the call.  "
3001 "This situation unfortunately results in a segmentation fault, which is a "
3002 "shortcoming of the C dynamic linking system itself."
3003 msgstr ""
3004
3005 #. type: textblock
3006 #: ../src/guestfs.pod:1543
3007 msgid ""
3008 "You can use L<dlopen(3)> to test if a function is available at run time, as "
3009 "in this example program (note that you still need the compile time check as "
3010 "well):"
3011 msgstr ""
3012
3013 #. type: verbatim
3014 #: ../src/guestfs.pod:1547
3015 #, no-wrap
3016 msgid ""
3017 " #include <stdio.h>\n"
3018 " #include <stdlib.h>\n"
3019 " #include <unistd.h>\n"
3020 " #include <dlfcn.h>\n"
3021 " #include <guestfs.h>\n"
3022 " \n"
3023 msgstr ""
3024
3025 #. type: verbatim
3026 #: ../src/guestfs.pod:1553
3027 #, no-wrap
3028 msgid ""
3029 " main ()\n"
3030 " {\n"
3031 " #ifdef LIBGUESTFS_HAVE_DD\n"
3032 "   void *dl;\n"
3033 "   int has_function;\n"
3034 " \n"
3035 msgstr ""
3036
3037 #. type: verbatim
3038 #: ../src/guestfs.pod:1559
3039 #, no-wrap
3040 msgid ""
3041 "   /* Test if the function guestfs_dd is really available. */\n"
3042 "   dl = dlopen (NULL, RTLD_LAZY);\n"
3043 "   if (!dl) {\n"
3044 "     fprintf (stderr, \"dlopen: %s\\n\", dlerror ());\n"
3045 "     exit (EXIT_FAILURE);\n"
3046 "   }\n"
3047 "   has_function = dlsym (dl, \"guestfs_dd\") != NULL;\n"
3048 "   dlclose (dl);\n"
3049 " \n"
3050 msgstr ""
3051
3052 #. type: verbatim
3053 #: ../src/guestfs.pod:1568
3054 #, no-wrap
3055 msgid ""
3056 "   if (!has_function)\n"
3057 "     printf (\"this libguestfs.so does NOT have guestfs_dd function\\n\");\n"
3058 "   else {\n"
3059 "     printf (\"this libguestfs.so has guestfs_dd function\\n\");\n"
3060 "     /* Now it's safe to call\n"
3061 "     guestfs_dd (g, \"foo\", \"bar\");\n"
3062 "     */\n"
3063 "   }\n"
3064 " #else\n"
3065 "   printf (\"guestfs_dd function was not found at compile time\\n\");\n"
3066 " #endif\n"
3067 "  }\n"
3068 "\n"
3069 msgstr ""
3070
3071 #. type: textblock
3072 #: ../src/guestfs.pod:1581
3073 msgid ""
3074 "You may think the above is an awful lot of hassle, and it is.  There are "
3075 "other ways outside of the C linking system to ensure that this kind of "
3076 "incompatibility never arises, such as using package versioning:"
3077 msgstr ""
3078
3079 #. type: verbatim
3080 #: ../src/guestfs.pod:1586
3081 #, no-wrap
3082 msgid ""
3083 " Requires: libguestfs >= 1.0.80\n"
3084 "\n"
3085 msgstr ""
3086
3087 #. type: =head1
3088 #: ../src/guestfs.pod:1588
3089 msgid "CALLS WITH OPTIONAL ARGUMENTS"
3090 msgstr ""
3091
3092 #. type: textblock
3093 #: ../src/guestfs.pod:1590
3094 msgid ""
3095 "A recent feature of the API is the introduction of calls which take optional "
3096 "arguments.  In C these are declared 3 ways.  The main way is as a call which "
3097 "takes variable arguments (ie. C<...>), as in this example:"
3098 msgstr ""
3099
3100 #. type: verbatim
3101 #: ../src/guestfs.pod:1595
3102 #, no-wrap
3103 msgid ""
3104 " int guestfs_add_drive_opts (guestfs_h *g, const char *filename, ...);\n"
3105 "\n"
3106 msgstr ""
3107
3108 #. type: textblock
3109 #: ../src/guestfs.pod:1597
3110 msgid ""
3111 "Call this with a list of optional arguments, terminated by C<-1>.  So to "
3112 "call with no optional arguments specified:"
3113 msgstr ""
3114
3115 #. type: verbatim
3116 #: ../src/guestfs.pod:1600
3117 #, no-wrap
3118 msgid ""
3119 " guestfs_add_drive_opts (g, filename, -1);\n"
3120 "\n"
3121 msgstr ""
3122
3123 #. type: textblock
3124 #: ../src/guestfs.pod:1602
3125 msgid "With a single optional argument:"
3126 msgstr ""
3127
3128 #. type: verbatim
3129 #: ../src/guestfs.pod:1604
3130 #, no-wrap
3131 msgid ""
3132 " guestfs_add_drive_opts (g, filename,\n"
3133 "                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
3134 "                         -1);\n"
3135 "\n"
3136 msgstr ""
3137
3138 #. type: textblock
3139 #: ../src/guestfs.pod:1608
3140 msgid "With two:"
3141 msgstr ""
3142
3143 #. type: verbatim
3144 #: ../src/guestfs.pod:1610
3145 #, no-wrap
3146 msgid ""
3147 " guestfs_add_drive_opts (g, filename,\n"
3148 "                         GUESTFS_ADD_DRIVE_OPTS_FORMAT, \"qcow2\",\n"
3149 "                         GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,\n"
3150 "                         -1);\n"
3151 "\n"
3152 msgstr ""
3153
3154 #. type: textblock
3155 #: ../src/guestfs.pod:1615
3156 msgid ""
3157 "and so forth.  Don't forget the terminating C<-1> otherwise Bad Things will "
3158 "happen!"
3159 msgstr ""
3160
3161 #. type: =head2
3162 #: ../src/guestfs.pod:1618
3163 msgid "USING va_list FOR OPTIONAL ARGUMENTS"
3164 msgstr ""
3165
3166 #. type: textblock
3167 #: ../src/guestfs.pod:1620
3168 msgid ""
3169 "The second variant has the same name with the suffix C<_va>, which works the "
3170 "same way but takes a C<va_list>.  See the C manual for details.  For the "
3171 "example function, this is declared:"
3172 msgstr ""
3173
3174 #. type: verbatim
3175 #: ../src/guestfs.pod:1624
3176 #, no-wrap
3177 msgid ""
3178 " int guestfs_add_drive_opts_va (guestfs_h *g, const char *filename,\n"
3179 "                                va_list args);\n"
3180 "\n"
3181 msgstr ""
3182
3183 #. type: =head2
3184 #: ../src/guestfs.pod:1627
3185 msgid "CONSTRUCTING OPTIONAL ARGUMENTS"
3186 msgstr ""
3187
3188 #. type: textblock
3189 #: ../src/guestfs.pod:1629
3190 msgid ""
3191 "The third variant is useful where you need to construct these calls.  You "
3192 "pass in a structure where you fill in the optional fields.  The structure "
3193 "has a bitmask as the first element which you must set to indicate which "
3194 "fields you have filled in.  For our example function the structure and call "
3195 "are declared:"
3196 msgstr ""
3197
3198 #. type: verbatim
3199 #: ../src/guestfs.pod:1635
3200 #, no-wrap
3201 msgid ""
3202 " struct guestfs_add_drive_opts_argv {\n"
3203 "   uint64_t bitmask;\n"
3204 "   int readonly;\n"
3205 "   const char *format;\n"
3206 "   /* ... */\n"
3207 " };\n"
3208 " int guestfs_add_drive_opts_argv (guestfs_h *g, const char *filename,\n"
3209 "              const struct guestfs_add_drive_opts_argv *optargs);\n"
3210 "\n"
3211 msgstr ""
3212
3213 #. type: textblock
3214 #: ../src/guestfs.pod:1644
3215 msgid "You could call it like this:"
3216 msgstr ""
3217
3218 #. type: verbatim
3219 #: ../src/guestfs.pod:1646
3220 #, no-wrap
3221 msgid ""
3222 " struct guestfs_add_drive_opts_argv optargs = {\n"
3223 "   .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK |\n"
3224 "              GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK,\n"
3225 "   .readonly = 1,\n"
3226 "   .format = \"qcow2\"\n"
3227 " };\n"
3228 " \n"
3229 msgstr ""
3230
3231 #. type: verbatim
3232 #: ../src/guestfs.pod:1653
3233 #, no-wrap
3234 msgid ""
3235 " guestfs_add_drive_opts_argv (g, filename, &optargs);\n"
3236 "\n"
3237 msgstr ""
3238
3239 #. type: textblock
3240 #: ../src/guestfs.pod:1655 ../src/guestfs-actions.pod:11 ../src/guestfs-actions.pod:1855 ../fish/guestfish-actions.pod:9 ../fish/guestfish-actions.pod:1260 ../tools/virt-win-reg.pl:532
3241 msgid "Notes:"
3242 msgstr ""
3243
3244 #. type: textblock
3245 #: ../src/guestfs.pod:1661
3246 msgid "The C<_BITMASK> suffix on each option name when specifying the bitmask."
3247 msgstr ""
3248
3249 #. type: textblock
3250 #: ../src/guestfs.pod:1666
3251 msgid "You do not need to fill in all fields of the structure."
3252 msgstr ""
3253
3254 #. type: textblock
3255 #: ../src/guestfs.pod:1670
3256 msgid ""
3257 "There must be a one-to-one correspondence between fields of the structure "
3258 "that are filled in, and bits set in the bitmask."
3259 msgstr ""
3260
3261 #. type: =head2
3262 #: ../src/guestfs.pod:1675
3263 msgid "OPTIONAL ARGUMENTS IN OTHER LANGUAGES"
3264 msgstr ""
3265
3266 #. type: textblock
3267 #: ../src/guestfs.pod:1677
3268 msgid ""
3269 "In other languages, optional arguments are expressed in the way that is "
3270 "natural for that language.  We refer you to the language-specific "
3271 "documentation for more details on that."
3272 msgstr ""
3273
3274 #. type: textblock
3275 #: ../src/guestfs.pod:1681
3276 msgid "For guestfish, see L<guestfish(1)/OPTIONAL ARGUMENTS>."
3277 msgstr ""
3278
3279 #. type: =head2
3280 #: ../src/guestfs.pod:1683
3281 msgid "SETTING CALLBACKS TO HANDLE EVENTS"
3282 msgstr ""
3283
3284 #. type: textblock
3285 #: ../src/guestfs.pod:1685
3286 msgid ""
3287 "B<Note:> This section documents the generic event mechanism introduced in "
3288 "libguestfs 1.10, which you should use in new code if possible.  The old "
3289 "functions C<guestfs_set_log_message_callback>, "
3290 "C<guestfs_set_subprocess_quit_callback>, "
3291 "C<guestfs_set_launch_done_callback>, C<guestfs_set_close_callback> and "
3292 "C<guestfs_set_progress_callback> are no longer documented in this manual "
3293 "page."
3294 msgstr ""
3295
3296 #. type: textblock
3297 #: ../src/guestfs.pod:1693
3298 msgid ""
3299 "Handles generate events when certain things happen, such as log messages "
3300 "being generated, progress messages during long-running operations, or the "
3301 "handle being closed.  The API calls described below let you register a "
3302 "callback to be called when events happen.  You can register multiple "
3303 "callbacks (for the same, different or overlapping sets of events), and "
3304 "individually remove callbacks.  If callbacks are not removed, then they "
3305 "remain in force until the handle is closed."
3306 msgstr ""
3307
3308 #. type: textblock
3309 #: ../src/guestfs.pod:1701
3310 msgid ""
3311 "In the current implementation, events are only generated synchronously: that "
3312 "means that events (and hence callbacks) can only happen while you are in the "
3313 "middle of making another libguestfs call.  The callback is called in the "
3314 "same thread."
3315 msgstr ""
3316
3317 #. type: textblock
3318 #: ../src/guestfs.pod:1706
3319 msgid ""
3320 "Events may contain a payload, usually nothing (void), an array of 64 bit "
3321 "unsigned integers, or a message buffer.  Payloads are discussed later on."
3322 msgstr ""
3323
3324 #. type: =head3
3325 #: ../src/guestfs.pod:1710
3326 msgid "CLASSES OF EVENTS"
3327 msgstr ""
3328
3329 #. type: =item
3330 #: ../src/guestfs.pod:1714
3331 msgid "GUESTFS_EVENT_CLOSE (payload type: void)"
3332 msgstr ""
3333
3334 #. type: textblock
3335 #: ../src/guestfs.pod:1717
3336 msgid ""
3337 "The callback function will be called while the handle is being closed "
3338 "(synchronously from L</guestfs_close>)."
3339 msgstr ""
3340
3341 #. type: textblock
3342 #: ../src/guestfs.pod:1720
3343 msgid ""
3344 "Note that libguestfs installs an L<atexit(3)> handler to try to clean up "
3345 "handles that are open when the program exits.  This means that this callback "
3346 "might be called indirectly from L<exit(3)>, which can cause unexpected "
3347 "problems in higher-level languages (eg. if your HLL interpreter has already "
3348 "been cleaned up by the time this is called, and if your callback then jumps "
3349 "into some HLL function)."
3350 msgstr ""
3351
3352 #. type: textblock
3353 #: ../src/guestfs.pod:1727
3354 msgid ""
3355 "If no callback is registered: the handle is closed without any callback "
3356 "being invoked."
3357 msgstr ""
3358
3359 #. type: =item
3360 #: ../src/guestfs.pod:1730
3361 msgid "GUESTFS_EVENT_SUBPROCESS_QUIT (payload type: void)"
3362 msgstr ""
3363
3364 #. type: textblock
3365 #: ../src/guestfs.pod:1733
3366 msgid ""
3367 "The callback function will be called when the child process quits, either "
3368 "asynchronously or if killed by L</guestfs_kill_subprocess>.  (This "
3369 "corresponds to a transition from any state to the CONFIG state)."
3370 msgstr ""
3371
3372 #. type: textblock
3373 #: ../src/guestfs.pod:1737 ../src/guestfs.pod:1746
3374 msgid "If no callback is registered: the event is ignored."
3375 msgstr ""
3376
3377 #. type: =item
3378 #: ../src/guestfs.pod:1739
3379 msgid "GUESTFS_EVENT_LAUNCH_DONE (payload type: void)"
3380 msgstr ""
3381
3382 #. type: textblock
3383 #: ../src/guestfs.pod:1742
3384 msgid ""
3385 "The callback function will be called when the child process becomes ready "
3386 "first time after it has been launched.  (This corresponds to a transition "
3387 "from LAUNCHING to the READY state)."
3388 msgstr ""
3389
3390 #. type: =item
3391 #: ../src/guestfs.pod:1748
3392 msgid "GUESTFS_EVENT_PROGRESS (payload type: array of 4 x uint64_t)"
3393 msgstr ""
3394
3395 #. type: textblock
3396 #: ../src/guestfs.pod:1751
3397 msgid ""
3398 "Some long-running operations can generate progress messages.  If this "
3399 "callback is registered, then it will be called each time a progress message "
3400 "is generated (usually two seconds after the operation started, and three "
3401 "times per second thereafter until it completes, although the frequency may "
3402 "change in future versions)."
3403 msgstr ""
3404
3405 #. type: textblock
3406 #: ../src/guestfs.pod:1757
3407 msgid ""
3408 "The callback receives in the payload four unsigned 64 bit numbers which are "
3409 "(in order): C<proc_nr>, C<serial>, C<position>, C<total>."
3410 msgstr ""
3411
3412 #. type: textblock
3413 #: ../src/guestfs.pod:1760
3414 msgid ""
3415 "The units of C<total> are not defined, although for some operations C<total> "
3416 "may relate in some way to the amount of data to be transferred (eg. in bytes "
3417 "or megabytes), and C<position> may be the portion which has been "
3418 "transferred."
3419 msgstr ""
3420
3421 #. type: textblock
3422 #: ../src/guestfs.pod:1765
3423 msgid "The only defined and stable parts of the API are:"
3424 msgstr ""
3425
3426 #. type: textblock
3427 #: ../src/guestfs.pod:1771
3428 msgid ""
3429 "The callback can display to the user some type of progress bar or indicator "
3430 "which shows the ratio of C<position>:C<total>."
3431 msgstr ""
3432
3433 #. type: textblock
3434 #: ../src/guestfs.pod:1776
3435 msgid "0 E<lt>= C<position> E<lt>= C<total>"
3436 msgstr ""
3437
3438 #. type: textblock
3439 #: ../src/guestfs.pod:1780
3440 msgid ""
3441 "If any progress notification is sent during a call, then a final progress "
3442 "notification is always sent when C<position> = C<total> (I<unless> the call "
3443 "fails with an error)."
3444 msgstr ""
3445
3446 #. type: textblock
3447 #: ../src/guestfs.pod:1784
3448 msgid ""
3449 "This is to simplify caller code, so callers can easily set the progress "
3450 "indicator to \"100%\" at the end of the operation, without requiring special "
3451 "code to detect this case."
3452 msgstr ""
3453
3454 #. type: textblock
3455 #: ../src/guestfs.pod:1790
3456 msgid ""
3457 "For some calls we are unable to estimate the progress of the call, but we "
3458 "can still generate progress messages to indicate activity.  This is known as "
3459 "\"pulse mode\", and is directly supported by certain progress bar "
3460 "implementations (eg. GtkProgressBar)."
3461 msgstr ""
3462
3463 #. type: textblock
3464 #: ../src/guestfs.pod:1795
3465 msgid ""
3466 "For these calls, zero or more progress messages are generated with "
3467 "C<position = 0> and C<total = 1>, followed by a final message with "
3468 "C<position = total = 1>."
3469 msgstr ""
3470
3471 #. type: textblock
3472 #: ../src/guestfs.pod:1799
3473 msgid ""
3474 "As noted above, if the call fails with an error then the final message may "
3475 "not be generated."
3476 msgstr ""
3477
3478 #. type: textblock
3479 #: ../src/guestfs.pod:1804
3480 msgid ""
3481 "The callback also receives the procedure number (C<proc_nr>) and serial "
3482 "number (C<serial>) of the call.  These are only useful for debugging "
3483 "protocol issues, and the callback can normally ignore them.  The callback "
3484 "may want to print these numbers in error messages or debugging messages."
3485 msgstr ""
3486
3487 #. type: textblock
3488 #: ../src/guestfs.pod:1810
3489 msgid "If no callback is registered: progress messages are discarded."
3490 msgstr ""
3491
3492 #. type: =item
3493 #: ../src/guestfs.pod:1812
3494 msgid "GUESTFS_EVENT_APPLIANCE (payload type: message buffer)"
3495 msgstr ""
3496
3497 #. type: textblock
3498 #: ../src/guestfs.pod:1815
3499 msgid ""
3500 "The callback function is called whenever a log message is generated by qemu, "
3501 "the appliance kernel, guestfsd (daemon), or utility programs."
3502 msgstr ""
3503
3504 #. type: textblock
3505 #: ../src/guestfs.pod:1818
3506 msgid ""
3507 "If the verbose flag (L</guestfs_set_verbose>) is set before launch "
3508 "(L</guestfs_launch>) then additional debug messages are generated."
3509 msgstr ""
3510
3511 #. type: textblock
3512 #: ../src/guestfs.pod:1821 ../src/guestfs.pod:1835
3513 msgid ""
3514 "If no callback is registered: the messages are discarded unless the verbose "
3515 "flag is set in which case they are sent to stderr.  You can override the "
3516 "printing of verbose messages to stderr by setting up a callback."
3517 msgstr ""
3518
3519 #. type: =item
3520 #: ../src/guestfs.pod:1826
3521 msgid "GUESTFS_EVENT_LIBRARY (payload type: message buffer)"
3522 msgstr ""
3523
3524 #. type: textblock
3525 #: ../src/guestfs.pod:1829
3526 msgid ""
3527 "The callback function is called whenever a log message is generated by the "
3528 "library part of libguestfs."
3529 msgstr ""
3530
3531 #. type: textblock
3532 #: ../src/guestfs.pod:1832
3533 msgid ""
3534 "If the verbose flag (L</guestfs_set_verbose>) is set then additional debug "
3535 "messages are generated."
3536 msgstr ""
3537
3538 #. type: =item
3539 #: ../src/guestfs.pod:1840
3540 msgid "GUESTFS_EVENT_TRACE (payload type: message buffer)"
3541 msgstr ""
3542
3543 #. type: textblock
3544 #: ../src/guestfs.pod:1843
3545 msgid ""
3546 "The callback function is called whenever a trace message is generated.  This "
3547 "only applies if the trace flag (L</guestfs_set_trace>) is set."
3548 msgstr ""
3549
3550 #. type: textblock
3551 #: ../src/guestfs.pod:1846
3552 msgid ""
3553 "If no callback is registered: the messages are sent to stderr.  You can "
3554 "override the printing of trace messages to stderr by setting up a callback."
3555 msgstr ""
3556
3557 #. type: =head3
3558 #: ../src/guestfs.pod:1852
3559 msgid "guestfs_set_event_callback"
3560 msgstr ""
3561
3562 #. type: verbatim
3563 #: ../src/guestfs.pod:1854
3564 #, no-wrap
3565 msgid ""
3566 " int guestfs_set_event_callback (guestfs_h *g,\n"
3567 "                                 guestfs_event_callback cb,\n"
3568 "                                 uint64_t event_bitmask,\n"
3569 "                                 int flags,\n"
3570 "                                 void *opaque);\n"
3571 "\n"
3572 msgstr ""
3573
3574 #. type: textblock
3575 #: ../src/guestfs.pod:1860
3576 msgid ""
3577 "This function registers a callback (C<cb>) for all event classes in the "
3578 "C<event_bitmask>."
3579 msgstr ""
3580
3581 #. type: textblock
3582 #: ../src/guestfs.pod:1863
3583 msgid ""
3584 "For example, to register for all log message events, you could call this "
3585 "function with the bitmask C<GUESTFS_EVENT_APPLIANCE|GUESTFS_EVENT_LIBRARY>.  "
3586 "To register a single callback for all possible classes of events, use "
3587 "C<GUESTFS_EVENT_ALL>."
3588 msgstr ""
3589
3590 #. type: textblock
3591 #: ../src/guestfs.pod:1869
3592 msgid "C<flags> should always be passed as 0."
3593 msgstr ""
3594
3595 #. type: textblock
3596 #: ../src/guestfs.pod:1871
3597 msgid ""
3598 "C<opaque> is an opaque pointer which is passed to the callback.  You can use "
3599 "it for any purpose."
3600 msgstr ""
3601
3602 #. type: textblock
3603 #: ../src/guestfs.pod:1874
3604 msgid ""
3605 "The return value is the event handle (an integer) which you can use to "
3606 "delete the callback (see below)."
3607 msgstr ""
3608
3609 #. type: textblock
3610 #: ../src/guestfs.pod:1877
3611 msgid ""
3612 "If there is an error, this function returns C<-1>, and sets the error in the "
3613 "handle in the usual way (see L</guestfs_last_error> etc.)"
3614 msgstr ""
3615
3616 #. type: textblock
3617 #: ../src/guestfs.pod:1880
3618 msgid ""
3619 "Callbacks remain in effect until they are deleted, or until the handle is "
3620 "closed."
3621 msgstr ""
3622
3623 #. type: textblock
3624 #: ../src/guestfs.pod:1883
3625 msgid ""
3626 "In the case where multiple callbacks are registered for a particular event "
3627 "class, all of the callbacks are called.  The order in which multiple "
3628 "callbacks are called is not defined."
3629 msgstr ""
3630
3631 #. type: =head3
3632 #: ../src/guestfs.pod:1887
3633 msgid "guestfs_delete_event_callback"
3634 msgstr ""
3635
3636 #. type: verbatim
3637 #: ../src/guestfs.pod:1889
3638 #, no-wrap
3639 msgid ""
3640 " void guestfs_delete_event_callback (guestfs_h *g, int event_handle);\n"
3641 "\n"
3642 msgstr ""
3643
3644 #. type: textblock
3645 #: ../src/guestfs.pod:1891
3646 msgid ""
3647 "Delete a callback that was previously registered.  C<event_handle> should be "
3648 "the integer that was returned by a previous call to "
3649 "C<guestfs_set_event_callback> on the same handle."
3650 msgstr ""
3651
3652 #. type: =head3
3653 #: ../src/guestfs.pod:1895
3654 msgid "guestfs_event_callback"
3655 msgstr ""
3656
3657 #. type: verbatim
3658 #: ../src/guestfs.pod:1897
3659 #, no-wrap
3660 msgid ""
3661 " typedef void (*guestfs_event_callback) (\n"
3662 "                  guestfs_h *g,\n"
3663 "                  void *opaque,\n"
3664 "                  uint64_t event,\n"
3665 "                  int event_handle,\n"
3666 "                  int flags,\n"
3667 "                  const char *buf, size_t buf_len,\n"
3668 "                  const uint64_t *array, size_t array_len);\n"
3669 "\n"
3670 msgstr ""
3671
3672 #. type: textblock
3673 #: ../src/guestfs.pod:1906
3674 msgid "This is the type of the event callback function that you have to provide."
3675 msgstr ""
3676
3677 #. type: textblock
3678 #: ../src/guestfs.pod:1909
3679 msgid ""
3680 "The basic parameters are: the handle (C<g>), the opaque user pointer "
3681 "(C<opaque>), the event class (eg. C<GUESTFS_EVENT_PROGRESS>), the event "
3682 "handle, and C<flags> which in the current API you should ignore."
3683 msgstr ""
3684
3685 #. type: textblock
3686 #: ../src/guestfs.pod:1913
3687 msgid ""
3688 "The remaining parameters contain the event payload (if any).  Each event may "
3689 "contain a payload, which usually relates to the event class, but for future "
3690 "proofing your code should be written to handle any payload for any event "
3691 "class."
3692 msgstr ""
3693
3694 #. type: textblock
3695 #: ../src/guestfs.pod:1918
3696 msgid ""
3697 "C<buf> and C<buf_len> contain a message buffer (if C<buf_len == 0>, then "
3698 "there is no message buffer).  Note that this message buffer can contain "
3699 "arbitrary 8 bit data, including NUL bytes."
3700 msgstr ""
3701
3702 #. type: textblock
3703 #: ../src/guestfs.pod:1922
3704 msgid ""
3705 "C<array> and C<array_len> is an array of 64 bit unsigned integers.  At the "
3706 "moment this is only used for progress messages."
3707 msgstr ""
3708
3709 #. type: =head3
3710 #: ../src/guestfs.pod:1925
3711 msgid "EXAMPLE: CAPTURING LOG MESSAGES"
3712 msgstr ""
3713
3714 #. type: textblock
3715 #: ../src/guestfs.pod:1927
3716 msgid ""
3717 "One motivation for the generic event API was to allow GUI programs to "
3718 "capture debug and other messages.  In libguestfs E<le> 1.8 these were sent "
3719 "unconditionally to C<stderr>."
3720 msgstr ""
3721
3722 #. type: textblock
3723 #: ../src/guestfs.pod:1931
3724 msgid ""
3725 "Events associated with log messages are: C<GUESTFS_EVENT_LIBRARY>, "
3726 "C<GUESTFS_EVENT_APPLIANCE> and C<GUESTFS_EVENT_TRACE>.  (Note that error "
3727 "messages are not events; you must capture error messages separately)."
3728 msgstr ""
3729
3730 #. type: textblock
3731 #: ../src/guestfs.pod:1936
3732 msgid ""
3733 "Programs have to set up a callback to capture the classes of events of "
3734 "interest:"
3735 msgstr ""
3736
3737 #. type: verbatim
3738 #: ../src/guestfs.pod:1939
3739 #, no-wrap
3740 msgid ""
3741 " int eh =\n"
3742 "   guestfs_set_event_callback\n"
3743 "     (g, message_callback,\n"
3744 "      GUESTFS_EVENT_LIBRARY|GUESTFS_EVENT_APPLIANCE|\n"
3745 "      GUESTFS_EVENT_TRACE,\n"
3746 "      0, NULL) == -1)\n"
3747 " if (eh == -1) {\n"
3748 "   // handle error in the usual way\n"
3749 " }\n"
3750 "\n"
3751 msgstr ""
3752
3753 #. type: textblock
3754 #: ../src/guestfs.pod:1949
3755 msgid ""
3756 "The callback can then direct messages to the appropriate place.  In this "
3757 "example, messages are directed to syslog:"
3758 msgstr ""
3759
3760 #. type: verbatim
3761 #: ../src/guestfs.pod:1952
3762 #, no-wrap
3763 msgid ""
3764 " static void\n"
3765 " message_callback (\n"
3766 "         guestfs_h *g,\n"
3767 "         void *opaque,\n"
3768 "         uint64_t event,\n"
3769 "         int event_handle,\n"
3770 "         int flags,\n"
3771 "         const char *buf, size_t buf_len,\n"
3772 "         const uint64_t *array, size_t array_len)\n"
3773 " {\n"
3774 "   const int priority = LOG_USER|LOG_INFO;\n"
3775 "   if (buf_len > 0)\n"
3776 "     syslog (priority, \"event 0x%lx: %s\", event, buf);\n"
3777 " }\n"
3778 "\n"
3779 msgstr ""
3780
3781 #. type: =head1
3782 #: ../src/guestfs.pod:1967
3783 msgid "PRIVATE DATA AREA"
3784 msgstr ""
3785
3786 #. type: textblock
3787 #: ../src/guestfs.pod:1969
3788 msgid ""
3789 "You can attach named pieces of private data to the libguestfs handle, fetch "
3790 "them by name, and walk over them, for the lifetime of the handle.  This is "
3791 "called the private data area and is only available from the C API."
3792 msgstr ""
3793
3794 #. type: textblock
3795 #: ../src/guestfs.pod:1974
3796 msgid "To attach a named piece of data, use the following call:"
3797 msgstr ""
3798
3799 #. type: verbatim
3800 #: ../src/guestfs.pod:1976
3801 #, no-wrap
3802 msgid ""
3803 " void guestfs_set_private (guestfs_h *g, const char *key, void *data);\n"
3804 "\n"
3805 msgstr ""
3806
3807 #. type: textblock
3808 #: ../src/guestfs.pod:1978
3809 msgid ""
3810 "C<key> is the name to associate with this data, and C<data> is an arbitrary "
3811 "pointer (which can be C<NULL>).  Any previous item with the same name is "
3812 "overwritten."
3813 msgstr ""
3814
3815 #. type: textblock
3816 #: ../src/guestfs.pod:1982
3817 msgid ""
3818 "You can use any C<key> you want, but names beginning with an underscore "
3819 "character are reserved for internal libguestfs purposes (for implementing "
3820 "language bindings).  It is recommended to prefix the name with some unique "
3821 "string to avoid collisions with other users."
3822 msgstr ""
3823
3824 #. type: textblock
3825 #: ../src/guestfs.pod:1987
3826 msgid "To retrieve the pointer, use:"
3827 msgstr ""
3828
3829 #. type: verbatim
3830 #: ../src/guestfs.pod:1989
3831 #, no-wrap
3832 msgid ""
3833 " void *guestfs_get_private (guestfs_h *g, const char *key);\n"
3834 "\n"
3835 msgstr ""
3836
3837 #. type: textblock
3838 #: ../src/guestfs.pod:1991
3839 msgid ""
3840 "This function returns C<NULL> if either no data is found associated with "
3841 "C<key>, or if the user previously set the C<key>'s C<data> pointer to "
3842 "C<NULL>."
3843 msgstr ""
3844
3845 #. type: textblock
3846 #: ../src/guestfs.pod:1995
3847 msgid ""
3848 "Libguestfs does not try to look at or interpret the C<data> pointer in any "
3849 "way.  As far as libguestfs is concerned, it need not be a valid pointer at "
3850 "all.  In particular, libguestfs does I<not> try to free the data when the "
3851 "handle is closed.  If the data must be freed, then the caller must either "
3852 "free it before calling L</guestfs_close> or must set up a close callback to "
3853 "do it (see L</GUESTFS_EVENT_CLOSE>)."
3854 msgstr ""
3855
3856 #. type: textblock
3857 #: ../src/guestfs.pod:2002
3858 msgid "To walk over all entries, use these two functions:"
3859 msgstr ""
3860
3861 #. type: verbatim
3862 #: ../src/guestfs.pod:2004
3863 #, no-wrap
3864 msgid ""
3865 " void *guestfs_first_private (guestfs_h *g, const char **key_rtn);\n"
3866 "\n"
3867 msgstr ""
3868
3869 #. type: verbatim
3870 #: ../src/guestfs.pod:2006
3871 #, no-wrap
3872 msgid ""
3873 " void *guestfs_next_private (guestfs_h *g, const char **key_rtn);\n"
3874 "\n"
3875 msgstr ""
3876
3877 #. type: textblock
3878 #: ../src/guestfs.pod:2008
3879 msgid ""
3880 "C<guestfs_first_private> returns the first key, pointer pair (\"first\" does "
3881 "not have any particular meaning -- keys are not returned in any defined "
3882 "order).  A pointer to the key is returned in C<*key_rtn> and the "
3883 "corresponding data pointer is returned from the function.  C<NULL> is "
3884 "returned if there are no keys stored in the handle."
3885 msgstr ""
3886
3887 #. type: textblock
3888 #: ../src/guestfs.pod:2014
3889 msgid ""
3890 "C<guestfs_next_private> returns the next key, pointer pair.  The return "
3891 "value of this function is also C<NULL> is there are no further entries to "
3892 "return."
3893 msgstr ""
3894
3895 #. type: textblock
3896 #: ../src/guestfs.pod:2018
3897 msgid "Notes about walking over entries:"
3898 msgstr ""
3899
3900 #. type: textblock
3901 #: ../src/guestfs.pod:2024
3902 msgid "You must not call C<guestfs_set_private> while walking over the entries."
3903 msgstr ""
3904
3905 #. type: textblock
3906 #: ../src/guestfs.pod:2029
3907 msgid ""
3908 "The handle maintains an internal iterator which is reset when you call "
3909 "C<guestfs_first_private>.  This internal iterator is invalidated when you "
3910 "call C<guestfs_set_private>."
3911 msgstr ""
3912
3913 #. type: textblock
3914 #: ../src/guestfs.pod:2035
3915 msgid "If you have set the data pointer associated with a key to C<NULL>, ie:"
3916 msgstr ""
3917
3918 #. type: verbatim
3919 #: ../src/guestfs.pod:2037
3920 #, no-wrap
3921 msgid ""
3922 " guestfs_set_private (g, key, NULL);\n"
3923 "\n"
3924 msgstr ""
3925
3926 #. type: textblock
3927 #: ../src/guestfs.pod:2039
3928 msgid "then that C<key> is not returned when walking."
3929 msgstr ""
3930
3931 #. type: textblock
3932 #: ../src/guestfs.pod:2043
3933 msgid ""
3934 "C<*key_rtn> is only valid until the next call to C<guestfs_first_private>, "
3935 "C<guestfs_next_private> or C<guestfs_set_private>."
3936 msgstr ""
3937
3938 #. type: textblock
3939 #: ../src/guestfs.pod:2049
3940 msgid ""
3941 "The following example code shows how to print all keys and data pointers "
3942 "that are associated with the handle C<g>:"
3943 msgstr ""
3944
3945 #. type: verbatim
3946 #: ../src/guestfs.pod:2052
3947 #, no-wrap
3948 msgid ""
3949 " const char *key;\n"
3950 " void *data = guestfs_first_private (g, &key);\n"
3951 " while (data != NULL)\n"
3952 "   {\n"
3953 "     printf (\"key = %s, data = %p\\n\", key, data);\n"
3954 "     data = guestfs_next_private (g, &key);\n"
3955 "   }\n"
3956 "\n"
3957 msgstr ""
3958
3959 #. type: textblock
3960 #: ../src/guestfs.pod:2060
3961 msgid ""
3962 "More commonly you are only interested in keys that begin with an "
3963 "application-specific prefix C<foo_>.  Modify the loop like so:"
3964 msgstr ""
3965
3966 #. type: verbatim
3967 #: ../src/guestfs.pod:2063
3968 #, no-wrap
3969 msgid ""
3970 " const char *key;\n"
3971 " void *data = guestfs_first_private (g, &key);\n"
3972 " while (data != NULL)\n"
3973 "   {\n"
3974 "     if (strncmp (key, \"foo_\", strlen (\"foo_\")) == 0)\n"
3975 "       printf (\"key = %s, data = %p\\n\", key, data);\n"
3976 "     data = guestfs_next_private (g, &key);\n"
3977 "   }\n"
3978 "\n"
3979 msgstr ""
3980
3981 #. type: textblock
3982 #: ../src/guestfs.pod:2072
3983 msgid ""
3984 "If you need to modify keys while walking, then you have to jump back to the "
3985 "beginning of the loop.  For example, to delete all keys prefixed with "
3986 "C<foo_>:"
3987 msgstr ""
3988
3989 #. type: verbatim
3990 #: ../src/guestfs.pod:2076
3991 #, no-wrap
3992 msgid ""
3993 "  const char *key;\n"
3994 "  void *data;\n"
3995 " again:\n"
3996 "  data = guestfs_first_private (g, &key);\n"
3997 "  while (data != NULL)\n"
3998 "    {\n"
3999 "      if (strncmp (key, \"foo_\", strlen (\"foo_\")) == 0)\n"
4000 "        {\n"
4001 "          guestfs_set_private (g, key, NULL);\n"
4002 "          /* note that 'key' pointer is now invalid, and so is\n"
4003 "             the internal iterator */\n"
4004 "          goto again;\n"
4005 "        }\n"
4006 "      data = guestfs_next_private (g, &key);\n"
4007 "    }\n"
4008 "\n"
4009 msgstr ""
4010
4011 #. type: textblock
4012 #: ../src/guestfs.pod:2092
4013 msgid ""
4014 "Note that the above loop is guaranteed to terminate because the keys are "
4015 "being deleted, but other manipulations of keys within the loop might not "
4016 "terminate unless you also maintain an indication of which keys have been "
4017 "visited."
4018 msgstr ""
4019
4020 #. type: =end
4021 #: ../src/guestfs.pod:2097 ../src/guestfs.pod:2102
4022 msgid "html"
4023 msgstr ""
4024
4025 #. type: textblock
4026 #: ../src/guestfs.pod:2099
4027 msgid ""
4028 "<!-- old anchor for the next section --> <a "
4029 "name=\"state_machine_and_low_level_event_api\"/>"
4030 msgstr ""
4031
4032 #. type: =head1
4033 #: ../src/guestfs.pod:2104
4034 msgid "ARCHITECTURE"
4035 msgstr ""
4036
4037 #. type: textblock
4038 #: ../src/guestfs.pod:2106
4039 msgid ""
4040 "Internally, libguestfs is implemented by running an appliance (a special "
4041 "type of small virtual machine) using L<qemu(1)>.  Qemu runs as a child "
4042 "process of the main program."
4043 msgstr ""
4044
4045 #. type: verbatim
4046 #: ../src/guestfs.pod:2110
4047 #, no-wrap
4048 msgid ""
4049 "  ___________________\n"
4050 " /                   \\\n"
4051 " | main program      |\n"
4052 " |                   |\n"
4053 " |                   |           child process / appliance\n"
4054 " |                   |           __________________________\n"
4055 " |                   |          / qemu                     \\\n"
4056 " +-------------------+   RPC    |      +-----------------+ |\n"
4057 " | libguestfs     <--------------------> guestfsd        | |\n"
4058 " |                   |          |      +-----------------+ |\n"
4059 " \\___________________/          |      | Linux kernel    | |\n"
4060 "                                |      +--^--------------+ |\n"
4061 "                                \\_________|________________/\n"
4062 "                                          |\n"
4063 "                                   _______v______\n"
4064 "                                  /              \\\n"
4065 "                                  | Device or    |\n"
4066 "                                  | disk image   |\n"
4067 "                                  \\______________/\n"
4068 "\n"
4069 msgstr ""
4070
4071 #. type: textblock
4072 #: ../src/guestfs.pod:2130
4073 msgid ""
4074 "The library, linked to the main program, creates the child process and hence "
4075 "the appliance in the L</guestfs_launch> function."
4076 msgstr ""
4077
4078 #. type: textblock
4079 #: ../src/guestfs.pod:2133
4080 msgid ""
4081 "Inside the appliance is a Linux kernel and a complete stack of userspace "
4082 "tools (such as LVM and ext2 programs) and a small controlling daemon called "
4083 "L</guestfsd>.  The library talks to L</guestfsd> using remote procedure "
4084 "calls (RPC).  There is a mostly one-to-one correspondence between libguestfs "
4085 "API calls and RPC calls to the daemon.  Lastly the disk image(s) are "
4086 "attached to the qemu process which translates device access by the "
4087 "appliance's Linux kernel into accesses to the image."
4088 msgstr ""
4089
4090 #. type: textblock
4091 #: ../src/guestfs.pod:2142
4092 msgid ""
4093 "A common misunderstanding is that the appliance \"is\" the virtual machine.  "
4094 "Although the disk image you are attached to might also be used by some "
4095 "virtual machine, libguestfs doesn't know or care about this.  (But you will "
4096 "care if both libguestfs's qemu process and your virtual machine are trying "
4097 "to update the disk image at the same time, since these usually results in "
4098 "massive disk corruption)."
4099 msgstr ""
4100
4101 #. type: =head1
4102 #: ../src/guestfs.pod:2149
4103 msgid "STATE MACHINE"
4104 msgstr ""
4105
4106 #. type: textblock
4107 #: ../src/guestfs.pod:2151
4108 msgid "libguestfs uses a state machine to model the child process:"
4109 msgstr ""
4110
4111 #. type: verbatim
4112 #: ../src/guestfs.pod:2153
4113 #, no-wrap
4114 msgid ""
4115 "                         |\n"
4116 "                    guestfs_create\n"
4117 "                         |\n"
4118 "                         |\n"
4119 "                     ____V_____\n"
4120 "                    /          \\\n"
4121 "                    |  CONFIG  |\n"
4122 "                    \\__________/\n"
4123 "                     ^ ^   ^  \\\n"
4124 "                    /  |    \\  \\ guestfs_launch\n"
4125 "                   /   |    _\\__V______\n"
4126 "                  /    |   /           \\\n"
4127 "                 /     |   | LAUNCHING |\n"
4128 "                /      |   \\___________/\n"
4129 "               /       |       /\n"
4130 "              /        |  guestfs_launch\n"
4131 "             /         |     /\n"
4132 "    ______  /        __|____V\n"
4133 "   /      \\ ------> /        \\\n"
4134 "   | BUSY |         | READY  |\n"
4135 "   \\______/ <------ \\________/\n"
4136 "\n"
4137 msgstr ""
4138
4139 #. type: textblock
4140 #: ../src/guestfs.pod:2175
4141 msgid ""
4142 "The normal transitions are (1) CONFIG (when the handle is created, but there "
4143 "is no child process), (2) LAUNCHING (when the child process is booting up), "
4144 "(3) alternating between READY and BUSY as commands are issued to, and "
4145 "carried out by, the child process."
4146 msgstr ""
4147
4148 #. type: textblock
4149 #: ../src/guestfs.pod:2180
4150 msgid ""
4151 "The guest may be killed by L</guestfs_kill_subprocess>, or may die "
4152 "asynchronously at any time (eg. due to some internal error), and that causes "
4153 "the state to transition back to CONFIG."
4154 msgstr ""
4155
4156 #. type: textblock
4157 #: ../src/guestfs.pod:2184
4158 msgid ""
4159 "Configuration commands for qemu such as L</guestfs_add_drive> can only be "
4160 "issued when in the CONFIG state."
4161 msgstr ""
4162
4163 #. type: textblock
4164 #: ../src/guestfs.pod:2187
4165 msgid ""
4166 "The API offers one call that goes from CONFIG through LAUNCHING to READY.  "
4167 "L</guestfs_launch> blocks until the child process is READY to accept "
4168 "commands (or until some failure or timeout).  L</guestfs_launch> internally "
4169 "moves the state from CONFIG to LAUNCHING while it is running."
4170 msgstr ""
4171
4172 #. type: textblock
4173 #: ../src/guestfs.pod:2193
4174 msgid ""
4175 "API actions such as L</guestfs_mount> can only be issued when in the READY "
4176 "state.  These API calls block waiting for the command to be carried out "
4177 "(ie. the state to transition to BUSY and then back to READY).  There are no "
4178 "non-blocking versions, and no way to issue more than one command per handle "
4179 "at the same time."
4180 msgstr ""
4181
4182 #. type: textblock
4183 #: ../src/guestfs.pod:2199
4184 msgid ""
4185 "Finally, the child process sends asynchronous messages back to the main "
4186 "program, such as kernel log messages.  You can register a callback to "
4187 "receive these messages."
4188 msgstr ""
4189
4190 #. type: =head1
4191 #: ../src/guestfs.pod:2203
4192 msgid "INTERNALS"
4193 msgstr ""
4194
4195 #. type: =head2
4196 #: ../src/guestfs.pod:2205
4197 msgid "COMMUNICATION PROTOCOL"
4198 msgstr ""
4199
4200 #. type: textblock
4201 #: ../src/guestfs.pod:2207
4202 msgid ""
4203 "Don't rely on using this protocol directly.  This section documents how it "
4204 "currently works, but it may change at any time."
4205 msgstr ""
4206
4207 #. type: textblock
4208 #: ../src/guestfs.pod:2210
4209 msgid ""
4210 "The protocol used to talk between the library and the daemon running inside "
4211 "the qemu virtual machine is a simple RPC mechanism built on top of XDR (RFC "
4212 "1014, RFC 1832, RFC 4506)."
4213 msgstr ""
4214
4215 #. type: textblock
4216 #: ../src/guestfs.pod:2214
4217 msgid ""
4218 "The detailed format of structures is in C<src/guestfs_protocol.x> (note: "
4219 "this file is automatically generated)."
4220 msgstr ""
4221
4222 #. type: textblock
4223 #: ../src/guestfs.pod:2217
4224 msgid ""
4225 "There are two broad cases, ordinary functions that don't have any C<FileIn> "
4226 "and C<FileOut> parameters, which are handled with very simple request/reply "
4227 "messages.  Then there are functions that have any C<FileIn> or C<FileOut> "
4228 "parameters, which use the same request and reply messages, but they may also "
4229 "be followed by files sent using a chunked encoding."
4230 msgstr ""
4231
4232 #. type: =head3
4233 #: ../src/guestfs.pod:2224
4234 msgid "ORDINARY FUNCTIONS (NO FILEIN/FILEOUT PARAMS)"
4235 msgstr ""
4236
4237 #. type: textblock
4238 #: ../src/guestfs.pod:2226
4239 msgid "For ordinary functions, the request message is:"
4240 msgstr ""
4241
4242 #. type: verbatim
4243 #: ../src/guestfs.pod:2228
4244 #, no-wrap
4245 msgid ""
4246 " total length (header + arguments,\n"
4247 "      but not including the length word itself)\n"
4248 " struct guestfs_message_header (encoded as XDR)\n"
4249 " struct guestfs_<foo>_args (encoded as XDR)\n"
4250 "\n"
4251 msgstr ""
4252
4253 #. type: textblock
4254 #: ../src/guestfs.pod:2233
4255 msgid ""
4256 "The total length field allows the daemon to allocate a fixed size buffer "
4257 "into which it slurps the rest of the message.  As a result, the total length "
4258 "is limited to C<GUESTFS_MESSAGE_MAX> bytes (currently 4MB), which means the "
4259 "effective size of any request is limited to somewhere under this size."
4260 msgstr ""
4261
4262 #. type: textblock
4263 #: ../src/guestfs.pod:2239
4264 msgid ""
4265 "Note also that many functions don't take any arguments, in which case the "
4266 "C<guestfs_I<foo>_args> is completely omitted."
4267 msgstr ""
4268
4269 #. type: textblock
4270 #: ../src/guestfs.pod:2242
4271 msgid ""
4272 "The header contains the procedure number (C<guestfs_proc>) which is how the "
4273 "receiver knows what type of args structure to expect, or none at all."
4274 msgstr ""
4275
4276 #. type: textblock
4277 #: ../src/guestfs.pod:2246
4278 msgid ""
4279 "For functions that take optional arguments, the optional arguments are "
4280 "encoded in the C<guestfs_I<foo>_args> structure in the same way as ordinary "
4281 "arguments.  A bitmask in the header indicates which optional arguments are "
4282 "meaningful.  The bitmask is also checked to see if it contains bits set "
4283 "which the daemon does not know about (eg. if more optional arguments were "
4284 "added in a later version of the library), and this causes the call to be "
4285 "rejected."
4286 msgstr ""
4287
4288 #. type: textblock
4289 #: ../src/guestfs.pod:2254
4290 msgid "The reply message for ordinary functions is:"
4291 msgstr ""
4292
4293 #. type: verbatim
4294 #: ../src/guestfs.pod:2256
4295 #, no-wrap
4296 msgid ""
4297 " total length (header + ret,\n"
4298 "      but not including the length word itself)\n"
4299 " struct guestfs_message_header (encoded as XDR)\n"
4300 " struct guestfs_<foo>_ret (encoded as XDR)\n"
4301 "\n"
4302 msgstr ""
4303
4304 #. type: textblock
4305 #: ../src/guestfs.pod:2261
4306 msgid ""
4307 "As above the C<guestfs_I<foo>_ret> structure may be completely omitted for "
4308 "functions that return no formal return values."
4309 msgstr ""
4310
4311 #. type: textblock
4312 #: ../src/guestfs.pod:2264
4313 msgid "As above the total length of the reply is limited to C<GUESTFS_MESSAGE_MAX>."
4314 msgstr ""
4315
4316 #. type: textblock
4317 #: ../src/guestfs.pod:2267
4318 msgid ""
4319 "In the case of an error, a flag is set in the header, and the reply message "
4320 "is slightly changed:"
4321 msgstr ""
4322
4323 #. type: verbatim
4324 #: ../src/guestfs.pod:2270
4325 #, no-wrap
4326 msgid ""
4327 " total length (header + error,\n"
4328 "      but not including the length word itself)\n"
4329 " struct guestfs_message_header (encoded as XDR)\n"
4330 " struct guestfs_message_error (encoded as XDR)\n"
4331 "\n"
4332 msgstr ""
4333
4334 #. type: textblock
4335 #: ../src/guestfs.pod:2275
4336 msgid ""
4337 "The C<guestfs_message_error> structure contains the error message as a "
4338 "string."
4339 msgstr ""
4340
4341 #. type: =head3
4342 #: ../src/guestfs.pod:2278
4343 msgid "FUNCTIONS THAT HAVE FILEIN PARAMETERS"
4344 msgstr ""
4345
4346 #. type: textblock
4347 #: ../src/guestfs.pod:2280
4348 msgid ""
4349 "A C<FileIn> parameter indicates that we transfer a file I<into> the guest.  "
4350 "The normal request message is sent (see above).  However this is followed by "
4351 "a sequence of file chunks."
4352 msgstr ""
4353
4354 #. type: verbatim
4355 #: ../src/guestfs.pod:2284
4356 #, no-wrap
4357 msgid ""
4358 " total length (header + arguments,\n"
4359 "      but not including the length word itself,\n"
4360 "      and not including the chunks)\n"
4361 " struct guestfs_message_header (encoded as XDR)\n"
4362 " struct guestfs_<foo>_args (encoded as XDR)\n"
4363 " sequence of chunks for FileIn param #0\n"
4364 " sequence of chunks for FileIn param #1 etc.\n"
4365 "\n"
4366 msgstr ""
4367
4368 #. type: textblock
4369 #: ../src/guestfs.pod:2292
4370 msgid "The \"sequence of chunks\" is:"
4371 msgstr ""
4372
4373 #. type: verbatim
4374 #: ../src/guestfs.pod:2294
4375 #, no-wrap
4376 msgid ""
4377 " length of chunk (not including length word itself)\n"
4378 " struct guestfs_chunk (encoded as XDR)\n"
4379 " length of chunk\n"
4380 " struct guestfs_chunk (encoded as XDR)\n"
4381 "   ...\n"
4382 " length of chunk\n"
4383 " struct guestfs_chunk (with data.data_len == 0)\n"
4384 "\n"
4385 msgstr ""
4386
4387 #. type: textblock
4388 #: ../src/guestfs.pod:2302
4389 msgid ""
4390 "The final chunk has the C<data_len> field set to zero.  Additionally a flag "
4391 "is set in the final chunk to indicate either successful completion or early "
4392 "cancellation."
4393 msgstr ""
4394
4395 #. type: textblock
4396 #: ../src/guestfs.pod:2306
4397 msgid ""
4398 "At time of writing there are no functions that have more than one FileIn "
4399 "parameter.  However this is (theoretically) supported, by sending the "
4400 "sequence of chunks for each FileIn parameter one after another (from left to "
4401 "right)."
4402 msgstr ""
4403
4404 #. type: textblock
4405 #: ../src/guestfs.pod:2311
4406 msgid ""
4407 "Both the library (sender) I<and> the daemon (receiver) may cancel the "
4408 "transfer.  The library does this by sending a chunk with a special flag set "
4409 "to indicate cancellation.  When the daemon sees this, it cancels the whole "
4410 "RPC, does I<not> send any reply, and goes back to reading the next request."
4411 msgstr ""
4412
4413 #. type: textblock
4414 #: ../src/guestfs.pod:2317
4415 msgid ""
4416 "The daemon may also cancel.  It does this by writing a special word "
4417 "C<GUESTFS_CANCEL_FLAG> to the socket.  The library listens for this during "
4418 "the transfer, and if it gets it, it will cancel the transfer (it sends a "
4419 "cancel chunk).  The special word is chosen so that even if cancellation "
4420 "happens right at the end of the transfer (after the library has finished "
4421 "writing and has started listening for the reply), the \"spurious\" cancel "
4422 "flag will not be confused with the reply message."
4423 msgstr ""
4424
4425 #. type: textblock
4426 #: ../src/guestfs.pod:2326
4427 msgid ""
4428 "This protocol allows the transfer of arbitrary sized files (no 32 bit "
4429 "limit), and also files where the size is not known in advance (eg. from "
4430 "pipes or sockets).  However the chunks are rather small "
4431 "(C<GUESTFS_MAX_CHUNK_SIZE>), so that neither the library nor the daemon need "
4432 "to keep much in memory."
4433 msgstr ""
4434
4435 #. type: =head3
4436 #: ../src/guestfs.pod:2332
4437 msgid "FUNCTIONS THAT HAVE FILEOUT PARAMETERS"
4438 msgstr ""
4439
4440 #. type: textblock
4441 #: ../src/guestfs.pod:2334
4442 msgid ""
4443 "The protocol for FileOut parameters is exactly the same as for FileIn "
4444 "parameters, but with the roles of daemon and library reversed."
4445 msgstr ""
4446
4447 #. type: verbatim
4448 #: ../src/guestfs.pod:2337
4449 #, no-wrap
4450 msgid ""
4451 " total length (header + ret,\n"
4452 "      but not including the length word itself,\n"
4453 "      and not including the chunks)\n"
4454 " struct guestfs_message_header (encoded as XDR)\n"
4455 " struct guestfs_<foo>_ret (encoded as XDR)\n"
4456 " sequence of chunks for FileOut param #0\n"
4457 " sequence of chunks for FileOut param #1 etc.\n"
4458 "\n"
4459 msgstr ""
4460
4461 #. type: =head3
4462 #: ../src/guestfs.pod:2345
4463 msgid "INITIAL MESSAGE"
4464 msgstr ""
4465
4466 #. type: textblock
4467 #: ../src/guestfs.pod:2347
4468 msgid ""
4469 "When the daemon launches it sends an initial word (C<GUESTFS_LAUNCH_FLAG>) "
4470 "which indicates that the guest and daemon is alive.  This is what "
4471 "L</guestfs_launch> waits for."
4472 msgstr ""
4473
4474 #. type: =head3
4475 #: ../src/guestfs.pod:2351
4476 msgid "PROGRESS NOTIFICATION MESSAGES"
4477 msgstr ""
4478
4479 #. type: textblock
4480 #: ../src/guestfs.pod:2353
4481 msgid ""
4482 "The daemon may send progress notification messages at any time.  These are "
4483 "distinguished by the normal length word being replaced by "
4484 "C<GUESTFS_PROGRESS_FLAG>, followed by a fixed size progress message."
4485 msgstr ""
4486
4487 #. type: textblock
4488 #: ../src/guestfs.pod:2357
4489 msgid ""
4490 "The library turns them into progress callbacks (see "
4491 "L</GUESTFS_EVENT_PROGRESS>) if there is a callback registered, or discards "
4492 "them if not."
4493 msgstr ""
4494
4495 #. type: textblock
4496 #: ../src/guestfs.pod:2361
4497 msgid ""
4498 "The daemon self-limits the frequency of progress messages it sends (see "
4499 "C<daemon/proto.c:notify_progress>).  Not all calls generate progress "
4500 "messages."
4501 msgstr ""
4502
4503 #. type: =head1
4504 #: ../src/guestfs.pod:2365
4505 msgid "LIBGUESTFS VERSION NUMBERS"
4506 msgstr ""
4507
4508 #. type: textblock
4509 #: ../src/guestfs.pod:2367
4510 msgid ""
4511 "Since April 2010, libguestfs has started to make separate development and "
4512 "stable releases, along with corresponding branches in our git repository.  "
4513 "These separate releases can be identified by version number:"
4514 msgstr ""
4515
4516 #. type: verbatim
4517 #: ../src/guestfs.pod:2372
4518 #, no-wrap
4519 msgid ""
4520 "                 even numbers for stable: 1.2.x, 1.4.x, ...\n"
4521 "       .-------- odd numbers for development: 1.3.x, 1.5.x, ...\n"
4522 "       |\n"
4523 "       v\n"
4524 " 1  .  3  .  5\n"
4525 " ^           ^\n"
4526 " |           |\n"
4527 " |           `-------- sub-version\n"
4528 " |\n"
4529 " `------ always '1' because we don't change the ABI\n"
4530 "\n"
4531 msgstr ""
4532
4533 #. type: textblock
4534 #: ../src/guestfs.pod:2383
4535 msgid "Thus \"1.3.5\" is the 5th update to the development branch \"1.3\"."
4536 msgstr ""
4537
4538 #. type: textblock
4539 #: ../src/guestfs.pod:2385
4540 msgid ""
4541 "As time passes we cherry pick fixes from the development branch and backport "
4542 "those into the stable branch, the effect being that the stable branch should "
4543 "get more stable and less buggy over time.  So the stable releases are ideal "
4544 "for people who don't need new features but would just like the software to "
4545 "work."
4546 msgstr ""
4547
4548 #. type: textblock
4549 #: ../src/guestfs.pod:2391
4550 msgid "Our criteria for backporting changes are:"
4551 msgstr ""
4552
4553 #. type: textblock
4554 #: ../src/guestfs.pod:2397
4555 msgid ""
4556 "Documentation changes which don't affect any code are backported unless the "
4557 "documentation refers to a future feature which is not in stable."
4558 msgstr ""
4559
4560 #. type: textblock
4561 #: ../src/guestfs.pod:2403
4562 msgid ""
4563 "Bug fixes which are not controversial, fix obvious problems, and have been "
4564 "well tested are backported."
4565 msgstr ""
4566
4567 #. type: textblock
4568 #: ../src/guestfs.pod:2408
4569 msgid ""
4570 "Simple rearrangements of code which shouldn't affect how it works get "
4571 "backported.  This is so that the code in the two branches doesn't get too "
4572 "far out of step, allowing us to backport future fixes more easily."
4573 msgstr ""
4574
4575 #. type: textblock