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