1Sys::Guestfs(3)       User Contributed Perl Documentation      Sys::Guestfs(3)
2
3
4

NAME

6       Sys::Guestfs - Perl bindings for libguestfs
7

SYNOPSIS

9        use Sys::Guestfs;
10
11        my $g = Sys::Guestfs->new ();
12        $g->add_drive_opts ('guest.img', format => 'raw');
13        $g->launch ();
14        $g->mount ('/dev/sda1', '/');
15        $g->touch ('/hello');
16        $g->shutdown ();
17        $g->close ();
18

DESCRIPTION

20       The "Sys::Guestfs" module provides a Perl XS binding to the libguestfs
21       API for examining and modifying virtual machine disk images.
22
23       Amongst the things this is good for: making batch configuration changes
24       to guests, getting disk used/free statistics (see also: virt-df),
25       migrating between virtualization systems (see also: virt-p2v),
26       performing partial backups, performing partial guest clones, cloning
27       guests and changing registry/UUID/hostname info, and much else besides.
28
29       Libguestfs uses Linux kernel and qemu code, and can access any type of
30       guest filesystem that Linux and qemu can, including but not limited to:
31       ext2/3/4, btrfs, FAT and NTFS, LVM, many different disk partition
32       schemes, qcow, qcow2, vmdk.
33
34       Libguestfs provides ways to enumerate guest storage (eg. partitions,
35       LVs, what filesystem is in each LV, etc.).  It can also run commands in
36       the context of the guest.  Also you can access filesystems over FUSE.
37

ERRORS

39       All errors turn into calls to "croak" (see Carp(3)).
40
41       The error string from libguestfs is directly available from $@.  Use
42       the "last_errno" method if you want to get the errno.
43

METHODS

45       $g = Sys::Guestfs->new ([environment => 0,] [close_on_exit => 0]);
46           Create a new guestfs handle.
47
48           If the optional argument "environment" is false, then the
49           "GUESTFS_CREATE_NO_ENVIRONMENT" flag is set.
50
51           If the optional argument "close_on_exit" is false, then the
52           "GUESTFS_CREATE_NO_CLOSE_ON_EXIT" flag is set.
53
54       $g->close ();
55           Explicitly close the guestfs handle.
56
57           Note: You should not usually call this function.  The handle will
58           be closed implicitly when its reference count goes to zero (eg.
59           when it goes out of scope or the program ends).  This call is only
60           required in some exceptional cases, such as where the program may
61           contain cached references to the handle 'somewhere' and you really
62           have to have the close happen right away.  After calling "close"
63           the program must not call any method (including "close") on the
64           handle (but the implicit call to "DESTROY" that happens when the
65           final reference is cleaned up is OK).
66
67       $Sys::Guestfs::EVENT_CLOSE
68           See "GUESTFS_EVENT_CLOSE" in guestfs(3).
69
70       $Sys::Guestfs::EVENT_SUBPROCESS_QUIT
71           See "GUESTFS_EVENT_SUBPROCESS_QUIT" in guestfs(3).
72
73       $Sys::Guestfs::EVENT_LAUNCH_DONE
74           See "GUESTFS_EVENT_LAUNCH_DONE" in guestfs(3).
75
76       $Sys::Guestfs::EVENT_PROGRESS
77           See "GUESTFS_EVENT_PROGRESS" in guestfs(3).
78
79       $Sys::Guestfs::EVENT_APPLIANCE
80           See "GUESTFS_EVENT_APPLIANCE" in guestfs(3).
81
82       $Sys::Guestfs::EVENT_LIBRARY
83           See "GUESTFS_EVENT_LIBRARY" in guestfs(3).
84
85       $Sys::Guestfs::EVENT_TRACE
86           See "GUESTFS_EVENT_TRACE" in guestfs(3).
87
88       $Sys::Guestfs::EVENT_ENTER
89           See "GUESTFS_EVENT_ENTER" in guestfs(3).
90
91       $Sys::Guestfs::EVENT_LIBVIRT_AUTH
92           See "GUESTFS_EVENT_LIBVIRT_AUTH" in guestfs(3).
93
94       $Sys::Guestfs::EVENT_WARNING
95           See "GUESTFS_EVENT_WARNING" in guestfs(3).
96
97       $Sys::Guestfs::EVENT_ALL
98           See "GUESTFS_EVENT_ALL" in guestfs(3).
99
100       $event_handle = $g->set_event_callback (\&cb, $event_bitmask);
101           Register "cb" as a callback function for all of the events in
102           $event_bitmask (one or more "$Sys::Guestfs::EVENT_*" flags
103           logically or'd together).
104
105           This function returns an event handle which can be used to delete
106           the callback using "delete_event_callback".
107
108           The callback function receives 4 parameters:
109
110            &cb ($event, $event_handle, $buf, $array)
111
112           $event
113               The event which happened (equal to one of
114               "$Sys::Guestfs::EVENT_*").
115
116           $event_handle
117               The event handle.
118
119           $buf
120               For some event types, this is a message buffer (ie. a string).
121
122           $array
123               For some event types (notably progress events), this is an
124               array of integers.
125
126           You should carefully read the documentation for
127           "guestfs_set_event_callback" in guestfs(3) before using this
128           function.
129
130       $g->delete_event_callback ($event_handle);
131           This removes the callback which was previously registered using
132           "set_event_callback".
133
134       $str = Sys::Guestfs::event_to_string ($events);
135           $events is either a single event or a bitmask of events.  This
136           returns a printable string, useful for debugging.
137
138           Note that this is a class function, not a method.
139
140       $errnum = $g->last_errno ();
141           This returns the last error number (errno) that happened on the
142           handle $g.
143
144           If successful, an errno integer not equal to zero is returned.
145
146           If no error number is available, this returns 0.  See
147           "guestfs_last_errno" in guestfs(3) for more details of why this can
148           happen.
149
150           You can use the standard Perl module Errno(3) to compare the
151           numeric error returned from this call with symbolic errnos:
152
153            $g->mkdir ("/foo");
154            if ($g->last_errno() == Errno::EEXIST()) {
155              # mkdir failed because the directory exists already.
156            }
157
158       $g->acl_delete_def_file ($dir);
159           This function deletes the default POSIX Access Control List (ACL)
160           attached to directory "dir".
161
162           This function depends on the feature "acl".  See also
163           "$g->feature-available".
164
165       $acl = $g->acl_get_file ($path, $acltype);
166           This function returns the POSIX Access Control List (ACL) attached
167           to "path".  The ACL is returned in "long text form" (see acl(5)).
168
169           The "acltype" parameter may be:
170
171           "access"
172               Return the ordinary (access) ACL for any file, directory or
173               other filesystem object.
174
175           "default"
176               Return the default ACL.  Normally this only makes sense if
177               "path" is a directory.
178
179           This function depends on the feature "acl".  See also
180           "$g->feature-available".
181
182       $g->acl_set_file ($path, $acltype, $acl);
183           This function sets the POSIX Access Control List (ACL) attached to
184           "path".
185
186           The "acltype" parameter may be:
187
188           "access"
189               Set the ordinary (access) ACL for any file, directory or other
190               filesystem object.
191
192           "default"
193               Set the default ACL.  Normally this only makes sense if "path"
194               is a directory.
195
196           The "acl" parameter is the new ACL in either "long text form" or
197           "short text form" (see acl(5)).  The new ACL completely replaces
198           any previous ACL on the file.  The ACL must contain the full Unix
199           permissions (eg. "u::rwx,g::rx,o::rx").
200
201           If you are specifying individual users or groups, then the mask
202           field is also required (eg. "m::rwx"), followed by the "u:ID:..."
203           and/or "g:ID:..." field(s).  A full ACL string might therefore look
204           like this:
205
206            u::rwx,g::rwx,o::rwx,m::rwx,u:500:rwx,g:500:rwx
207            \ Unix permissions / \mask/ \      ACL        /
208
209           You should use numeric UIDs and GIDs.  To map usernames and
210           groupnames to the correct numeric ID in the context of the guest,
211           use the Augeas functions (see "$g->aug_init").
212
213           This function depends on the feature "acl".  See also
214           "$g->feature-available".
215
216       $g->add_cdrom ($filename);
217           This function adds a virtual CD-ROM disk image to the guest.
218
219           The image is added as read-only drive, so this function is
220           equivalent of "$g->add_drive_ro".
221
222           This function is deprecated.  In new code, use the "add_drive_ro"
223           call instead.
224
225           Deprecated functions will not be removed from the API, but the fact
226           that they are deprecated indicates that there are problems with
227           correct use of these functions.
228
229       $nrdisks = $g->add_domain ($dom [, libvirturi => $libvirturi] [,
230       readonly => $readonly] [, iface => $iface] [, live => $live] [,
231       allowuuid => $allowuuid] [, readonlydisk => $readonlydisk] [, cachemode
232       => $cachemode] [, discard => $discard] [, copyonread => $copyonread]);
233           This function adds the disk(s) attached to the named libvirt domain
234           "dom".  It works by connecting to libvirt, requesting the domain
235           and domain XML from libvirt, parsing it for disks, and calling
236           "$g->add_drive_opts" on each one.
237
238           The number of disks added is returned.  This operation is atomic:
239           if an error is returned, then no disks are added.
240
241           This function does some minimal checks to make sure the libvirt
242           domain is not running (unless "readonly" is true).  In a future
243           version we will try to acquire the libvirt lock on each disk.
244
245           Disks must be accessible locally.  This often means that adding
246           disks from a remote libvirt connection (see
247           <https://libvirt.org/remote.html>) will fail unless those disks are
248           accessible via the same device path locally too.
249
250           The optional "libvirturi" parameter sets the libvirt URI (see
251           <https://libvirt.org/uri.html>).  If this is not set then we
252           connect to the default libvirt URI (or one set through an
253           environment variable, see the libvirt documentation for full
254           details).
255
256           The optional "live" flag is ignored in libguestfs X 1.48.
257
258           If the "allowuuid" flag is true (default is false) then a UUID may
259           be passed instead of the domain name.  The "dom" string is treated
260           as a UUID first and looked up, and if that lookup fails then we
261           treat "dom" as a name as usual.
262
263           The optional "readonlydisk" parameter controls what we do for disks
264           which are marked <readonly/> in the libvirt XML.  Possible values
265           are:
266
267           readonlydisk = "error"
268               If "readonly" is false:
269
270               The whole call is aborted with an error if any disk with the
271               <readonly/> flag is found.
272
273               If "readonly" is true:
274
275               Disks with the <readonly/> flag are added read-only.
276
277           readonlydisk = "read"
278               If "readonly" is false:
279
280               Disks with the <readonly/> flag are added read-only.  Other
281               disks are added read/write.
282
283               If "readonly" is true:
284
285               Disks with the <readonly/> flag are added read-only.
286
287           readonlydisk = "write" (default)
288               If "readonly" is false:
289
290               Disks with the <readonly/> flag are added read/write.
291
292               If "readonly" is true:
293
294               Disks with the <readonly/> flag are added read-only.
295
296           readonlydisk = "ignore"
297               If "readonly" is true or false:
298
299               Disks with the <readonly/> flag are skipped.
300
301           If present, the value of "logical_block_size" attribute of
302           <blockio/> tag in libvirt XML will be passed as "blocksize"
303           parameter to "$g->add_drive_opts".
304
305           The other optional parameters are passed directly through to
306           "$g->add_drive_opts".
307
308       $g->add_drive ($filename [, readonly => $readonly] [, format =>
309       $format] [, iface => $iface] [, name => $name] [, label => $label] [,
310       protocol => $protocol] [, server => $server] [, username => $username]
311       [, secret => $secret] [, cachemode => $cachemode] [, discard =>
312       $discard] [, copyonread => $copyonread] [, blocksize => $blocksize]);
313           This function adds a disk image called filename to the handle.
314           filename may be a regular host file or a host device.
315
316           When this function is called before "$g->launch" (the usual case)
317           then the first time you call this function, the disk appears in the
318           API as /dev/sda, the second time as /dev/sdb, and so on.
319
320           You don't necessarily need to be root when using libguestfs.
321           However you obviously do need sufficient permissions to access the
322           filename for whatever operations you want to perform (ie. read
323           access if you just want to read the image or write access if you
324           want to modify the image).
325
326           This call checks that filename exists.
327
328           filename may be the special string "/dev/null".  See "NULL DISKS"
329           in guestfs(3).
330
331           The optional arguments are:
332
333           "readonly"
334               If true then the image is treated as read-only.  Writes are
335               still allowed, but they are stored in a temporary snapshot
336               overlay which is discarded at the end.  The disk that you add
337               is not modified.
338
339           "format"
340               This forces the image format.  If you omit this (or use
341               "$g->add_drive" or "$g->add_drive_ro") then the format is
342               automatically detected.  Possible formats include "raw" and
343               "qcow2".
344
345               Automatic detection of the format opens you up to a potential
346               security hole when dealing with untrusted raw-format images.
347               See CVE-2010-3851 and RHBZ#642934.  Specifying the format
348               closes this security hole.
349
350           "iface"
351               This rarely-used option lets you emulate the behaviour of the
352               deprecated "$g->add_drive_with_if" call (q.v.)
353
354           "name"
355               This field used to be passed as a hint for guest inspection,
356               but it is no longer used.
357
358           "label"
359               Give the disk a label.  The label should be a unique, short
360               string using only ASCII characters "[a-zA-Z]".  As well as its
361               usual name in the API (such as /dev/sda), the drive will also
362               be named /dev/disk/guestfs/label.
363
364               See "DISK LABELS" in guestfs(3).
365
366           "protocol"
367               The optional protocol argument can be used to select an
368               alternate source protocol.
369
370               See also: "REMOTE STORAGE" in guestfs(3).
371
372               "protocol = "file""
373                   filename is interpreted as a local file or device.  This is
374                   the default if the optional protocol parameter is omitted.
375
376               "protocol = "ftp"|"ftps"|"http"|"https"|"tftp""
377                   Connect to a remote FTP, HTTP or TFTP server.  The "server"
378                   parameter must also be supplied - see below.
379
380                   See also: "FTP, HTTP AND TFTP" in guestfs(3)
381
382               "protocol = "gluster""
383                   Connect to the GlusterFS server.  The "server" parameter
384                   must also be supplied - see below.
385
386                   See also: "GLUSTER" in guestfs(3)
387
388               "protocol = "iscsi""
389                   Connect to the iSCSI server.  The "server" parameter must
390                   also be supplied - see below.  The "username" parameter may
391                   be supplied.  See below.  The "secret" parameter may be
392                   supplied.  See below.
393
394                   See also: "ISCSI" in guestfs(3).
395
396               "protocol = "nbd""
397                   Connect to the Network Block Device server.  The "server"
398                   parameter must also be supplied - see below.
399
400                   See also: "NETWORK BLOCK DEVICE" in guestfs(3).
401
402               "protocol = "rbd""
403                   Connect to the Ceph (librbd/RBD) server.  The "server"
404                   parameter must also be supplied - see below.  The
405                   "username" parameter may be supplied.  See below.  The
406                   "secret" parameter may be supplied.  See below.
407
408                   See also: "CEPH" in guestfs(3).
409
410               "protocol = "sheepdog""
411                   Connect to the Sheepdog server.  The "server" parameter may
412                   also be supplied - see below.
413
414                   See also: "SHEEPDOG" in guestfs(3).
415
416               "protocol = "ssh""
417                   Connect to the Secure Shell (ssh) server.
418
419                   The "server" parameter must be supplied.  The "username"
420                   parameter may be supplied.  See below.
421
422                   See also: "SSH" in guestfs(3).
423
424           "server"
425               For protocols which require access to a remote server, this is
426               a list of server(s).
427
428                Protocol       Number of servers required
429                --------       --------------------------
430                file           List must be empty or param not used at all
431                ftp|ftps|http|https|tftp  Exactly one
432                gluster        Exactly one
433                iscsi          Exactly one
434                nbd            Exactly one
435                rbd            Zero or more
436                sheepdog       Zero or more
437                ssh            Exactly one
438
439               Each list element is a string specifying a server.  The string
440               must be in one of the following formats:
441
442                hostname
443                hostname:port
444                tcp:hostname
445                tcp:hostname:port
446                unix:/path/to/socket
447
448               If the port number is omitted, then the standard port number
449               for the protocol is used (see /etc/services).
450
451           "username"
452               For the "ftp", "ftps", "http", "https", "iscsi", "rbd", "ssh"
453               and "tftp" protocols, this specifies the remote username.
454
455               If not given, then the local username is used for "ssh", and no
456               authentication is attempted for ceph.  But note this sometimes
457               may give unexpected results, for example if using the libvirt
458               backend and if the libvirt backend is configured to start the
459               qemu appliance as a special user such as "qemu.qemu".  If in
460               doubt, specify the remote username you want.
461
462           "secret"
463               For the "rbd" protocol only, this specifies the XsecretX to use
464               when connecting to the remote device.  It must be base64
465               encoded.
466
467               If not given, then a secret matching the given username will be
468               looked up in the default keychain locations, or if no username
469               is given, then no authentication will be used.
470
471           "cachemode"
472               Choose whether or not libguestfs will obey sync operations
473               (safe but slow) or not (unsafe but fast).  The possible values
474               for this string are:
475
476               "cachemode = "writeback""
477                   This is the default.
478
479                   Write operations in the API do not return until a write(2)
480                   call has completed in the host [but note this does not
481                   imply that anything gets written to disk].
482
483                   Sync operations in the API, including implicit syncs caused
484                   by filesystem journalling, will not return until an
485                   fdatasync(2) call has completed in the host, indicating
486                   that data has been committed to disk.
487
488               "cachemode = "unsafe""
489                   In this mode, there are no guarantees.  Libguestfs may
490                   cache anything and ignore sync requests.  This is suitable
491                   only for scratch or temporary disks.
492
493           "discard"
494               Enable or disable discard (a.k.a. trim or unmap) support on
495               this drive.  If enabled, operations such as "$g->fstrim" will
496               be able to discard / make thin / punch holes in the underlying
497               host file or device.
498
499               Possible discard settings are:
500
501               "discard = "disable""
502                   Disable discard support.  This is the default.
503
504               "discard = "enable""
505                   Enable discard support.  Fail if discard is not possible.
506
507               "discard = "besteffort""
508                   Enable discard support if possible, but don't fail if it is
509                   not supported.
510
511                   Since not all backends and not all underlying systems
512                   support discard, this is a good choice if you want to use
513                   discard if possible, but don't mind if it doesn't work.
514
515           "copyonread"
516               The boolean parameter "copyonread" enables copy-on-read
517               support.  This only affects disk formats which have backing
518               files, and causes reads to be stored in the overlay layer,
519               speeding up multiple reads of the same area of disk.
520
521               The default is false.
522
523           "blocksize"
524               This parameter sets the sector size of the disk.  Possible
525               values are 512 (the default if the parameter is omitted) or
526               4096.  Use 4096 when handling an "Advanced Format" disk that
527               uses 4K sector size
528               (<https://en.wikipedia.org/wiki/Advanced_Format>).
529
530               Only a subset of the backends support this parameter (currently
531               only the libvirt and direct backends do).
532
533       $g->add_drive_opts ($filename [, readonly => $readonly] [, format =>
534       $format] [, iface => $iface] [, name => $name] [, label => $label] [,
535       protocol => $protocol] [, server => $server] [, username => $username]
536       [, secret => $secret] [, cachemode => $cachemode] [, discard =>
537       $discard] [, copyonread => $copyonread] [, blocksize => $blocksize]);
538           This is an alias of "add_drive".
539
540       $g->add_drive_ro ($filename);
541           This function is the equivalent of calling "$g->add_drive_opts"
542           with the optional parameter "GUESTFS_ADD_DRIVE_OPTS_READONLY" set
543           to 1, so the disk is added read-only, with the format being
544           detected automatically.
545
546       $g->add_drive_ro_with_if ($filename, $iface);
547           This is the same as "$g->add_drive_ro" but it allows you to specify
548           the QEMU interface emulation to use at run time.
549
550           This function is deprecated.  In new code, use the "add_drive" call
551           instead.
552
553           Deprecated functions will not be removed from the API, but the fact
554           that they are deprecated indicates that there are problems with
555           correct use of these functions.
556
557       $g->add_drive_scratch ($size [, name => $name] [, label => $label] [,
558       blocksize => $blocksize]);
559           This command adds a temporary scratch drive to the handle.  The
560           "size" parameter is the virtual size (in bytes).  The scratch drive
561           is blank initially (all reads return zeroes until you start writing
562           to it).  The drive is deleted when the handle is closed.
563
564           The optional arguments "name", "label" and "blocksize" are passed
565           through to "$g->add_drive_opts".
566
567       $g->add_drive_with_if ($filename, $iface);
568           This is the same as "$g->add_drive" but it allows you to specify
569           the QEMU interface emulation to use at run time.
570
571           This function is deprecated.  In new code, use the "add_drive" call
572           instead.
573
574           Deprecated functions will not be removed from the API, but the fact
575           that they are deprecated indicates that there are problems with
576           correct use of these functions.
577
578       $nrdisks = $g->add_libvirt_dom ($dom [, readonly => $readonly] [, iface
579       => $iface] [, live => $live] [, readonlydisk => $readonlydisk] [,
580       cachemode => $cachemode] [, discard => $discard] [, copyonread =>
581       $copyonread]);
582           This function adds the disk(s) attached to the libvirt domain
583           "dom".  It works by requesting the domain XML from libvirt, parsing
584           it for disks, and calling "$g->add_drive_opts" on each one.
585
586           In the C API we declare "void *dom", but really it has type
587           "virDomainPtr dom".  This is so we don't need <libvirt.h>.
588
589           The number of disks added is returned.  This operation is atomic:
590           if an error is returned, then no disks are added.
591
592           This function does some minimal checks to make sure the libvirt
593           domain is not running (unless "readonly" is true).  In a future
594           version we will try to acquire the libvirt lock on each disk.
595
596           Disks must be accessible locally.  This often means that adding
597           disks from a remote libvirt connection (see
598           <https://libvirt.org/remote.html>) will fail unless those disks are
599           accessible via the same device path locally too.
600
601           The optional "live" flag is ignored in libguestfs X 1.48.
602
603           The optional "readonlydisk" parameter controls what we do for disks
604           which are marked <readonly/> in the libvirt XML.  See
605           "$g->add_domain" for possible values.
606
607           If present, the value of "logical_block_size" attribute of
608           <blockio/> tag in libvirt XML will be passed as "blocksize"
609           parameter to "$g->add_drive_opts".
610
611           The other optional parameters are passed directly through to
612           "$g->add_drive_opts".
613
614       $g->aug_clear ($augpath);
615           Set the value associated with "path" to "NULL".  This is the same
616           as the augtool(1) "clear" command.
617
618       $g->aug_close ();
619           Close the current Augeas handle and free up any resources used by
620           it.  After calling this, you have to call "$g->aug_init" again
621           before you can use any other Augeas functions.
622
623       %nrnodescreated = $g->aug_defnode ($name, $expr, $val);
624           Defines a variable "name" whose value is the result of evaluating
625           "expr".
626
627           If "expr" evaluates to an empty nodeset, a node is created,
628           equivalent to calling "$g->aug_set" "expr", "val".  "name" will be
629           the nodeset containing that single node.
630
631           On success this returns a pair containing the number of nodes in
632           the nodeset, and a boolean flag if a node was created.
633
634       $nrnodes = $g->aug_defvar ($name, $expr);
635           Defines an Augeas variable "name" whose value is the result of
636           evaluating "expr".  If "expr" is NULL, then "name" is undefined.
637
638           On success this returns the number of nodes in "expr", or 0 if
639           "expr" evaluates to something which is not a nodeset.
640
641       $val = $g->aug_get ($augpath);
642           Look up the value associated with "path".  If "path" matches
643           exactly one node, the "value" is returned.
644
645       $g->aug_init ($root, $flags);
646           Create a new Augeas handle for editing configuration files.  If
647           there was any previous Augeas handle associated with this guestfs
648           session, then it is closed.
649
650           You must call this before using any other "$g->aug_*" commands.
651
652           "root" is the filesystem root.  "root" must not be NULL, use /
653           instead.
654
655           The flags are the same as the flags defined in <augeas.h>, the
656           logical or of the following integers:
657
658           "AUG_SAVE_BACKUP" = 1
659               Keep the original file with a ".augsave" extension.
660
661           "AUG_SAVE_NEWFILE" = 2
662               Save changes into a file with extension ".augnew", and do not
663               overwrite original.  Overrides "AUG_SAVE_BACKUP".
664
665           "AUG_TYPE_CHECK" = 4
666               Typecheck lenses.
667
668               This option is only useful when debugging Augeas lenses.  Use
669               of this option may require additional memory for the libguestfs
670               appliance.  You may need to set the "LIBGUESTFS_MEMSIZE"
671               environment variable or call "$g->set_memsize".
672
673           "AUG_NO_STDINC" = 8
674               Do not use standard load path for modules.
675
676           "AUG_SAVE_NOOP" = 16
677               Make save a no-op, just record what would have been changed.
678
679           "AUG_NO_LOAD" = 32
680               Do not load the tree in "$g->aug_init".
681
682           To close the handle, you can call "$g->aug_close".
683
684           To find out more about Augeas, see <http://augeas.net/>.
685
686       $g->aug_insert ($augpath, $label, $before);
687           Create a new sibling "label" for "path", inserting it into the tree
688           before or after "path" (depending on the boolean flag "before").
689
690           "path" must match exactly one existing node in the tree, and
691           "label" must be a label, ie. not contain /, "*" or end with a
692           bracketed index "[N]".
693
694       $label = $g->aug_label ($augpath);
695           The label (name of the last element) of the Augeas path expression
696           "augpath" is returned.  "augpath" must match exactly one node, else
697           this function returns an error.
698
699       $g->aug_load ();
700           Load files into the tree.
701
702           See "aug_load" in the Augeas documentation for the full gory
703           details.
704
705       @matches = $g->aug_ls ($augpath);
706           This is just a shortcut for listing "$g->aug_match" "path/*" and
707           sorting the resulting nodes into alphabetical order.
708
709       @matches = $g->aug_match ($augpath);
710           Returns a list of paths which match the path expression "path".
711           The returned paths are sufficiently qualified so that they match
712           exactly one node in the current tree.
713
714       $g->aug_mv ($src, $dest);
715           Move the node "src" to "dest".  "src" must match exactly one node.
716           "dest" is overwritten if it exists.
717
718       $nrnodes = $g->aug_rm ($augpath);
719           Remove "path" and all of its children.
720
721           On success this returns the number of entries which were removed.
722
723       $g->aug_save ();
724           This writes all pending changes to disk.
725
726           The flags which were passed to "$g->aug_init" affect exactly how
727           files are saved.
728
729       $g->aug_set ($augpath, $val);
730           Set the value associated with "augpath" to "val".
731
732           In the Augeas API, it is possible to clear a node by setting the
733           value to NULL.  Due to an oversight in the libguestfs API you
734           cannot do that with this call.  Instead you must use the
735           "$g->aug_clear" call.
736
737       $nodes = $g->aug_setm ($base, $sub, $val);
738           Change multiple Augeas nodes in a single operation.  "base" is an
739           expression matching multiple nodes.  "sub" is a path expression
740           relative to "base".  All nodes matching "base" are found, and then
741           for each node, "sub" is changed to "val".  "sub" may also be "NULL"
742           in which case the "base" nodes are modified.
743
744           This returns the number of nodes modified.
745
746       $g->aug_transform ($lens, $file [, remove => $remove]);
747           Add an Augeas transformation for the specified "lens" so it can
748           handle "file".
749
750           If "remove" is true ("false" by default), then the transformation
751           is removed.
752
753       $g->available (\@groups);
754           This command is used to check the availability of some groups of
755           functionality in the appliance, which not all builds of the
756           libguestfs appliance will be able to provide.
757
758           The libguestfs groups, and the functions that those groups
759           correspond to, are listed in "AVAILABILITY" in guestfs(3).  You can
760           also fetch this list at runtime by calling
761           "$g->available_all_groups".
762
763           The argument "groups" is a list of group names, eg: "["inotify",
764           "augeas"]" would check for the availability of the Linux inotify
765           functions and Augeas (configuration file editing) functions.
766
767           The command returns no error if all requested groups are available.
768
769           It fails with an error if one or more of the requested groups is
770           unavailable in the appliance.
771
772           If an unknown group name is included in the list of groups then an
773           error is always returned.
774
775           Notes:
776
777           •   "$g->feature_available" is the same as this call, but with a
778               slightly simpler to use API: that call returns a boolean
779               true/false instead of throwing an error.
780
781           •   You must call "$g->launch" before calling this function.
782
783               The reason is because we don't know what groups are supported
784               by the appliance/daemon until it is running and can be queried.
785
786           •   If a group of functions is available, this does not necessarily
787               mean that they will work.  You still have to check for errors
788               when calling individual API functions even if they are
789               available.
790
791           •   It is usually the job of distro packagers to build complete
792               functionality into the libguestfs appliance.  Upstream
793               libguestfs, if built from source with all requirements
794               satisfied, will support everything.
795
796           •   This call was added in version 1.0.80.  In previous versions of
797               libguestfs all you could do would be to speculatively execute a
798               command to find out if the daemon implemented it.  See also
799               "$g->version".
800
801           See also "$g->filesystem_available".
802
803       @groups = $g->available_all_groups ();
804           This command returns a list of all optional groups that this daemon
805           knows about.  Note this returns both supported and unsupported
806           groups.  To find out which ones the daemon can actually support you
807           have to call "$g->available" / "$g->feature_available" on each
808           member of the returned list.
809
810           See also "$g->available", "$g->feature_available" and
811           "AVAILABILITY" in guestfs(3).
812
813       $g->base64_in ($base64file, $filename);
814           This command uploads base64-encoded data from "base64file" to
815           filename.
816
817       $g->base64_out ($filename, $base64file);
818           This command downloads the contents of filename, writing it out to
819           local file "base64file" encoded as base64.
820
821       $g->blkdiscard ($device);
822           This discards all blocks on the block device "device", giving the
823           free space back to the host.
824
825           This operation requires support in libguestfs, the host filesystem,
826           qemu and the host kernel.  If this support isn't present it may
827           give an error or even appear to run but do nothing.  You must also
828           set the "discard" attribute on the underlying drive (see
829           "$g->add_drive_opts").
830
831           This function depends on the feature "blkdiscard".  See also
832           "$g->feature-available".
833
834       $zeroes = $g->blkdiscardzeroes ($device);
835           This call returns true if blocks on "device" that have been
836           discarded by a call to "$g->blkdiscard" are returned as blocks of
837           zero bytes when read the next time.
838
839           If it returns false, then it may be that discarded blocks are read
840           as stale or random data.
841
842           This function depends on the feature "blkdiscardzeroes".  See also
843           "$g->feature-available".
844
845       %info = $g->blkid ($device);
846           This command returns block device attributes for "device". The
847           following fields are usually present in the returned hash. Other
848           fields may also be present.
849
850           "UUID"
851               The uuid of this device.
852
853           "LABEL"
854               The label of this device.
855
856           "VERSION"
857               The version of blkid command.
858
859           "TYPE"
860               The filesystem type or RAID of this device.
861
862           "USAGE"
863               The usage of this device, for example "filesystem" or "raid".
864
865       $g->blockdev_flushbufs ($device);
866           This tells the kernel to flush internal buffers associated with
867           "device".
868
869           This uses the blockdev(8) command.
870
871       $blocksize = $g->blockdev_getbsz ($device);
872           This returns the block size of a device.
873
874           Note: this is different from both size in blocks and filesystem
875           block size.  Also this setting is not really used by anything.  You
876           should probably not use it for anything.  Filesystems have their
877           own idea about what block size to choose.
878
879           This uses the blockdev(8) command.
880
881       $ro = $g->blockdev_getro ($device);
882           Returns a boolean indicating if the block device is read-only (true
883           if read-only, false if not).
884
885           This uses the blockdev(8) command.
886
887       $sizeinbytes = $g->blockdev_getsize64 ($device);
888           This returns the size of the device in bytes.
889
890           See also "$g->blockdev_getsz".
891
892           This uses the blockdev(8) command.
893
894       $sectorsize = $g->blockdev_getss ($device);
895           This returns the size of sectors on a block device.  Usually 512,
896           but can be larger for modern devices.
897
898           (Note, this is not the size in sectors, use "$g->blockdev_getsz"
899           for that).
900
901           This uses the blockdev(8) command.
902
903       $sizeinsectors = $g->blockdev_getsz ($device);
904           This returns the size of the device in units of 512-byte sectors
905           (even if the sectorsize isn't 512 bytes ... weird).
906
907           See also "$g->blockdev_getss" for the real sector size of the
908           device, and "$g->blockdev_getsize64" for the more useful size in
909           bytes.
910
911           This uses the blockdev(8) command.
912
913       $g->blockdev_rereadpt ($device);
914           Reread the partition table on "device".
915
916           This uses the blockdev(8) command.
917
918       $g->blockdev_setbsz ($device, $blocksize);
919           This call does nothing and has never done anything because of a bug
920           in blockdev.  Do not use it.
921
922           If you need to set the filesystem block size, use the "blocksize"
923           option of "$g->mkfs".
924
925           This function is deprecated.  There is no replacement.  Consult the
926           API documentation in guestfs(3) for further information.
927
928           Deprecated functions will not be removed from the API, but the fact
929           that they are deprecated indicates that there are problems with
930           correct use of these functions.
931
932       $g->blockdev_setra ($device, $sectors);
933           Set readahead (in 512-byte sectors) for the device.
934
935           This uses the blockdev(8) command.
936
937       $g->blockdev_setro ($device);
938           Sets the block device named "device" to read-only.
939
940           This uses the blockdev(8) command.
941
942       $g->blockdev_setrw ($device);
943           Sets the block device named "device" to read-write.
944
945           This uses the blockdev(8) command.
946
947       $g->btrfs_balance_cancel ($path);
948           Cancel a running balance on a btrfs filesystem.
949
950           This function depends on the feature "btrfs".  See also
951           "$g->feature-available".
952
953       $g->btrfs_balance_pause ($path);
954           Pause a running balance on a btrfs filesystem.
955
956           This function depends on the feature "btrfs".  See also
957           "$g->feature-available".
958
959       $g->btrfs_balance_resume ($path);
960           Resume a paused balance on a btrfs filesystem.
961
962           This function depends on the feature "btrfs".  See also
963           "$g->feature-available".
964
965       %status = $g->btrfs_balance_status ($path);
966           Show the status of a running or paused balance on a btrfs
967           filesystem.
968
969           This function depends on the feature "btrfs".  See also
970           "$g->feature-available".
971
972       $g->btrfs_device_add (\@devices, $fs);
973           Add the list of device(s) in "devices" to the btrfs filesystem
974           mounted at "fs".  If "devices" is an empty list, this does nothing.
975
976           This function depends on the feature "btrfs".  See also
977           "$g->feature-available".
978
979       $g->btrfs_device_delete (\@devices, $fs);
980           Remove the "devices" from the btrfs filesystem mounted at "fs".  If
981           "devices" is an empty list, this does nothing.
982
983           This function depends on the feature "btrfs".  See also
984           "$g->feature-available".
985
986       $g->btrfs_filesystem_balance ($fs);
987           Balance the chunks in the btrfs filesystem mounted at "fs" across
988           the underlying devices.
989
990           This function depends on the feature "btrfs".  See also
991           "$g->feature-available".
992
993       $g->btrfs_filesystem_defragment ($path [, flush => $flush] [, compress
994       => $compress]);
995           Defragment a file or directory on a btrfs filesystem. compress is
996           one of zlib or lzo.
997
998           This function depends on the feature "btrfs".  See also
999           "$g->feature-available".
1000
1001       $g->btrfs_filesystem_resize ($mountpoint [, size => $size]);
1002           This command resizes a btrfs filesystem.
1003
1004           Note that unlike other resize calls, the filesystem has to be
1005           mounted and the parameter is the mountpoint not the device (this is
1006           a requirement of btrfs itself).
1007
1008           The optional parameters are:
1009
1010           "size"
1011               The new size (in bytes) of the filesystem.  If omitted, the
1012               filesystem is resized to the maximum size.
1013
1014           See also btrfs(8).
1015
1016           This function depends on the feature "btrfs".  See also
1017           "$g->feature-available".
1018
1019       @devices = $g->btrfs_filesystem_show ($device);
1020           Show all the devices where the filesystems in "device" is spanned
1021           over.
1022
1023           If not all the devices for the filesystems are present, then this
1024           function fails and the "errno" is set to "ENODEV".
1025
1026           This function depends on the feature "btrfs".  See also
1027           "$g->feature-available".
1028
1029       $g->btrfs_filesystem_sync ($fs);
1030           Force sync on the btrfs filesystem mounted at "fs".
1031
1032           This function depends on the feature "btrfs".  See also
1033           "$g->feature-available".
1034
1035       $g->btrfs_fsck ($device [, superblock => $superblock] [, repair =>
1036       $repair]);
1037           Used to check a btrfs filesystem, "device" is the device file where
1038           the filesystem is stored.
1039
1040           This function depends on the feature "btrfs".  See also
1041           "$g->feature-available".
1042
1043       $g->btrfs_image (\@source, $image [, compresslevel => $compresslevel]);
1044           This is used to create an image of a btrfs filesystem.  All data
1045           will be zeroed, but metadata and the like is preserved.
1046
1047           This function depends on the feature "btrfs".  See also
1048           "$g->feature-available".
1049
1050       $g->btrfs_qgroup_assign ($src, $dst, $path);
1051           Add qgroup "src" to parent qgroup "dst". This command can group
1052           several qgroups into a parent qgroup to share common limit.
1053
1054           This function depends on the feature "btrfs".  See also
1055           "$g->feature-available".
1056
1057       $g->btrfs_qgroup_create ($qgroupid, $subvolume);
1058           Create a quota group (qgroup) for subvolume at "subvolume".
1059
1060           This function depends on the feature "btrfs".  See also
1061           "$g->feature-available".
1062
1063       $g->btrfs_qgroup_destroy ($qgroupid, $subvolume);
1064           Destroy a quota group.
1065
1066           This function depends on the feature "btrfs".  See also
1067           "$g->feature-available".
1068
1069       $g->btrfs_qgroup_limit ($subvolume, $size);
1070           Limit the size of the subvolume with path "subvolume".
1071
1072           This function depends on the feature "btrfs".  See also
1073           "$g->feature-available".
1074
1075       $g->btrfs_qgroup_remove ($src, $dst, $path);
1076           Remove qgroup "src" from the parent qgroup "dst".
1077
1078           This function depends on the feature "btrfs".  See also
1079           "$g->feature-available".
1080
1081       @qgroups = $g->btrfs_qgroup_show ($path);
1082           Show all subvolume quota groups in a btrfs filesystem, including
1083           their usages.
1084
1085           This function depends on the feature "btrfs".  See also
1086           "$g->feature-available".
1087
1088       $g->btrfs_quota_enable ($fs, $enable);
1089           Enable or disable subvolume quota support for filesystem which
1090           contains "path".
1091
1092           This function depends on the feature "btrfs".  See also
1093           "$g->feature-available".
1094
1095       $g->btrfs_quota_rescan ($fs);
1096           Trash all qgroup numbers and scan the metadata again with the
1097           current config.
1098
1099           This function depends on the feature "btrfs".  See also
1100           "$g->feature-available".
1101
1102       $g->btrfs_replace ($srcdev, $targetdev, $mntpoint);
1103           Replace device of a btrfs filesystem. On a live filesystem,
1104           duplicate the data to the target device which is currently stored
1105           on the source device.  After completion of the operation, the
1106           source device is wiped out and removed from the filesystem.
1107
1108           The "targetdev" needs to be same size or larger than the "srcdev".
1109           Devices which are currently mounted are never allowed to be used as
1110           the "targetdev".
1111
1112           This function depends on the feature "btrfs".  See also
1113           "$g->feature-available".
1114
1115       $g->btrfs_rescue_chunk_recover ($device);
1116           Recover the chunk tree of btrfs filesystem by scanning the devices
1117           one by one.
1118
1119           This function depends on the feature "btrfs".  See also
1120           "$g->feature-available".
1121
1122       $g->btrfs_rescue_super_recover ($device);
1123           Recover bad superblocks from good copies.
1124
1125           This function depends on the feature "btrfs".  See also
1126           "$g->feature-available".
1127
1128       $g->btrfs_scrub_cancel ($path);
1129           Cancel a running scrub on a btrfs filesystem.
1130
1131           This function depends on the feature "btrfs".  See also
1132           "$g->feature-available".
1133
1134       $g->btrfs_scrub_resume ($path);
1135           Resume a previously canceled or interrupted scrub on a btrfs
1136           filesystem.
1137
1138           This function depends on the feature "btrfs".  See also
1139           "$g->feature-available".
1140
1141       $g->btrfs_scrub_start ($path);
1142           Reads all the data and metadata on the filesystem, and uses
1143           checksums and the duplicate copies from RAID storage to identify
1144           and repair any corrupt data.
1145
1146           This function depends on the feature "btrfs".  See also
1147           "$g->feature-available".
1148
1149       %status = $g->btrfs_scrub_status ($path);
1150           Show status of running or finished scrub on a btrfs filesystem.
1151
1152           This function depends on the feature "btrfs".  See also
1153           "$g->feature-available".
1154
1155       $g->btrfs_set_seeding ($device, $seeding);
1156           Enable or disable the seeding feature of a device that contains a
1157           btrfs filesystem.
1158
1159           This function depends on the feature "btrfs".  See also
1160           "$g->feature-available".
1161
1162       $g->btrfs_subvolume_create ($dest [, qgroupid => $qgroupid]);
1163           Create a btrfs subvolume.  The "dest" argument is the destination
1164           directory and the name of the subvolume, in the form
1165           /path/to/dest/name.  The optional parameter "qgroupid" represents
1166           the qgroup which the newly created subvolume will be added to.
1167
1168           This function depends on the feature "btrfs".  See also
1169           "$g->feature-available".
1170
1171       $g->btrfs_subvolume_create_opts ($dest [, qgroupid => $qgroupid]);
1172           This is an alias of "btrfs_subvolume_create".
1173
1174       $g->btrfs_subvolume_delete ($subvolume);
1175           Delete the named btrfs subvolume or snapshot.
1176
1177           This function depends on the feature "btrfs".  See also
1178           "$g->feature-available".
1179
1180       $id = $g->btrfs_subvolume_get_default ($fs);
1181           Get the default subvolume or snapshot of a filesystem mounted at
1182           "mountpoint".
1183
1184           This function depends on the feature "btrfs".  See also
1185           "$g->feature-available".
1186
1187       @subvolumes = $g->btrfs_subvolume_list ($fs);
1188           List the btrfs snapshots and subvolumes of the btrfs filesystem
1189           which is mounted at "fs".
1190
1191           This function depends on the feature "btrfs".  See also
1192           "$g->feature-available".
1193
1194       $g->btrfs_subvolume_set_default ($id, $fs);
1195           Set the subvolume of the btrfs filesystem "fs" which will be
1196           mounted by default.  See "$g->btrfs_subvolume_list" to get a list
1197           of subvolumes.
1198
1199           This function depends on the feature "btrfs".  See also
1200           "$g->feature-available".
1201
1202       %btrfssubvolumeinfo = $g->btrfs_subvolume_show ($subvolume);
1203           Return detailed information of the subvolume.
1204
1205           This function depends on the feature "btrfs".  See also
1206           "$g->feature-available".
1207
1208       $g->btrfs_subvolume_snapshot ($source, $dest [, ro => $ro] [, qgroupid
1209       => $qgroupid]);
1210           Create a snapshot of the btrfs subvolume "source".  The "dest"
1211           argument is the destination directory and the name of the snapshot,
1212           in the form /path/to/dest/name. By default the newly created
1213           snapshot is writable, if the value of optional parameter "ro" is
1214           true, then a readonly snapshot is created. The optional parameter
1215           "qgroupid" represents the qgroup which the newly created snapshot
1216           will be added to.
1217
1218           This function depends on the feature "btrfs".  See also
1219           "$g->feature-available".
1220
1221       $g->btrfs_subvolume_snapshot_opts ($source, $dest [, ro => $ro] [,
1222       qgroupid => $qgroupid]);
1223           This is an alias of "btrfs_subvolume_snapshot".
1224
1225       $g->btrfstune_enable_extended_inode_refs ($device);
1226           This will Enable extended inode refs.
1227
1228           This function depends on the feature "btrfs".  See also
1229           "$g->feature-available".
1230
1231       $g->btrfstune_enable_skinny_metadata_extent_refs ($device);
1232           This enable skinny metadata extent refs.
1233
1234           This function depends on the feature "btrfs".  See also
1235           "$g->feature-available".
1236
1237       $g->btrfstune_seeding ($device, $seeding);
1238           Enable seeding of a btrfs device, this will force a fs readonly so
1239           that you can use it to build other filesystems.
1240
1241           This function depends on the feature "btrfs".  See also
1242           "$g->feature-available".
1243
1244       $ptr = $g->c_pointer ();
1245           In non-C language bindings, this allows you to retrieve the
1246           underlying C pointer to the handle (ie. "$g->h *").  The purpose of
1247           this is to allow other libraries to interwork with libguestfs.
1248
1249       $canonical = $g->canonical_device_name ($device);
1250           This utility function is useful when displaying device names to the
1251           user.  It takes a number of irregular device names and returns them
1252           in a consistent format:
1253
1254           /dev/hdX
1255           /dev/vdX
1256               These are returned as /dev/sdX.  Note this works for device
1257               names and partition names.  This is approximately the reverse
1258               of the algorithm described in "BLOCK DEVICE NAMING" in
1259               guestfs(3).
1260
1261           /dev/mapper/VG-LV
1262           /dev/dm-N
1263               Converted to /dev/VG/LV form using "$g->lvm_canonical_lv_name".
1264
1265           Other strings are returned unmodified.
1266
1267       $cap = $g->cap_get_file ($path);
1268           This function returns the Linux capabilities attached to "path".
1269           The capabilities set is returned in text form (see cap_to_text(3)).
1270
1271           If no capabilities are attached to a file, an empty string is
1272           returned.
1273
1274           This function depends on the feature "linuxcaps".  See also
1275           "$g->feature-available".
1276
1277       $g->cap_set_file ($path, $cap);
1278           This function sets the Linux capabilities attached to "path".  The
1279           capabilities set "cap" should be passed in text form (see
1280           cap_from_text(3)).
1281
1282           This function depends on the feature "linuxcaps".  See also
1283           "$g->feature-available".
1284
1285       $rpath = $g->case_sensitive_path ($path);
1286           This can be used to resolve case insensitive paths on a filesystem
1287           which is case sensitive.  The use case is to resolve paths which
1288           you have read from Windows configuration files or the Windows
1289           Registry, to the true path.
1290
1291           The command handles a peculiarity of the Linux ntfs-3g filesystem
1292           driver (and probably others), which is that although the underlying
1293           filesystem is case-insensitive, the driver exports the filesystem
1294           to Linux as case-sensitive.
1295
1296           One consequence of this is that special directories such as
1297           C:\windows may appear as /WINDOWS or /windows (or other things)
1298           depending on the precise details of how they were created.  In
1299           Windows itself this would not be a problem.
1300
1301           Bug or feature?  You decide:
1302           <https://www.tuxera.com/community/ntfs-3g-faq/#posixfilenames1>
1303
1304           "$g->case_sensitive_path" attempts to resolve the true case of each
1305           element in the path. It will return a resolved path if either the
1306           full path or its parent directory exists. If the parent directory
1307           exists but the full path does not, the case of the parent directory
1308           will be correctly resolved, and the remainder appended unmodified.
1309           For example, if the file "/Windows/System32/netkvm.sys" exists:
1310
1311           "$g->case_sensitive_path" ("/windows/system32/netkvm.sys")
1312               "Windows/System32/netkvm.sys"
1313
1314           "$g->case_sensitive_path" ("/windows/system32/NoSuchFile")
1315               "Windows/System32/NoSuchFile"
1316
1317           "$g->case_sensitive_path" ("/windows/system33/netkvm.sys")
1318               ERROR
1319
1320           Note: Because of the above behaviour, "$g->case_sensitive_path"
1321           cannot be used to check for the existence of a file.
1322
1323           Note: This function does not handle drive names, backslashes etc.
1324
1325           See also "$g->realpath".
1326
1327       $content = $g->cat ($path);
1328           Return the contents of the file named "path".
1329
1330           Because, in C, this function returns a "char *", there is no way to
1331           differentiate between a "\0" character in a file and end of string.
1332           To handle binary files, use the "$g->read_file" or "$g->download"
1333           functions.
1334
1335       $checksum = $g->checksum ($csumtype, $path);
1336           This call computes the MD5, SHAx or CRC checksum of the file named
1337           "path".
1338
1339           The type of checksum to compute is given by the "csumtype"
1340           parameter which must have one of the following values:
1341
1342           "crc"
1343               Compute the cyclic redundancy check (CRC) specified by POSIX
1344               for the "cksum" command.
1345
1346           "md5"
1347               Compute the MD5 hash (using the md5sum(1) program).
1348
1349           "sha1"
1350               Compute the SHA1 hash (using the sha1sum(1) program).
1351
1352           "sha224"
1353               Compute the SHA224 hash (using the sha224sum(1) program).
1354
1355           "sha256"
1356               Compute the SHA256 hash (using the sha256sum(1) program).
1357
1358           "sha384"
1359               Compute the SHA384 hash (using the sha384sum(1) program).
1360
1361           "sha512"
1362               Compute the SHA512 hash (using the sha512sum(1) program).
1363
1364           The checksum is returned as a printable string.
1365
1366           To get the checksum for a device, use "$g->checksum_device".
1367
1368           To get the checksums for many files, use "$g->checksums_out".
1369
1370       $checksum = $g->checksum_device ($csumtype, $device);
1371           This call computes the MD5, SHAx or CRC checksum of the contents of
1372           the device named "device".  For the types of checksums supported
1373           see the "$g->checksum" command.
1374
1375       $g->checksums_out ($csumtype, $directory, $sumsfile);
1376           This command computes the checksums of all regular files in
1377           directory and then emits a list of those checksums to the local
1378           output file "sumsfile".
1379
1380           This can be used for verifying the integrity of a virtual machine.
1381           However to be properly secure you should pay attention to the
1382           output of the checksum command (it uses the ones from GNU
1383           coreutils).  In particular when the filename is not printable,
1384           coreutils uses a special backslash syntax.  For more information,
1385           see the GNU coreutils info file.
1386
1387       $g->chmod ($mode, $path);
1388           Change the mode (permissions) of "path" to "mode".  Only numeric
1389           modes are supported.
1390
1391           Note: When using this command from guestfish, "mode" by default
1392           would be decimal, unless you prefix it with 0 to get octal, ie. use
1393           0700 not 700.
1394
1395           The mode actually set is affected by the umask.
1396
1397       $g->chown ($owner, $group, $path);
1398           Change the file owner to "owner" and group to "group".
1399
1400           Only numeric uid and gid are supported.  If you want to use names,
1401           you will need to locate and parse the password file yourself
1402           (Augeas support makes this relatively easy).
1403
1404       $count = $g->clear_backend_setting ($name);
1405           If there is a backend setting string matching "name" or beginning
1406           with "name=", then that string is removed from the backend
1407           settings.
1408
1409           This call returns the number of strings which were removed (which
1410           may be 0, 1 or greater than 1).
1411
1412           See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
1413
1414       $output = $g->command (\@arguments);
1415           This call runs a command from the guest filesystem.  The filesystem
1416           must be mounted, and must contain a compatible operating system
1417           (ie. something Linux, with the same or compatible processor
1418           architecture).
1419
1420           The single parameter is an argv-style list of arguments.  The first
1421           element is the name of the program to run.  Subsequent elements are
1422           parameters.  The list must be non-empty (ie. must contain a program
1423           name).  Note that the command runs directly, and is not invoked via
1424           the shell (see "$g->sh").
1425
1426           The return value is anything printed to stdout by the command.
1427
1428           If the command returns a non-zero exit status, then this function
1429           returns an error message.  The error message string is the content
1430           of stderr from the command.
1431
1432           The $PATH environment variable will contain at least /usr/bin and
1433           /bin.  If you require a program from another location, you should
1434           provide the full path in the first parameter.
1435
1436           Shared libraries and data files required by the program must be
1437           available on filesystems which are mounted in the correct places.
1438           It is the callerXs responsibility to ensure all filesystems that
1439           are needed are mounted at the right locations.
1440
1441           Because of the message protocol, there is a transfer limit of
1442           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
1443           guestfs(3).
1444
1445       @lines = $g->command_lines (\@arguments);
1446           This is the same as "$g->command", but splits the result into a
1447           list of lines.
1448
1449           See also: "$g->sh_lines"
1450
1451           Because of the message protocol, there is a transfer limit of
1452           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
1453           guestfs(3).
1454
1455       $g->compress_device_out ($ctype, $device, $zdevice [, level =>
1456       $level]);
1457           This command compresses "device" and writes it out to the local
1458           file "zdevice".
1459
1460           The "ctype" and optional "level" parameters have the same meaning
1461           as in "$g->compress_out".
1462
1463       $g->compress_out ($ctype, $file, $zfile [, level => $level]);
1464           This command compresses file and writes it out to the local file
1465           zfile.
1466
1467           The compression program used is controlled by the "ctype"
1468           parameter.  Currently this includes: "compress", "gzip", "bzip2",
1469           "xz" or "lzop".  Some compression types may not be supported by
1470           particular builds of libguestfs, in which case you will get an
1471           error containing the substring "not supported".
1472
1473           The optional "level" parameter controls compression level.  The
1474           meaning and default for this parameter depends on the compression
1475           program being used.
1476
1477       $g->config ($hvparam, $hvvalue);
1478           This can be used to add arbitrary hypervisor parameters of the form
1479           -param value.  Actually itXs not quite arbitrary - we prevent you
1480           from setting some parameters which would interfere with parameters
1481           that we use.
1482
1483           The first character of "hvparam" string must be a "-" (dash).
1484
1485           "hvvalue" can be NULL.
1486
1487       $g->copy_attributes ($src, $dest [, all => $all] [, mode => $mode] [,
1488       xattributes => $xattributes] [, ownership => $ownership]);
1489           Copy the attributes of a path (which can be a file or a directory)
1490           to another path.
1491
1492           By default no attribute is copied, so make sure to specify any (or
1493           "all" to copy everything).
1494
1495           The optional arguments specify which attributes can be copied:
1496
1497           "mode"
1498               Copy part of the file mode from "source" to "destination". Only
1499               the UNIX permissions and the sticky/setuid/setgid bits can be
1500               copied.
1501
1502           "xattributes"
1503               Copy the Linux extended attributes (xattrs) from "source" to
1504               "destination".  This flag does nothing if the linuxxattrs
1505               feature is not available (see "$g->feature_available").
1506
1507           "ownership"
1508               Copy the owner uid and the group gid of "source" to
1509               "destination".
1510
1511           "all"
1512               Copy all the attributes from "source" to "destination".
1513               Enabling it enables all the other flags, if they are not
1514               specified already.
1515
1516       $g->copy_device_to_device ($src, $dest [, srcoffset => $srcoffset] [,
1517       destoffset => $destoffset] [, size => $size] [, sparse => $sparse] [,
1518       append => $append]);
1519           The four calls "$g->copy_device_to_device",
1520           "$g->copy_device_to_file", "$g->copy_file_to_device", and
1521           "$g->copy_file_to_file" let you copy from a source (device|file) to
1522           a destination (device|file).
1523
1524           Partial copies can be made since you can specify optionally the
1525           source offset, destination offset and size to copy.  These values
1526           are all specified in bytes.  If not given, the offsets both default
1527           to zero, and the size defaults to copying as much as possible until
1528           we hit the end of the source.
1529
1530           The source and destination may be the same object.  However
1531           overlapping regions may not be copied correctly.
1532
1533           If the destination is a file, it is created if required.  If the
1534           destination file is not large enough, it is extended.
1535
1536           If the destination is a file and the "append" flag is not set, then
1537           the destination file is truncated.  If the "append" flag is set,
1538           then the copy appends to the destination file.  The "append" flag
1539           currently cannot be set for devices.
1540
1541           If the "sparse" flag is true then the call avoids writing blocks
1542           that contain only zeroes, which can help in some situations where
1543           the backing disk is thin-provisioned.  Note that unless the target
1544           is already zeroed, using this option will result in incorrect
1545           copying.
1546
1547       $g->copy_device_to_file ($src, $dest [, srcoffset => $srcoffset] [,
1548       destoffset => $destoffset] [, size => $size] [, sparse => $sparse] [,
1549       append => $append]);
1550           See "$g->copy_device_to_device" for a general overview of this
1551           call.
1552
1553       $g->copy_file_to_device ($src, $dest [, srcoffset => $srcoffset] [,
1554       destoffset => $destoffset] [, size => $size] [, sparse => $sparse] [,
1555       append => $append]);
1556           See "$g->copy_device_to_device" for a general overview of this
1557           call.
1558
1559       $g->copy_file_to_file ($src, $dest [, srcoffset => $srcoffset] [,
1560       destoffset => $destoffset] [, size => $size] [, sparse => $sparse] [,
1561       append => $append]);
1562           See "$g->copy_device_to_device" for a general overview of this
1563           call.
1564
1565           This is not the function you want for copying files.  This is for
1566           copying blocks within existing files.  See "$g->cp", "$g->cp_a" and
1567           "$g->mv" for general file copying and moving functions.
1568
1569       $g->copy_in ($localpath, $remotedir);
1570           "$g->copy_in" copies local files or directories recursively into
1571           the disk image, placing them in the directory called "remotedir"
1572           (which must exist).
1573
1574           Wildcards cannot be used.
1575
1576       $g->copy_out ($remotepath, $localdir);
1577           "$g->copy_out" copies remote files or directories recursively out
1578           of the disk image, placing them on the host disk in a local
1579           directory called "localdir" (which must exist).
1580
1581           To download to the current directory, use "." as in:
1582
1583            C<$g-E<gt>copy_out> /home .
1584
1585           Wildcards cannot be used.
1586
1587       $g->copy_size ($src, $dest, $size);
1588           This command copies exactly "size" bytes from one source device or
1589           file "src" to another destination device or file "dest".
1590
1591           Note this will fail if the source is too short or if the
1592           destination is not large enough.
1593
1594           This function is deprecated.  In new code, use the
1595           "copy_device_to_device" call instead.
1596
1597           Deprecated functions will not be removed from the API, but the fact
1598           that they are deprecated indicates that there are problems with
1599           correct use of these functions.
1600
1601       $g->cp ($src, $dest);
1602           This copies a file from "src" to "dest" where "dest" is either a
1603           destination filename or destination directory.
1604
1605       $g->cp_a ($src, $dest);
1606           This copies a file or directory from "src" to "dest" recursively
1607           using the "cp -a" command.
1608
1609       $g->cp_r ($src, $dest);
1610           This copies a file or directory from "src" to "dest" recursively
1611           using the "cp -rP" command.
1612
1613           Most users should use "$g->cp_a" instead.  This command is useful
1614           when you don't want to preserve permissions, because the target
1615           filesystem does not support it (primarily when writing to DOS FAT
1616           filesystems).
1617
1618       $g->cpio_out ($directory, $cpiofile [, format => $format]);
1619           This command packs the contents of directory and downloads it to
1620           local file "cpiofile".
1621
1622           The optional "format" parameter can be used to select the format.
1623           Only the following formats are currently permitted:
1624
1625           "newc"
1626               New (SVR4) portable format.  This format happens to be
1627               compatible with the cpio-like format used by the Linux kernel
1628               for initramfs.
1629
1630               This is the default format.
1631
1632           "crc"
1633               New (SVR4) portable format with a checksum.
1634
1635       $g->cryptsetup_close ($device);
1636           This closes an encrypted device that was created earlier by
1637           "$g->cryptsetup_open".  The "device" parameter must be the name of
1638           the mapping device (ie. /dev/mapper/mapname) and not the name of
1639           the underlying block device.
1640
1641           This function depends on the feature "luks".  See also
1642           "$g->feature-available".
1643
1644       $g->cryptsetup_open ($device, $key, $mapname [, readonly => $readonly]
1645       [, crypttype => $crypttype]);
1646           This command opens a block device which has been encrypted
1647           according to the Linux Unified Key Setup (LUKS) standard, Windows
1648           BitLocker, or some other types.
1649
1650           "device" is the encrypted block device or partition.
1651
1652           The caller must supply one of the keys associated with the
1653           encrypted block device, in the "key" parameter.
1654
1655           This creates a new block device called /dev/mapper/mapname.  Reads
1656           and writes to this block device are decrypted from and encrypted to
1657           the underlying "device" respectively.
1658
1659           "mapname" cannot be "control" because that name is reserved by
1660           device-mapper.
1661
1662           If the optional "crypttype" parameter is not present then
1663           libguestfs tries to guess the correct type (for example LUKS or
1664           BitLocker).  However you can override this by specifying one of the
1665           following types:
1666
1667           "luks"
1668               A Linux LUKS device.
1669
1670           "bitlk"
1671               A Windows BitLocker device.
1672
1673           The optional "readonly" flag, if set to true, creates a read-only
1674           mapping.
1675
1676           If this block device contains LVM volume groups, then calling
1677           "$g->lvm_scan" with the "activate" parameter "true" will make them
1678           visible.
1679
1680           Use "$g->list_dm_devices" to list all device mapper devices.
1681
1682           This function depends on the feature "luks".  See also
1683           "$g->feature-available".
1684
1685       $g->dd ($src, $dest);
1686           This command copies from one source device or file "src" to another
1687           destination device or file "dest".  Normally you would use this to
1688           copy to or from a device or partition, for example to duplicate a
1689           filesystem.
1690
1691           If the destination is a device, it must be as large or larger than
1692           the source file or device, otherwise the copy will fail.  This
1693           command cannot do partial copies (see "$g->copy_device_to_device").
1694
1695           This function is deprecated.  In new code, use the
1696           "copy_device_to_device" call instead.
1697
1698           Deprecated functions will not be removed from the API, but the fact
1699           that they are deprecated indicates that there are problems with
1700           correct use of these functions.
1701
1702       $index = $g->device_index ($device);
1703           This function takes a device name (eg. "/dev/sdb") and returns the
1704           index of the device in the list of devices.
1705
1706           Index numbers start from 0.  The named device must exist, for
1707           example as a string returned from "$g->list_devices".
1708
1709           See also "$g->list_devices", "$g->part_to_dev".
1710
1711       $output = $g->df ();
1712           This command runs the df(1) command to report disk space used.
1713
1714           This command is mostly useful for interactive sessions.  It is not
1715           intended that you try to parse the output string.  Use
1716           "$g->statvfs" from programs.
1717
1718       $output = $g->df_h ();
1719           This command runs the "df -h" command to report disk space used in
1720           human-readable format.
1721
1722           This command is mostly useful for interactive sessions.  It is not
1723           intended that you try to parse the output string.  Use
1724           "$g->statvfs" from programs.
1725
1726       $g->disk_create ($filename, $format, $size [, backingfile =>
1727       $backingfile] [, backingformat => $backingformat] [, preallocation =>
1728       $preallocation] [, compat => $compat] [, clustersize => $clustersize]);
1729           Create a blank disk image called filename (a host file) with format
1730           "format" (usually "raw" or "qcow2").  The size is "size" bytes.
1731
1732           If used with the optional "backingfile" parameter, then a snapshot
1733           is created on top of the backing file.  In this case, "size" must
1734           be passed as "-1".  The size of the snapshot is the same as the
1735           size of the backing file, which is discovered automatically.  You
1736           are encouraged to also pass "backingformat" to describe the format
1737           of "backingfile".
1738
1739           If filename refers to a block device, then the device is formatted.
1740           The "size" is ignored since block devices have an intrinsic size.
1741
1742           The other optional parameters are:
1743
1744           "preallocation"
1745               If format is "raw", then this can be either "off" (or "sparse")
1746               or "full" to create a sparse or fully allocated file
1747               respectively.  The default is "off".
1748
1749               If format is "qcow2", then this can be "off" (or "sparse"),
1750               "metadata" or "full".  Preallocating metadata can be faster
1751               when doing lots of writes, but uses more space.  The default is
1752               "off".
1753
1754           "compat"
1755               "qcow2" only: Pass the string 1.1 to use the advanced qcow2
1756               format supported by qemu X 1.1.
1757
1758           "clustersize"
1759               "qcow2" only: Change the qcow2 cluster size.  The default is
1760               65536 (bytes) and this setting may be any power of two between
1761               512 and 2097152.
1762
1763           Note that this call does not add the new disk to the handle.  You
1764           may need to call "$g->add_drive_opts" separately.
1765
1766       $format = $g->disk_format ($filename);
1767           Detect and return the format of the disk image called filename.
1768           filename can also be a host device, etc.  If the format of the
1769           image could not be detected, then "unknown" is returned.
1770
1771           Note that detecting the disk format can be insecure under some
1772           circumstances.  See "CVE-2010-3851" in guestfs(3).
1773
1774           See also: "DISK IMAGE FORMATS" in guestfs(3)
1775
1776       $backingfile = $g->disk_has_backing_file ($filename);
1777           Detect and return whether the disk image filename has a backing
1778           file.
1779
1780           Note that detecting disk features can be insecure under some
1781           circumstances.  See "CVE-2010-3851" in guestfs(3).
1782
1783       $size = $g->disk_virtual_size ($filename);
1784           Detect and return the virtual size in bytes of the disk image
1785           called filename.
1786
1787           Note that detecting disk features can be insecure under some
1788           circumstances.  See "CVE-2010-3851" in guestfs(3).
1789
1790       $kmsgs = $g->dmesg ();
1791           This returns the kernel messages (dmesg(1) output) from the guest
1792           kernel.  This is sometimes useful for extended debugging of
1793           problems.
1794
1795           Another way to get the same information is to enable verbose
1796           messages with "$g->set_verbose" or by setting the environment
1797           variable "LIBGUESTFS_DEBUG=1" before running the program.
1798
1799       $g->download ($remotefilename, $filename);
1800           Download file remotefilename and save it as filename on the local
1801           machine.
1802
1803           filename can also be a named pipe.
1804
1805           See also "$g->upload", "$g->cat".
1806
1807       $g->download_blocks ($device, $start, $stop, $filename [, unallocated
1808       => $unallocated]);
1809           Download the data units from start address to stop from the disk
1810           partition (eg. /dev/sda1) and save them as filename on the local
1811           machine.
1812
1813           The use of this API on sparse disk image formats such as QCOW, may
1814           result in large zero-filled files downloaded on the host.
1815
1816           The size of a data unit varies across filesystem implementations.
1817           On NTFS filesystems data units are referred as clusters while on
1818           ExtX ones they are referred as fragments.
1819
1820           If the optional "unallocated" flag is true (default is false), only
1821           the unallocated blocks will be extracted.  This is useful to detect
1822           hidden data or to retrieve deleted files which data units have not
1823           been overwritten yet.
1824
1825           This function depends on the feature "sleuthkit".  See also
1826           "$g->feature-available".
1827
1828       $g->download_inode ($device, $inode, $filename);
1829           Download a file given its inode from the disk partition (eg.
1830           /dev/sda1) and save it as filename on the local machine.
1831
1832           It is not required to mount the disk to run this command.
1833
1834           The command is capable of downloading deleted or inaccessible
1835           files.
1836
1837           This function depends on the feature "sleuthkit".  See also
1838           "$g->feature-available".
1839
1840       $g->download_offset ($remotefilename, $filename, $offset, $size);
1841           Download file remotefilename and save it as filename on the local
1842           machine.
1843
1844           remotefilename is read for "size" bytes starting at "offset" (this
1845           region must be within the file or device).
1846
1847           Note that there is no limit on the amount of data that can be
1848           downloaded with this call, unlike with "$g->pread", and this call
1849           always reads the full amount unless an error occurs.
1850
1851           See also "$g->download", "$g->pread".
1852
1853       $g->drop_caches ($whattodrop);
1854           This instructs the guest kernel to drop its page cache, and/or
1855           dentries and inode caches.  The parameter "whattodrop" tells the
1856           kernel what precisely to drop, see
1857           <https://linux-mm.org/Drop_Caches>
1858
1859           Setting "whattodrop" to 3 should drop everything.
1860
1861           This automatically calls sync(2) before the operation, so that the
1862           maximum guest memory is freed.
1863
1864       $sizekb = $g->du ($path);
1865           This command runs the "du -s" command to estimate file space usage
1866           for "path".
1867
1868           "path" can be a file or a directory.  If "path" is a directory then
1869           the estimate includes the contents of the directory and all
1870           subdirectories (recursively).
1871
1872           The result is the estimated size in kilobytes (ie. units of 1024
1873           bytes).
1874
1875       $g->e2fsck ($device [, correct => $correct] [, forceall => $forceall]);
1876           This runs the ext2/ext3 filesystem checker on "device".  It can
1877           take the following optional arguments:
1878
1879           "correct"
1880               Automatically repair the file system. This option will cause
1881               e2fsck to automatically fix any filesystem problems that can be
1882               safely fixed without human intervention.
1883
1884               This option may not be specified at the same time as the
1885               "forceall" option.
1886
1887           "forceall"
1888               Assume an answer of XyesX to all questions; allows e2fsck to be
1889               used non-interactively.
1890
1891               This option may not be specified at the same time as the
1892               "correct" option.
1893
1894       $g->e2fsck_f ($device);
1895           This runs "e2fsck -p -f device", ie. runs the ext2/ext3 filesystem
1896           checker on "device", noninteractively (-p), even if the filesystem
1897           appears to be clean (-f).
1898
1899           This function is deprecated.  In new code, use the "e2fsck" call
1900           instead.
1901
1902           Deprecated functions will not be removed from the API, but the fact
1903           that they are deprecated indicates that there are problems with
1904           correct use of these functions.
1905
1906       $output = $g->echo_daemon (\@words);
1907           This command concatenates the list of "words" passed with single
1908           spaces between them and returns the resulting string.
1909
1910           You can use this command to test the connection through to the
1911           daemon.
1912
1913           See also "$g->ping_daemon".
1914
1915       @lines = $g->egrep ($regex, $path);
1916           This calls the external egrep(1) program and returns the matching
1917           lines.
1918
1919           Because of the message protocol, there is a transfer limit of
1920           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
1921           guestfs(3).
1922
1923           This function is deprecated.  In new code, use the "grep" call
1924           instead.
1925
1926           Deprecated functions will not be removed from the API, but the fact
1927           that they are deprecated indicates that there are problems with
1928           correct use of these functions.
1929
1930       @lines = $g->egrepi ($regex, $path);
1931           This calls the external "egrep -i" program and returns the matching
1932           lines.
1933
1934           Because of the message protocol, there is a transfer limit of
1935           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
1936           guestfs(3).
1937
1938           This function is deprecated.  In new code, use the "grep" call
1939           instead.
1940
1941           Deprecated functions will not be removed from the API, but the fact
1942           that they are deprecated indicates that there are problems with
1943           correct use of these functions.
1944
1945       $equality = $g->equal ($file1, $file2);
1946           This compares the two files file1 and file2 and returns true if
1947           their content is exactly equal, or false otherwise.
1948
1949           The external cmp(1) program is used for the comparison.
1950
1951       $existsflag = $g->exists ($path);
1952           This returns "true" if and only if there is a file, directory (or
1953           anything) with the given "path" name.
1954
1955           See also "$g->is_file", "$g->is_dir", "$g->stat".
1956
1957       $g->extlinux ($directory);
1958           Install the SYSLINUX bootloader on the device mounted at directory.
1959           Unlike "$g->syslinux" which requires a FAT filesystem, this can be
1960           used on an ext2/3/4 or btrfs filesystem.
1961
1962           The directory parameter can be either a mountpoint, or a directory
1963           within the mountpoint.
1964
1965           You also have to mark the partition as "active"
1966           ("$g->part_set_bootable") and a Master Boot Record must be
1967           installed (eg. using "$g->pwrite_device") on the first sector of
1968           the whole disk.  The SYSLINUX package comes with some suitable
1969           Master Boot Records.  See the extlinux(1) man page for further
1970           information.
1971
1972           Additional configuration can be supplied to SYSLINUX by placing a
1973           file called extlinux.conf on the filesystem under directory.  For
1974           further information about the contents of this file, see
1975           extlinux(1).
1976
1977           See also "$g->syslinux".
1978
1979           This function depends on the feature "extlinux".  See also
1980           "$g->feature-available".
1981
1982       $g->f2fs_expand ($device);
1983           This expands a f2fs filesystem to match the size of the underlying
1984           device.
1985
1986           This function depends on the feature "f2fs".  See also
1987           "$g->feature-available".
1988
1989       $g->fallocate ($path, $len);
1990           This command preallocates a file (containing zero bytes) named
1991           "path" of size "len" bytes.  If the file exists already, it is
1992           overwritten.
1993
1994           Do not confuse this with the guestfish-specific "alloc" command
1995           which allocates a file in the host and attaches it as a device.
1996
1997           This function is deprecated.  In new code, use the "fallocate64"
1998           call instead.
1999
2000           Deprecated functions will not be removed from the API, but the fact
2001           that they are deprecated indicates that there are problems with
2002           correct use of these functions.
2003
2004       $g->fallocate64 ($path, $len);
2005           This command preallocates a file (containing zero bytes) named
2006           "path" of size "len" bytes.  If the file exists already, it is
2007           overwritten.
2008
2009           Note that this call allocates disk blocks for the file.  To create
2010           a sparse file use "$g->truncate_size" instead.
2011
2012           The deprecated call "$g->fallocate" does the same, but owing to an
2013           oversight it only allowed 30 bit lengths to be specified,
2014           effectively limiting the maximum size of files created through that
2015           call to 1GB.
2016
2017           Do not confuse this with the guestfish-specific "alloc" and
2018           "sparse" commands which create a file in the host and attach it as
2019           a device.
2020
2021       $isavailable = $g->feature_available (\@groups);
2022           This is the same as "$g->available", but unlike that call it
2023           returns a simple true/false boolean result, instead of throwing an
2024           exception if a feature is not found.  For other documentation see
2025           "$g->available".
2026
2027       @lines = $g->fgrep ($pattern, $path);
2028           This calls the external fgrep(1) program and returns the matching
2029           lines.
2030
2031           Because of the message protocol, there is a transfer limit of
2032           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2033           guestfs(3).
2034
2035           This function is deprecated.  In new code, use the "grep" call
2036           instead.
2037
2038           Deprecated functions will not be removed from the API, but the fact
2039           that they are deprecated indicates that there are problems with
2040           correct use of these functions.
2041
2042       @lines = $g->fgrepi ($pattern, $path);
2043           This calls the external "fgrep -i" program and returns the matching
2044           lines.
2045
2046           Because of the message protocol, there is a transfer limit of
2047           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2048           guestfs(3).
2049
2050           This function is deprecated.  In new code, use the "grep" call
2051           instead.
2052
2053           Deprecated functions will not be removed from the API, but the fact
2054           that they are deprecated indicates that there are problems with
2055           correct use of these functions.
2056
2057       $description = $g->file ($path);
2058           This call uses the standard file(1) command to determine the type
2059           or contents of the file.
2060
2061           This call will also transparently look inside various types of
2062           compressed file.
2063
2064           The exact command which runs is "file -zb path".  Note in
2065           particular that the filename is not prepended to the output (the -b
2066           option).
2067
2068           The output depends on the output of the underlying file(1) command
2069           and it can change in future in ways beyond our control.  In other
2070           words, the output is not guaranteed by the ABI.
2071
2072           See also: file(1), "$g->vfs_type", "$g->lstat", "$g->is_file",
2073           "$g->is_blockdev" (etc), "$g->is_zero".
2074
2075       $arch = $g->file_architecture ($filename);
2076           This detects the architecture of the binary filename, and returns
2077           it if known.
2078
2079           Currently defined architectures are:
2080
2081           "aarch64"
2082               64 bit ARM.
2083
2084           "arm"
2085               32 bit ARM.
2086
2087           "i386"
2088               This string is returned for all 32 bit i386, i486, i586, i686
2089               binaries irrespective of the precise processor requirements of
2090               the binary.
2091
2092           "ia64"
2093               Intel Itanium.
2094
2095           "ppc"
2096               32 bit Power PC.
2097
2098           "ppc64"
2099               64 bit Power PC (big endian).
2100
2101           "ppc64le"
2102               64 bit Power PC (little endian).
2103
2104           "riscv32"
2105           "riscv64"
2106           "riscv128"
2107               RISC-V 32-, 64- or 128-bit variants.
2108
2109           "s390"
2110               31 bit IBM S/390.
2111
2112           "s390x"
2113               64 bit IBM S/390.
2114
2115           "sparc"
2116               32 bit SPARC.
2117
2118           "sparc64"
2119               64 bit SPARC V9 and above.
2120
2121           "x86_64"
2122               64 bit x86-64.
2123
2124           Libguestfs may return other architecture strings in future.
2125
2126           The function works on at least the following types of files:
2127
2128           •   many types of Un*x and Linux binary
2129
2130           •   many types of Un*x and Linux shared library
2131
2132           •   Windows Win32 and Win64 binaries
2133
2134           •   Windows Win32 and Win64 DLLs
2135
2136               Win32 binaries and DLLs return "i386".
2137
2138               Win64 binaries and DLLs return "x86_64".
2139
2140           •   Linux kernel modules
2141
2142           •   Linux new-style initrd images
2143
2144           •   some non-x86 Linux vmlinuz kernels
2145
2146           What it can't do currently:
2147
2148           •   static libraries (libfoo.a)
2149
2150           •   Linux old-style initrd as compressed ext2 filesystem (RHEL 3)
2151
2152           •   x86 Linux vmlinuz kernels
2153
2154               x86 vmlinuz images (bzImage format) consist of a mix of 16-,
2155               32- and compressed code, and are horribly hard to unpack.  If
2156               you want to find the architecture of a kernel, use the
2157               architecture of the associated initrd or kernel module(s)
2158               instead.
2159
2160       $size = $g->filesize ($file);
2161           This command returns the size of file in bytes.
2162
2163           To get other stats about a file, use "$g->stat", "$g->lstat",
2164           "$g->is_dir", "$g->is_file" etc.  To get the size of block devices,
2165           use "$g->blockdev_getsize64".
2166
2167       $fsavail = $g->filesystem_available ($filesystem);
2168           Check whether libguestfs supports the named filesystem.  The
2169           argument "filesystem" is a filesystem name, such as "ext3".
2170
2171           You must call "$g->launch" before using this command.
2172
2173           This is mainly useful as a negative test.  If this returns true, it
2174           doesn't mean that a particular filesystem can be created or
2175           mounted, since filesystems can fail for other reasons such as it
2176           being a later version of the filesystem, or having incompatible
2177           features, or lacking the right mkfs.<fs> tool.
2178
2179           See also "$g->available", "$g->feature_available", "AVAILABILITY"
2180           in guestfs(3).
2181
2182       @dirents = $g->filesystem_walk ($device);
2183           Walk through the internal structures of a disk partition (eg.
2184           /dev/sda1) in order to return a list of all the files and
2185           directories stored within.
2186
2187           It is not necessary to mount the disk partition to run this
2188           command.
2189
2190           All entries in the filesystem are returned. This function can list
2191           deleted or unaccessible files. The entries are not sorted.
2192
2193           The "tsk_dirent" structure contains the following fields.
2194
2195           "tsk_inode"
2196               Filesystem reference number of the node. It might be 0 if the
2197               node has been deleted.
2198
2199           "tsk_type"
2200               Basic file type information.  See below for a detailed list of
2201               values.
2202
2203           "tsk_size"
2204               File size in bytes. It might be "-1" if the node has been
2205               deleted.
2206
2207           "tsk_name"
2208               The file path relative to its directory.
2209
2210           "tsk_flags"
2211               Bitfield containing extra information regarding the entry.  It
2212               contains the logical OR of the following values:
2213
2214               0x0001
2215                   If set to 1, the file is allocated and visible within the
2216                   filesystem.  Otherwise, the file has been deleted.  Under
2217                   certain circumstances, the function "download_inode" can be
2218                   used to recover deleted files.
2219
2220               0x0002
2221                   Filesystem such as NTFS and Ext2 or greater, separate the
2222                   file name from the metadata structure.  The bit is set to 1
2223                   when the file name is in an unallocated state and the
2224                   metadata structure is in an allocated one.  This generally
2225                   implies the metadata has been reallocated to a new file.
2226                   Therefore, information such as file type, file size,
2227                   timestamps, number of links and symlink target might not
2228                   correspond with the ones of the original deleted entry.
2229
2230               0x0004
2231                   The bit is set to 1 when the file is compressed using
2232                   filesystem native compression support (NTFS). The API is
2233                   not able to detect application level compression.
2234
2235           "tsk_atime_sec"
2236           "tsk_atime_nsec"
2237           "tsk_mtime_sec"
2238           "tsk_mtime_nsec"
2239           "tsk_ctime_sec"
2240           "tsk_ctime_nsec"
2241           "tsk_crtime_sec"
2242           "tsk_crtime_nsec"
2243               Respectively, access, modification, last status change and
2244               creation time in Unix format in seconds and nanoseconds.
2245
2246           "tsk_nlink"
2247               Number of file names pointing to this entry.
2248
2249           "tsk_link"
2250               If the entry is a symbolic link, this field will contain the
2251               path to the target file.
2252
2253           The "tsk_type" field will contain one of the following characters:
2254
2255           'b' Block special
2256
2257           'c' Char special
2258
2259           'd' Directory
2260
2261           'f' FIFO (named pipe)
2262
2263           'l' Symbolic link
2264
2265           'r' Regular file
2266
2267           's' Socket
2268
2269           'h' Shadow inode (Solaris)
2270
2271           'w' Whiteout inode (BSD)
2272
2273           'u' Unknown file type
2274
2275           This function depends on the feature "libtsk".  See also
2276           "$g->feature-available".
2277
2278       $g->fill ($c, $len, $path);
2279           This command creates a new file called "path".  The initial content
2280           of the file is "len" octets of "c", where "c" must be a number in
2281           the range "[0..255]".
2282
2283           To fill a file with zero bytes (sparsely), it is much more
2284           efficient to use "$g->truncate_size".  To create a file with a
2285           pattern of repeating bytes use "$g->fill_pattern".
2286
2287       $g->fill_dir ($dir, $nr);
2288           This function, useful for testing filesystems, creates "nr" empty
2289           files in the directory "dir" with names 00000000 through "nr-1"
2290           (ie. each file name is 8 digits long padded with zeroes).
2291
2292       $g->fill_pattern ($pattern, $len, $path);
2293           This function is like "$g->fill" except that it creates a new file
2294           of length "len" containing the repeating pattern of bytes in
2295           "pattern".  The pattern is truncated if necessary to ensure the
2296           length of the file is exactly "len" bytes.
2297
2298       @names = $g->find ($directory);
2299           This command lists out all files and directories, recursively,
2300           starting at directory.  It is essentially equivalent to running the
2301           shell command "find directory -print" but some post-processing
2302           happens on the output, described below.
2303
2304           This returns a list of strings without any prefix.  Thus if the
2305           directory structure was:
2306
2307            /tmp/a
2308            /tmp/b
2309            /tmp/c/d
2310
2311           then the returned list from "$g->find" /tmp would be 4 elements:
2312
2313            a
2314            b
2315            c
2316            c/d
2317
2318           If directory is not a directory, then this command returns an
2319           error.
2320
2321           The returned list is sorted.
2322
2323       $g->find0 ($directory, $files);
2324           This command lists out all files and directories, recursively,
2325           starting at directory, placing the resulting list in the external
2326           file called files.
2327
2328           This command works the same way as "$g->find" with the following
2329           exceptions:
2330
2331           •   The resulting list is written to an external file.
2332
2333           •   Items (filenames) in the result are separated by "\0"
2334               characters.  See find(1) option -print0.
2335
2336           •   The result list is not sorted.
2337
2338       @dirents = $g->find_inode ($device, $inode);
2339           Searches all the entries associated with the given inode.
2340
2341           For each entry, a "tsk_dirent" structure is returned.  See
2342           "filesystem_walk" for more information about "tsk_dirent"
2343           structures.
2344
2345           This function depends on the feature "libtsk".  See also
2346           "$g->feature-available".
2347
2348       $device = $g->findfs_label ($label);
2349           This command searches the filesystems and returns the one which has
2350           the given label.  An error is returned if no such filesystem can be
2351           found.
2352
2353           To find the label of a filesystem, use "$g->vfs_label".
2354
2355       $device = $g->findfs_uuid ($uuid);
2356           This command searches the filesystems and returns the one which has
2357           the given UUID.  An error is returned if no such filesystem can be
2358           found.
2359
2360           To find the UUID of a filesystem, use "$g->vfs_uuid".
2361
2362       $status = $g->fsck ($fstype, $device);
2363           This runs the filesystem checker (fsck) on "device" which should
2364           have filesystem type "fstype".
2365
2366           The returned integer is the status.  See fsck(8) for the list of
2367           status codes from "fsck".
2368
2369           Notes:
2370
2371           •   Multiple status codes can be summed together.
2372
2373           •   A non-zero return code can mean "success", for example if
2374               errors have been corrected on the filesystem.
2375
2376           •   Checking or repairing NTFS volumes is not supported (by linux-
2377               ntfs).
2378
2379           This command is entirely equivalent to running "fsck -a -t fstype
2380           device".
2381
2382       $g->fstrim ($mountpoint [, offset => $offset] [, length => $length] [,
2383       minimumfreeextent => $minimumfreeextent]);
2384           Trim the free space in the filesystem mounted on "mountpoint".  The
2385           filesystem must be mounted read-write.
2386
2387           The filesystem contents are not affected, but any free space in the
2388           filesystem is "trimmed", that is, given back to the host device,
2389           thus making disk images more sparse, allowing unused space in qcow2
2390           files to be reused, etc.
2391
2392           This operation requires support in libguestfs, the mounted
2393           filesystem, the host filesystem, qemu and the host kernel.  If this
2394           support isn't present it may give an error or even appear to run
2395           but do nothing.
2396
2397           In the case where the kernel vfs driver does not support trimming,
2398           this call will fail with errno set to "ENOTSUP".  Currently this
2399           happens when trying to trim FAT filesystems.
2400
2401           See also "$g->zero_free_space".  That is a slightly different
2402           operation that turns free space in the filesystem into zeroes.  It
2403           is valid to call "$g->fstrim" either instead of, or after calling
2404           "$g->zero_free_space".
2405
2406           This function depends on the feature "fstrim".  See also
2407           "$g->feature-available".
2408
2409       $append = $g->get_append ();
2410           Return the additional kernel options which are added to the
2411           libguestfs appliance kernel command line.
2412
2413           If "NULL" then no options are added.
2414
2415       $backend = $g->get_attach_method ();
2416           Return the current backend.
2417
2418           See "$g->set_backend" and "BACKEND" in guestfs(3).
2419
2420           This function is deprecated.  In new code, use the "get_backend"
2421           call instead.
2422
2423           Deprecated functions will not be removed from the API, but the fact
2424           that they are deprecated indicates that there are problems with
2425           correct use of these functions.
2426
2427       $autosync = $g->get_autosync ();
2428           Get the autosync flag.
2429
2430       $backend = $g->get_backend ();
2431           Return the current backend.
2432
2433           This handle property was previously called the "attach method".
2434
2435           See "$g->set_backend" and "BACKEND" in guestfs(3).
2436
2437       $val = $g->get_backend_setting ($name);
2438           Find a backend setting string which is either "name" or begins with
2439           "name=".  If "name", this returns the string "1".  If "name=", this
2440           returns the part after the equals sign (which may be an empty
2441           string).
2442
2443           If no such setting is found, this function throws an error.  The
2444           errno (see "$g->last_errno") will be "ESRCH" in this case.
2445
2446           See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
2447
2448       @settings = $g->get_backend_settings ();
2449           Return the current backend settings.
2450
2451           This call returns all backend settings strings.  If you want to
2452           find a single backend setting, see "$g->get_backend_setting".
2453
2454           See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
2455
2456       $cachedir = $g->get_cachedir ();
2457           Get the directory used by the handle to store the appliance cache.
2458
2459       $direct = $g->get_direct ();
2460           Return the direct appliance mode flag.
2461
2462           This function is deprecated.  In new code, use the
2463           "internal_get_console_socket" call instead.
2464
2465           Deprecated functions will not be removed from the API, but the fact
2466           that they are deprecated indicates that there are problems with
2467           correct use of these functions.
2468
2469       $attrs = $g->get_e2attrs ($file);
2470           This returns the file attributes associated with file.
2471
2472           The attributes are a set of bits associated with each inode which
2473           affect the behaviour of the file.  The attributes are returned as a
2474           string of letters (described below).  The string may be empty,
2475           indicating that no file attributes are set for this file.
2476
2477           These attributes are only present when the file is located on an
2478           ext2/3/4 filesystem.  Using this call on other filesystem types
2479           will result in an error.
2480
2481           The characters (file attributes) in the returned string are
2482           currently:
2483
2484           'A' When the file is accessed, its atime is not modified.
2485
2486           'a' The file is append-only.
2487
2488           'c' The file is compressed on-disk.
2489
2490           'D' (Directories only.)  Changes to this directory are written
2491               synchronously to disk.
2492
2493           'd' The file is not a candidate for backup (see dump(8)).
2494
2495           'E' The file has compression errors.
2496
2497           'e' The file is using extents.
2498
2499           'h' The file is storing its blocks in units of the filesystem
2500               blocksize instead of sectors.
2501
2502           'I' (Directories only.)  The directory is using hashed trees.
2503
2504           'i' The file is immutable.  It cannot be modified, deleted or
2505               renamed.  No link can be created to this file.
2506
2507           'j' The file is data-journaled.
2508
2509           's' When the file is deleted, all its blocks will be zeroed.
2510
2511           'S' Changes to this file are written synchronously to disk.
2512
2513           'T' (Directories only.)  This is a hint to the block allocator that
2514               subdirectories contained in this directory should be spread
2515               across blocks.  If not present, the block allocator will try to
2516               group subdirectories together.
2517
2518           't' For a file, this disables tail-merging.  (Not used by upstream
2519               implementations of ext2.)
2520
2521           'u' When the file is deleted, its blocks will be saved, allowing
2522               the file to be undeleted.
2523
2524           'X' The raw contents of the compressed file may be accessed.
2525
2526           'Z' The compressed file is dirty.
2527
2528           More file attributes may be added to this list later.  Not all file
2529           attributes may be set for all kinds of files.  For detailed
2530           information, consult the chattr(1) man page.
2531
2532           See also "$g->set_e2attrs".
2533
2534           Don't confuse these attributes with extended attributes (see
2535           "$g->getxattr").
2536
2537       $generation = $g->get_e2generation ($file);
2538           This returns the ext2 file generation of a file.  The generation
2539           (which used to be called the "version") is a number associated with
2540           an inode.  This is most commonly used by NFS servers.
2541
2542           The generation is only present when the file is located on an
2543           ext2/3/4 filesystem.  Using this call on other filesystem types
2544           will result in an error.
2545
2546           See "$g->set_e2generation".
2547
2548       $label = $g->get_e2label ($device);
2549           This returns the ext2/3/4 filesystem label of the filesystem on
2550           "device".
2551
2552           This function is deprecated.  In new code, use the "vfs_label" call
2553           instead.
2554
2555           Deprecated functions will not be removed from the API, but the fact
2556           that they are deprecated indicates that there are problems with
2557           correct use of these functions.
2558
2559       $uuid = $g->get_e2uuid ($device);
2560           This returns the ext2/3/4 filesystem UUID of the filesystem on
2561           "device".
2562
2563           This function is deprecated.  In new code, use the "vfs_uuid" call
2564           instead.
2565
2566           Deprecated functions will not be removed from the API, but the fact
2567           that they are deprecated indicates that there are problems with
2568           correct use of these functions.
2569
2570       $hv = $g->get_hv ();
2571           Return the current hypervisor binary.
2572
2573           This is always non-NULL.  If it wasn't set already, then this will
2574           return the default qemu binary name.
2575
2576       $identifier = $g->get_identifier ();
2577           Get the handle identifier.  See "$g->set_identifier".
2578
2579       $challenge = $g->get_libvirt_requested_credential_challenge ($index);
2580           Get the challenge (provided by libvirt) for the "index"'th
2581           requested credential.  If libvirt did not provide a challenge, this
2582           returns the empty string "".
2583
2584           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
2585           example code.
2586
2587       $defresult = $g->get_libvirt_requested_credential_defresult ($index);
2588           Get the default result (provided by libvirt) for the "index"'th
2589           requested credential.  If libvirt did not provide a default result,
2590           this returns the empty string "".
2591
2592           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
2593           example code.
2594
2595       $prompt = $g->get_libvirt_requested_credential_prompt ($index);
2596           Get the prompt (provided by libvirt) for the "index"'th requested
2597           credential.  If libvirt did not provide a prompt, this returns the
2598           empty string "".
2599
2600           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
2601           example code.
2602
2603       @creds = $g->get_libvirt_requested_credentials ();
2604           This should only be called during the event callback for events of
2605           type "GUESTFS_EVENT_LIBVIRT_AUTH".
2606
2607           Return the list of credentials requested by libvirt.  Possible
2608           values are a subset of the strings provided when you called
2609           "$g->set_libvirt_supported_credentials".
2610
2611           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
2612           example code.
2613
2614       $memsize = $g->get_memsize ();
2615           This gets the memory size in megabytes allocated to the hypervisor.
2616
2617           If "$g->set_memsize" was not called on this handle, and if
2618           "LIBGUESTFS_MEMSIZE" was not set, then this returns the compiled-in
2619           default value for memsize.
2620
2621           For more information on the architecture of libguestfs, see
2622           guestfs(3).
2623
2624       $network = $g->get_network ();
2625           This returns the enable network flag.
2626
2627       $path = $g->get_path ();
2628           Return the current search path.
2629
2630           This is always non-NULL.  If it wasn't set already, then this will
2631           return the default path.
2632
2633       $pgroup = $g->get_pgroup ();
2634           This returns the process group flag.
2635
2636       $pid = $g->get_pid ();
2637           Return the process ID of the hypervisor.  If there is no hypervisor
2638           running, then this will return an error.
2639
2640           This is an internal call used for debugging and testing.
2641
2642       $program = $g->get_program ();
2643           Get the program name.  See "$g->set_program".
2644
2645       $hv = $g->get_qemu ();
2646           Return the current hypervisor binary (usually qemu).
2647
2648           This is always non-NULL.  If it wasn't set already, then this will
2649           return the default qemu binary name.
2650
2651           This function is deprecated.  In new code, use the "get_hv" call
2652           instead.
2653
2654           Deprecated functions will not be removed from the API, but the fact
2655           that they are deprecated indicates that there are problems with
2656           correct use of these functions.
2657
2658       $recoveryproc = $g->get_recovery_proc ();
2659           Return the recovery process enabled flag.
2660
2661       $selinux = $g->get_selinux ();
2662           This returns the current setting of the selinux flag which is
2663           passed to the appliance at boot time.  See "$g->set_selinux".
2664
2665           For more information on the architecture of libguestfs, see
2666           guestfs(3).
2667
2668           This function is deprecated.  In new code, use the
2669           "selinux_relabel" call instead.
2670
2671           Deprecated functions will not be removed from the API, but the fact
2672           that they are deprecated indicates that there are problems with
2673           correct use of these functions.
2674
2675       $smp = $g->get_smp ();
2676           This returns the number of virtual CPUs assigned to the appliance.
2677
2678       $sockdir = $g->get_sockdir ();
2679           Get the directory used by the handle to store temporary socket
2680           files.
2681
2682           This is different from "$g->get_tmpdir", as we need shorter paths
2683           for sockets (due to the limited buffers of filenames for UNIX
2684           sockets), and "$g->get_tmpdir" may be too long for them.
2685
2686           The environment variable "XDG_RUNTIME_DIR" controls the default
2687           value: If "XDG_RUNTIME_DIR" is set, then that is the default.  Else
2688           /tmp is the default.
2689
2690       $state = $g->get_state ();
2691           This returns the current state as an opaque integer.  This is only
2692           useful for printing debug and internal error messages.
2693
2694           For more information on states, see guestfs(3).
2695
2696       $tmpdir = $g->get_tmpdir ();
2697           Get the directory used by the handle to store temporary files.
2698
2699       $trace = $g->get_trace ();
2700           Return the command trace flag.
2701
2702       $mask = $g->get_umask ();
2703           Return the current umask.  By default the umask is 022 unless it
2704           has been set by calling "$g->umask".
2705
2706       $verbose = $g->get_verbose ();
2707           This returns the verbose messages flag.
2708
2709       $context = $g->getcon ();
2710           This gets the SELinux security context of the daemon.
2711
2712           See the documentation about SELINUX in guestfs(3), and "$g->setcon"
2713
2714           This function depends on the feature "selinux".  See also
2715           "$g->feature-available".
2716
2717           This function is deprecated.  In new code, use the
2718           "selinux_relabel" call instead.
2719
2720           Deprecated functions will not be removed from the API, but the fact
2721           that they are deprecated indicates that there are problems with
2722           correct use of these functions.
2723
2724       $xattr = $g->getxattr ($path, $name);
2725           Get a single extended attribute from file "path" named "name".
2726           This call follows symlinks.  If you want to lookup an extended
2727           attribute for the symlink itself, use "$g->lgetxattr".
2728
2729           Normally it is better to get all extended attributes from a file in
2730           one go by calling "$g->getxattrs".  However some Linux filesystem
2731           implementations are buggy and do not provide a way to list out
2732           attributes.  For these filesystems (notably ntfs-3g) you have to
2733           know the names of the extended attributes you want in advance and
2734           call this function.
2735
2736           Extended attribute values are blobs of binary data.  If there is no
2737           extended attribute named "name", this returns an error.
2738
2739           See also: "$g->getxattrs", "$g->lgetxattr", attr(5).
2740
2741           This function depends on the feature "linuxxattrs".  See also
2742           "$g->feature-available".
2743
2744       @xattrs = $g->getxattrs ($path);
2745           This call lists the extended attributes of the file or directory
2746           "path".
2747
2748           At the system call level, this is a combination of the listxattr(2)
2749           and getxattr(2) calls.
2750
2751           See also: "$g->lgetxattrs", attr(5).
2752
2753           This function depends on the feature "linuxxattrs".  See also
2754           "$g->feature-available".
2755
2756       @paths = $g->glob_expand ($pattern [, directoryslash =>
2757       $directoryslash]);
2758           This command searches for all the pathnames matching "pattern"
2759           according to the wildcard expansion rules used by the shell.
2760
2761           If no paths match, then this returns an empty list (note: not an
2762           error).
2763
2764           It is just a wrapper around the C glob(3) function with flags
2765           "GLOB_MARK|GLOB_BRACE".  See that manual page for more details.
2766
2767           "directoryslash" controls whether use the "GLOB_MARK" flag for
2768           glob(3), and it defaults to true.  It can be explicitly set as off
2769           to return no trailing slashes in filenames of directories.
2770
2771           Notice that there is no equivalent command for expanding a device
2772           name (eg. /dev/sd*).  Use "$g->list_devices", "$g->list_partitions"
2773           etc functions instead.
2774
2775       @paths = $g->glob_expand_opts ($pattern [, directoryslash =>
2776       $directoryslash]);
2777           This is an alias of "glob_expand".
2778
2779       @lines = $g->grep ($regex, $path [, extended => $extended] [, fixed =>
2780       $fixed] [, insensitive => $insensitive] [, compressed => $compressed]);
2781           This calls the external grep(1) program and returns the matching
2782           lines.
2783
2784           The optional flags are:
2785
2786           "extended"
2787               Use extended regular expressions.  This is the same as using
2788               the -E flag.
2789
2790           "fixed"
2791               Match fixed (don't use regular expressions).  This is the same
2792               as using the -F flag.
2793
2794           "insensitive"
2795               Match case-insensitive.  This is the same as using the -i flag.
2796
2797           "compressed"
2798               Use zgrep(1) instead of grep(1).  This allows the input to be
2799               compress- or gzip-compressed.
2800
2801           Because of the message protocol, there is a transfer limit of
2802           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2803           guestfs(3).
2804
2805       @lines = $g->grep_opts ($regex, $path [, extended => $extended] [,
2806       fixed => $fixed] [, insensitive => $insensitive] [, compressed =>
2807       $compressed]);
2808           This is an alias of "grep".
2809
2810       @lines = $g->grepi ($regex, $path);
2811           This calls the external "grep -i" program and returns the matching
2812           lines.
2813
2814           Because of the message protocol, there is a transfer limit of
2815           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2816           guestfs(3).
2817
2818           This function is deprecated.  In new code, use the "grep" call
2819           instead.
2820
2821           Deprecated functions will not be removed from the API, but the fact
2822           that they are deprecated indicates that there are problems with
2823           correct use of these functions.
2824
2825       $g->grub_install ($root, $device);
2826           This command installs GRUB 1 (the Grand Unified Bootloader) on
2827           "device", with the root directory being "root".
2828
2829           Notes:
2830
2831           •   There is currently no way in the API to install grub2, which is
2832               used by most modern Linux guests.  It is possible to run the
2833               grub2 command from the guest, although see the caveats in
2834               "RUNNING COMMANDS" in guestfs(3).
2835
2836           •   This uses grub-install(8) from the host.  Unfortunately grub is
2837               not always compatible with itself, so this only works in rather
2838               narrow circumstances.  Careful testing with each guest version
2839               is advisable.
2840
2841           •   If grub-install reports the error "No suitable drive was found
2842               in the generated device map."  it may be that you need to
2843               create a /boot/grub/device.map file first that contains the
2844               mapping between grub device names and Linux device names.  It
2845               is usually sufficient to create a file containing:
2846
2847                (hd0) /dev/vda
2848
2849               replacing /dev/vda with the name of the installation device.
2850
2851           This function depends on the feature "grub".  See also
2852           "$g->feature-available".
2853
2854       @lines = $g->head ($path);
2855           This command returns up to the first 10 lines of a file as a list
2856           of strings.
2857
2858           Because of the message protocol, there is a transfer limit of
2859           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2860           guestfs(3).
2861
2862       @lines = $g->head_n ($nrlines, $path);
2863           If the parameter "nrlines" is a positive number, this returns the
2864           first "nrlines" lines of the file "path".
2865
2866           If the parameter "nrlines" is a negative number, this returns lines
2867           from the file "path", excluding the last "nrlines" lines.
2868
2869           If the parameter "nrlines" is zero, this returns an empty list.
2870
2871           Because of the message protocol, there is a transfer limit of
2872           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2873           guestfs(3).
2874
2875       $dump = $g->hexdump ($path);
2876           This runs "hexdump -C" on the given "path".  The result is the
2877           human-readable, canonical hex dump of the file.
2878
2879           Because of the message protocol, there is a transfer limit of
2880           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
2881           guestfs(3).
2882
2883       $g->hivex_close ();
2884           Close the current hivex handle.
2885
2886           This is a wrapper around the hivex(3) call of the same name.
2887
2888           This function depends on the feature "hivex".  See also
2889           "$g->feature-available".
2890
2891       $g->hivex_commit ($filename);
2892           Commit (write) changes to the hive.
2893
2894           If the optional filename parameter is null, then the changes are
2895           written back to the same hive that was opened.  If this is not null
2896           then they are written to the alternate filename given and the
2897           original hive is left untouched.
2898
2899           This is a wrapper around the hivex(3) call of the same name.
2900
2901           This function depends on the feature "hivex".  See also
2902           "$g->feature-available".
2903
2904       $nodeh = $g->hivex_node_add_child ($parent, $name);
2905           Add a child node to "parent" named "name".
2906
2907           This is a wrapper around the hivex(3) call of the same name.
2908
2909           This function depends on the feature "hivex".  See also
2910           "$g->feature-available".
2911
2912       @nodehs = $g->hivex_node_children ($nodeh);
2913           Return the list of nodes which are subkeys of "nodeh".
2914
2915           This is a wrapper around the hivex(3) call of the same name.
2916
2917           This function depends on the feature "hivex".  See also
2918           "$g->feature-available".
2919
2920       $g->hivex_node_delete_child ($nodeh);
2921           Delete "nodeh", recursively if necessary.
2922
2923           This is a wrapper around the hivex(3) call of the same name.
2924
2925           This function depends on the feature "hivex".  See also
2926           "$g->feature-available".
2927
2928       $child = $g->hivex_node_get_child ($nodeh, $name);
2929           Return the child of "nodeh" with the name "name", if it exists.
2930           This can return 0 meaning the name was not found.
2931
2932           This is a wrapper around the hivex(3) call of the same name.
2933
2934           This function depends on the feature "hivex".  See also
2935           "$g->feature-available".
2936
2937       $valueh = $g->hivex_node_get_value ($nodeh, $key);
2938           Return the value attached to "nodeh" which has the name "key", if
2939           it exists.  This can return 0 meaning the key was not found.
2940
2941           This is a wrapper around the hivex(3) call of the same name.
2942
2943           This function depends on the feature "hivex".  See also
2944           "$g->feature-available".
2945
2946       $name = $g->hivex_node_name ($nodeh);
2947           Return the name of "nodeh".
2948
2949           This is a wrapper around the hivex(3) call of the same name.
2950
2951           This function depends on the feature "hivex".  See also
2952           "$g->feature-available".
2953
2954       $parent = $g->hivex_node_parent ($nodeh);
2955           Return the parent node of "nodeh".
2956
2957           This is a wrapper around the hivex(3) call of the same name.
2958
2959           This function depends on the feature "hivex".  See also
2960           "$g->feature-available".
2961
2962       $g->hivex_node_set_value ($nodeh, $key, $t, $val);
2963           Set or replace a single value under the node "nodeh".  The "key" is
2964           the name, "t" is the type, and "val" is the data.
2965
2966           This is a wrapper around the hivex(3) call of the same name.
2967
2968           This function depends on the feature "hivex".  See also
2969           "$g->feature-available".
2970
2971       @valuehs = $g->hivex_node_values ($nodeh);
2972           Return the array of (key, datatype, data) tuples attached to
2973           "nodeh".
2974
2975           This is a wrapper around the hivex(3) call of the same name.
2976
2977           This function depends on the feature "hivex".  See also
2978           "$g->feature-available".
2979
2980       $g->hivex_open ($filename [, verbose => $verbose] [, debug => $debug]
2981       [, write => $write] [, unsafe => $unsafe]);
2982           Open the Windows Registry hive file named filename.  If there was
2983           any previous hivex handle associated with this guestfs session,
2984           then it is closed.
2985
2986           This is a wrapper around the hivex(3) call of the same name.
2987
2988           This function depends on the feature "hivex".  See also
2989           "$g->feature-available".
2990
2991       $nodeh = $g->hivex_root ();
2992           Return the root node of the hive.
2993
2994           This is a wrapper around the hivex(3) call of the same name.
2995
2996           This function depends on the feature "hivex".  See also
2997           "$g->feature-available".
2998
2999       $key = $g->hivex_value_key ($valueh);
3000           Return the key (name) field of a (key, datatype, data) tuple.
3001
3002           This is a wrapper around the hivex(3) call of the same name.
3003
3004           This function depends on the feature "hivex".  See also
3005           "$g->feature-available".
3006
3007       $databuf = $g->hivex_value_string ($valueh);
3008           This calls "$g->hivex_value_value" (which returns the data field
3009           from a hivex value tuple).  It then assumes that the field is a
3010           UTF-16LE string and converts the result to UTF-8 (or if this is not
3011           possible, it returns an error).
3012
3013           This is useful for reading strings out of the Windows registry.
3014           However it is not foolproof because the registry is not strongly-
3015           typed and fields can contain arbitrary or unexpected data.
3016
3017           This function depends on the feature "hivex".  See also
3018           "$g->feature-available".
3019
3020       $datatype = $g->hivex_value_type ($valueh);
3021           Return the data type field from a (key, datatype, data) tuple.
3022
3023           This is a wrapper around the hivex(3) call of the same name.
3024
3025           This function depends on the feature "hivex".  See also
3026           "$g->feature-available".
3027
3028       $databuf = $g->hivex_value_utf8 ($valueh);
3029           This calls "$g->hivex_value_value" (which returns the data field
3030           from a hivex value tuple).  It then assumes that the field is a
3031           UTF-16LE string and converts the result to UTF-8 (or if this is not
3032           possible, it returns an error).
3033
3034           This is useful for reading strings out of the Windows registry.
3035           However it is not foolproof because the registry is not strongly-
3036           typed and fields can contain arbitrary or unexpected data.
3037
3038           This function depends on the feature "hivex".  See also
3039           "$g->feature-available".
3040
3041           This function is deprecated.  In new code, use the
3042           "hivex_value_string" call instead.
3043
3044           Deprecated functions will not be removed from the API, but the fact
3045           that they are deprecated indicates that there are problems with
3046           correct use of these functions.
3047
3048       $databuf = $g->hivex_value_value ($valueh);
3049           Return the data field of a (key, datatype, data) tuple.
3050
3051           This is a wrapper around the hivex(3) call of the same name.
3052
3053           See also: "$g->hivex_value_utf8".
3054
3055           This function depends on the feature "hivex".  See also
3056           "$g->feature-available".
3057
3058       $content = $g->initrd_cat ($initrdpath, $filename);
3059           This command unpacks the file filename from the initrd file called
3060           initrdpath.  The filename must be given without the initial /
3061           character.
3062
3063           For example, in guestfish you could use the following command to
3064           examine the boot script (usually called /init) contained in a Linux
3065           initrd or initramfs image:
3066
3067            initrd-cat /boot/initrd-<version>.img init
3068
3069           See also "$g->initrd_list".
3070
3071           Because of the message protocol, there is a transfer limit of
3072           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
3073           guestfs(3).
3074
3075       @filenames = $g->initrd_list ($path);
3076           This command lists out files contained in an initrd.
3077
3078           The files are listed without any initial / character.  The files
3079           are listed in the order they appear (not necessarily alphabetical).
3080           Directory names are listed as separate items.
3081
3082           Old Linux kernels (2.4 and earlier) used a compressed ext2
3083           filesystem as initrd.  We only support the newer initramfs format
3084           (compressed cpio files).
3085
3086       $wd = $g->inotify_add_watch ($path, $mask);
3087           Watch "path" for the events listed in "mask".
3088
3089           Note that if "path" is a directory then events within that
3090           directory are watched, but this does not happen recursively (in
3091           subdirectories).
3092
3093           Note for non-C or non-Linux callers: the inotify events are defined
3094           by the Linux kernel ABI and are listed in
3095           /usr/include/sys/inotify.h.
3096
3097           This function depends on the feature "inotify".  See also
3098           "$g->feature-available".
3099
3100       $g->inotify_close ();
3101           This closes the inotify handle which was previously opened by
3102           inotify_init.  It removes all watches, throws away any pending
3103           events, and deallocates all resources.
3104
3105           This function depends on the feature "inotify".  See also
3106           "$g->feature-available".
3107
3108       @paths = $g->inotify_files ();
3109           This function is a helpful wrapper around "$g->inotify_read" which
3110           just returns a list of pathnames of objects that were touched.  The
3111           returned pathnames are sorted and deduplicated.
3112
3113           This function depends on the feature "inotify".  See also
3114           "$g->feature-available".
3115
3116       $g->inotify_init ($maxevents);
3117           This command creates a new inotify handle.  The inotify subsystem
3118           can be used to notify events which happen to objects in the guest
3119           filesystem.
3120
3121           "maxevents" is the maximum number of events which will be queued up
3122           between calls to "$g->inotify_read" or "$g->inotify_files".  If
3123           this is passed as 0, then the kernel (or previously set) default is
3124           used.  For Linux 2.6.29 the default was 16384 events.  Beyond this
3125           limit, the kernel throws away events, but records the fact that it
3126           threw them away by setting a flag "IN_Q_OVERFLOW" in the returned
3127           structure list (see "$g->inotify_read").
3128
3129           Before any events are generated, you have to add some watches to
3130           the internal watch list.  See: "$g->inotify_add_watch" and
3131           "$g->inotify_rm_watch".
3132
3133           Queued up events should be read periodically by calling
3134           "$g->inotify_read" (or "$g->inotify_files" which is just a helpful
3135           wrapper around "$g->inotify_read").  If you don't read the events
3136           out often enough then you risk the internal queue overflowing.
3137
3138           The handle should be closed after use by calling
3139           "$g->inotify_close".  This also removes any watches automatically.
3140
3141           See also inotify(7) for an overview of the inotify interface as
3142           exposed by the Linux kernel, which is roughly what we expose via
3143           libguestfs.  Note that there is one global inotify handle per
3144           libguestfs instance.
3145
3146           This function depends on the feature "inotify".  See also
3147           "$g->feature-available".
3148
3149       @events = $g->inotify_read ();
3150           Return the complete queue of events that have happened since the
3151           previous read call.
3152
3153           If no events have happened, this returns an empty list.
3154
3155           Note: In order to make sure that all events have been read, you
3156           must call this function repeatedly until it returns an empty list.
3157           The reason is that the call will read events up to the maximum
3158           appliance-to-host message size and leave remaining events in the
3159           queue.
3160
3161           This function depends on the feature "inotify".  See also
3162           "$g->feature-available".
3163
3164       $g->inotify_rm_watch ($wd);
3165           Remove a previously defined inotify watch.  See
3166           "$g->inotify_add_watch".
3167
3168           This function depends on the feature "inotify".  See also
3169           "$g->feature-available".
3170
3171       $arch = $g->inspect_get_arch ($root);
3172           This returns the architecture of the inspected operating system.
3173           The possible return values are listed under
3174           "$g->file_architecture".
3175
3176           If the architecture could not be determined, then the string
3177           "unknown" is returned.
3178
3179           Please read "INSPECTION" in guestfs(3) for more details.
3180
3181       $distro = $g->inspect_get_distro ($root);
3182           This returns the distro (distribution) of the inspected operating
3183           system.
3184
3185           Currently defined distros are:
3186
3187           "alpinelinux"
3188               Alpine Linux.
3189
3190           "altlinux"
3191               ALT Linux.
3192
3193           "archlinux"
3194               Arch Linux.
3195
3196           "buildroot"
3197               Buildroot-derived distro, but not one we specifically
3198               recognize.
3199
3200           "centos"
3201               CentOS.
3202
3203           "cirros"
3204               Cirros.
3205
3206           "coreos"
3207               CoreOS.
3208
3209           "debian"
3210               Debian.
3211
3212           "fedora"
3213               Fedora.
3214
3215           "freebsd"
3216               FreeBSD.
3217
3218           "freedos"
3219               FreeDOS.
3220
3221           "frugalware"
3222               Frugalware.
3223
3224           "gentoo"
3225               Gentoo.
3226
3227           "kalilinux"
3228               Kali Linux.
3229
3230           "kylin"
3231               Kylin.
3232
3233           "linuxmint"
3234               Linux Mint.
3235
3236           "mageia"
3237               Mageia.
3238
3239           "mandriva"
3240               Mandriva.
3241
3242           "meego"
3243               MeeGo.
3244
3245           "msdos"
3246               Microsoft DOS.
3247
3248           "neokylin"
3249               NeoKylin.
3250
3251           "netbsd"
3252               NetBSD.
3253
3254           "openbsd"
3255               OpenBSD.
3256
3257           "openmandriva"
3258               OpenMandriva Lx.
3259
3260           "opensuse"
3261               OpenSUSE.
3262
3263           "oraclelinux"
3264               Oracle Linux.
3265
3266           "pardus"
3267               Pardus.
3268
3269           "pldlinux"
3270               PLD Linux.
3271
3272           "redhat-based"
3273               Some Red Hat-derived distro.
3274
3275           "rhel"
3276               Red Hat Enterprise Linux.
3277
3278           "rocky"
3279               Rocky Linux.
3280
3281           "scientificlinux"
3282               Scientific Linux.
3283
3284           "slackware"
3285               Slackware.
3286
3287           "sles"
3288               SuSE Linux Enterprise Server or Desktop.
3289
3290           "suse-based"
3291               Some openSuSE-derived distro.
3292
3293           "ttylinux"
3294               ttylinux.
3295
3296           "ubuntu"
3297               Ubuntu.
3298
3299           "unknown"
3300               The distro could not be determined.
3301
3302           "voidlinux"
3303               Void Linux.
3304
3305           "windows"
3306               Windows does not have distributions.  This string is returned
3307               if the OS type is Windows.
3308
3309           Future versions of libguestfs may return other strings here.  The
3310           caller should be prepared to handle any string.
3311
3312           Please read "INSPECTION" in guestfs(3) for more details.
3313
3314       %drives = $g->inspect_get_drive_mappings ($root);
3315           This call is useful for Windows which uses a primitive system of
3316           assigning drive letters (like C:\) to partitions.  This inspection
3317           API examines the Windows Registry to find out how disks/partitions
3318           are mapped to drive letters, and returns a hash table as in the
3319           example below:
3320
3321            C      =>     /dev/vda2
3322            E      =>     /dev/vdb1
3323            F      =>     /dev/vdc1
3324
3325           Note that keys are drive letters.  For Windows, the key is case
3326           insensitive and just contains the drive letter, without the
3327           customary colon separator character.
3328
3329           In future we may support other operating systems that also used
3330           drive letters, but the keys for those might not be case insensitive
3331           and might be longer than 1 character.  For example in OS-9, hard
3332           drives were named "h0", "h1" etc.
3333
3334           For Windows guests, currently only hard drive mappings are
3335           returned.  Removable disks (eg. DVD-ROMs) are ignored.
3336
3337           For guests that do not use drive mappings, or if the drive mappings
3338           could not be determined, this returns an empty hash table.
3339
3340           Please read "INSPECTION" in guestfs(3) for more details.  See also
3341           "$g->inspect_get_mountpoints", "$g->inspect_get_filesystems".
3342
3343       @filesystems = $g->inspect_get_filesystems ($root);
3344           This returns a list of all the filesystems that we think are
3345           associated with this operating system.  This includes the root
3346           filesystem, other ordinary filesystems, and non-mounted devices
3347           like swap partitions.
3348
3349           In the case of a multi-boot virtual machine, it is possible for a
3350           filesystem to be shared between operating systems.
3351
3352           Please read "INSPECTION" in guestfs(3) for more details.  See also
3353           "$g->inspect_get_mountpoints".
3354
3355       $format = $g->inspect_get_format ($root);
3356           Before libguestfs 1.38, there was some unreliable support for
3357           detecting installer CDs.  This API would return:
3358
3359           "installed"
3360               This is an installed operating system.
3361
3362           "installer"
3363               The disk image being inspected is not an installed operating
3364               system, but a bootable install disk, live CD, or similar.
3365
3366           "unknown"
3367               The format of this disk image is not known.
3368
3369           In libguestfs X 1.38, this only returns "installed".  Use libosinfo
3370           directly to detect installer CDs.
3371
3372           Please read "INSPECTION" in guestfs(3) for more details.
3373
3374           This function is deprecated.  There is no replacement.  Consult the
3375           API documentation in guestfs(3) for further information.
3376
3377           Deprecated functions will not be removed from the API, but the fact
3378           that they are deprecated indicates that there are problems with
3379           correct use of these functions.
3380
3381       $hostname = $g->inspect_get_hostname ($root);
3382           This function returns the hostname of the operating system as found
3383           by inspection of the guestXs configuration files.
3384
3385           If the hostname could not be determined, then the string "unknown"
3386           is returned.
3387
3388           Please read "INSPECTION" in guestfs(3) for more details.
3389
3390       $icon = $g->inspect_get_icon ($root [, favicon => $favicon] [,
3391       highquality => $highquality]);
3392           This function returns an icon corresponding to the inspected
3393           operating system.  The icon is returned as a buffer containing a
3394           PNG image (re-encoded to PNG if necessary).
3395
3396           If it was not possible to get an icon this function returns a zero-
3397           length (non-NULL) buffer.  Callers must check for this case.
3398
3399           Libguestfs will start by looking for a file called /etc/favicon.png
3400           or C:\etc\favicon.png and if it has the correct format, the
3401           contents of this file will be returned.  You can disable favicons
3402           by passing the optional "favicon" boolean as false (default is
3403           true).
3404
3405           If finding the favicon fails, then we look in other places in the
3406           guest for a suitable icon.
3407
3408           If the optional "highquality" boolean is true then only high
3409           quality icons are returned, which means only icons of high
3410           resolution with an alpha channel.  The default (false) is to return
3411           any icon we can, even if it is of substandard quality.
3412
3413           Notes:
3414
3415           •   Unlike most other inspection API calls, the guestXs disks must
3416               be mounted up before you call this, since it needs to read
3417               information from the guest filesystem during the call.
3418
3419           •   Security: The icon data comes from the untrusted guest, and
3420               should be treated with caution.  PNG files have been known to
3421               contain exploits.  Ensure that libpng (or other relevant
3422               libraries) are fully up to date before trying to process or
3423               display the icon.
3424
3425           •   The PNG image returned can be any size.  It might not be
3426               square.  Libguestfs tries to return the largest, highest
3427               quality icon available.  The application must scale the icon to
3428               the required size.
3429
3430           •   Extracting icons from Windows guests requires the external
3431               wrestool(1) program from the "icoutils" package, and several
3432               programs (bmptopnm(1), pnmtopng(1), pamcut(1)) from the
3433               "netpbm" package.  These must be installed separately.
3434
3435           •   Operating system icons are usually trademarks.  Seek legal
3436               advice before using trademarks in applications.
3437
3438       $major = $g->inspect_get_major_version ($root);
3439           This returns the major version number of the inspected operating
3440           system.
3441
3442           Windows uses a consistent versioning scheme which is not reflected
3443           in the popular public names used by the operating system.  Notably
3444           the operating system known as "Windows 7" is really version 6.1
3445           (ie. major = 6, minor = 1).  You can find out the real versions
3446           corresponding to releases of Windows by consulting Wikipedia or
3447           MSDN.
3448
3449           If the version could not be determined, then 0 is returned.
3450
3451           Please read "INSPECTION" in guestfs(3) for more details.
3452
3453       $minor = $g->inspect_get_minor_version ($root);
3454           This returns the minor version number of the inspected operating
3455           system.
3456
3457           If the version could not be determined, then 0 is returned.
3458
3459           Please read "INSPECTION" in guestfs(3) for more details.  See also
3460           "$g->inspect_get_major_version".
3461
3462       %mountpoints = $g->inspect_get_mountpoints ($root);
3463           This returns a hash of where we think the filesystems associated
3464           with this operating system should be mounted.  Callers should note
3465           that this is at best an educated guess made by reading
3466           configuration files such as /etc/fstab.  In particular note that
3467           this may return filesystems which are non-existent or not mountable
3468           and callers should be prepared to handle or ignore failures if they
3469           try to mount them.
3470
3471           Each element in the returned hashtable has a key which is the path
3472           of the mountpoint (eg. /boot) and a value which is the filesystem
3473           that would be mounted there (eg. /dev/sda1).
3474
3475           Non-mounted devices such as swap devices are not returned in this
3476           list.
3477
3478           For operating systems like Windows which still use drive letters,
3479           this call will only return an entry for the first drive "mounted
3480           on" /.  For information about the mapping of drive letters to
3481           partitions, see "$g->inspect_get_drive_mappings".
3482
3483           Please read "INSPECTION" in guestfs(3) for more details.  See also
3484           "$g->inspect_get_filesystems".
3485
3486       $id = $g->inspect_get_osinfo ($root);
3487           This function returns a possible short ID for libosinfo
3488           corresponding to the guest.
3489
3490           Note: The returned ID is only a guess by libguestfs, and nothing
3491           ensures that it actually exists in osinfo-db.
3492
3493           If no ID could not be determined, then the string "unknown" is
3494           returned.
3495
3496       $packageformat = $g->inspect_get_package_format ($root);
3497           This function and "$g->inspect_get_package_management" return the
3498           package format and package management tool used by the inspected
3499           operating system.  For example for Fedora these functions would
3500           return "rpm" (package format), and "yum" or "dnf" (package
3501           management).
3502
3503           This returns the string "unknown" if we could not determine the
3504           package format or if the operating system does not have a real
3505           packaging system (eg. Windows).
3506
3507           Possible strings include: "rpm", "deb", "ebuild", "pisi", "pacman",
3508           "pkgsrc", "apk", "xbps".  Future versions of libguestfs may return
3509           other strings.
3510
3511           Please read "INSPECTION" in guestfs(3) for more details.
3512
3513       $packagemanagement = $g->inspect_get_package_management ($root);
3514           "$g->inspect_get_package_format" and this function return the
3515           package format and package management tool used by the inspected
3516           operating system.  For example for Fedora these functions would
3517           return "rpm" (package format), and "yum" or "dnf" (package
3518           management).
3519
3520           This returns the string "unknown" if we could not determine the
3521           package management tool or if the operating system does not have a
3522           real packaging system (eg. Windows).
3523
3524           Possible strings include: "yum", "dnf", "up2date", "apt" (for all
3525           Debian derivatives), "portage", "pisi", "pacman", "urpmi",
3526           "zypper", "apk", "xbps".  Future versions of libguestfs may return
3527           other strings.
3528
3529           Please read "INSPECTION" in guestfs(3) for more details.
3530
3531       $product = $g->inspect_get_product_name ($root);
3532           This returns the product name of the inspected operating system.
3533           The product name is generally some freeform string which can be
3534           displayed to the user, but should not be parsed by programs.
3535
3536           If the product name could not be determined, then the string
3537           "unknown" is returned.
3538
3539           Please read "INSPECTION" in guestfs(3) for more details.
3540
3541       $variant = $g->inspect_get_product_variant ($root);
3542           This returns the product variant of the inspected operating system.
3543
3544           For Windows guests, this returns the contents of the Registry key
3545           "HKLM\Software\Microsoft\Windows NT\CurrentVersion"
3546           "InstallationType" which is usually a string such as "Client" or
3547           "Server" (other values are possible).  This can be used to
3548           distinguish consumer and enterprise versions of Windows that have
3549           the same version number (for example, Windows 7 and Windows 2008
3550           Server are both version 6.1, but the former is "Client" and the
3551           latter is "Server").
3552
3553           For enterprise Linux guests, in future we intend this to return the
3554           product variant such as "Desktop", "Server" and so on.  But this is
3555           not implemented at present.
3556
3557           If the product variant could not be determined, then the string
3558           "unknown" is returned.
3559
3560           Please read "INSPECTION" in guestfs(3) for more details.  See also
3561           "$g->inspect_get_product_name", "$g->inspect_get_major_version".
3562
3563       @roots = $g->inspect_get_roots ();
3564           This function is a convenient way to get the list of root devices,
3565           as returned from a previous call to "$g->inspect_os", but without
3566           redoing the whole inspection process.
3567
3568           This returns an empty list if either no root devices were found or
3569           the caller has not called "$g->inspect_os".
3570
3571           Please read "INSPECTION" in guestfs(3) for more details.
3572
3573       $name = $g->inspect_get_type ($root);
3574           This returns the type of the inspected operating system.  Currently
3575           defined types are:
3576
3577           "linux"
3578               Any Linux-based operating system.
3579
3580           "windows"
3581               Any Microsoft Windows operating system.
3582
3583           "freebsd"
3584               FreeBSD.
3585
3586           "netbsd"
3587               NetBSD.
3588
3589           "openbsd"
3590               OpenBSD.
3591
3592           "hurd"
3593               GNU/Hurd.
3594
3595           "dos"
3596               MS-DOS, FreeDOS and others.
3597
3598           "minix"
3599               MINIX.
3600
3601           "unknown"
3602               The operating system type could not be determined.
3603
3604           Future versions of libguestfs may return other strings here.  The
3605           caller should be prepared to handle any string.
3606
3607           Please read "INSPECTION" in guestfs(3) for more details.
3608
3609       $controlset = $g->inspect_get_windows_current_control_set ($root);
3610           This returns the Windows CurrentControlSet of the inspected guest.
3611           The CurrentControlSet is a registry key name such as
3612           "ControlSet001".
3613
3614           This call assumes that the guest is Windows and that the Registry
3615           could be examined by inspection.  If this is not the case then an
3616           error is returned.
3617
3618           Please read "INSPECTION" in guestfs(3) for more details.
3619
3620       $path = $g->inspect_get_windows_software_hive ($root);
3621           This returns the path to the hive (binary Windows Registry file)
3622           corresponding to HKLM\SOFTWARE.
3623
3624           This call assumes that the guest is Windows and that the guest has
3625           a software hive file with the right name.  If this is not the case
3626           then an error is returned.  This call does not check that the hive
3627           is a valid Windows Registry hive.
3628
3629           You can use "$g->hivex_open" to read or write to the hive.
3630
3631           Please read "INSPECTION" in guestfs(3) for more details.
3632
3633       $path = $g->inspect_get_windows_system_hive ($root);
3634           This returns the path to the hive (binary Windows Registry file)
3635           corresponding to HKLM\SYSTEM.
3636
3637           This call assumes that the guest is Windows and that the guest has
3638           a system hive file with the right name.  If this is not the case
3639           then an error is returned.  This call does not check that the hive
3640           is a valid Windows Registry hive.
3641
3642           You can use "$g->hivex_open" to read or write to the hive.
3643
3644           Please read "INSPECTION" in guestfs(3) for more details.
3645
3646       $systemroot = $g->inspect_get_windows_systemroot ($root);
3647           This returns the Windows systemroot of the inspected guest.  The
3648           systemroot is a directory path such as /WINDOWS.
3649
3650           This call assumes that the guest is Windows and that the systemroot
3651           could be determined by inspection.  If this is not the case then an
3652           error is returned.
3653
3654           Please read "INSPECTION" in guestfs(3) for more details.
3655
3656       $live = $g->inspect_is_live ($root);
3657           This is deprecated and always returns "false".
3658
3659           Please read "INSPECTION" in guestfs(3) for more details.
3660
3661           This function is deprecated.  There is no replacement.  Consult the
3662           API documentation in guestfs(3) for further information.
3663
3664           Deprecated functions will not be removed from the API, but the fact
3665           that they are deprecated indicates that there are problems with
3666           correct use of these functions.
3667
3668       $multipart = $g->inspect_is_multipart ($root);
3669           This is deprecated and always returns "false".
3670
3671           Please read "INSPECTION" in guestfs(3) for more details.
3672
3673           This function is deprecated.  There is no replacement.  Consult the
3674           API documentation in guestfs(3) for further information.
3675
3676           Deprecated functions will not be removed from the API, but the fact
3677           that they are deprecated indicates that there are problems with
3678           correct use of these functions.
3679
3680       $netinst = $g->inspect_is_netinst ($root);
3681           This is deprecated and always returns "false".
3682
3683           Please read "INSPECTION" in guestfs(3) for more details.
3684
3685           This function is deprecated.  There is no replacement.  Consult the
3686           API documentation in guestfs(3) for further information.
3687
3688           Deprecated functions will not be removed from the API, but the fact
3689           that they are deprecated indicates that there are problems with
3690           correct use of these functions.
3691
3692       @applications = $g->inspect_list_applications ($root);
3693           Return the list of applications installed in the operating system.
3694
3695           Note: This call works differently from other parts of the
3696           inspection API.  You have to call "$g->inspect_os", then
3697           "$g->inspect_get_mountpoints", then mount up the disks, before
3698           calling this.  Listing applications is a significantly more
3699           difficult operation which requires access to the full filesystem.
3700           Also note that unlike the other "$g->inspect_get_*" calls which are
3701           just returning data cached in the libguestfs handle, this call
3702           actually reads parts of the mounted filesystems during the call.
3703
3704           This returns an empty list if the inspection code was not able to
3705           determine the list of applications.
3706
3707           The application structure contains the following fields:
3708
3709           "app_name"
3710               The name of the application.  For Linux guests, this is the
3711               package name.
3712
3713           "app_display_name"
3714               The display name of the application, sometimes localized to the
3715               install language of the guest operating system.
3716
3717               If unavailable this is returned as an empty string "".  Callers
3718               needing to display something can use "app_name" instead.
3719
3720           "app_epoch"
3721               For package managers which use epochs, this contains the epoch
3722               of the package (an integer).  If unavailable, this is returned
3723               as 0.
3724
3725           "app_version"
3726               The version string of the application or package.  If
3727               unavailable this is returned as an empty string "".
3728
3729           "app_release"
3730               The release string of the application or package, for package
3731               managers that use this.  If unavailable this is returned as an
3732               empty string "".
3733
3734           "app_install_path"
3735               The installation path of the application (on operating systems
3736               such as Windows which use installation paths).  This path is in
3737               the format used by the guest operating system, it is not a
3738               libguestfs path.
3739
3740               If unavailable this is returned as an empty string "".
3741
3742           "app_trans_path"
3743               The install path translated into a libguestfs path.  If
3744               unavailable this is returned as an empty string "".
3745
3746           "app_publisher"
3747               The name of the publisher of the application, for package
3748               managers that use this.  If unavailable this is returned as an
3749               empty string "".
3750
3751           "app_url"
3752               The URL (eg. upstream URL) of the application.  If unavailable
3753               this is returned as an empty string "".
3754
3755           "app_source_package"
3756               For packaging systems which support this, the name of the
3757               source package.  If unavailable this is returned as an empty
3758               string "".
3759
3760           "app_summary"
3761               A short (usually one line) description of the application or
3762               package.  If unavailable this is returned as an empty string
3763               "".
3764
3765           "app_description"
3766               A longer description of the application or package.  If
3767               unavailable this is returned as an empty string "".
3768
3769           Please read "INSPECTION" in guestfs(3) for more details.
3770
3771           This function is deprecated.  In new code, use the
3772           "inspect_list_applications2" call instead.
3773
3774           Deprecated functions will not be removed from the API, but the fact
3775           that they are deprecated indicates that there are problems with
3776           correct use of these functions.
3777
3778       @applications2 = $g->inspect_list_applications2 ($root);
3779           Return the list of applications installed in the operating system.
3780
3781           Note: This call works differently from other parts of the
3782           inspection API.  You have to call "$g->inspect_os", then
3783           "$g->inspect_get_mountpoints", then mount up the disks, before
3784           calling this.  Listing applications is a significantly more
3785           difficult operation which requires access to the full filesystem.
3786           Also note that unlike the other "$g->inspect_get_*" calls which are
3787           just returning data cached in the libguestfs handle, this call
3788           actually reads parts of the mounted filesystems during the call.
3789
3790           This returns an empty list if the inspection code was not able to
3791           determine the list of applications.
3792
3793           The application structure contains the following fields:
3794
3795           "app2_name"
3796               The name of the application.  For Linux guests, this is the
3797               package name.
3798
3799           "app2_display_name"
3800               The display name of the application, sometimes localized to the
3801               install language of the guest operating system.
3802
3803               If unavailable this is returned as an empty string "".  Callers
3804               needing to display something can use "app2_name" instead.
3805
3806           "app2_epoch"
3807               For package managers which use epochs, this contains the epoch
3808               of the package (an integer).  If unavailable, this is returned
3809               as 0.
3810
3811           "app2_version"
3812               The version string of the application or package.  If
3813               unavailable this is returned as an empty string "".
3814
3815           "app2_release"
3816               The release string of the application or package, for package
3817               managers that use this.  If unavailable this is returned as an
3818               empty string "".
3819
3820           "app2_arch"
3821               The architecture string of the application or package, for
3822               package managers that use this.  If unavailable this is
3823               returned as an empty string "".
3824
3825           "app2_install_path"
3826               The installation path of the application (on operating systems
3827               such as Windows which use installation paths).  This path is in
3828               the format used by the guest operating system, it is not a
3829               libguestfs path.
3830
3831               If unavailable this is returned as an empty string "".
3832
3833           "app2_trans_path"
3834               The install path translated into a libguestfs path.  If
3835               unavailable this is returned as an empty string "".
3836
3837           "app2_publisher"
3838               The name of the publisher of the application, for package
3839               managers that use this.  If unavailable this is returned as an
3840               empty string "".
3841
3842           "app2_url"
3843               The URL (eg. upstream URL) of the application.  If unavailable
3844               this is returned as an empty string "".
3845
3846           "app2_source_package"
3847               For packaging systems which support this, the name of the
3848               source package.  If unavailable this is returned as an empty
3849               string "".
3850
3851           "app2_summary"
3852               A short (usually one line) description of the application or
3853               package.  If unavailable this is returned as an empty string
3854               "".
3855
3856           "app2_description"
3857               A longer description of the application or package.  If
3858               unavailable this is returned as an empty string "".
3859
3860           Please read "INSPECTION" in guestfs(3) for more details.
3861
3862       @roots = $g->inspect_os ();
3863           This function uses other libguestfs functions and certain
3864           heuristics to inspect the disk(s) (usually disks belonging to a
3865           virtual machine), looking for operating systems.
3866
3867           The list returned is empty if no operating systems were found.
3868
3869           If one operating system was found, then this returns a list with a
3870           single element, which is the name of the root filesystem of this
3871           operating system.  It is also possible for this function to return
3872           a list containing more than one element, indicating a dual-boot or
3873           multi-boot virtual machine, with each element being the root
3874           filesystem of one of the operating systems.
3875
3876           You can pass the root string(s) returned to other
3877           "$g->inspect_get_*" functions in order to query further information
3878           about each operating system, such as the name and version.
3879
3880           This function uses other libguestfs features such as "$g->mount_ro"
3881           and "$g->umount_all" in order to mount and unmount filesystems and
3882           look at the contents.  This should be called with no disks
3883           currently mounted.  The function may also use Augeas, so any
3884           existing Augeas handle will be closed.
3885
3886           This function cannot decrypt encrypted disks.  The caller must do
3887           that first (supplying the necessary keys) if the disk is encrypted.
3888
3889           Please read "INSPECTION" in guestfs(3) for more details.
3890
3891           See also "$g->list_filesystems".
3892
3893       $flag = $g->is_blockdev ($path [, followsymlinks => $followsymlinks]);
3894           This returns "true" if and only if there is a block device with the
3895           given "path" name.
3896
3897           If the optional flag "followsymlinks" is true, then a symlink (or
3898           chain of symlinks) that ends with a block device also causes the
3899           function to return true.
3900
3901           This call only looks at files within the guest filesystem.
3902           Libguestfs partitions and block devices (eg. /dev/sda) cannot be
3903           used as the "path" parameter of this call.
3904
3905           See also "$g->stat".
3906
3907       $flag = $g->is_blockdev_opts ($path [, followsymlinks =>
3908       $followsymlinks]);
3909           This is an alias of "is_blockdev".
3910
3911       $busy = $g->is_busy ();
3912           This always returns false.  This function is deprecated with no
3913           replacement.  Do not use this function.
3914
3915           For more information on states, see guestfs(3).
3916
3917       $flag = $g->is_chardev ($path [, followsymlinks => $followsymlinks]);
3918           This returns "true" if and only if there is a character device with
3919           the given "path" name.
3920
3921           If the optional flag "followsymlinks" is true, then a symlink (or
3922           chain of symlinks) that ends with a chardev also causes the
3923           function to return true.
3924
3925           See also "$g->stat".
3926
3927       $flag = $g->is_chardev_opts ($path [, followsymlinks =>
3928       $followsymlinks]);
3929           This is an alias of "is_chardev".
3930
3931       $config = $g->is_config ();
3932           This returns true iff this handle is being configured (in the
3933           "CONFIG" state).
3934
3935           For more information on states, see guestfs(3).
3936
3937       $dirflag = $g->is_dir ($path [, followsymlinks => $followsymlinks]);
3938           This returns "true" if and only if there is a directory with the
3939           given "path" name.  Note that it returns false for other objects
3940           like files.
3941
3942           If the optional flag "followsymlinks" is true, then a symlink (or
3943           chain of symlinks) that ends with a directory also causes the
3944           function to return true.
3945
3946           See also "$g->stat".
3947
3948       $dirflag = $g->is_dir_opts ($path [, followsymlinks =>
3949       $followsymlinks]);
3950           This is an alias of "is_dir".
3951
3952       $flag = $g->is_fifo ($path [, followsymlinks => $followsymlinks]);
3953           This returns "true" if and only if there is a FIFO (named pipe)
3954           with the given "path" name.
3955
3956           If the optional flag "followsymlinks" is true, then a symlink (or
3957           chain of symlinks) that ends with a FIFO also causes the function
3958           to return true.
3959
3960           See also "$g->stat".
3961
3962       $flag = $g->is_fifo_opts ($path [, followsymlinks => $followsymlinks]);
3963           This is an alias of "is_fifo".
3964
3965       $fileflag = $g->is_file ($path [, followsymlinks => $followsymlinks]);
3966           This returns "true" if and only if there is a regular file with the
3967           given "path" name.  Note that it returns false for other objects
3968           like directories.
3969
3970           If the optional flag "followsymlinks" is true, then a symlink (or
3971           chain of symlinks) that ends with a file also causes the function
3972           to return true.
3973
3974           See also "$g->stat".
3975
3976       $fileflag = $g->is_file_opts ($path [, followsymlinks =>
3977       $followsymlinks]);
3978           This is an alias of "is_file".
3979
3980       $launching = $g->is_launching ();
3981           This returns true iff this handle is launching the subprocess (in
3982           the "LAUNCHING" state).
3983
3984           For more information on states, see guestfs(3).
3985
3986       $lvflag = $g->is_lv ($mountable);
3987           This command tests whether "mountable" is a logical volume, and
3988           returns true iff this is the case.
3989
3990       $ready = $g->is_ready ();
3991           This returns true iff this handle is ready to accept commands (in
3992           the "READY" state).
3993
3994           For more information on states, see guestfs(3).
3995
3996       $flag = $g->is_socket ($path [, followsymlinks => $followsymlinks]);
3997           This returns "true" if and only if there is a Unix domain socket
3998           with the given "path" name.
3999
4000           If the optional flag "followsymlinks" is true, then a symlink (or
4001           chain of symlinks) that ends with a socket also causes the function
4002           to return true.
4003
4004           See also "$g->stat".
4005
4006       $flag = $g->is_socket_opts ($path [, followsymlinks =>
4007       $followsymlinks]);
4008           This is an alias of "is_socket".
4009
4010       $flag = $g->is_symlink ($path);
4011           This returns "true" if and only if there is a symbolic link with
4012           the given "path" name.
4013
4014           See also "$g->stat".
4015
4016       $flag = $g->is_whole_device ($device);
4017           This returns "true" if and only if "device" refers to a whole block
4018           device. That is, not a partition or a logical device.
4019
4020       $zeroflag = $g->is_zero ($path);
4021           This returns true iff the file exists and the file is empty or it
4022           contains all zero bytes.
4023
4024       $zeroflag = $g->is_zero_device ($device);
4025           This returns true iff the device exists and contains all zero
4026           bytes.
4027
4028           Note that for large devices this can take a long time to run.
4029
4030       %isodata = $g->isoinfo ($isofile);
4031           This is the same as "$g->isoinfo_device" except that it works for
4032           an ISO file located inside some other mounted filesystem.  Note
4033           that in the common case where you have added an ISO file as a
4034           libguestfs device, you would not call this.  Instead you would call
4035           "$g->isoinfo_device".
4036
4037       %isodata = $g->isoinfo_device ($device);
4038           "device" is an ISO device.  This returns a struct of information
4039           read from the primary volume descriptor (the ISO equivalent of the
4040           superblock) of the device.
4041
4042           Usually it is more efficient to use the isoinfo(1) command with the
4043           -d option on the host to analyze ISO files, instead of going
4044           through libguestfs.
4045
4046           For information on the primary volume descriptor fields, see
4047           <https://wiki.osdev.org/ISO_9660#The_Primary_Volume_Descriptor>
4048
4049       $g->journal_close ();
4050           Close the journal handle.
4051
4052           This function depends on the feature "journal".  See also
4053           "$g->feature-available".
4054
4055       @fields = $g->journal_get ();
4056           Read the current journal entry.  This returns all the fields in the
4057           journal as a set of "(attrname, attrval)" pairs.  The "attrname" is
4058           the field name (a string).
4059
4060           The "attrval" is the field value (a binary blob, often but not
4061           always a string).  Please note that "attrval" is a byte array, not
4062           a \0-terminated C string.
4063
4064           The length of data may be truncated to the data threshold (see:
4065           "$g->journal_set_data_threshold",
4066           "$g->journal_get_data_threshold").
4067
4068           If you set the data threshold to unlimited (0) then this call can
4069           read a journal entry of any size, ie. it is not limited by the
4070           libguestfs protocol.
4071
4072           This function depends on the feature "journal".  See also
4073           "$g->feature-available".
4074
4075       $threshold = $g->journal_get_data_threshold ();
4076           Get the current data threshold for reading journal entries.  This
4077           is a hint to the journal that it may truncate data fields to this
4078           size when reading them (note also that it may not truncate them).
4079           If this returns 0, then the threshold is unlimited.
4080
4081           See also "$g->journal_set_data_threshold".
4082
4083           This function depends on the feature "journal".  See also
4084           "$g->feature-available".
4085
4086       $usec = $g->journal_get_realtime_usec ();
4087           Get the realtime (wallclock) timestamp of the current journal
4088           entry.
4089
4090           This function depends on the feature "journal".  See also
4091           "$g->feature-available".
4092
4093       $more = $g->journal_next ();
4094           Move to the next journal entry.  You have to call this at least
4095           once after opening the handle before you are able to read data.
4096
4097           The returned boolean tells you if there are any more journal
4098           records to read.  "true" means you can read the next record (eg.
4099           using "$g->journal_get"), and "false" means you have reached the
4100           end of the journal.
4101
4102           This function depends on the feature "journal".  See also
4103           "$g->feature-available".
4104
4105       $g->journal_open ($directory);
4106           Open the systemd journal located in directory.  Any previously
4107           opened journal handle is closed.
4108
4109           The contents of the journal can be read using "$g->journal_next"
4110           and "$g->journal_get".
4111
4112           After you have finished using the journal, you should close the
4113           handle by calling "$g->journal_close".
4114
4115           This function depends on the feature "journal".  See also
4116           "$g->feature-available".
4117
4118       $g->journal_set_data_threshold ($threshold);
4119           Set the data threshold for reading journal entries.  This is a hint
4120           to the journal that it may truncate data fields to this size when
4121           reading them (note also that it may not truncate them).  If you set
4122           this to 0, then the threshold is unlimited.
4123
4124           See also "$g->journal_get_data_threshold".
4125
4126           This function depends on the feature "journal".  See also
4127           "$g->feature-available".
4128
4129       $rskip = $g->journal_skip ($skip);
4130           Skip forwards ("skip X 0") or backwards ("skip < 0") in the
4131           journal.
4132
4133           The number of entries actually skipped is returned (note
4134           "rskip X 0").  If this is not the same as the absolute value of the
4135           skip parameter ("|skip|") you passed in then it means you have
4136           reached the end or the start of the journal.
4137
4138           This function depends on the feature "journal".  See also
4139           "$g->feature-available".
4140
4141       $g->kill_subprocess ();
4142           This kills the hypervisor.
4143
4144           Do not call this.  See: "$g->shutdown" instead.
4145
4146           This function is deprecated.  In new code, use the "shutdown" call
4147           instead.
4148
4149           Deprecated functions will not be removed from the API, but the fact
4150           that they are deprecated indicates that there are problems with
4151           correct use of these functions.
4152
4153       $g->launch ();
4154           You should call this after configuring the handle (eg. adding
4155           drives) but before performing any actions.
4156
4157           Do not call "$g->launch" twice on the same handle.  Although it
4158           will not give an error (for historical reasons), the precise
4159           behaviour when you do this is not well defined.  Handles are very
4160           cheap to create, so create a new one for each launch.
4161
4162       $g->lchown ($owner, $group, $path);
4163           Change the file owner to "owner" and group to "group".  This is
4164           like "$g->chown" but if "path" is a symlink then the link itself is
4165           changed, not the target.
4166
4167           Only numeric uid and gid are supported.  If you want to use names,
4168           you will need to locate and parse the password file yourself
4169           (Augeas support makes this relatively easy).
4170
4171       $g->ldmtool_create_all ();
4172           This function scans all block devices looking for Windows dynamic
4173           disk volumes and partitions, and creates devices for any that were
4174           found.
4175
4176           Call "$g->list_ldm_volumes" and "$g->list_ldm_partitions" to return
4177           all devices.
4178
4179           Note that you don't normally need to call this explicitly, since it
4180           is done automatically at "$g->launch" time.
4181
4182           This function depends on the feature "ldm".  See also
4183           "$g->feature-available".
4184
4185       @disks = $g->ldmtool_diskgroup_disks ($diskgroup);
4186           Return the disks in a Windows dynamic disk group.  The "diskgroup"
4187           parameter should be the GUID of a disk group, one element from the
4188           list returned by "$g->ldmtool_scan".
4189
4190           This function depends on the feature "ldm".  See also
4191           "$g->feature-available".
4192
4193       $name = $g->ldmtool_diskgroup_name ($diskgroup);
4194           Return the name of a Windows dynamic disk group.  The "diskgroup"
4195           parameter should be the GUID of a disk group, one element from the
4196           list returned by "$g->ldmtool_scan".
4197
4198           This function depends on the feature "ldm".  See also
4199           "$g->feature-available".
4200
4201       @volumes = $g->ldmtool_diskgroup_volumes ($diskgroup);
4202           Return the volumes in a Windows dynamic disk group.  The
4203           "diskgroup" parameter should be the GUID of a disk group, one
4204           element from the list returned by "$g->ldmtool_scan".
4205
4206           This function depends on the feature "ldm".  See also
4207           "$g->feature-available".
4208
4209       $g->ldmtool_remove_all ();
4210           This is essentially the opposite of "$g->ldmtool_create_all".  It
4211           removes the device mapper mappings for all Windows dynamic disk
4212           volumes
4213
4214           This function depends on the feature "ldm".  See also
4215           "$g->feature-available".
4216
4217       @guids = $g->ldmtool_scan ();
4218           This function scans for Windows dynamic disks.  It returns a list
4219           of identifiers (GUIDs) for all disk groups that were found.  These
4220           identifiers can be passed to other "$g->ldmtool_*" functions.
4221
4222           This function scans all block devices.  To scan a subset of block
4223           devices, call "$g->ldmtool_scan_devices" instead.
4224
4225           This function depends on the feature "ldm".  See also
4226           "$g->feature-available".
4227
4228       @guids = $g->ldmtool_scan_devices (\@devices);
4229           This function scans for Windows dynamic disks.  It returns a list
4230           of identifiers (GUIDs) for all disk groups that were found.  These
4231           identifiers can be passed to other "$g->ldmtool_*" functions.
4232
4233           The parameter "devices" is a list of block devices which are
4234           scanned.  If this list is empty, all block devices are scanned.
4235
4236           This function depends on the feature "ldm".  See also
4237           "$g->feature-available".
4238
4239       $hint = $g->ldmtool_volume_hint ($diskgroup, $volume);
4240           Return the hint field of the volume named "volume" in the disk
4241           group with GUID "diskgroup".  This may not be defined, in which
4242           case the empty string is returned.  The hint field is often, though
4243           not always, the name of a Windows drive, eg. "E:".
4244
4245           This function depends on the feature "ldm".  See also
4246           "$g->feature-available".
4247
4248       @partitions = $g->ldmtool_volume_partitions ($diskgroup, $volume);
4249           Return the list of partitions in the volume named "volume" in the
4250           disk group with GUID "diskgroup".
4251
4252           This function depends on the feature "ldm".  See also
4253           "$g->feature-available".
4254
4255       $voltype = $g->ldmtool_volume_type ($diskgroup, $volume);
4256           Return the type of the volume named "volume" in the disk group with
4257           GUID "diskgroup".
4258
4259           Possible volume types that can be returned here include: "simple",
4260           "spanned", "striped", "mirrored", "raid5".  Other types may also be
4261           returned.
4262
4263           This function depends on the feature "ldm".  See also
4264           "$g->feature-available".
4265
4266       $xattr = $g->lgetxattr ($path, $name);
4267           Get a single extended attribute from file "path" named "name".  If
4268           "path" is a symlink, then this call returns an extended attribute
4269           from the symlink.
4270
4271           Normally it is better to get all extended attributes from a file in
4272           one go by calling "$g->getxattrs".  However some Linux filesystem
4273           implementations are buggy and do not provide a way to list out
4274           attributes.  For these filesystems (notably ntfs-3g) you have to
4275           know the names of the extended attributes you want in advance and
4276           call this function.
4277
4278           Extended attribute values are blobs of binary data.  If there is no
4279           extended attribute named "name", this returns an error.
4280
4281           See also: "$g->lgetxattrs", "$g->getxattr", attr(5).
4282
4283           This function depends on the feature "linuxxattrs".  See also
4284           "$g->feature-available".
4285
4286       @xattrs = $g->lgetxattrs ($path);
4287           This is the same as "$g->getxattrs", but if "path" is a symbolic
4288           link, then it returns the extended attributes of the link itself.
4289
4290           This function depends on the feature "linuxxattrs".  See also
4291           "$g->feature-available".
4292
4293       @mounttags = $g->list_9p ();
4294           This call does nothing and returns an error.
4295
4296           This function is deprecated.  There is no replacement.  Consult the
4297           API documentation in guestfs(3) for further information.
4298
4299           Deprecated functions will not be removed from the API, but the fact
4300           that they are deprecated indicates that there are problems with
4301           correct use of these functions.
4302
4303       @devices = $g->list_devices ();
4304           List all the block devices.
4305
4306           The full block device names are returned, eg. /dev/sda.
4307
4308           See also "$g->list_filesystems".
4309
4310       %labels = $g->list_disk_labels ();
4311           If you add drives using the optional "label" parameter of
4312           "$g->add_drive_opts", you can use this call to map between disk
4313           labels, and raw block device and partition names (like /dev/sda and
4314           /dev/sda1).
4315
4316           This returns a hashtable, where keys are the disk labels (without
4317           the /dev/disk/guestfs prefix), and the values are the full raw
4318           block device and partition names (eg. /dev/sda and /dev/sda1).
4319
4320       @devices = $g->list_dm_devices ();
4321           List all device mapper devices.
4322
4323           The returned list contains /dev/mapper/* devices, eg. ones created
4324           by a previous call to "$g->luks_open".
4325
4326           Device mapper devices which correspond to logical volumes are not
4327           returned in this list.  Call "$g->lvs" if you want to list logical
4328           volumes.
4329
4330       %fses = $g->list_filesystems ();
4331           This inspection command looks for filesystems on partitions, block
4332           devices and logical volumes, returning a list of "mountables"
4333           containing filesystems and their type.
4334
4335           The return value is a hash, where the keys are the devices
4336           containing filesystems, and the values are the filesystem types.
4337           For example:
4338
4339            "/dev/sda1" => "ntfs"
4340            "/dev/sda2" => "ext2"
4341            "/dev/vg_guest/lv_root" => "ext4"
4342            "/dev/vg_guest/lv_swap" => "swap"
4343
4344           The key is not necessarily a block device. It may also be an opaque
4345           XmountableX string which can be passed to "$g->mount".
4346
4347           The value can have the special value "unknown", meaning the content
4348           of the device is undetermined or empty.  "swap" means a Linux swap
4349           partition.
4350
4351           In libguestfs X 1.36 this command ran other libguestfs commands,
4352           which might have included "$g->mount" and "$g->umount", and
4353           therefore you had to use this soon after launch and only when
4354           nothing else was mounted.  This restriction is removed in
4355           libguestfs X 1.38.
4356
4357           Not all of the filesystems returned will be mountable.  In
4358           particular, swap partitions are returned in the list.  Also this
4359           command does not check that each filesystem found is valid and
4360           mountable, and some filesystems might be mountable but require
4361           special options.  Filesystems may not all belong to a single
4362           logical operating system (use "$g->inspect_os" to look for OSes).
4363
4364       @devices = $g->list_ldm_partitions ();
4365           This function returns all Windows dynamic disk partitions that were
4366           found at launch time.  It returns a list of device names.
4367
4368           This function depends on the feature "ldm".  See also
4369           "$g->feature-available".
4370
4371       @devices = $g->list_ldm_volumes ();
4372           This function returns all Windows dynamic disk volumes that were
4373           found at launch time.  It returns a list of device names.
4374
4375           This function depends on the feature "ldm".  See also
4376           "$g->feature-available".
4377
4378       @devices = $g->list_md_devices ();
4379           List all Linux md devices.
4380
4381       @partitions = $g->list_partitions ();
4382           List all the partitions detected on all block devices.
4383
4384           The full partition device names are returned, eg. /dev/sda1
4385
4386           This does not return logical volumes.  For that you will need to
4387           call "$g->lvs".
4388
4389           See also "$g->list_filesystems".
4390
4391       $listing = $g->ll ($directory);
4392           List the files in directory (relative to the root directory, there
4393           is no cwd) in the format of "ls -la".
4394
4395           This command is mostly useful for interactive sessions.  It is not
4396           intended that you try to parse the output string.
4397
4398       $listing = $g->llz ($directory);
4399           List the files in directory in the format of "ls -laZ".
4400
4401           This command is mostly useful for interactive sessions.  It is not
4402           intended that you try to parse the output string.
4403
4404           This function is deprecated.  In new code, use the "lgetxattrs"
4405           call instead.
4406
4407           Deprecated functions will not be removed from the API, but the fact
4408           that they are deprecated indicates that there are problems with
4409           correct use of these functions.
4410
4411       $g->ln ($target, $linkname);
4412           This command creates a hard link.
4413
4414       $g->ln_f ($target, $linkname);
4415           This command creates a hard link, removing the link "linkname" if
4416           it exists already.
4417
4418       $g->ln_s ($target, $linkname);
4419           This command creates a symbolic link using the "ln -s" command.
4420
4421       $g->ln_sf ($target, $linkname);
4422           This command creates a symbolic link using the "ln -sf" command,
4423           The -f option removes the link ("linkname") if it exists already.
4424
4425       $g->lremovexattr ($xattr, $path);
4426           This is the same as "$g->removexattr", but if "path" is a symbolic
4427           link, then it removes an extended attribute of the link itself.
4428
4429           This function depends on the feature "linuxxattrs".  See also
4430           "$g->feature-available".
4431
4432       @listing = $g->ls ($directory);
4433           List the files in directory (relative to the root directory, there
4434           is no cwd).  The "." and ".." entries are not returned, but hidden
4435           files are shown.
4436
4437       $g->ls0 ($dir, $filenames);
4438           This specialized command is used to get a listing of the filenames
4439           in the directory "dir".  The list of filenames is written to the
4440           local file filenames (on the host).
4441
4442           In the output file, the filenames are separated by "\0" characters.
4443
4444           "." and ".." are not returned.  The filenames are not sorted.
4445
4446       $g->lsetxattr ($xattr, $val, $vallen, $path);
4447           This is the same as "$g->setxattr", but if "path" is a symbolic
4448           link, then it sets an extended attribute of the link itself.
4449
4450           This function depends on the feature "linuxxattrs".  See also
4451           "$g->feature-available".
4452
4453       %statbuf = $g->lstat ($path);
4454           Returns file information for the given "path".
4455
4456           This is the same as "$g->stat" except that if "path" is a symbolic
4457           link, then the link is stat-ed, not the file it refers to.
4458
4459           This is the same as the lstat(2) system call.
4460
4461           This function is deprecated.  In new code, use the "lstatns" call
4462           instead.
4463
4464           Deprecated functions will not be removed from the API, but the fact
4465           that they are deprecated indicates that there are problems with
4466           correct use of these functions.
4467
4468       @statbufs = $g->lstatlist ($path, \@names);
4469           This call allows you to perform the "$g->lstat" operation on
4470           multiple files, where all files are in the directory "path".
4471           "names" is the list of files from this directory.
4472
4473           On return you get a list of stat structs, with a one-to-one
4474           correspondence to the "names" list.  If any name did not exist or
4475           could not be lstat'd, then the "st_ino" field of that structure is
4476           set to "-1".
4477
4478           This call is intended for programs that want to efficiently list a
4479           directory contents without making many round-trips.  See also
4480           "$g->lxattrlist" for a similarly efficient call for getting
4481           extended attributes.
4482
4483           This function is deprecated.  In new code, use the "lstatnslist"
4484           call instead.
4485
4486           Deprecated functions will not be removed from the API, but the fact
4487           that they are deprecated indicates that there are problems with
4488           correct use of these functions.
4489
4490       %statbuf = $g->lstatns ($path);
4491           Returns file information for the given "path".
4492
4493           This is the same as "$g->statns" except that if "path" is a
4494           symbolic link, then the link is stat-ed, not the file it refers to.
4495
4496           This is the same as the lstat(2) system call.
4497
4498       @statbufs = $g->lstatnslist ($path, \@names);
4499           This call allows you to perform the "$g->lstatns" operation on
4500           multiple files, where all files are in the directory "path".
4501           "names" is the list of files from this directory.
4502
4503           On return you get a list of stat structs, with a one-to-one
4504           correspondence to the "names" list.  If any name did not exist or
4505           could not be lstat'd, then the "st_ino" field of that structure is
4506           set to "-1".
4507
4508           This call is intended for programs that want to efficiently list a
4509           directory contents without making many round-trips.  See also
4510           "$g->lxattrlist" for a similarly efficient call for getting
4511           extended attributes.
4512
4513       $g->luks_add_key ($device, $key, $newkey, $keyslot);
4514           This command adds a new key on LUKS device "device".  "key" is any
4515           existing key, and is used to access the device.  "newkey" is the
4516           new key to add.  "keyslot" is the key slot that will be replaced.
4517
4518           Note that if "keyslot" already contains a key, then this command
4519           will fail.  You have to use "$g->luks_kill_slot" first to remove
4520           that key.
4521
4522           This function depends on the feature "luks".  See also
4523           "$g->feature-available".
4524
4525       $g->luks_close ($device);
4526           This closes a LUKS device that was created earlier by
4527           "$g->luks_open" or "$g->luks_open_ro".  The "device" parameter must
4528           be the name of the LUKS mapping device (ie. /dev/mapper/mapname)
4529           and not the name of the underlying block device.
4530
4531           This function depends on the feature "luks".  See also
4532           "$g->feature-available".
4533
4534           This function is deprecated.  In new code, use the
4535           "cryptsetup_close" call instead.
4536
4537           Deprecated functions will not be removed from the API, but the fact
4538           that they are deprecated indicates that there are problems with
4539           correct use of these functions.
4540
4541       $g->luks_format ($device, $key, $keyslot);
4542           This command erases existing data on "device" and formats the
4543           device as a LUKS encrypted device.  "key" is the initial key, which
4544           is added to key slot "keyslot".  (LUKS supports 8 key slots,
4545           numbered 0-7).
4546
4547           This function depends on the feature "luks".  See also
4548           "$g->feature-available".
4549
4550       $g->luks_format_cipher ($device, $key, $keyslot, $cipher);
4551           This command is the same as "$g->luks_format" but it also allows
4552           you to set the "cipher" used.
4553
4554           This function depends on the feature "luks".  See also
4555           "$g->feature-available".
4556
4557       $g->luks_kill_slot ($device, $key, $keyslot);
4558           This command deletes the key in key slot "keyslot" from the
4559           encrypted LUKS device "device".  "key" must be one of the other
4560           keys.
4561
4562           This function depends on the feature "luks".  See also
4563           "$g->feature-available".
4564
4565       $g->luks_open ($device, $key, $mapname);
4566           This command opens a block device which has been encrypted
4567           according to the Linux Unified Key Setup (LUKS) standard.
4568
4569           "device" is the encrypted block device or partition.
4570
4571           The caller must supply one of the keys associated with the LUKS
4572           block device, in the "key" parameter.
4573
4574           This creates a new block device called /dev/mapper/mapname.  Reads
4575           and writes to this block device are decrypted from and encrypted to
4576           the underlying "device" respectively.
4577
4578           If this block device contains LVM volume groups, then calling
4579           "$g->lvm_scan" with the "activate" parameter "true" will make them
4580           visible.
4581
4582           Use "$g->list_dm_devices" to list all device mapper devices.
4583
4584           This function depends on the feature "luks".  See also
4585           "$g->feature-available".
4586
4587           This function is deprecated.  In new code, use the
4588           "cryptsetup_open" call instead.
4589
4590           Deprecated functions will not be removed from the API, but the fact
4591           that they are deprecated indicates that there are problems with
4592           correct use of these functions.
4593
4594       $g->luks_open_ro ($device, $key, $mapname);
4595           This is the same as "$g->luks_open" except that a read-only mapping
4596           is created.
4597
4598           This function depends on the feature "luks".  See also
4599           "$g->feature-available".
4600
4601           This function is deprecated.  In new code, use the
4602           "cryptsetup_open" call instead.
4603
4604           Deprecated functions will not be removed from the API, but the fact
4605           that they are deprecated indicates that there are problems with
4606           correct use of these functions.
4607
4608       $uuid = $g->luks_uuid ($device);
4609           This returns the UUID of the LUKS device "device".
4610
4611           This function depends on the feature "luks".  See also
4612           "$g->feature-available".
4613
4614       $g->lvcreate ($logvol, $volgroup, $mbytes);
4615           This creates an LVM logical volume called "logvol" on the volume
4616           group "volgroup", with "size" megabytes.
4617
4618           This function depends on the feature "lvm2".  See also
4619           "$g->feature-available".
4620
4621       $g->lvcreate_free ($logvol, $volgroup, $percent);
4622           Create an LVM logical volume called /dev/volgroup/logvol, using
4623           approximately "percent" % of the free space remaining in the volume
4624           group.  Most usefully, when "percent" is 100 this will create the
4625           largest possible LV.
4626
4627           This function depends on the feature "lvm2".  See also
4628           "$g->feature-available".
4629
4630       $lv = $g->lvm_canonical_lv_name ($lvname);
4631           This converts alternative naming schemes for LVs that you might
4632           find to the canonical name.  For example, /dev/mapper/VG-LV is
4633           converted to /dev/VG/LV.
4634
4635           This command returns an error if the "lvname" parameter does not
4636           refer to a logical volume.  In this case errno will be set to
4637           "EINVAL".
4638
4639           See also "$g->is_lv", "$g->canonical_device_name".
4640
4641       $g->lvm_clear_filter ();
4642           This undoes the effect of "$g->lvm_set_filter".  LVM will be able
4643           to see every block device.
4644
4645           This command also clears the LVM cache and performs a volume group
4646           scan.
4647
4648       $g->lvm_remove_all ();
4649           This command removes all LVM logical volumes, volume groups and
4650           physical volumes.
4651
4652           This function depends on the feature "lvm2".  See also
4653           "$g->feature-available".
4654
4655       $g->lvm_scan ($activate);
4656           This scans all block devices and rebuilds the list of LVM physical
4657           volumes, volume groups and logical volumes.
4658
4659           If the "activate" parameter is "true" then newly found volume
4660           groups and logical volumes are activated, meaning the LV /dev/VG/LV
4661           devices become visible.
4662
4663           When a libguestfs handle is launched it scans for existing devices,
4664           so you do not normally need to use this API.  However it is useful
4665           when you have added a new device or deleted an existing device
4666           (such as when the "$g->luks_open" API is used).
4667
4668       $g->lvm_set_filter (\@devices);
4669           This sets the LVM device filter so that LVM will only be able to
4670           "see" the block devices in the list "devices", and will ignore all
4671           other attached block devices.
4672
4673           Where disk image(s) contain duplicate PVs or VGs, this command is
4674           useful to get LVM to ignore the duplicates, otherwise LVM can get
4675           confused.  Note also there are two types of duplication possible:
4676           either cloned PVs/VGs which have identical UUIDs; or VGs that are
4677           not cloned but just happen to have the same name.  In normal
4678           operation you cannot create this situation, but you can do it
4679           outside LVM, eg.  by cloning disk images or by bit twiddling inside
4680           the LVM metadata.
4681
4682           This command also clears the LVM cache and performs a volume group
4683           scan.
4684
4685           You can filter whole block devices or individual partitions.
4686
4687           You cannot use this if any VG is currently in use (eg.  contains a
4688           mounted filesystem), even if you are not filtering out that VG.
4689
4690           This function depends on the feature "lvm2".  See also
4691           "$g->feature-available".
4692
4693       $g->lvremove ($device);
4694           Remove an LVM logical volume "device", where "device" is the path
4695           to the LV, such as /dev/VG/LV.
4696
4697           You can also remove all LVs in a volume group by specifying the VG
4698           name, /dev/VG.
4699
4700           This function depends on the feature "lvm2".  See also
4701           "$g->feature-available".
4702
4703       $g->lvrename ($logvol, $newlogvol);
4704           Rename a logical volume "logvol" with the new name "newlogvol".
4705
4706       $g->lvresize ($device, $mbytes);
4707           This resizes (expands or shrinks) an existing LVM logical volume to
4708           "mbytes".  When reducing, data in the reduced part is lost.
4709
4710           This function depends on the feature "lvm2".  See also
4711           "$g->feature-available".
4712
4713       $g->lvresize_free ($lv, $percent);
4714           This expands an existing logical volume "lv" so that it fills "pc"
4715           % of the remaining free space in the volume group.  Commonly you
4716           would call this with pc = 100 which expands the logical volume as
4717           much as possible, using all remaining free space in the volume
4718           group.
4719
4720           This function depends on the feature "lvm2".  See also
4721           "$g->feature-available".
4722
4723       @logvols = $g->lvs ();
4724           List all the logical volumes detected.  This is the equivalent of
4725           the lvs(8) command.
4726
4727           This returns a list of the logical volume device names (eg.
4728           /dev/VolGroup00/LogVol00).
4729
4730           See also "$g->lvs_full", "$g->list_filesystems".
4731
4732           This function depends on the feature "lvm2".  See also
4733           "$g->feature-available".
4734
4735       @logvols = $g->lvs_full ();
4736           List all the logical volumes detected.  This is the equivalent of
4737           the lvs(8) command.  The "full" version includes all fields.
4738
4739           This function depends on the feature "lvm2".  See also
4740           "$g->feature-available".
4741
4742       $uuid = $g->lvuuid ($device);
4743           This command returns the UUID of the LVM LV "device".
4744
4745       @xattrs = $g->lxattrlist ($path, \@names);
4746           This call allows you to get the extended attributes of multiple
4747           files, where all files are in the directory "path".  "names" is the
4748           list of files from this directory.
4749
4750           On return you get a flat list of xattr structs which must be
4751           interpreted sequentially.  The first xattr struct always has a
4752           zero-length "attrname".  "attrval" in this struct is zero-length to
4753           indicate there was an error doing "$g->lgetxattr" for this file, or
4754           is a C string which is a decimal number (the number of following
4755           attributes for this file, which could be "0").  Then after the
4756           first xattr struct are the zero or more attributes for the first
4757           named file.  This repeats for the second and subsequent files.
4758
4759           This call is intended for programs that want to efficiently list a
4760           directory contents without making many round-trips.  See also
4761           "$g->lstatlist" for a similarly efficient call for getting standard
4762           stats.
4763
4764           This function depends on the feature "linuxxattrs".  See also
4765           "$g->feature-available".
4766
4767       $disks = $g->max_disks ();
4768           Return the maximum number of disks that may be added to a handle
4769           (eg. by "$g->add_drive_opts" and similar calls).
4770
4771           This function was added in libguestfs 1.19.7.  In previous versions
4772           of libguestfs the limit was 25.
4773
4774           See "MAXIMUM NUMBER OF DISKS" in guestfs(3) for additional
4775           information on this topic.
4776
4777       $g->md_create ($name, \@devices [, missingbitmap => $missingbitmap] [,
4778       nrdevices => $nrdevices] [, spare => $spare] [, chunk => $chunk] [,
4779       level => $level]);
4780           Create a Linux md (RAID) device named "name" on the devices in the
4781           list "devices".
4782
4783           The optional parameters are:
4784
4785           "missingbitmap"
4786               A bitmap of missing devices.  If a bit is set it means that a
4787               missing device is added to the array.  The least significant
4788               bit corresponds to the first device in the array.
4789
4790               As examples:
4791
4792               If "devices = ["/dev/sda"]" and "missingbitmap = 0x1" then the
4793               resulting array would be "[<missing>, "/dev/sda"]".
4794
4795               If "devices = ["/dev/sda"]" and "missingbitmap = 0x2" then the
4796               resulting array would be "["/dev/sda", <missing>]".
4797
4798               This defaults to 0 (no missing devices).
4799
4800               The length of "devices" + the number of bits set in
4801               "missingbitmap" must equal "nrdevices" + "spare".
4802
4803           "nrdevices"
4804               The number of active RAID devices.
4805
4806               If not set, this defaults to the length of "devices" plus the
4807               number of bits set in "missingbitmap".
4808
4809           "spare"
4810               The number of spare devices.
4811
4812               If not set, this defaults to 0.
4813
4814           "chunk"
4815               The chunk size in bytes.
4816
4817               The "chunk" parameter does not make sense, and should not be
4818               specified, when "level" is "raid1" (which is the default; see
4819               below).
4820
4821           "level"
4822               The RAID level, which can be one of: "linear", "raid0", 0,
4823               "stripe", "raid1", 1, "mirror", "raid4", 4, "raid5", 5,
4824               "raid6", 6, "raid10", 10.  Some of these are synonymous, and
4825               more levels may be added in future.
4826
4827               If not set, this defaults to "raid1".
4828
4829           This function depends on the feature "mdadm".  See also
4830           "$g->feature-available".
4831
4832       %info = $g->md_detail ($md);
4833           This command exposes the output of "mdadm -DY <md>".  The following
4834           fields are usually present in the returned hash.  Other fields may
4835           also be present.
4836
4837           "level"
4838               The raid level of the MD device.
4839
4840           "devices"
4841               The number of underlying devices in the MD device.
4842
4843           "metadata"
4844               The metadata version used.
4845
4846           "uuid"
4847               The UUID of the MD device.
4848
4849           "name"
4850               The name of the MD device.
4851
4852           This function depends on the feature "mdadm".  See also
4853           "$g->feature-available".
4854
4855       @devices = $g->md_stat ($md);
4856           This call returns a list of the underlying devices which make up
4857           the single software RAID array device "md".
4858
4859           To get a list of software RAID devices, call "$g->list_md_devices".
4860
4861           Each structure returned corresponds to one device along with
4862           additional status information:
4863
4864           "mdstat_device"
4865               The name of the underlying device.
4866
4867           "mdstat_index"
4868               The index of this device within the array.
4869
4870           "mdstat_flags"
4871               Flags associated with this device.  This is a string containing
4872               (in no specific order) zero or more of the following flags:
4873
4874               "W" write-mostly
4875
4876               "F" device is faulty
4877
4878               "S" device is a RAID spare
4879
4880               "R" replacement
4881
4882           This function depends on the feature "mdadm".  See also
4883           "$g->feature-available".
4884
4885       $g->md_stop ($md);
4886           This command deactivates the MD array named "md".  The device is
4887           stopped, but it is not destroyed or zeroed.
4888
4889           This function depends on the feature "mdadm".  See also
4890           "$g->feature-available".
4891
4892       $g->mkdir ($path);
4893           Create a directory named "path".
4894
4895       $g->mkdir_mode ($path, $mode);
4896           This command creates a directory, setting the initial permissions
4897           of the directory to "mode".
4898
4899           For common Linux filesystems, the actual mode which is set will be
4900           "mode & ~umask & 01777".  Non-native-Linux filesystems may
4901           interpret the mode in other ways.
4902
4903           See also "$g->mkdir", "$g->umask"
4904
4905       $g->mkdir_p ($path);
4906           Create a directory named "path", creating any parent directories as
4907           necessary.  This is like the "mkdir -p" shell command.
4908
4909       $dir = $g->mkdtemp ($tmpl);
4910           This command creates a temporary directory.  The "tmpl" parameter
4911           should be a full pathname for the temporary directory name with the
4912           final six characters being "XXXXXX".
4913
4914           For example: "/tmp/myprogXXXXXX" or "/Temp/myprogXXXXXX", the
4915           second one being suitable for Windows filesystems.
4916
4917           The name of the temporary directory that was created is returned.
4918
4919           The temporary directory is created with mode 0700 and is owned by
4920           root.
4921
4922           The caller is responsible for deleting the temporary directory and
4923           its contents after use.
4924
4925           See also: mkdtemp(3)
4926
4927       $g->mke2fs ($device [, blockscount => $blockscount] [, blocksize =>
4928       $blocksize] [, fragsize => $fragsize] [, blockspergroup =>
4929       $blockspergroup] [, numberofgroups => $numberofgroups] [, bytesperinode
4930       => $bytesperinode] [, inodesize => $inodesize] [, journalsize =>
4931       $journalsize] [, numberofinodes => $numberofinodes] [, stridesize =>
4932       $stridesize] [, stripewidth => $stripewidth] [, maxonlineresize =>
4933       $maxonlineresize] [, reservedblockspercentage =>
4934       $reservedblockspercentage] [, mmpupdateinterval => $mmpupdateinterval]
4935       [, journaldevice => $journaldevice] [, label => $label] [,
4936       lastmounteddir => $lastmounteddir] [, creatoros => $creatoros] [,
4937       fstype => $fstype] [, usagetype => $usagetype] [, uuid => $uuid] [,
4938       forcecreate => $forcecreate] [, writesbandgrouponly =>
4939       $writesbandgrouponly] [, lazyitableinit => $lazyitableinit] [,
4940       lazyjournalinit => $lazyjournalinit] [, testfs => $testfs] [, discard
4941       => $discard] [, quotatype => $quotatype] [, extent => $extent] [,
4942       filetype => $filetype] [, flexbg => $flexbg] [, hasjournal =>
4943       $hasjournal] [, journaldev => $journaldev] [, largefile => $largefile]
4944       [, quota => $quota] [, resizeinode => $resizeinode] [, sparsesuper =>
4945       $sparsesuper] [, uninitbg => $uninitbg]);
4946           "mke2fs" is used to create an ext2, ext3, or ext4 filesystem on
4947           "device".
4948
4949           The optional "blockscount" is the size of the filesystem in blocks.
4950           If omitted it defaults to the size of "device".  Note if the
4951           filesystem is too small to contain a journal, "mke2fs" will
4952           silently create an ext2 filesystem instead.
4953
4954       $g->mke2fs_J ($fstype, $blocksize, $device, $journal);
4955           This creates an ext2/3/4 filesystem on "device" with an external
4956           journal on "journal".  It is equivalent to the command:
4957
4958            mke2fs -t fstype -b blocksize -J device=<journal> <device>
4959
4960           See also "$g->mke2journal".
4961
4962           This function is deprecated.  In new code, use the "mke2fs" call
4963           instead.
4964
4965           Deprecated functions will not be removed from the API, but the fact
4966           that they are deprecated indicates that there are problems with
4967           correct use of these functions.
4968
4969       $g->mke2fs_JL ($fstype, $blocksize, $device, $label);
4970           This creates an ext2/3/4 filesystem on "device" with an external
4971           journal on the journal labeled "label".
4972
4973           See also "$g->mke2journal_L".
4974
4975           This function is deprecated.  In new code, use the "mke2fs" call
4976           instead.
4977
4978           Deprecated functions will not be removed from the API, but the fact
4979           that they are deprecated indicates that there are problems with
4980           correct use of these functions.
4981
4982       $g->mke2fs_JU ($fstype, $blocksize, $device, $uuid);
4983           This creates an ext2/3/4 filesystem on "device" with an external
4984           journal on the journal with UUID "uuid".
4985
4986           See also "$g->mke2journal_U".
4987
4988           This function depends on the feature "linuxfsuuid".  See also
4989           "$g->feature-available".
4990
4991           This function is deprecated.  In new code, use the "mke2fs" call
4992           instead.
4993
4994           Deprecated functions will not be removed from the API, but the fact
4995           that they are deprecated indicates that there are problems with
4996           correct use of these functions.
4997
4998       $g->mke2journal ($blocksize, $device);
4999           This creates an ext2 external journal on "device".  It is
5000           equivalent to the command:
5001
5002            mke2fs -O journal_dev -b blocksize device
5003
5004           This function is deprecated.  In new code, use the "mke2fs" call
5005           instead.
5006
5007           Deprecated functions will not be removed from the API, but the fact
5008           that they are deprecated indicates that there are problems with
5009           correct use of these functions.
5010
5011       $g->mke2journal_L ($blocksize, $label, $device);
5012           This creates an ext2 external journal on "device" with label
5013           "label".
5014
5015           This function is deprecated.  In new code, use the "mke2fs" call
5016           instead.
5017
5018           Deprecated functions will not be removed from the API, but the fact
5019           that they are deprecated indicates that there are problems with
5020           correct use of these functions.
5021
5022       $g->mke2journal_U ($blocksize, $uuid, $device);
5023           This creates an ext2 external journal on "device" with UUID "uuid".
5024
5025           This function depends on the feature "linuxfsuuid".  See also
5026           "$g->feature-available".
5027
5028           This function is deprecated.  In new code, use the "mke2fs" call
5029           instead.
5030
5031           Deprecated functions will not be removed from the API, but the fact
5032           that they are deprecated indicates that there are problems with
5033           correct use of these functions.
5034
5035       $g->mkfifo ($mode, $path);
5036           This call creates a FIFO (named pipe) called "path" with mode
5037           "mode".  It is just a convenient wrapper around "$g->mknod".
5038
5039           Unlike with "$g->mknod", "mode" must contain only permissions bits.
5040
5041           The mode actually set is affected by the umask.
5042
5043           This function depends on the feature "mknod".  See also
5044           "$g->feature-available".
5045
5046       $g->mkfs ($fstype, $device [, blocksize => $blocksize] [, features =>
5047       $features] [, inode => $inode] [, sectorsize => $sectorsize] [, label
5048       => $label]);
5049           This function creates a filesystem on "device".  The filesystem
5050           type is "fstype", for example "ext3".
5051
5052           The optional arguments are:
5053
5054           "blocksize"
5055               The filesystem block size.  Supported block sizes depend on the
5056               filesystem type, but typically they are 1024, 2048 or 4096 for
5057               Linux ext2/3 filesystems.
5058
5059               For VFAT and NTFS the "blocksize" parameter is treated as the
5060               requested cluster size.
5061
5062               For UFS block sizes, please see mkfs.ufs(8).
5063
5064           "features"
5065               This passes the -O parameter to the external mkfs program.
5066
5067               For certain filesystem types, this allows extra filesystem
5068               features to be selected.  See mke2fs(8) and mkfs.ufs(8) for
5069               more details.
5070
5071               You cannot use this optional parameter with the "gfs" or "gfs2"
5072               filesystem type.
5073
5074           "inode"
5075               This passes the -I parameter to the external mke2fs(8) program
5076               which sets the inode size (only for ext2/3/4 filesystems at
5077               present).
5078
5079           "sectorsize"
5080               This passes the -S parameter to external mkfs.ufs(8) program,
5081               which sets sector size for ufs filesystem.
5082
5083       $g->mkfs_opts ($fstype, $device [, blocksize => $blocksize] [, features
5084       => $features] [, inode => $inode] [, sectorsize => $sectorsize] [,
5085       label => $label]);
5086           This is an alias of "mkfs".
5087
5088       $g->mkfs_b ($fstype, $blocksize, $device);
5089           This call is similar to "$g->mkfs", but it allows you to control
5090           the block size of the resulting filesystem.  Supported block sizes
5091           depend on the filesystem type, but typically they are 1024, 2048 or
5092           4096 only.
5093
5094           For VFAT and NTFS the "blocksize" parameter is treated as the
5095           requested cluster size.
5096
5097           This function is deprecated.  In new code, use the "mkfs" call
5098           instead.
5099
5100           Deprecated functions will not be removed from the API, but the fact
5101           that they are deprecated indicates that there are problems with
5102           correct use of these functions.
5103
5104       $g->mkfs_btrfs (\@devices [, allocstart => $allocstart] [, bytecount =>
5105       $bytecount] [, datatype => $datatype] [, leafsize => $leafsize] [,
5106       label => $label] [, metadata => $metadata] [, nodesize => $nodesize] [,
5107       sectorsize => $sectorsize]);
5108           Create a btrfs filesystem, allowing all configurables to be set.
5109           For more information on the optional arguments, see mkfs.btrfs(8).
5110
5111           Since btrfs filesystems can span multiple devices, this takes a
5112           non-empty list of devices.
5113
5114           To create general filesystems, use "$g->mkfs".
5115
5116           This function depends on the feature "btrfs".  See also
5117           "$g->feature-available".
5118
5119       $g->mklost_and_found ($mountpoint);
5120           Make the "lost+found" directory, normally in the root directory of
5121           an ext2/3/4 filesystem.  "mountpoint" is the directory under which
5122           we try to create the "lost+found" directory.
5123
5124       $g->mkmountpoint ($exemptpath);
5125           "$g->mkmountpoint" and "$g->rmmountpoint" are specialized calls
5126           that can be used to create extra mountpoints before mounting the
5127           first filesystem.
5128
5129           These calls are only necessary in some very limited circumstances,
5130           mainly the case where you want to mount a mix of unrelated and/or
5131           read-only filesystems together.
5132
5133           For example, live CDs often contain a "Russian doll" nest of
5134           filesystems, an ISO outer layer, with a squashfs image inside, with
5135           an ext2/3 image inside that.  You can unpack this as follows in
5136           guestfish:
5137
5138            add-ro Fedora-11-i686-Live.iso
5139            run
5140            mkmountpoint /cd
5141            mkmountpoint /sqsh
5142            mkmountpoint /ext3fs
5143            mount /dev/sda /cd
5144            mount-loop /cd/LiveOS/squashfs.img /sqsh
5145            mount-loop /sqsh/LiveOS/ext3fs.img /ext3fs
5146
5147           The inner filesystem is now unpacked under the /ext3fs mountpoint.
5148
5149           "$g->mkmountpoint" is not compatible with "$g->umount_all".  You
5150           may get unexpected errors if you try to mix these calls.  It is
5151           safest to manually unmount filesystems and remove mountpoints after
5152           use.
5153
5154           "$g->umount_all" unmounts filesystems by sorting the paths longest
5155           first, so for this to work for manual mountpoints, you must ensure
5156           that the innermost mountpoints have the longest pathnames, as in
5157           the example code above.
5158
5159           For more details see
5160           <https://bugzilla.redhat.com/show_bug.cgi?id=599503>
5161
5162           Autosync [see "$g->set_autosync", this is set by default on
5163           handles] can cause "$g->umount_all" to be called when the handle is
5164           closed which can also trigger these issues.
5165
5166       $g->mknod ($mode, $devmajor, $devminor, $path);
5167           This call creates block or character special devices, or named
5168           pipes (FIFOs).
5169
5170           The "mode" parameter should be the mode, using the standard
5171           constants.  "devmajor" and "devminor" are the device major and
5172           minor numbers, only used when creating block and character special
5173           devices.
5174
5175           Note that, just like mknod(2), the mode must be bitwise OR'd with
5176           S_IFBLK, S_IFCHR, S_IFIFO or S_IFSOCK (otherwise this call just
5177           creates a regular file).  These constants are available in the
5178           standard Linux header files, or you can use "$g->mknod_b",
5179           "$g->mknod_c" or "$g->mkfifo" which are wrappers around this
5180           command which bitwise OR in the appropriate constant for you.
5181
5182           The mode actually set is affected by the umask.
5183
5184           This function depends on the feature "mknod".  See also
5185           "$g->feature-available".
5186
5187       $g->mknod_b ($mode, $devmajor, $devminor, $path);
5188           This call creates a block device node called "path" with mode
5189           "mode" and device major/minor "devmajor" and "devminor".  It is
5190           just a convenient wrapper around "$g->mknod".
5191
5192           Unlike with "$g->mknod", "mode" must contain only permissions bits.
5193
5194           The mode actually set is affected by the umask.
5195
5196           This function depends on the feature "mknod".  See also
5197           "$g->feature-available".
5198
5199       $g->mknod_c ($mode, $devmajor, $devminor, $path);
5200           This call creates a char device node called "path" with mode "mode"
5201           and device major/minor "devmajor" and "devminor".  It is just a
5202           convenient wrapper around "$g->mknod".
5203
5204           Unlike with "$g->mknod", "mode" must contain only permissions bits.
5205
5206           The mode actually set is affected by the umask.
5207
5208           This function depends on the feature "mknod".  See also
5209           "$g->feature-available".
5210
5211       $g->mksquashfs ($path, $filename [, compress => $compress] [, excludes
5212       => $excludes]);
5213           Create a squashfs filesystem for the specified "path".
5214
5215           The optional "compress" flag controls compression.  If not given,
5216           then the output compressed using "gzip".  Otherwise one of the
5217           following strings may be given to select the compression type of
5218           the squashfs: "gzip", "lzma", "lzo", "lz4", "xz".
5219
5220           The other optional arguments are:
5221
5222           "excludes"
5223               A list of wildcards.  Files are excluded if they match any of
5224               the wildcards.
5225
5226           Please note that this API may fail when used to compress
5227           directories with large files, such as the resulting squashfs will
5228           be over 3GB big.
5229
5230           This function depends on the feature "squashfs".  See also
5231           "$g->feature-available".
5232
5233       $g->mkswap ($device [, label => $label] [, uuid => $uuid]);
5234           Create a Linux swap partition on "device".
5235
5236           The option arguments "label" and "uuid" allow you to set the label
5237           and/or UUID of the new swap partition.
5238
5239       $g->mkswap_opts ($device [, label => $label] [, uuid => $uuid]);
5240           This is an alias of "mkswap".
5241
5242       $g->mkswap_L ($label, $device);
5243           Create a swap partition on "device" with label "label".
5244
5245           Note that you cannot attach a swap label to a block device (eg.
5246           /dev/sda), just to a partition.  This appears to be a limitation of
5247           the kernel or swap tools.
5248
5249           This function is deprecated.  In new code, use the "mkswap" call
5250           instead.
5251
5252           Deprecated functions will not be removed from the API, but the fact
5253           that they are deprecated indicates that there are problems with
5254           correct use of these functions.
5255
5256       $g->mkswap_U ($uuid, $device);
5257           Create a swap partition on "device" with UUID "uuid".
5258
5259           This function depends on the feature "linuxfsuuid".  See also
5260           "$g->feature-available".
5261
5262           This function is deprecated.  In new code, use the "mkswap" call
5263           instead.
5264
5265           Deprecated functions will not be removed from the API, but the fact
5266           that they are deprecated indicates that there are problems with
5267           correct use of these functions.
5268
5269       $g->mkswap_file ($path);
5270           Create a swap file.
5271
5272           This command just writes a swap file signature to an existing file.
5273           To create the file itself, use something like "$g->fallocate".
5274
5275       $path = $g->mktemp ($tmpl [, suffix => $suffix]);
5276           This command creates a temporary file.  The "tmpl" parameter should
5277           be a full pathname for the temporary directory name with the final
5278           six characters being "XXXXXX".
5279
5280           For example: "/tmp/myprogXXXXXX" or "/Temp/myprogXXXXXX", the
5281           second one being suitable for Windows filesystems.
5282
5283           The name of the temporary file that was created is returned.
5284
5285           The temporary file is created with mode 0600 and is owned by root.
5286
5287           The caller is responsible for deleting the temporary file after
5288           use.
5289
5290           If the optional "suffix" parameter is given, then the suffix (eg.
5291           ".txt") is appended to the temporary name.
5292
5293           See also: "$g->mkdtemp".
5294
5295       $g->modprobe ($modulename);
5296           This loads a kernel module in the appliance.
5297
5298           This function depends on the feature "linuxmodules".  See also
5299           "$g->feature-available".
5300
5301       $g->mount ($mountable, $mountpoint);
5302           Mount a guest disk at a position in the filesystem.  Block devices
5303           are named /dev/sda, /dev/sdb and so on, as they were added to the
5304           guest.  If those block devices contain partitions, they will have
5305           the usual names (eg. /dev/sda1).  Also LVM /dev/VG/LV-style names
5306           can be used, or XmountableX strings returned by
5307           "$g->list_filesystems" or "$g->inspect_get_mountpoints".
5308
5309           The rules are the same as for mount(2):  A filesystem must first be
5310           mounted on / before others can be mounted.  Other filesystems can
5311           only be mounted on directories which already exist.
5312
5313           The mounted filesystem is writable, if we have sufficient
5314           permissions on the underlying device.
5315
5316           Before libguestfs 1.13.16, this call implicitly added the options
5317           "sync" and "noatime".  The "sync" option greatly slowed writes and
5318           caused many problems for users.  If your program might need to work
5319           with older versions of libguestfs, use "$g->mount_options" instead
5320           (using an empty string for the first parameter if you don't want
5321           any options).
5322
5323       $g->mount_9p ($mounttag, $mountpoint [, options => $options]);
5324           This call does nothing and returns an error.
5325
5326           This function is deprecated.  There is no replacement.  Consult the
5327           API documentation in guestfs(3) for further information.
5328
5329           Deprecated functions will not be removed from the API, but the fact
5330           that they are deprecated indicates that there are problems with
5331           correct use of these functions.
5332
5333       $g->mount_local ($localmountpoint [, readonly => $readonly] [, options
5334       => $options] [, cachetimeout => $cachetimeout] [, debugcalls =>
5335       $debugcalls]);
5336           This call exports the libguestfs-accessible filesystem to a local
5337           mountpoint (directory) called "localmountpoint".  Ordinary reads
5338           and writes to files and directories under "localmountpoint" are
5339           redirected through libguestfs.
5340
5341           If the optional "readonly" flag is set to true, then writes to the
5342           filesystem return error "EROFS".
5343
5344           "options" is a comma-separated list of mount options.  See
5345           guestmount(1) for some useful options.
5346
5347           "cachetimeout" sets the timeout (in seconds) for cached directory
5348           entries.  The default is 60 seconds.  See guestmount(1) for further
5349           information.
5350
5351           If "debugcalls" is set to true, then additional debugging
5352           information is generated for every FUSE call.
5353
5354           When "$g->mount_local" returns, the filesystem is ready, but is not
5355           processing requests (access to it will block).  You have to call
5356           "$g->mount_local_run" to run the main loop.
5357
5358           See "MOUNT LOCAL" in guestfs(3) for full documentation.
5359
5360       $g->mount_local_run ();
5361           Run the main loop which translates kernel calls to libguestfs
5362           calls.
5363
5364           This should only be called after "$g->mount_local" returns
5365           successfully.  The call will not return until the filesystem is
5366           unmounted.
5367
5368           Note you must not make concurrent libguestfs calls on the same
5369           handle from another thread.
5370
5371           You may call this from a different thread than the one which called
5372           "$g->mount_local", subject to the usual rules for threads and
5373           libguestfs (see "MULTIPLE HANDLES AND MULTIPLE THREADS" in
5374           guestfs(3)).
5375
5376           See "MOUNT LOCAL" in guestfs(3) for full documentation.
5377
5378       $g->mount_loop ($file, $mountpoint);
5379           This command lets you mount file (a filesystem image in a file) on
5380           a mount point.  It is entirely equivalent to the command "mount -o
5381           loop file mountpoint".
5382
5383       $g->mount_options ($options, $mountable, $mountpoint);
5384           This is the same as the "$g->mount" command, but it allows you to
5385           set the mount options as for the mount(8) -o flag.
5386
5387           If the "options" parameter is an empty string, then no options are
5388           passed (all options default to whatever the filesystem uses).
5389
5390       $g->mount_ro ($mountable, $mountpoint);
5391           This is the same as the "$g->mount" command, but it mounts the
5392           filesystem with the read-only (-o ro) flag.
5393
5394       $g->mount_vfs ($options, $vfstype, $mountable, $mountpoint);
5395           This is the same as the "$g->mount" command, but it allows you to
5396           set both the mount options and the vfstype as for the mount(8) -o
5397           and -t flags.
5398
5399       $device = $g->mountable_device ($mountable);
5400           Returns the device name of a mountable. In quite a lot of cases,
5401           the mountable is the device name.
5402
5403           However this doesn't apply for btrfs subvolumes, where the
5404           mountable is a combination of both the device name and the
5405           subvolume path (see also "$g->mountable_subvolume" to extract the
5406           subvolume path of the mountable if any).
5407
5408       $subvolume = $g->mountable_subvolume ($mountable);
5409           Returns the subvolume path of a mountable. Btrfs subvolumes
5410           mountables are a combination of both the device name and the
5411           subvolume path (see also "$g->mountable_device" to extract the
5412           device of the mountable).
5413
5414           If the mountable does not represent a btrfs subvolume, then this
5415           function fails and the "errno" is set to "EINVAL".
5416
5417       %mps = $g->mountpoints ();
5418           This call is similar to "$g->mounts".  That call returns a list of
5419           devices.  This one returns a hash table (map) of device name to
5420           directory where the device is mounted.
5421
5422       @devices = $g->mounts ();
5423           This returns the list of currently mounted filesystems.  It returns
5424           the list of devices (eg. /dev/sda1, /dev/VG/LV).
5425
5426           Some internal mounts are not shown.
5427
5428           See also: "$g->mountpoints"
5429
5430       $g->mv ($src, $dest);
5431           This moves a file from "src" to "dest" where "dest" is either a
5432           destination filename or destination directory.
5433
5434           See also: "$g->rename".
5435
5436       $nrdisks = $g->nr_devices ();
5437           This returns the number of whole block devices that were added.
5438           This is the same as the number of devices that would be returned if
5439           you called "$g->list_devices".
5440
5441           To find out the maximum number of devices that could be added, call
5442           "$g->max_disks".
5443
5444       $status = $g->ntfs_3g_probe ($rw, $device);
5445           This command runs the ntfs-3g.probe(8) command which probes an NTFS
5446           "device" for mountability.  (Not all NTFS volumes can be mounted
5447           read-write, and some cannot be mounted at all).
5448
5449           "rw" is a boolean flag.  Set it to true if you want to test if the
5450           volume can be mounted read-write.  Set it to false if you want to
5451           test if the volume can be mounted read-only.
5452
5453           The return value is an integer which 0 if the operation would
5454           succeed, or some non-zero value documented in the ntfs-3g.probe(8)
5455           manual page.
5456
5457           This function depends on the feature "ntfs3g".  See also
5458           "$g->feature-available".
5459
5460       $g->ntfscat_i ($device, $inode, $filename);
5461           Download a file given its inode from a NTFS filesystem and save it
5462           as filename on the local machine.
5463
5464           This allows to download some otherwise inaccessible files such as
5465           the ones within the $Extend folder.
5466
5467           The filesystem from which to extract the file must be unmounted,
5468           otherwise the call will fail.
5469
5470       $g->ntfsclone_in ($backupfile, $device);
5471           Restore the "backupfile" (from a previous call to
5472           "$g->ntfsclone_out") to "device", overwriting any existing contents
5473           of this device.
5474
5475           This function depends on the feature "ntfs3g".  See also
5476           "$g->feature-available".
5477
5478       $g->ntfsclone_out ($device, $backupfile [, metadataonly =>
5479       $metadataonly] [, rescue => $rescue] [, ignorefscheck =>
5480       $ignorefscheck] [, preservetimestamps => $preservetimestamps] [, force
5481       => $force]);
5482           Stream the NTFS filesystem "device" to the local file "backupfile".
5483           The format used for the backup file is a special format used by the
5484           ntfsclone(8) tool.
5485
5486           If the optional "metadataonly" flag is true, then only the metadata
5487           is saved, losing all the user data (this is useful for diagnosing
5488           some filesystem problems).
5489
5490           The optional "rescue", "ignorefscheck", "preservetimestamps" and
5491           "force" flags have precise meanings detailed in the ntfsclone(8)
5492           man page.
5493
5494           Use "$g->ntfsclone_in" to restore the file back to a libguestfs
5495           device.
5496
5497           This function depends on the feature "ntfs3g".  See also
5498           "$g->feature-available".
5499
5500       $g->ntfsfix ($device [, clearbadsectors => $clearbadsectors]);
5501           This command repairs some fundamental NTFS inconsistencies, resets
5502           the NTFS journal file, and schedules an NTFS consistency check for
5503           the first boot into Windows.
5504
5505           This is not an equivalent of Windows "chkdsk".  It does not scan
5506           the filesystem for inconsistencies.
5507
5508           The optional "clearbadsectors" flag clears the list of bad sectors.
5509           This is useful after cloning a disk with bad sectors to a new disk.
5510
5511           This function depends on the feature "ntfs3g".  See also
5512           "$g->feature-available".
5513
5514       $g->ntfsresize ($device [, size => $size] [, force => $force]);
5515           This command resizes an NTFS filesystem, expanding or shrinking it
5516           to the size of the underlying device.
5517
5518           The optional parameters are:
5519
5520           "size"
5521               The new size (in bytes) of the filesystem.  If omitted, the
5522               filesystem is resized to fit the container (eg. partition).
5523
5524           "force"
5525               If this option is true, then force the resize of the filesystem
5526               even if the filesystem is marked as requiring a consistency
5527               check.
5528
5529               After the resize operation, the filesystem is always marked as
5530               requiring a consistency check (for safety).  You have to boot
5531               into Windows to perform this check and clear this condition.
5532               If you don't set the "force" option then it is not possible to
5533               call "$g->ntfsresize" multiple times on a single filesystem
5534               without booting into Windows between each resize.
5535
5536           See also ntfsresize(8).
5537
5538           This function depends on the feature "ntfsprogs".  See also
5539           "$g->feature-available".
5540
5541       $g->ntfsresize_opts ($device [, size => $size] [, force => $force]);
5542           This is an alias of "ntfsresize".
5543
5544       $g->ntfsresize_size ($device, $size);
5545           This command is the same as "$g->ntfsresize" except that it allows
5546           you to specify the new size (in bytes) explicitly.
5547
5548           This function depends on the feature "ntfsprogs".  See also
5549           "$g->feature-available".
5550
5551           This function is deprecated.  In new code, use the "ntfsresize"
5552           call instead.
5553
5554           Deprecated functions will not be removed from the API, but the fact
5555           that they are deprecated indicates that there are problems with
5556           correct use of these functions.
5557
5558       $g->parse_environment ();
5559           Parse the programXs environment and set flags in the handle
5560           accordingly.  For example if "LIBGUESTFS_DEBUG=1" then the
5561           XverboseX flag is set in the handle.
5562
5563           Most programs do not need to call this.  It is done implicitly when
5564           you call "$g->create".
5565
5566           See "ENVIRONMENT VARIABLES" in guestfs(3) for a list of environment
5567           variables that can affect libguestfs handles.  See also
5568           "guestfs_create_flags" in guestfs(3), and
5569           "$g->parse_environment_list".
5570
5571       $g->parse_environment_list (\@environment);
5572           Parse the list of strings in the argument "environment" and set
5573           flags in the handle accordingly.  For example if
5574           "LIBGUESTFS_DEBUG=1" is a string in the list, then the XverboseX
5575           flag is set in the handle.
5576
5577           This is the same as "$g->parse_environment" except that it parses
5578           an explicit list of strings instead of the program's environment.
5579
5580       $g->part_add ($device, $prlogex, $startsect, $endsect);
5581           This command adds a partition to "device".  If there is no
5582           partition table on the device, call "$g->part_init" first.
5583
5584           The "prlogex" parameter is the type of partition.  Normally you
5585           should pass "p" or "primary" here, but MBR partition tables also
5586           support "l" (or "logical") and "e" (or "extended") partition types.
5587
5588           "startsect" and "endsect" are the start and end of the partition in
5589           sectors.  "endsect" may be negative, which means it counts
5590           backwards from the end of the disk ("-1" is the last sector).
5591
5592           Creating a partition which covers the whole disk is not so easy.
5593           Use "$g->part_disk" to do that.
5594
5595       $g->part_del ($device, $partnum);
5596           This command deletes the partition numbered "partnum" on "device".
5597
5598           Note that in the case of MBR partitioning, deleting an extended
5599           partition also deletes any logical partitions it contains.
5600
5601       $g->part_disk ($device, $parttype);
5602           This command is simply a combination of "$g->part_init" followed by
5603           "$g->part_add" to create a single primary partition covering the
5604           whole disk.
5605
5606           "parttype" is the partition table type, usually "mbr" or "gpt", but
5607           other possible values are described in "$g->part_init".
5608
5609       $g->part_expand_gpt ($device);
5610           Move backup GPT data structures to the end of the disk.  This is
5611           useful in case of in-place image expand since disk space after
5612           backup GPT header is not usable.  This is equivalent to "sgdisk
5613           -e".
5614
5615           See also sgdisk(8).
5616
5617           This function depends on the feature "gdisk".  See also
5618           "$g->feature-available".
5619
5620       $bootable = $g->part_get_bootable ($device, $partnum);
5621           This command returns true if the partition "partnum" on "device"
5622           has the bootable flag set.
5623
5624           See also "$g->part_set_bootable".
5625
5626       $guid = $g->part_get_disk_guid ($device);
5627           Return the disk identifier (GUID) of a GPT-partitioned "device".
5628           Behaviour is undefined for other partition types.
5629
5630           This function depends on the feature "gdisk".  See also
5631           "$g->feature-available".
5632
5633       $attributes = $g->part_get_gpt_attributes ($device, $partnum);
5634           Return the attribute flags of numbered GPT partition "partnum".  An
5635           error is returned for MBR partitions.
5636
5637           This function depends on the feature "gdisk".  See also
5638           "$g->feature-available".
5639
5640       $guid = $g->part_get_gpt_guid ($device, $partnum);
5641           Return the GUID of numbered GPT partition "partnum".
5642
5643           This function depends on the feature "gdisk".  See also
5644           "$g->feature-available".
5645
5646       $guid = $g->part_get_gpt_type ($device, $partnum);
5647           Return the type GUID of numbered GPT partition "partnum". For MBR
5648           partitions, return an appropriate GUID corresponding to the MBR
5649           type. Behaviour is undefined for other partition types.
5650
5651           This function depends on the feature "gdisk".  See also
5652           "$g->feature-available".
5653
5654       $idbyte = $g->part_get_mbr_id ($device, $partnum);
5655           Returns the MBR type byte (also known as the ID byte) from the
5656           numbered partition "partnum".
5657
5658           Note that only MBR (old DOS-style) partitions have type bytes.  You
5659           will get undefined results for other partition table types (see
5660           "$g->part_get_parttype").
5661
5662       $partitiontype = $g->part_get_mbr_part_type ($device, $partnum);
5663           This returns the partition type of an MBR partition numbered
5664           "partnum" on device "device".
5665
5666           It returns "primary", "logical", or "extended".
5667
5668       $name = $g->part_get_name ($device, $partnum);
5669           This gets the partition name on partition numbered "partnum" on
5670           device "device".  Note that partitions are numbered from 1.
5671
5672           The partition name can only be read on certain types of partition
5673           table.  This works on "gpt" but not on "mbr" partitions.
5674
5675       $parttype = $g->part_get_parttype ($device);
5676           This command examines the partition table on "device" and returns
5677           the partition table type (format) being used.
5678
5679           Common return values include: "msdos" (a DOS/Windows style MBR
5680           partition table), "gpt" (a GPT/EFI-style partition table).  Other
5681           values are possible, although unusual.  See "$g->part_init" for a
5682           full list.
5683
5684       $g->part_init ($device, $parttype);
5685           This creates an empty partition table on "device" of one of the
5686           partition types listed below.  Usually "parttype" should be either
5687           "msdos" or "gpt" (for large disks).
5688
5689           Initially there are no partitions.  Following this, you should call
5690           "$g->part_add" for each partition required.
5691
5692           Possible values for "parttype" are:
5693
5694           "efi"
5695           "gpt"
5696               Intel EFI / GPT partition table.
5697
5698               This is recommended for >= 2 TB partitions that will be
5699               accessed from Linux and Intel-based Mac OS X.  It also has
5700               limited backwards compatibility with the "mbr" format.
5701
5702           "mbr"
5703           "msdos"
5704               The standard PC "Master Boot Record" (MBR) format used by MS-
5705               DOS and Windows.  This partition type will only work for device
5706               sizes up to 2 TB.  For large disks we recommend using "gpt".
5707
5708           Other partition table types that may work but are not supported
5709           include:
5710
5711           "aix"
5712               AIX disk labels.
5713
5714           "amiga"
5715           "rdb"
5716               Amiga "Rigid Disk Block" format.
5717
5718           "bsd"
5719               BSD disk labels.
5720
5721           "dasd"
5722               DASD, used on IBM mainframes.
5723
5724           "dvh"
5725               MIPS/SGI volumes.
5726
5727           "mac"
5728               Old Mac partition format.  Modern Macs use "gpt".
5729
5730           "pc98"
5731               NEC PC-98 format, common in Japan apparently.
5732
5733           "sun"
5734               Sun disk labels.
5735
5736       @partitions = $g->part_list ($device);
5737           This command parses the partition table on "device" and returns the
5738           list of partitions found.
5739
5740           The fields in the returned structure are:
5741
5742           "part_num"
5743               Partition number, counting from 1.
5744
5745           "part_start"
5746               Start of the partition in bytes.  To get sectors you have to
5747               divide by the deviceXs sector size, see "$g->blockdev_getss".
5748
5749           "part_end"
5750               End of the partition in bytes.
5751
5752           "part_size"
5753               Size of the partition in bytes.
5754
5755       $g->part_resize ($device, $partnum, $endsect);
5756           This command resizes the partition numbered "partnum" on "device"
5757           by moving the end position.
5758
5759           Note that this does not modify any filesystem present in the
5760           partition.  If you wish to do this, you will need to use filesystem
5761           resizing commands like "$g->resize2fs".
5762
5763           When growing a partition you will want to grow the filesystem
5764           afterwards, but when shrinking, you need to shrink the filesystem
5765           before the partition.
5766
5767       $g->part_set_bootable ($device, $partnum, $bootable);
5768           This sets the bootable flag on partition numbered "partnum" on
5769           device "device".  Note that partitions are numbered from 1.
5770
5771           The bootable flag is used by some operating systems (notably
5772           Windows) to determine which partition to boot from.  It is by no
5773           means universally recognized.
5774
5775       $g->part_set_disk_guid ($device, $guid);
5776           Set the disk identifier (GUID) of a GPT-partitioned "device" to
5777           "guid".  Return an error if the partition table of "device" isn't
5778           GPT, or if "guid" is not a valid GUID.
5779
5780           This function depends on the feature "gdisk".  See also
5781           "$g->feature-available".
5782
5783       $g->part_set_disk_guid_random ($device);
5784           Set the disk identifier (GUID) of a GPT-partitioned "device" to a
5785           randomly generated value.  Return an error if the partition table
5786           of "device" isn't GPT.
5787
5788           This function depends on the feature "gdisk".  See also
5789           "$g->feature-available".
5790
5791       $g->part_set_gpt_attributes ($device, $partnum, $attributes);
5792           Set the attribute flags of numbered GPT partition "partnum" to
5793           "attributes". Return an error if the partition table of "device"
5794           isn't GPT.
5795
5796           See
5797           <https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries>
5798           for a useful list of partition attributes.
5799
5800           This function depends on the feature "gdisk".  See also
5801           "$g->feature-available".
5802
5803       $g->part_set_gpt_guid ($device, $partnum, $guid);
5804           Set the GUID of numbered GPT partition "partnum" to "guid".  Return
5805           an error if the partition table of "device" isn't GPT, or if "guid"
5806           is not a valid GUID.
5807
5808           This function depends on the feature "gdisk".  See also
5809           "$g->feature-available".
5810
5811       $g->part_set_gpt_type ($device, $partnum, $guid);
5812           Set the type GUID of numbered GPT partition "partnum" to "guid".
5813           Return an error if the partition table of "device" isn't GPT, or if
5814           "guid" is not a valid GUID.
5815
5816           See
5817           <https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs>
5818           for a useful list of type GUIDs.
5819
5820           This function depends on the feature "gdisk".  See also
5821           "$g->feature-available".
5822
5823       $g->part_set_mbr_id ($device, $partnum, $idbyte);
5824           Sets the MBR type byte (also known as the ID byte) of the numbered
5825           partition "partnum" to "idbyte".  Note that the type bytes quoted
5826           in most documentation are in fact hexadecimal numbers, but usually
5827           documented without any leading "0x" which might be confusing.
5828
5829           Note that only MBR (old DOS-style) partitions have type bytes.  You
5830           will get undefined results for other partition table types (see
5831           "$g->part_get_parttype").
5832
5833       $g->part_set_name ($device, $partnum, $name);
5834           This sets the partition name on partition numbered "partnum" on
5835           device "device".  Note that partitions are numbered from 1.
5836
5837           The partition name can only be set on certain types of partition
5838           table.  This works on "gpt" but not on "mbr" partitions.
5839
5840       $device = $g->part_to_dev ($partition);
5841           This function takes a partition name (eg. "/dev/sdb1") and removes
5842           the partition number, returning the device name (eg. "/dev/sdb").
5843
5844           The named partition must exist, for example as a string returned
5845           from "$g->list_partitions".
5846
5847           See also "$g->part_to_partnum", "$g->device_index".
5848
5849       $partnum = $g->part_to_partnum ($partition);
5850           This function takes a partition name (eg. "/dev/sdb1") and returns
5851           the partition number (eg. 1).
5852
5853           The named partition must exist, for example as a string returned
5854           from "$g->list_partitions".
5855
5856           See also "$g->part_to_dev".
5857
5858       $g->ping_daemon ();
5859           This is a test probe into the guestfs daemon running inside the
5860           libguestfs appliance.  Calling this function checks that the daemon
5861           responds to the ping message, without affecting the daemon or
5862           attached block device(s) in any other way.
5863
5864       $content = $g->pread ($path, $count, $offset);
5865           This command lets you read part of a file.  It reads "count" bytes
5866           of the file, starting at "offset", from file "path".
5867
5868           This may read fewer bytes than requested.  For further details see
5869           the pread(2) system call.
5870
5871           See also "$g->pwrite", "$g->pread_device".
5872
5873           Because of the message protocol, there is a transfer limit of
5874           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
5875           guestfs(3).
5876
5877       $content = $g->pread_device ($device, $count, $offset);
5878           This command lets you read part of a block device.  It reads
5879           "count" bytes of "device", starting at "offset".
5880
5881           This may read fewer bytes than requested.  For further details see
5882           the pread(2) system call.
5883
5884           See also "$g->pread".
5885
5886           Because of the message protocol, there is a transfer limit of
5887           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
5888           guestfs(3).
5889
5890       $g->pvchange_uuid ($device);
5891           Generate a new random UUID for the physical volume "device".
5892
5893           This function depends on the feature "lvm2".  See also
5894           "$g->feature-available".
5895
5896       $g->pvchange_uuid_all ();
5897           Generate new random UUIDs for all physical volumes.
5898
5899           This function depends on the feature "lvm2".  See also
5900           "$g->feature-available".
5901
5902       $g->pvcreate ($device);
5903           This creates an LVM physical volume on the named "device", where
5904           "device" should usually be a partition name such as /dev/sda1.
5905
5906           This function depends on the feature "lvm2".  See also
5907           "$g->feature-available".
5908
5909       $g->pvremove ($device);
5910           This wipes a physical volume "device" so that LVM will no longer
5911           recognise it.
5912
5913           The implementation uses the pvremove(8) command which refuses to
5914           wipe physical volumes that contain any volume groups, so you have
5915           to remove those first.
5916
5917           This function depends on the feature "lvm2".  See also
5918           "$g->feature-available".
5919
5920       $g->pvresize ($device);
5921           This resizes (expands or shrinks) an existing LVM physical volume
5922           to match the new size of the underlying device.
5923
5924           This function depends on the feature "lvm2".  See also
5925           "$g->feature-available".
5926
5927       $g->pvresize_size ($device, $size);
5928           This command is the same as "$g->pvresize" except that it allows
5929           you to specify the new size (in bytes) explicitly.
5930
5931           This function depends on the feature "lvm2".  See also
5932           "$g->feature-available".
5933
5934       @physvols = $g->pvs ();
5935           List all the physical volumes detected.  This is the equivalent of
5936           the pvs(8) command.
5937
5938           This returns a list of just the device names that contain PVs (eg.
5939           /dev/sda2).
5940
5941           See also "$g->pvs_full".
5942
5943           This function depends on the feature "lvm2".  See also
5944           "$g->feature-available".
5945
5946       @physvols = $g->pvs_full ();
5947           List all the physical volumes detected.  This is the equivalent of
5948           the pvs(8) command.  The "full" version includes all fields.
5949
5950           This function depends on the feature "lvm2".  See also
5951           "$g->feature-available".
5952
5953       $uuid = $g->pvuuid ($device);
5954           This command returns the UUID of the LVM PV "device".
5955
5956       $nbytes = $g->pwrite ($path, $content, $offset);
5957           This command writes to part of a file.  It writes the data buffer
5958           "content" to the file "path" starting at offset "offset".
5959
5960           This command implements the pwrite(2) system call, and like that
5961           system call it may not write the full data requested.  The return
5962           value is the number of bytes that were actually written to the
5963           file.  This could even be 0, although short writes are unlikely for
5964           regular files in ordinary circumstances.
5965
5966           See also "$g->pread", "$g->pwrite_device".
5967
5968           Because of the message protocol, there is a transfer limit of
5969           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
5970           guestfs(3).
5971
5972       $nbytes = $g->pwrite_device ($device, $content, $offset);
5973           This command writes to part of a device.  It writes the data buffer
5974           "content" to "device" starting at offset "offset".
5975
5976           This command implements the pwrite(2) system call, and like that
5977           system call it may not write the full data requested (although
5978           short writes to disk devices and partitions are probably impossible
5979           with standard Linux kernels).
5980
5981           See also "$g->pwrite".
5982
5983           Because of the message protocol, there is a transfer limit of
5984           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
5985           guestfs(3).
5986
5987       $content = $g->read_file ($path);
5988           This calls returns the contents of the file "path" as a buffer.
5989
5990           Unlike "$g->cat", this function can correctly handle files that
5991           contain embedded ASCII NUL characters.
5992
5993       @lines = $g->read_lines ($path);
5994           Return the contents of the file named "path".
5995
5996           The file contents are returned as a list of lines.  Trailing "LF"
5997           and "CRLF" character sequences are not returned.
5998
5999           Note that this function cannot correctly handle binary files
6000           (specifically, files containing "\0" character which is treated as
6001           end of string).  For those you need to use the "$g->read_file"
6002           function and split the buffer into lines yourself.
6003
6004       @entries = $g->readdir ($dir);
6005           This returns the list of directory entries in directory "dir".
6006
6007           All entries in the directory are returned, including "." and "..".
6008           The entries are not sorted, but returned in the same order as the
6009           underlying filesystem.
6010
6011           Also this call returns basic file type information about each file.
6012           The "ftyp" field will contain one of the following characters:
6013
6014           'b' Block special
6015
6016           'c' Char special
6017
6018           'd' Directory
6019
6020           'f' FIFO (named pipe)
6021
6022           'l' Symbolic link
6023
6024           'r' Regular file
6025
6026           's' Socket
6027
6028           'u' Unknown file type
6029
6030           '?' The readdir(3) call returned a "d_type" field with an
6031               unexpected value
6032
6033           This function is primarily intended for use by programs.  To get a
6034           simple list of names, use "$g->ls".  To get a printable directory
6035           for human consumption, use "$g->ll".
6036
6037           Because of the message protocol, there is a transfer limit of
6038           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
6039           guestfs(3).
6040
6041       $link = $g->readlink ($path);
6042           This command reads the target of a symbolic link.
6043
6044       @links = $g->readlinklist ($path, \@names);
6045           This call allows you to do a "readlink" operation on multiple
6046           files, where all files are in the directory "path".  "names" is the
6047           list of files from this directory.
6048
6049           On return you get a list of strings, with a one-to-one
6050           correspondence to the "names" list.  Each string is the value of
6051           the symbolic link.
6052
6053           If the readlink(2) operation fails on any name, then the
6054           corresponding result string is the empty string "".  However the
6055           whole operation is completed even if there were readlink(2) errors,
6056           and so you can call this function with names where you don't know
6057           if they are symbolic links already (albeit slightly less
6058           efficient).
6059
6060           This call is intended for programs that want to efficiently list a
6061           directory contents without making many round-trips.
6062
6063       $rpath = $g->realpath ($path);
6064           Return the canonicalized absolute pathname of "path".  The returned
6065           path has no ".", ".." or symbolic link path elements.
6066
6067       $g->remount ($mountpoint [, rw => $rw]);
6068           This call allows you to change the "rw" (readonly/read-write) flag
6069           on an already mounted filesystem at "mountpoint", converting a
6070           readonly filesystem to be read-write, or vice-versa.
6071
6072           Note that at the moment you must supply the "optional" "rw"
6073           parameter.  In future we may allow other flags to be adjusted.
6074
6075       $g->remove_drive ($label);
6076           This call does nothing and returns an error.
6077
6078           This function is deprecated.  There is no replacement.  Consult the
6079           API documentation in guestfs(3) for further information.
6080
6081           Deprecated functions will not be removed from the API, but the fact
6082           that they are deprecated indicates that there are problems with
6083           correct use of these functions.
6084
6085       $g->removexattr ($xattr, $path);
6086           This call removes the extended attribute named "xattr" of the file
6087           "path".
6088
6089           See also: "$g->lremovexattr", attr(5).
6090
6091           This function depends on the feature "linuxxattrs".  See also
6092           "$g->feature-available".
6093
6094       $g->rename ($oldpath, $newpath);
6095           Rename a file to a new place on the same filesystem.  This is the
6096           same as the Linux rename(2) system call.  In most cases you are
6097           better to use "$g->mv" instead.
6098
6099       $g->resize2fs ($device);
6100           This resizes an ext2, ext3 or ext4 filesystem to match the size of
6101           the underlying device.
6102
6103           See also "RESIZE2FS ERRORS" in guestfs(3).
6104
6105       $g->resize2fs_M ($device);
6106           This command is the same as "$g->resize2fs", but the filesystem is
6107           resized to its minimum size.  This works like the -M option to the
6108           resize2fs(8) command.
6109
6110           To get the resulting size of the filesystem you should call
6111           "$g->tune2fs_l" and read the "Block size" and "Block count" values.
6112           These two numbers, multiplied together, give the resulting size of
6113           the minimal filesystem in bytes.
6114
6115           See also "RESIZE2FS ERRORS" in guestfs(3).
6116
6117       $g->resize2fs_size ($device, $size);
6118           This command is the same as "$g->resize2fs" except that it allows
6119           you to specify the new size (in bytes) explicitly.
6120
6121           See also "RESIZE2FS ERRORS" in guestfs(3).
6122
6123       $g->rm ($path);
6124           Remove the single file "path".
6125
6126       $g->rm_f ($path);
6127           Remove the file "path".
6128
6129           If the file doesn't exist, that error is ignored.  (Other errors,
6130           eg. I/O errors or bad paths, are not ignored)
6131
6132           This call cannot remove directories.  Use "$g->rmdir" to remove an
6133           empty directory, or "$g->rm_rf" to remove directories recursively.
6134
6135       $g->rm_rf ($path);
6136           Remove the file or directory "path", recursively removing the
6137           contents if its a directory.  This is like the "rm -rf" shell
6138           command.
6139
6140       $g->rmdir ($path);
6141           Remove the single directory "path".
6142
6143       $g->rmmountpoint ($exemptpath);
6144           This call removes a mountpoint that was previously created with
6145           "$g->mkmountpoint".  See "$g->mkmountpoint" for full details.
6146
6147       $g->rsync ($src, $dest [, archive => $archive] [, deletedest =>
6148       $deletedest]);
6149           This call may be used to copy or synchronize two directories under
6150           the same libguestfs handle.  This uses the rsync(1) program which
6151           uses a fast algorithm that avoids copying files unnecessarily.
6152
6153           "src" and "dest" are the source and destination directories.  Files
6154           are copied from "src" to "dest".
6155
6156           The optional arguments are:
6157
6158           "archive"
6159               Turns on archive mode.  This is the same as passing the
6160               --archive flag to "rsync".
6161
6162           "deletedest"
6163               Delete files at the destination that do not exist at the
6164               source.
6165
6166           This function depends on the feature "rsync".  See also
6167           "$g->feature-available".
6168
6169       $g->rsync_in ($remote, $dest [, archive => $archive] [, deletedest =>
6170       $deletedest]);
6171           This call may be used to copy or synchronize the filesystem on the
6172           host or on a remote computer with the filesystem within libguestfs.
6173           This uses the rsync(1) program which uses a fast algorithm that
6174           avoids copying files unnecessarily.
6175
6176           This call only works if the network is enabled.  See
6177           "$g->set_network" or the --network option to various tools like
6178           guestfish(1).
6179
6180           Files are copied from the remote server and directory specified by
6181           "remote" to the destination directory "dest".
6182
6183           The format of the remote server string is defined by rsync(1).
6184           Note that there is no way to supply a password or passphrase so the
6185           target must be set up not to require one.
6186
6187           The optional arguments are the same as those of "$g->rsync".
6188
6189           This function depends on the feature "rsync".  See also
6190           "$g->feature-available".
6191
6192       $g->rsync_out ($src, $remote [, archive => $archive] [, deletedest =>
6193       $deletedest]);
6194           This call may be used to copy or synchronize the filesystem within
6195           libguestfs with a filesystem on the host or on a remote computer.
6196           This uses the rsync(1) program which uses a fast algorithm that
6197           avoids copying files unnecessarily.
6198
6199           This call only works if the network is enabled.  See
6200           "$g->set_network" or the --network option to various tools like
6201           guestfish(1).
6202
6203           Files are copied from the source directory "src" to the remote
6204           server and directory specified by "remote".
6205
6206           The format of the remote server string is defined by rsync(1).
6207           Note that there is no way to supply a password or passphrase so the
6208           target must be set up not to require one.
6209
6210           The optional arguments are the same as those of "$g->rsync".
6211
6212           Globbing does not happen on the "src" parameter.  In programs which
6213           use the API directly you have to expand wildcards yourself (see
6214           "$g->glob_expand").  In guestfish you can use the "glob" command
6215           (see "glob" in guestfish(1)), for example:
6216
6217            ><fs> glob rsync-out /* rsync://remote/
6218
6219           This function depends on the feature "rsync".  See also
6220           "$g->feature-available".
6221
6222       $g->scrub_device ($device);
6223           This command writes patterns over "device" to make data retrieval
6224           more difficult.
6225
6226           It is an interface to the scrub(1) program.  See that manual page
6227           for more details.
6228
6229           This function depends on the feature "scrub".  See also
6230           "$g->feature-available".
6231
6232       $g->scrub_file ($file);
6233           This command writes patterns over a file to make data retrieval
6234           more difficult.
6235
6236           The file is removed after scrubbing.
6237
6238           It is an interface to the scrub(1) program.  See that manual page
6239           for more details.
6240
6241           This function depends on the feature "scrub".  See also
6242           "$g->feature-available".
6243
6244       $g->scrub_freespace ($dir);
6245           This command creates the directory "dir" and then fills it with
6246           files until the filesystem is full, and scrubs the files as for
6247           "$g->scrub_file", and deletes them.  The intention is to scrub any
6248           free space on the partition containing "dir".
6249
6250           It is an interface to the scrub(1) program.  See that manual page
6251           for more details.
6252
6253           This function depends on the feature "scrub".  See also
6254           "$g->feature-available".
6255
6256       $g->selinux_relabel ($specfile, $path [, force => $force]);
6257           SELinux relabel parts of the filesystem.
6258
6259           The "specfile" parameter controls the policy spec file used.  You
6260           have to parse "/etc/selinux/config" to find the correct SELinux
6261           policy and then pass the spec file, usually: "/etc/selinux/" +
6262           selinuxtype + "/contexts/files/file_contexts".
6263
6264           The required "path" parameter is the top level directory where
6265           relabelling starts.  Normally you should pass "path" as "/" to
6266           relabel the whole guest filesystem.
6267
6268           The optional "force" boolean controls whether the context is reset
6269           for customizable files, and also whether the user, role and range
6270           parts of the file context is changed.
6271
6272           This function depends on the feature "selinuxrelabel".  See also
6273           "$g->feature-available".
6274
6275       $g->set_append ($append);
6276           This function is used to add additional options to the libguestfs
6277           appliance kernel command line.
6278
6279           The default is "NULL" unless overridden by setting
6280           "LIBGUESTFS_APPEND" environment variable.
6281
6282           Setting "append" to "NULL" means no additional options are passed
6283           (libguestfs always adds a few of its own).
6284
6285       $g->set_attach_method ($backend);
6286           Set the method that libguestfs uses to connect to the backend
6287           guestfsd daemon.
6288
6289           See "BACKEND" in guestfs(3).
6290
6291           This function is deprecated.  In new code, use the "set_backend"
6292           call instead.
6293
6294           Deprecated functions will not be removed from the API, but the fact
6295           that they are deprecated indicates that there are problems with
6296           correct use of these functions.
6297
6298       $g->set_autosync ($autosync);
6299           If "autosync" is true, this enables autosync.  Libguestfs will make
6300           a best effort attempt to make filesystems consistent and
6301           synchronized when the handle is closed (also if the program exits
6302           without closing handles).
6303
6304           This is enabled by default (since libguestfs 1.5.24, previously it
6305           was disabled by default).
6306
6307       $g->set_backend ($backend);
6308           Set the method that libguestfs uses to connect to the backend
6309           guestfsd daemon.
6310
6311           This handle property was previously called the "attach method".
6312
6313           See "BACKEND" in guestfs(3).
6314
6315       $g->set_backend_setting ($name, $val);
6316           Append "name=value" to the backend settings string list.  However
6317           if a string already exists matching "name" or beginning with
6318           "name=", then that setting is replaced.
6319
6320           See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
6321
6322       $g->set_backend_settings (\@settings);
6323           Set a list of zero or more settings which are passed through to the
6324           current backend.  Each setting is a string which is interpreted in
6325           a backend-specific way, or ignored if not understood by the
6326           backend.
6327
6328           The default value is an empty list, unless the environment variable
6329           "LIBGUESTFS_BACKEND_SETTINGS" was set when the handle was created.
6330           This environment variable contains a colon-separated list of
6331           settings.
6332
6333           This call replaces all backend settings.  If you want to replace a
6334           single backend setting, see "$g->set_backend_setting".  If you want
6335           to clear a single backend setting, see "$g->clear_backend_setting".
6336
6337           See "BACKEND" in guestfs(3), "BACKEND SETTINGS" in guestfs(3).
6338
6339       $g->set_cachedir ($cachedir);
6340           Set the directory used by the handle to store the appliance cache,
6341           when using a supermin appliance.  The appliance is cached and
6342           shared between all handles which have the same effective user ID.
6343
6344           The environment variables "LIBGUESTFS_CACHEDIR" and "TMPDIR"
6345           control the default value: If "LIBGUESTFS_CACHEDIR" is set, then
6346           that is the default.  Else if "TMPDIR" is set, then that is the
6347           default.  Else /var/tmp is the default.
6348
6349       $g->set_direct ($direct);
6350           If the direct appliance mode flag is enabled, then stdin and stdout
6351           are passed directly through to the appliance once it is launched.
6352
6353           One consequence of this is that log messages aren't caught by the
6354           library and handled by "$g->set_log_message_callback", but go
6355           straight to stdout.
6356
6357           You probably don't want to use this unless you know what you are
6358           doing.
6359
6360           The default is disabled.
6361
6362           This function is deprecated.  In new code, use the
6363           "internal_get_console_socket" call instead.
6364
6365           Deprecated functions will not be removed from the API, but the fact
6366           that they are deprecated indicates that there are problems with
6367           correct use of these functions.
6368
6369       $g->set_e2attrs ($file, $attrs [, clear => $clear]);
6370           This sets or clears the file attributes "attrs" associated with the
6371           inode file.
6372
6373           "attrs" is a string of characters representing file attributes.
6374           See "$g->get_e2attrs" for a list of possible attributes.  Not all
6375           attributes can be changed.
6376
6377           If optional boolean "clear" is not present or false, then the
6378           "attrs" listed are set in the inode.
6379
6380           If "clear" is true, then the "attrs" listed are cleared in the
6381           inode.
6382
6383           In both cases, other attributes not present in the "attrs" string
6384           are left unchanged.
6385
6386           These attributes are only present when the file is located on an
6387           ext2/3/4 filesystem.  Using this call on other filesystem types
6388           will result in an error.
6389
6390       $g->set_e2generation ($file, $generation);
6391           This sets the ext2 file generation of a file.
6392
6393           See "$g->get_e2generation".
6394
6395       $g->set_e2label ($device, $label);
6396           This sets the ext2/3/4 filesystem label of the filesystem on
6397           "device" to "label".  Filesystem labels are limited to 16
6398           characters.
6399
6400           You can use either "$g->tune2fs_l" or "$g->get_e2label" to return
6401           the existing label on a filesystem.
6402
6403           This function is deprecated.  In new code, use the "set_label" call
6404           instead.
6405
6406           Deprecated functions will not be removed from the API, but the fact
6407           that they are deprecated indicates that there are problems with
6408           correct use of these functions.
6409
6410       $g->set_e2uuid ($device, $uuid);
6411           This sets the ext2/3/4 filesystem UUID of the filesystem on
6412           "device" to "uuid".  The format of the UUID and alternatives such
6413           as "clear", "random" and "time" are described in the tune2fs(8)
6414           manpage.
6415
6416           You can use "$g->vfs_uuid" to return the existing UUID of a
6417           filesystem.
6418
6419           This function is deprecated.  In new code, use the "set_uuid" call
6420           instead.
6421
6422           Deprecated functions will not be removed from the API, but the fact
6423           that they are deprecated indicates that there are problems with
6424           correct use of these functions.
6425
6426       $g->set_hv ($hv);
6427           Set the hypervisor binary that we will use.  The hypervisor depends
6428           on the backend, but is usually the location of the qemu/KVM
6429           hypervisor.
6430
6431           The default is chosen when the library was compiled by the
6432           configure script.
6433
6434           You can also override this by setting the "LIBGUESTFS_HV"
6435           environment variable.
6436
6437           Note that you should call this function as early as possible after
6438           creating the handle.  This is because some pre-launch operations
6439           depend on testing qemu features (by running "qemu -help").  If the
6440           qemu binary changes, we don't retest features, and so you might see
6441           inconsistent results.  Using the environment variable
6442           "LIBGUESTFS_HV" is safest of all since that picks the qemu binary
6443           at the same time as the handle is created.
6444
6445       $g->set_identifier ($identifier);
6446           This is an informative string which the caller may optionally set
6447           in the handle.  It is printed in various places, allowing the
6448           current handle to be identified in debugging output.
6449
6450           One important place is when tracing is enabled.  If the identifier
6451           string is not an empty string, then trace messages change from
6452           this:
6453
6454            libguestfs: trace: get_tmpdir
6455            libguestfs: trace: get_tmpdir = "/tmp"
6456
6457           to this:
6458
6459            libguestfs: trace: ID: get_tmpdir
6460            libguestfs: trace: ID: get_tmpdir = "/tmp"
6461
6462           where "ID" is the identifier string set by this call.
6463
6464           The identifier must only contain alphanumeric ASCII characters,
6465           underscore and minus sign.  The default is the empty string.
6466
6467           See also "$g->set_program", "$g->set_trace", "$g->get_identifier".
6468
6469       $g->set_label ($mountable, $label);
6470           Set the filesystem label on "mountable" to "label".
6471
6472           Only some filesystem types support labels, and libguestfs supports
6473           setting labels on only a subset of these.
6474
6475           ext2, ext3, ext4
6476               Labels are limited to 16 bytes.
6477
6478           NTFS
6479               Labels are limited to 128 unicode characters.
6480
6481           XFS The label is limited to 12 bytes.  The filesystem must not be
6482               mounted when trying to set the label.
6483
6484           btrfs
6485               The label is limited to 255 bytes and some characters are not
6486               allowed.  Setting the label on a btrfs subvolume will set the
6487               label on its parent filesystem.  The filesystem must not be
6488               mounted when trying to set the label.
6489
6490           fat The label is limited to 11 bytes.
6491
6492           swap
6493               The label is limited to 16 bytes.
6494
6495           If there is no support for changing the label for the type of the
6496           specified filesystem, set_label will fail and set errno as ENOTSUP.
6497
6498           To read the label on a filesystem, call "$g->vfs_label".
6499
6500       $g->set_libvirt_requested_credential ($index, $cred);
6501           After requesting the "index"'th credential from the user, call this
6502           function to pass the answer back to libvirt.
6503
6504           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
6505           example code.
6506
6507       $g->set_libvirt_supported_credentials (\@creds);
6508           Call this function before setting an event handler for
6509           "GUESTFS_EVENT_LIBVIRT_AUTH", to supply the list of credential
6510           types that the program knows how to process.
6511
6512           The "creds" list must be a non-empty list of strings.  Possible
6513           strings are:
6514
6515           "username"
6516           "authname"
6517           "language"
6518           "cnonce"
6519           "passphrase"
6520           "echoprompt"
6521           "noechoprompt"
6522           "realm"
6523           "external"
6524
6525           See libvirt documentation for the meaning of these credential
6526           types.
6527
6528           See "LIBVIRT AUTHENTICATION" in guestfs(3) for documentation and
6529           example code.
6530
6531       $g->set_memsize ($memsize);
6532           This sets the memory size in megabytes allocated to the hypervisor.
6533           This only has any effect if called before "$g->launch".
6534
6535           You can also change this by setting the environment variable
6536           "LIBGUESTFS_MEMSIZE" before the handle is created.
6537
6538           For more information on the architecture of libguestfs, see
6539           guestfs(3).
6540
6541       $g->set_network ($network);
6542           If "network" is true, then the network is enabled in the libguestfs
6543           appliance.  The default is false.
6544
6545           This affects whether commands are able to access the network (see
6546           "RUNNING COMMANDS" in guestfs(3)).
6547
6548           You must call this before calling "$g->launch", otherwise it has no
6549           effect.
6550
6551       $g->set_path ($searchpath);
6552           Set the path that libguestfs searches for kernel and initrd.img.
6553
6554           The default is "$libdir/guestfs" unless overridden by setting
6555           "LIBGUESTFS_PATH" environment variable.
6556
6557           Setting "path" to "NULL" restores the default path.
6558
6559       $g->set_pgroup ($pgroup);
6560           If "pgroup" is true, child processes are placed into their own
6561           process group.
6562
6563           The practical upshot of this is that signals like "SIGINT" (from
6564           users pressing "^C") won't be received by the child process.
6565
6566           The default for this flag is false, because usually you want "^C"
6567           to kill the subprocess.  Guestfish sets this flag to true when used
6568           interactively, so that "^C" can cancel long-running commands
6569           gracefully (see "$g->user_cancel").
6570
6571       $g->set_program ($program);
6572           Set the program name.  This is an informative string which the main
6573           program may optionally set in the handle.
6574
6575           When the handle is created, the program name in the handle is set
6576           to the basename from "argv[0]".  The program name can never be
6577           "NULL".
6578
6579       $g->set_qemu ($hv);
6580           Set the hypervisor binary (usually qemu) that we will use.
6581
6582           The default is chosen when the library was compiled by the
6583           configure script.
6584
6585           You can also override this by setting the "LIBGUESTFS_HV"
6586           environment variable.
6587
6588           Setting "hv" to "NULL" restores the default qemu binary.
6589
6590           Note that you should call this function as early as possible after
6591           creating the handle.  This is because some pre-launch operations
6592           depend on testing qemu features (by running "qemu -help").  If the
6593           qemu binary changes, we don't retest features, and so you might see
6594           inconsistent results.  Using the environment variable
6595           "LIBGUESTFS_HV" is safest of all since that picks the qemu binary
6596           at the same time as the handle is created.
6597
6598           This function is deprecated.  In new code, use the "set_hv" call
6599           instead.
6600
6601           Deprecated functions will not be removed from the API, but the fact
6602           that they are deprecated indicates that there are problems with
6603           correct use of these functions.
6604
6605       $g->set_recovery_proc ($recoveryproc);
6606           If this is called with the parameter "false" then "$g->launch" does
6607           not create a recovery process.  The purpose of the recovery process
6608           is to stop runaway hypervisor processes in the case where the main
6609           program aborts abruptly.
6610
6611           This only has any effect if called before "$g->launch", and the
6612           default is true.
6613
6614           About the only time when you would want to disable this is if the
6615           main process will fork itself into the background ("daemonize"
6616           itself).  In this case the recovery process thinks that the main
6617           program has disappeared and so kills the hypervisor, which is not
6618           very helpful.
6619
6620       $g->set_selinux ($selinux);
6621           This sets the selinux flag that is passed to the appliance at boot
6622           time.  The default is "selinux=0" (disabled).
6623
6624           Note that if SELinux is enabled, it is always in Permissive mode
6625           ("enforcing=0").
6626
6627           For more information on the architecture of libguestfs, see
6628           guestfs(3).
6629
6630           This function is deprecated.  In new code, use the
6631           "selinux_relabel" call instead.
6632
6633           Deprecated functions will not be removed from the API, but the fact
6634           that they are deprecated indicates that there are problems with
6635           correct use of these functions.
6636
6637       $g->set_smp ($smp);
6638           Change the number of virtual CPUs assigned to the appliance.  The
6639           default is 1.  Increasing this may improve performance, though
6640           often it has no effect.
6641
6642           This function must be called before "$g->launch".
6643
6644       $g->set_tmpdir ($tmpdir);
6645           Set the directory used by the handle to store temporary files.
6646
6647           The environment variables "LIBGUESTFS_TMPDIR" and "TMPDIR" control
6648           the default value: If "LIBGUESTFS_TMPDIR" is set, then that is the
6649           default.  Else if "TMPDIR" is set, then that is the default.  Else
6650           /tmp is the default.
6651
6652       $g->set_trace ($trace);
6653           If the command trace flag is set to 1, then libguestfs calls,
6654           parameters and return values are traced.
6655
6656           If you want to trace C API calls into libguestfs (and other
6657           libraries) then possibly a better way is to use the external
6658           ltrace(1) command.
6659
6660           Command traces are disabled unless the environment variable
6661           "LIBGUESTFS_TRACE" is defined and set to 1.
6662
6663           Trace messages are normally sent to "stderr", unless you register a
6664           callback to send them somewhere else (see
6665           "$g->set_event_callback").
6666
6667       $g->set_uuid ($device, $uuid);
6668           Set the filesystem UUID on "device" to "uuid".  If this fails and
6669           the errno is ENOTSUP, means that there is no support for changing
6670           the UUID for the type of the specified filesystem.
6671
6672           Only some filesystem types support setting UUIDs.
6673
6674           To read the UUID on a filesystem, call "$g->vfs_uuid".
6675
6676       $g->set_uuid_random ($device);
6677           Set the filesystem UUID on "device" to a random UUID.  If this
6678           fails and the errno is ENOTSUP, means that there is no support for
6679           changing the UUID for the type of the specified filesystem.
6680
6681           Only some filesystem types support setting UUIDs.
6682
6683           To read the UUID on a filesystem, call "$g->vfs_uuid".
6684
6685       $g->set_verbose ($verbose);
6686           If "verbose" is true, this turns on verbose messages.
6687
6688           Verbose messages are disabled unless the environment variable
6689           "LIBGUESTFS_DEBUG" is defined and set to 1.
6690
6691           Verbose messages are normally sent to "stderr", unless you register
6692           a callback to send them somewhere else (see
6693           "$g->set_event_callback").
6694
6695       $g->setcon ($context);
6696           This sets the SELinux security context of the daemon to the string
6697           "context".
6698
6699           See the documentation about SELINUX in guestfs(3).
6700
6701           This function depends on the feature "selinux".  See also
6702           "$g->feature-available".
6703
6704           This function is deprecated.  In new code, use the
6705           "selinux_relabel" call instead.
6706
6707           Deprecated functions will not be removed from the API, but the fact
6708           that they are deprecated indicates that there are problems with
6709           correct use of these functions.
6710
6711       $g->setxattr ($xattr, $val, $vallen, $path);
6712           This call sets the extended attribute named "xattr" of the file
6713           "path" to the value "val" (of length "vallen").  The value is
6714           arbitrary 8 bit data.
6715
6716           See also: "$g->lsetxattr", attr(5).
6717
6718           This function depends on the feature "linuxxattrs".  See also
6719           "$g->feature-available".
6720
6721       $g->sfdisk ($device, $cyls, $heads, $sectors, \@lines);
6722           This is a direct interface to the sfdisk(8) program for creating
6723           partitions on block devices.
6724
6725           "device" should be a block device, for example /dev/sda.
6726
6727           "cyls", "heads" and "sectors" are the number of cylinders, heads
6728           and sectors on the device, which are passed directly to sfdisk(8)
6729           as the -C, -H and -S parameters.  If you pass 0 for any of these,
6730           then the corresponding parameter is omitted.  Usually for XlargeX
6731           disks, you can just pass 0 for these, but for small (floppy-sized)
6732           disks, sfdisk(8) (or rather, the kernel) cannot work out the right
6733           geometry and you will need to tell it.
6734
6735           "lines" is a list of lines that we feed to sfdisk(8).  For more
6736           information refer to the sfdisk(8) manpage.
6737
6738           To create a single partition occupying the whole disk, you would
6739           pass "lines" as a single element list, when the single element
6740           being the string "," (comma).
6741
6742           See also: "$g->sfdisk_l", "$g->sfdisk_N", "$g->part_init"
6743
6744           This function is deprecated.  In new code, use the "part_add" call
6745           instead.
6746
6747           Deprecated functions will not be removed from the API, but the fact
6748           that they are deprecated indicates that there are problems with
6749           correct use of these functions.
6750
6751       $g->sfdiskM ($device, \@lines);
6752           This is a simplified interface to the "$g->sfdisk" command, where
6753           partition sizes are specified in megabytes only (rounded to the
6754           nearest cylinder) and you don't need to specify the cyls, heads and
6755           sectors parameters which were rarely if ever used anyway.
6756
6757           See also: "$g->sfdisk", the sfdisk(8) manpage and "$g->part_disk"
6758
6759           This function is deprecated.  In new code, use the "part_add" call
6760           instead.
6761
6762           Deprecated functions will not be removed from the API, but the fact
6763           that they are deprecated indicates that there are problems with
6764           correct use of these functions.
6765
6766       $g->sfdisk_N ($device, $partnum, $cyls, $heads, $sectors, $line);
6767           This runs sfdisk(8) option to modify just the single partition "n"
6768           (note: "n" counts from 1).
6769
6770           For other parameters, see "$g->sfdisk".  You should usually pass 0
6771           for the cyls/heads/sectors parameters.
6772
6773           See also: "$g->part_add"
6774
6775           This function is deprecated.  In new code, use the "part_add" call
6776           instead.
6777
6778           Deprecated functions will not be removed from the API, but the fact
6779           that they are deprecated indicates that there are problems with
6780           correct use of these functions.
6781
6782       $partitions = $g->sfdisk_disk_geometry ($device);
6783           This displays the disk geometry of "device" read from the partition
6784           table.  Especially in the case where the underlying block device
6785           has been resized, this can be different from the kernelXs idea of
6786           the geometry (see "$g->sfdisk_kernel_geometry").
6787
6788           The result is in human-readable format, and not designed to be
6789           parsed.
6790
6791       $partitions = $g->sfdisk_kernel_geometry ($device);
6792           This displays the kernelXs idea of the geometry of "device".
6793
6794           The result is in human-readable format, and not designed to be
6795           parsed.
6796
6797       $partitions = $g->sfdisk_l ($device);
6798           This displays the partition table on "device", in the human-
6799           readable output of the sfdisk(8) command.  It is not intended to be
6800           parsed.
6801
6802           See also: "$g->part_list"
6803
6804           This function is deprecated.  In new code, use the "part_list" call
6805           instead.
6806
6807           Deprecated functions will not be removed from the API, but the fact
6808           that they are deprecated indicates that there are problems with
6809           correct use of these functions.
6810
6811       $output = $g->sh ($command);
6812           This call runs a command from the guest filesystem via the guestXs
6813           /bin/sh.
6814
6815           This is like "$g->command", but passes the command to:
6816
6817            /bin/sh -c "command"
6818
6819           Depending on the guestXs shell, this usually results in wildcards
6820           being expanded, shell expressions being interpolated and so on.
6821
6822           All the provisos about "$g->command" apply to this call.
6823
6824       @lines = $g->sh_lines ($command);
6825           This is the same as "$g->sh", but splits the result into a list of
6826           lines.
6827
6828           See also: "$g->command_lines"
6829
6830       $g->shutdown ();
6831           This is the opposite of "$g->launch".  It performs an orderly
6832           shutdown of the backend process(es).  If the autosync flag is set
6833           (which is the default) then the disk image is synchronized.
6834
6835           If the subprocess exits with an error then this function will
6836           return an error, which should not be ignored (it may indicate that
6837           the disk image could not be written out properly).
6838
6839           It is safe to call this multiple times.  Extra calls are ignored.
6840
6841           This call does not close or free up the handle.  You still need to
6842           call "$g->close" afterwards.
6843
6844           "$g->close" will call this if you don't do it explicitly, but note
6845           that any errors are ignored in that case.
6846
6847       $g->sleep ($secs);
6848           Sleep for "secs" seconds.
6849
6850       %statbuf = $g->stat ($path);
6851           Returns file information for the given "path".
6852
6853           This is the same as the stat(2) system call.
6854
6855           This function is deprecated.  In new code, use the "statns" call
6856           instead.
6857
6858           Deprecated functions will not be removed from the API, but the fact
6859           that they are deprecated indicates that there are problems with
6860           correct use of these functions.
6861
6862       %statbuf = $g->statns ($path);
6863           Returns file information for the given "path".
6864
6865           This is the same as the stat(2) system call.
6866
6867       %statbuf = $g->statvfs ($path);
6868           Returns file system statistics for any mounted file system.  "path"
6869           should be a file or directory in the mounted file system (typically
6870           it is the mount point itself, but it doesn't need to be).
6871
6872           This is the same as the statvfs(2) system call.
6873
6874       @stringsout = $g->strings ($path);
6875           This runs the strings(1) command on a file and returns the list of
6876           printable strings found.
6877
6878           The "strings" command has, in the past, had problems with parsing
6879           untrusted files.  These are mitigated in the current version of
6880           libguestfs, but see "CVE-2014-8484" in guestfs(3).
6881
6882           Because of the message protocol, there is a transfer limit of
6883           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
6884           guestfs(3).
6885
6886       @stringsout = $g->strings_e ($encoding, $path);
6887           This is like the "$g->strings" command, but allows you to specify
6888           the encoding of strings that are looked for in the source file
6889           "path".
6890
6891           Allowed encodings are:
6892
6893           s   Single 7-bit-byte characters like ASCII and the ASCII-
6894               compatible parts of ISO-8859-X (this is what "$g->strings"
6895               uses).
6896
6897           S   Single 8-bit-byte characters.
6898
6899           b   16-bit big endian strings such as those encoded in UTF-16BE or
6900               UCS-2BE.
6901
6902           l (lower case letter L)
6903               16-bit little endian such as UTF-16LE and UCS-2LE.  This is
6904               useful for examining binaries in Windows guests.
6905
6906           B   32-bit big endian such as UCS-4BE.
6907
6908           L   32-bit little endian such as UCS-4LE.
6909
6910           The returned strings are transcoded to UTF-8.
6911
6912           The "strings" command has, in the past, had problems with parsing
6913           untrusted files.  These are mitigated in the current version of
6914           libguestfs, but see "CVE-2014-8484" in guestfs(3).
6915
6916           Because of the message protocol, there is a transfer limit of
6917           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
6918           guestfs(3).
6919
6920       $g->swapoff_device ($device);
6921           This command disables the libguestfs appliance swap device or
6922           partition named "device".  See "$g->swapon_device".
6923
6924       $g->swapoff_file ($file);
6925           This command disables the libguestfs appliance swap on file.
6926
6927       $g->swapoff_label ($label);
6928           This command disables the libguestfs appliance swap on labeled swap
6929           partition.
6930
6931       $g->swapoff_uuid ($uuid);
6932           This command disables the libguestfs appliance swap partition with
6933           the given UUID.
6934
6935           This function depends on the feature "linuxfsuuid".  See also
6936           "$g->feature-available".
6937
6938       $g->swapon_device ($device);
6939           This command enables the libguestfs appliance to use the swap
6940           device or partition named "device".  The increased memory is made
6941           available for all commands, for example those run using
6942           "$g->command" or "$g->sh".
6943
6944           Note that you should not swap to existing guest swap partitions
6945           unless you know what you are doing.  They may contain hibernation
6946           information, or other information that the guest doesn't want you
6947           to trash.  You also risk leaking information about the host to the
6948           guest this way.  Instead, attach a new host device to the guest and
6949           swap on that.
6950
6951       $g->swapon_file ($file);
6952           This command enables swap to a file.  See "$g->swapon_device" for
6953           other notes.
6954
6955       $g->swapon_label ($label);
6956           This command enables swap to a labeled swap partition.  See
6957           "$g->swapon_device" for other notes.
6958
6959       $g->swapon_uuid ($uuid);
6960           This command enables swap to a swap partition with the given UUID.
6961           See "$g->swapon_device" for other notes.
6962
6963           This function depends on the feature "linuxfsuuid".  See also
6964           "$g->feature-available".
6965
6966       $g->sync ();
6967           This syncs the disk, so that any writes are flushed through to the
6968           underlying disk image.
6969
6970           You should always call this if you have modified a disk image,
6971           before closing the handle.
6972
6973       $g->syslinux ($device [, directory => $directory]);
6974           Install the SYSLINUX bootloader on "device".
6975
6976           The device parameter must be either a whole disk formatted as a FAT
6977           filesystem, or a partition formatted as a FAT filesystem.  In the
6978           latter case, the partition should be marked as "active"
6979           ("$g->part_set_bootable") and a Master Boot Record must be
6980           installed (eg. using "$g->pwrite_device") on the first sector of
6981           the whole disk.  The SYSLINUX package comes with some suitable
6982           Master Boot Records.  See the syslinux(1) man page for further
6983           information.
6984
6985           The optional arguments are:
6986
6987           directory
6988               Install SYSLINUX in the named subdirectory, instead of in the
6989               root directory of the FAT filesystem.
6990
6991           Additional configuration can be supplied to SYSLINUX by placing a
6992           file called syslinux.cfg on the FAT filesystem, either in the root
6993           directory, or under directory if that optional argument is being
6994           used.  For further information about the contents of this file, see
6995           syslinux(1).
6996
6997           See also "$g->extlinux".
6998
6999           This function depends on the feature "syslinux".  See also
7000           "$g->feature-available".
7001
7002       @lines = $g->tail ($path);
7003           This command returns up to the last 10 lines of a file as a list of
7004           strings.
7005
7006           Because of the message protocol, there is a transfer limit of
7007           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7008           guestfs(3).
7009
7010       @lines = $g->tail_n ($nrlines, $path);
7011           If the parameter "nrlines" is a positive number, this returns the
7012           last "nrlines" lines of the file "path".
7013
7014           If the parameter "nrlines" is a negative number, this returns lines
7015           from the file "path", starting with the "-nrlines"'th line.
7016
7017           If the parameter "nrlines" is zero, this returns an empty list.
7018
7019           Because of the message protocol, there is a transfer limit of
7020           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7021           guestfs(3).
7022
7023       $g->tar_in ($tarfile, $directory [, compress => $compress] [, xattrs =>
7024       $xattrs] [, selinux => $selinux] [, acls => $acls]);
7025           This command uploads and unpacks local file "tarfile" into
7026           directory.
7027
7028           The optional "compress" flag controls compression.  If not given,
7029           then the input should be an uncompressed tar file.  Otherwise one
7030           of the following strings may be given to select the compression
7031           type of the input file: "compress", "gzip", "bzip2", "xz", "lzop".
7032           (Note that not all builds of libguestfs will support all of these
7033           compression types).
7034
7035           The other optional arguments are:
7036
7037           "xattrs"
7038               If set to true, extended attributes are restored from the tar
7039               file.
7040
7041           "selinux"
7042               If set to true, SELinux contexts are restored from the tar
7043               file.
7044
7045           "acls"
7046               If set to true, POSIX ACLs are restored from the tar file.
7047
7048       $g->tar_in_opts ($tarfile, $directory [, compress => $compress] [,
7049       xattrs => $xattrs] [, selinux => $selinux] [, acls => $acls]);
7050           This is an alias of "tar_in".
7051
7052       $g->tar_out ($directory, $tarfile [, compress => $compress] [,
7053       numericowner => $numericowner] [, excludes => $excludes] [, xattrs =>
7054       $xattrs] [, selinux => $selinux] [, acls => $acls]);
7055           This command packs the contents of directory and downloads it to
7056           local file "tarfile".
7057
7058           The optional "compress" flag controls compression.  If not given,
7059           then the output will be an uncompressed tar file.  Otherwise one of
7060           the following strings may be given to select the compression type
7061           of the output file: "compress", "gzip", "bzip2", "xz", "lzop".
7062           (Note that not all builds of libguestfs will support all of these
7063           compression types).
7064
7065           The other optional arguments are:
7066
7067           "excludes"
7068               A list of wildcards.  Files are excluded if they match any of
7069               the wildcards.
7070
7071           "numericowner"
7072               If set to true, the output tar file will contain UID/GID
7073               numbers instead of user/group names.
7074
7075           "xattrs"
7076               If set to true, extended attributes are saved in the output
7077               tar.
7078
7079           "selinux"
7080               If set to true, SELinux contexts are saved in the output tar.
7081
7082           "acls"
7083               If set to true, POSIX ACLs are saved in the output tar.
7084
7085       $g->tar_out_opts ($directory, $tarfile [, compress => $compress] [,
7086       numericowner => $numericowner] [, excludes => $excludes] [, xattrs =>
7087       $xattrs] [, selinux => $selinux] [, acls => $acls]);
7088           This is an alias of "tar_out".
7089
7090       $g->tgz_in ($tarball, $directory);
7091           This command uploads and unpacks local file "tarball" (a gzip
7092           compressed tar file) into directory.
7093
7094           This function is deprecated.  In new code, use the "tar_in" call
7095           instead.
7096
7097           Deprecated functions will not be removed from the API, but the fact
7098           that they are deprecated indicates that there are problems with
7099           correct use of these functions.
7100
7101       $g->tgz_out ($directory, $tarball);
7102           This command packs the contents of directory and downloads it to
7103           local file "tarball".
7104
7105           This function is deprecated.  In new code, use the "tar_out" call
7106           instead.
7107
7108           Deprecated functions will not be removed from the API, but the fact
7109           that they are deprecated indicates that there are problems with
7110           correct use of these functions.
7111
7112       $g->touch ($path);
7113           Touch acts like the touch(1) command.  It can be used to update the
7114           timestamps on a file, or, if the file does not exist, to create a
7115           new zero-length file.
7116
7117           This command only works on regular files, and will fail on other
7118           file types such as directories, symbolic links, block special etc.
7119
7120       $g->truncate ($path);
7121           This command truncates "path" to a zero-length file.  The file must
7122           exist already.
7123
7124       $g->truncate_size ($path, $size);
7125           This command truncates "path" to size "size" bytes.  The file must
7126           exist already.
7127
7128           If the current file size is less than "size" then the file is
7129           extended to the required size with zero bytes.  This creates a
7130           sparse file (ie. disk blocks are not allocated for the file until
7131           you write to it).  To create a non-sparse file of zeroes, use
7132           "$g->fallocate64" instead.
7133
7134       $g->tune2fs ($device [, force => $force] [, maxmountcount =>
7135       $maxmountcount] [, mountcount => $mountcount] [, errorbehavior =>
7136       $errorbehavior] [, group => $group] [, intervalbetweenchecks =>
7137       $intervalbetweenchecks] [, reservedblockspercentage =>
7138       $reservedblockspercentage] [, lastmounteddirectory =>
7139       $lastmounteddirectory] [, reservedblockscount => $reservedblockscount]
7140       [, user => $user]);
7141           This call allows you to adjust various filesystem parameters of an
7142           ext2/ext3/ext4 filesystem called "device".
7143
7144           The optional parameters are:
7145
7146           "force"
7147               Force tune2fs to complete the operation even in the face of
7148               errors.  This is the same as the tune2fs(8) "-f" option.
7149
7150           "maxmountcount"
7151               Set the number of mounts after which the filesystem is checked
7152               by e2fsck(8).  If this is 0 then the number of mounts is
7153               disregarded.  This is the same as the tune2fs(8) "-c" option.
7154
7155           "mountcount"
7156               Set the number of times the filesystem has been mounted.  This
7157               is the same as the tune2fs(8) "-C" option.
7158
7159           "errorbehavior"
7160               Change the behavior of the kernel code when errors are
7161               detected.  Possible values currently are: "continue",
7162               "remount-ro", "panic".  In practice these options don't really
7163               make any difference, particularly for write errors.
7164
7165               This is the same as the tune2fs(8) "-e" option.
7166
7167           "group"
7168               Set the group which can use reserved filesystem blocks.  This
7169               is the same as the tune2fs(8) "-g" option except that it can
7170               only be specified as a number.
7171
7172           "intervalbetweenchecks"
7173               Adjust the maximal time between two filesystem checks (in
7174               seconds).  If the option is passed as 0 then time-dependent
7175               checking is disabled.
7176
7177               This is the same as the tune2fs(8) "-i" option.
7178
7179           "reservedblockspercentage"
7180               Set the percentage of the filesystem which may only be
7181               allocated by privileged processes.  This is the same as the
7182               tune2fs(8) "-m" option.
7183
7184           "lastmounteddirectory"
7185               Set the last mounted directory.  This is the same as the
7186               tune2fs(8) "-M" option.
7187
7188           "reservedblockscount" Set the number of reserved filesystem blocks.
7189           This is the same as the tune2fs(8) "-r" option.
7190           "user"
7191               Set the user who can use the reserved filesystem blocks.  This
7192               is the same as the tune2fs(8) "-u" option except that it can
7193               only be specified as a number.
7194
7195           To get the current values of filesystem parameters, see
7196           "$g->tune2fs_l".  For precise details of how tune2fs works, see the
7197           tune2fs(8) man page.
7198
7199       %superblock = $g->tune2fs_l ($device);
7200           This returns the contents of the ext2, ext3 or ext4 filesystem
7201           superblock on "device".
7202
7203           It is the same as running "tune2fs -l device".  See tune2fs(8)
7204           manpage for more details.  The list of fields returned isn't
7205           clearly defined, and depends on both the version of "tune2fs" that
7206           libguestfs was built against, and the filesystem itself.
7207
7208       $g->txz_in ($tarball, $directory);
7209           This command uploads and unpacks local file "tarball" (an xz
7210           compressed tar file) into directory.
7211
7212           This function depends on the feature "xz".  See also
7213           "$g->feature-available".
7214
7215           This function is deprecated.  In new code, use the "tar_in" call
7216           instead.
7217
7218           Deprecated functions will not be removed from the API, but the fact
7219           that they are deprecated indicates that there are problems with
7220           correct use of these functions.
7221
7222       $g->txz_out ($directory, $tarball);
7223           This command packs the contents of directory and downloads it to
7224           local file "tarball" (as an xz compressed tar archive).
7225
7226           This function depends on the feature "xz".  See also
7227           "$g->feature-available".
7228
7229           This function is deprecated.  In new code, use the "tar_out" call
7230           instead.
7231
7232           Deprecated functions will not be removed from the API, but the fact
7233           that they are deprecated indicates that there are problems with
7234           correct use of these functions.
7235
7236       $oldmask = $g->umask ($mask);
7237           This function sets the mask used for creating new files and device
7238           nodes to "mask & 0777".
7239
7240           Typical umask values would be 022 which creates new files with
7241           permissions like "-rw-r--r--" or "-rwxr-xr-x", and 002 which
7242           creates new files with permissions like "-rw-rw-r--" or
7243           "-rwxrwxr-x".
7244
7245           The default umask is 022.  This is important because it means that
7246           directories and device nodes will be created with 0644 or 0755 mode
7247           even if you specify 0777.
7248
7249           See also "$g->get_umask", umask(2), "$g->mknod", "$g->mkdir".
7250
7251           This call returns the previous umask.
7252
7253       $g->umount ($pathordevice [, force => $force] [, lazyunmount =>
7254       $lazyunmount]);
7255           This unmounts the given filesystem.  The filesystem may be
7256           specified either by its mountpoint (path) or the device which
7257           contains the filesystem.
7258
7259       $g->umount_opts ($pathordevice [, force => $force] [, lazyunmount =>
7260       $lazyunmount]);
7261           This is an alias of "umount".
7262
7263       $g->umount_all ();
7264           This unmounts all mounted filesystems.
7265
7266           Some internal mounts are not unmounted by this call.
7267
7268       $g->umount_local ([retry => $retry]);
7269           If libguestfs is exporting the filesystem on a local mountpoint,
7270           then this unmounts it.
7271
7272           See "MOUNT LOCAL" in guestfs(3) for full documentation.
7273
7274       $g->upload ($filename, $remotefilename);
7275           Upload local file filename to remotefilename on the filesystem.
7276
7277           filename can also be a named pipe.
7278
7279           See also "$g->download".
7280
7281       $g->upload_offset ($filename, $remotefilename, $offset);
7282           Upload local file filename to remotefilename on the filesystem.
7283
7284           remotefilename is overwritten starting at the byte "offset"
7285           specified.  The intention is to overwrite parts of existing files
7286           or devices, although if a non-existent file is specified then it is
7287           created with a "hole" before "offset".  The size of the data
7288           written is implicit in the size of the source filename.
7289
7290           Note that there is no limit on the amount of data that can be
7291           uploaded with this call, unlike with "$g->pwrite", and this call
7292           always writes the full amount unless an error occurs.
7293
7294           See also "$g->upload", "$g->pwrite".
7295
7296       $g->user_cancel ();
7297           This function cancels the current upload or download operation.
7298
7299           Unlike most other libguestfs calls, this function is signal safe
7300           and thread safe.  You can call it from a signal handler or from
7301           another thread, without needing to do any locking.
7302
7303           The transfer that was in progress (if there is one) will stop
7304           shortly afterwards, and will return an error.  The errno (see
7305           "guestfs_last_errno") is set to "EINTR", so you can test for this
7306           to find out if the operation was cancelled or failed because of
7307           another error.
7308
7309           No cleanup is performed: for example, if a file was being uploaded
7310           then after cancellation there may be a partially uploaded file.  It
7311           is the callerXs responsibility to clean up if necessary.
7312
7313           There are two common places that you might call "$g->user_cancel":
7314
7315           In an interactive text-based program, you might call it from a
7316           "SIGINT" signal handler so that pressing "^C" cancels the current
7317           operation.  (You also need to call "$g->set_pgroup" so that child
7318           processes don't receive the "^C" signal).
7319
7320           In a graphical program, when the main thread is displaying a
7321           progress bar with a cancel button, wire up the cancel button to
7322           call this function.
7323
7324       $g->utimens ($path, $atsecs, $atnsecs, $mtsecs, $mtnsecs);
7325           This command sets the timestamps of a file with nanosecond
7326           precision.
7327
7328           "atsecs", "atnsecs" are the last access time (atime) in secs and
7329           nanoseconds from the epoch.
7330
7331           "mtsecs", "mtnsecs" are the last modification time (mtime) in secs
7332           and nanoseconds from the epoch.
7333
7334           If the *nsecs field contains the special value "-1" then the
7335           corresponding timestamp is set to the current time.  (The *secs
7336           field is ignored in this case).
7337
7338           If the *nsecs field contains the special value "-2" then the
7339           corresponding timestamp is left unchanged.  (The *secs field is
7340           ignored in this case).
7341
7342       %uts = $g->utsname ();
7343           This returns the kernel version of the appliance, where this is
7344           available.  This information is only useful for debugging.  Nothing
7345           in the returned structure is defined by the API.
7346
7347       %version = $g->version ();
7348           Return the libguestfs version number that the program is linked
7349           against.
7350
7351           Note that because of dynamic linking this is not necessarily the
7352           version of libguestfs that you compiled against.  You can compile
7353           the program, and then at runtime dynamically link against a
7354           completely different libguestfs.so library.
7355
7356           This call was added in version 1.0.58.  In previous versions of
7357           libguestfs there was no way to get the version number.  From C code
7358           you can use dynamic linker functions to find out if this symbol
7359           exists (if it doesn't, then itXs an earlier version).
7360
7361           The call returns a structure with four elements.  The first three
7362           ("major", "minor" and "release") are numbers and correspond to the
7363           usual version triplet.  The fourth element ("extra") is a string
7364           and is normally empty, but may be used for distro-specific
7365           information.
7366
7367           To construct the original version string:
7368           "$major.$minor.$release$extra"
7369
7370           See also: "LIBGUESTFS VERSION NUMBERS" in guestfs(3).
7371
7372           Note: Don't use this call to test for availability of features.  In
7373           enterprise distributions we backport features from later versions
7374           into earlier versions, making this an unreliable way to test for
7375           features.  Use "$g->available" or "$g->feature_available" instead.
7376
7377       $label = $g->vfs_label ($mountable);
7378           This returns the label of the filesystem on "mountable".
7379
7380           If the filesystem is unlabeled, this returns the empty string.
7381
7382           To find a filesystem from the label, use "$g->findfs_label".
7383
7384       $sizeinbytes = $g->vfs_minimum_size ($mountable);
7385           Get the minimum size of filesystem in bytes.  This is the minimum
7386           possible size for filesystem shrinking.
7387
7388           If getting minimum size of specified filesystem is not supported,
7389           this will fail and set errno as ENOTSUP.
7390
7391           See also ntfsresize(8), resize2fs(8), btrfs(8), xfs_info(8).
7392
7393       $fstype = $g->vfs_type ($mountable);
7394           This command gets the filesystem type corresponding to the
7395           filesystem on "mountable".
7396
7397           For most filesystems, the result is the name of the Linux VFS
7398           module which would be used to mount this filesystem if you mounted
7399           it without specifying the filesystem type.  For example a string
7400           such as "ext3" or "ntfs".
7401
7402       $uuid = $g->vfs_uuid ($mountable);
7403           This returns the filesystem UUID of the filesystem on "mountable".
7404
7405           If the filesystem does not have a UUID, this returns the empty
7406           string.
7407
7408           To find a filesystem from the UUID, use "$g->findfs_uuid".
7409
7410       $g->vg_activate ($activate, \@volgroups);
7411           This command activates or (if "activate" is false) deactivates all
7412           logical volumes in the listed volume groups "volgroups".
7413
7414           This command is the same as running "vgchange -a y|n volgroups..."
7415
7416           Note that if "volgroups" is an empty list then all volume groups
7417           are activated or deactivated.
7418
7419           This function depends on the feature "lvm2".  See also
7420           "$g->feature-available".
7421
7422       $g->vg_activate_all ($activate);
7423           This command activates or (if "activate" is false) deactivates all
7424           logical volumes in all volume groups.
7425
7426           This command is the same as running "vgchange -a y|n"
7427
7428           This function depends on the feature "lvm2".  See also
7429           "$g->feature-available".
7430
7431       $g->vgchange_uuid ($vg);
7432           Generate a new random UUID for the volume group "vg".
7433
7434           This function depends on the feature "lvm2".  See also
7435           "$g->feature-available".
7436
7437       $g->vgchange_uuid_all ();
7438           Generate new random UUIDs for all volume groups.
7439
7440           This function depends on the feature "lvm2".  See also
7441           "$g->feature-available".
7442
7443       $g->vgcreate ($volgroup, \@physvols);
7444           This creates an LVM volume group called "volgroup" from the non-
7445           empty list of physical volumes "physvols".
7446
7447           This function depends on the feature "lvm2".  See also
7448           "$g->feature-available".
7449
7450       @uuids = $g->vglvuuids ($vgname);
7451           Given a VG called "vgname", this returns the UUIDs of all the
7452           logical volumes created in this volume group.
7453
7454           You can use this along with "$g->lvs" and "$g->lvuuid" calls to
7455           associate logical volumes and volume groups.
7456
7457           See also "$g->vgpvuuids".
7458
7459       $metadata = $g->vgmeta ($vgname);
7460           "vgname" is an LVM volume group.  This command examines the volume
7461           group and returns its metadata.
7462
7463           Note that the metadata is an internal structure used by LVM,
7464           subject to change at any time, and is provided for information
7465           only.
7466
7467           This function depends on the feature "lvm2".  See also
7468           "$g->feature-available".
7469
7470       @uuids = $g->vgpvuuids ($vgname);
7471           Given a VG called "vgname", this returns the UUIDs of all the
7472           physical volumes that this volume group resides on.
7473
7474           You can use this along with "$g->pvs" and "$g->pvuuid" calls to
7475           associate physical volumes and volume groups.
7476
7477           See also "$g->vglvuuids".
7478
7479       $g->vgremove ($vgname);
7480           Remove an LVM volume group "vgname", (for example "VG").
7481
7482           This also forcibly removes all logical volumes in the volume group
7483           (if any).
7484
7485           This function depends on the feature "lvm2".  See also
7486           "$g->feature-available".
7487
7488       $g->vgrename ($volgroup, $newvolgroup);
7489           Rename a volume group "volgroup" with the new name "newvolgroup".
7490
7491       @volgroups = $g->vgs ();
7492           List all the volumes groups detected.  This is the equivalent of
7493           the vgs(8) command.
7494
7495           This returns a list of just the volume group names that were
7496           detected (eg. "VolGroup00").
7497
7498           See also "$g->vgs_full".
7499
7500           This function depends on the feature "lvm2".  See also
7501           "$g->feature-available".
7502
7503       @volgroups = $g->vgs_full ();
7504           List all the volumes groups detected.  This is the equivalent of
7505           the vgs(8) command.  The "full" version includes all fields.
7506
7507           This function depends on the feature "lvm2".  See also
7508           "$g->feature-available".
7509
7510       $g->vgscan ();
7511           This rescans all block devices and rebuilds the list of LVM
7512           physical volumes, volume groups and logical volumes.
7513
7514           This function is deprecated.  In new code, use the "lvm_scan" call
7515           instead.
7516
7517           Deprecated functions will not be removed from the API, but the fact
7518           that they are deprecated indicates that there are problems with
7519           correct use of these functions.
7520
7521       $uuid = $g->vguuid ($vgname);
7522           This command returns the UUID of the LVM VG named "vgname".
7523
7524       $g->wait_ready ();
7525           This function is a no op.
7526
7527           In versions of the API < 1.0.71 you had to call this function just
7528           after calling "$g->launch" to wait for the launch to complete.
7529           However this is no longer necessary because "$g->launch" now does
7530           the waiting.
7531
7532           If you see any calls to this function in code then you can just
7533           remove them, unless you want to retain compatibility with older
7534           versions of the API.
7535
7536           This function is deprecated.  There is no replacement.  Consult the
7537           API documentation in guestfs(3) for further information.
7538
7539           Deprecated functions will not be removed from the API, but the fact
7540           that they are deprecated indicates that there are problems with
7541           correct use of these functions.
7542
7543       $chars = $g->wc_c ($path);
7544           This command counts the characters in a file, using the "wc -c"
7545           external command.
7546
7547       $lines = $g->wc_l ($path);
7548           This command counts the lines in a file, using the "wc -l" external
7549           command.
7550
7551       $words = $g->wc_w ($path);
7552           This command counts the words in a file, using the "wc -w" external
7553           command.
7554
7555       $g->wipefs ($device);
7556           This command erases filesystem or RAID signatures from the
7557           specified "device" to make the filesystem invisible to libblkid.
7558
7559           This does not erase the filesystem itself nor any other data from
7560           the "device".
7561
7562           Compare with "$g->zero" which zeroes the first few blocks of a
7563           device.
7564
7565           This function depends on the feature "wipefs".  See also
7566           "$g->feature-available".
7567
7568       $g->write ($path, $content);
7569           This call creates a file called "path".  The content of the file is
7570           the string "content" (which can contain any 8 bit data).
7571
7572           See also "$g->write_append".
7573
7574       $g->write_append ($path, $content);
7575           This call appends "content" to the end of file "path".  If "path"
7576           does not exist, then a new file is created.
7577
7578           See also "$g->write".
7579
7580       $g->write_file ($path, $content, $size);
7581           This call creates a file called "path".  The contents of the file
7582           is the string "content" (which can contain any 8 bit data), with
7583           length "size".
7584
7585           As a special case, if "size" is 0 then the length is calculated
7586           using "strlen" (so in this case the content cannot contain embedded
7587           ASCII NULs).
7588
7589           NB. Owing to a bug, writing content containing ASCII NUL characters
7590           does not work, even if the length is specified.
7591
7592           Because of the message protocol, there is a transfer limit of
7593           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7594           guestfs(3).
7595
7596           This function is deprecated.  In new code, use the "write" call
7597           instead.
7598
7599           Deprecated functions will not be removed from the API, but the fact
7600           that they are deprecated indicates that there are problems with
7601           correct use of these functions.
7602
7603       $g->xfs_admin ($device [, extunwritten => $extunwritten] [, imgfile =>
7604       $imgfile] [, v2log => $v2log] [, projid32bit => $projid32bit] [,
7605       lazycounter => $lazycounter] [, label => $label] [, uuid => $uuid]);
7606           Change the parameters of the XFS filesystem on "device".
7607
7608           Devices that are mounted cannot be modified.  Administrators must
7609           unmount filesystems before this call can modify parameters.
7610
7611           Some of the parameters of a mounted filesystem can be examined and
7612           modified using the "$g->xfs_info" and "$g->xfs_growfs" calls.
7613
7614           Beginning with XFS version 5, it is no longer possible to modify
7615           the lazy-counters setting (ie. "lazycounter" parameter has no
7616           effect).
7617
7618           This function depends on the feature "xfs".  See also
7619           "$g->feature-available".
7620
7621       $g->xfs_growfs ($path [, datasec => $datasec] [, logsec => $logsec] [,
7622       rtsec => $rtsec] [, datasize => $datasize] [, logsize => $logsize] [,
7623       rtsize => $rtsize] [, rtextsize => $rtextsize] [, maxpct => $maxpct]);
7624           Grow the XFS filesystem mounted at "path".
7625
7626           The returned struct contains geometry information.  Missing fields
7627           are returned as "-1" (for numeric fields) or empty string.
7628
7629           This function depends on the feature "xfs".  See also
7630           "$g->feature-available".
7631
7632       %info = $g->xfs_info ($pathordevice);
7633           "pathordevice" is a mounted XFS filesystem or a device containing
7634           an XFS filesystem.  This command returns the geometry of the
7635           filesystem.
7636
7637           The returned struct contains geometry information.  Missing fields
7638           are returned as "-1" (for numeric fields) or empty string.
7639
7640           This function depends on the feature "xfs".  See also
7641           "$g->feature-available".
7642
7643       $status = $g->xfs_repair ($device [, forcelogzero => $forcelogzero] [,
7644       nomodify => $nomodify] [, noprefetch => $noprefetch] [, forcegeometry
7645       => $forcegeometry] [, maxmem => $maxmem] [, ihashsize => $ihashsize] [,
7646       bhashsize => $bhashsize] [, agstride => $agstride] [, logdev =>
7647       $logdev] [, rtdev => $rtdev]);
7648           Repair corrupt or damaged XFS filesystem on "device".
7649
7650           The filesystem is specified using the "device" argument which
7651           should be the device name of the disk partition or volume
7652           containing the filesystem.  If given the name of a block device,
7653           "xfs_repair" will attempt to find the raw device associated with
7654           the specified block device and will use the raw device instead.
7655
7656           Regardless, the filesystem to be repaired must be unmounted,
7657           otherwise, the resulting filesystem may be inconsistent or corrupt.
7658
7659           The returned status indicates whether filesystem corruption was
7660           detected (returns 1) or was not detected (returns 0).
7661
7662           This function depends on the feature "xfs".  See also
7663           "$g->feature-available".
7664
7665       $g->yara_destroy ();
7666           Destroy previously loaded Yara rules in order to free libguestfs
7667           resources.
7668
7669           This function depends on the feature "libyara".  See also
7670           "$g->feature-available".
7671
7672       $g->yara_load ($filename);
7673           Upload a set of Yara rules from local file filename.
7674
7675           Yara rules allow to categorize files based on textual or binary
7676           patterns within their content.  See "$g->yara_scan" to see how to
7677           scan files with the loaded rules.
7678
7679           Rules can be in binary format, as when compiled with yarac command,
7680           or in source code format. In the latter case, the rules will be
7681           first compiled and then loaded.
7682
7683           Rules in source code format cannot include external files. In such
7684           cases, it is recommended to compile them first.
7685
7686           Previously loaded rules will be destroyed.
7687
7688           This function depends on the feature "libyara".  See also
7689           "$g->feature-available".
7690
7691       @detections = $g->yara_scan ($path);
7692           Scan a file with the previously loaded Yara rules.
7693
7694           For each matching rule, a "yara_detection" structure is returned.
7695
7696           The "yara_detection" structure contains the following fields.
7697
7698           "yara_name"
7699               Path of the file matching a Yara rule.
7700
7701           "yara_rule"
7702               Identifier of the Yara rule which matched against the given
7703               file.
7704
7705           This function depends on the feature "libyara".  See also
7706           "$g->feature-available".
7707
7708       @lines = $g->zegrep ($regex, $path);
7709           This calls the external "zegrep" program and returns the matching
7710           lines.
7711
7712           Because of the message protocol, there is a transfer limit of
7713           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7714           guestfs(3).
7715
7716           This function is deprecated.  In new code, use the "grep" call
7717           instead.
7718
7719           Deprecated functions will not be removed from the API, but the fact
7720           that they are deprecated indicates that there are problems with
7721           correct use of these functions.
7722
7723       @lines = $g->zegrepi ($regex, $path);
7724           This calls the external "zegrep -i" program and returns the
7725           matching lines.
7726
7727           Because of the message protocol, there is a transfer limit of
7728           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7729           guestfs(3).
7730
7731           This function is deprecated.  In new code, use the "grep" call
7732           instead.
7733
7734           Deprecated functions will not be removed from the API, but the fact
7735           that they are deprecated indicates that there are problems with
7736           correct use of these functions.
7737
7738       $g->zero ($device);
7739           This command writes zeroes over the first few blocks of "device".
7740
7741           How many blocks are zeroed isn't specified (but itXs not enough to
7742           securely wipe the device).  It should be sufficient to remove any
7743           partition tables, filesystem superblocks and so on.
7744
7745           If blocks are already zero, then this command avoids writing
7746           zeroes.  This prevents the underlying device from becoming non-
7747           sparse or growing unnecessarily.
7748
7749           See also: "$g->zero_device", "$g->scrub_device",
7750           "$g->is_zero_device"
7751
7752       $g->zero_device ($device);
7753           This command writes zeroes over the entire "device".  Compare with
7754           "$g->zero" which just zeroes the first few blocks of a device.
7755
7756           If blocks are already zero, then this command avoids writing
7757           zeroes.  This prevents the underlying device from becoming non-
7758           sparse or growing unnecessarily.
7759
7760       $g->zero_free_space ($directory);
7761           Zero the free space in the filesystem mounted on directory.  The
7762           filesystem must be mounted read-write.
7763
7764           The filesystem contents are not affected, but any free space in the
7765           filesystem is freed.
7766
7767           Free space is not "trimmed".  You may want to call "$g->fstrim"
7768           either as an alternative to this, or after calling this, depending
7769           on your requirements.
7770
7771       $g->zerofree ($device);
7772           This runs the zerofree program on "device".  This program claims to
7773           zero unused inodes and disk blocks on an ext2/3 filesystem, thus
7774           making it possible to compress the filesystem more effectively.
7775
7776           You should not run this program if the filesystem is mounted.
7777
7778           It is possible that using this program can damage the filesystem or
7779           data on the filesystem.
7780
7781           This function depends on the feature "zerofree".  See also
7782           "$g->feature-available".
7783
7784       @lines = $g->zfgrep ($pattern, $path);
7785           This calls the external "zfgrep" program and returns the matching
7786           lines.
7787
7788           Because of the message protocol, there is a transfer limit of
7789           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7790           guestfs(3).
7791
7792           This function is deprecated.  In new code, use the "grep" call
7793           instead.
7794
7795           Deprecated functions will not be removed from the API, but the fact
7796           that they are deprecated indicates that there are problems with
7797           correct use of these functions.
7798
7799       @lines = $g->zfgrepi ($pattern, $path);
7800           This calls the external "zfgrep -i" program and returns the
7801           matching lines.
7802
7803           Because of the message protocol, there is a transfer limit of
7804           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7805           guestfs(3).
7806
7807           This function is deprecated.  In new code, use the "grep" call
7808           instead.
7809
7810           Deprecated functions will not be removed from the API, but the fact
7811           that they are deprecated indicates that there are problems with
7812           correct use of these functions.
7813
7814       $description = $g->zfile ($meth, $path);
7815           This command runs file(1) after first decompressing "path" using
7816           "meth".
7817
7818           "meth" must be one of "gzip", "compress" or "bzip2".
7819
7820           Since 1.0.63, use "$g->file" instead which can now process
7821           compressed files.
7822
7823           This function is deprecated.  In new code, use the "file" call
7824           instead.
7825
7826           Deprecated functions will not be removed from the API, but the fact
7827           that they are deprecated indicates that there are problems with
7828           correct use of these functions.
7829
7830       @lines = $g->zgrep ($regex, $path);
7831           This calls the external zgrep(1) program and returns the matching
7832           lines.
7833
7834           Because of the message protocol, there is a transfer limit of
7835           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7836           guestfs(3).
7837
7838           This function is deprecated.  In new code, use the "grep" call
7839           instead.
7840
7841           Deprecated functions will not be removed from the API, but the fact
7842           that they are deprecated indicates that there are problems with
7843           correct use of these functions.
7844
7845       @lines = $g->zgrepi ($regex, $path);
7846           This calls the external "zgrep -i" program and returns the matching
7847           lines.
7848
7849           Because of the message protocol, there is a transfer limit of
7850           somewhere between 2MB and 4MB.  See "PROTOCOL LIMITS" in
7851           guestfs(3).
7852
7853           This function is deprecated.  In new code, use the "grep" call
7854           instead.
7855
7856           Deprecated functions will not be removed from the API, but the fact
7857           that they are deprecated indicates that there are problems with
7858           correct use of these functions.
7859

AVAILABILITY

7861       From time to time we add new libguestfs APIs.  Also some libguestfs
7862       APIs won't be available in all builds of libguestfs (the Fedora build
7863       is full-featured, but other builds may disable features).  How do you
7864       test whether the APIs that your Perl program needs are available in the
7865       version of "Sys::Guestfs" that you are using?
7866
7867       To test if a particular function is available in the "Sys::Guestfs"
7868       class, use the ordinary Perl UNIVERSAL method "can(METHOD)" (see
7869       perlobj(1)).  For example:
7870
7871        use Sys::Guestfs;
7872        if (defined (Sys::Guestfs->can ("set_verbose"))) {
7873          print "\$g->set_verbose is available\n";
7874        }
7875
7876       To test if particular features are supported by the current build, use
7877       the "feature_available" method like the example below.  Note that the
7878       appliance must be launched first.
7879
7880        $g->feature_available ( ["augeas"] );
7881
7882       For further discussion on this topic, refer to "AVAILABILITY" in
7883       guestfs(3).
7884

STORING DATA IN THE HANDLE

7886       The handle returned from "new" is a hash reference.  The hash normally
7887       contains some elements:
7888
7889        {
7890          _g => [private data used by libguestfs],
7891          _flags => [flags provided when creating the handle]
7892        }
7893
7894       Callers can add other elements to this hash to store data for their own
7895       purposes.  The data lasts for the lifetime of the handle.
7896
7897       Any fields whose names begin with an underscore are reserved for
7898       private use by libguestfs.  We may add more in future.
7899
7900       It is recommended that callers prefix the name of their field(s) with
7901       some unique string, to avoid conflicts with other users.
7902
7904       Copyright (C) 2009-2020 Red Hat Inc.
7905

LICENSE

7907       Please see the file COPYING.LIB for the full license.
7908

SEE ALSO

7910       guestfs(3), guestfish(1), <http://libguestfs.org>.
7911
7912
7913
7914perl v5.34.1                      2022-05-26                   Sys::Guestfs(3)
Impressum