-
Notifications
You must be signed in to change notification settings - Fork 163
/
generator_actions.ml
6291 lines (5068 loc) · 222 KB
/
generator_actions.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* libguestfs
* Copyright (C) 2009-2011 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
(* Please read generator/README first. *)
(* Note about long descriptions: When referring to another
* action, use the format C<guestfs_other> (ie. the full name of
* the C function). This will be replaced as appropriate in other
* language bindings.
*
* Apart from that, long descriptions are just perldoc paragraphs.
*)
open Generator_types
open Generator_utils
(* These test functions are used in the language binding tests. *)
let test_all_args = [
String "str";
OptString "optstr";
StringList "strlist";
Bool "b";
Int "integer";
Int64 "integer64";
FileIn "filein";
FileOut "fileout";
BufferIn "bufferin";
]
let test_all_rets = [
(* except for RErr, which is tested thoroughly elsewhere *)
"test0rint", RInt "valout";
"test0rint64", RInt64 "valout";
"test0rbool", RBool "valout";
"test0rconststring", RConstString "valout";
"test0rconstoptstring", RConstOptString "valout";
"test0rstring", RString "valout";
"test0rstringlist", RStringList "valout";
"test0rstruct", RStruct ("valout", "lvm_pv");
"test0rstructlist", RStructList ("valout", "lvm_pv");
"test0rhashtable", RHashtable "valout";
]
let test_functions = [
("test0", (RErr, test_all_args, []), -1, [NotInFish; NotInDocs],
[],
"internal test function - do not use",
"\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
parameter type correctly.
It echos the contents of each parameter to stdout.
You probably don't want to call this function.");
] @ List.flatten (
List.map (
fun (name, ret) ->
[(name, (ret, [String "val"], []), -1, [NotInFish; NotInDocs],
[],
"internal test function - do not use",
"\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
return type correctly.
It converts string C<val> to the return type.
You probably don't want to call this function.");
(name ^ "err", (ret, [], []), -1, [NotInFish; NotInDocs],
[],
"internal test function - do not use",
"\
This is an internal test function which is used to test whether
the automatically generated bindings can handle every possible
return type correctly.
This function always returns an error.
You probably don't want to call this function.")]
) test_all_rets
)
(* non_daemon_functions are any functions which don't get processed
* in the daemon, eg. functions for setting and getting local
* configuration values.
*)
let non_daemon_functions = test_functions @ [
("launch", (RErr, [], []), -1, [FishAlias "run"; Progress],
[],
"launch the qemu subprocess",
"\
Internally libguestfs is implemented by running a virtual machine
using L<qemu(1)>.
You should call this after configuring the handle
(eg. adding drives) but before performing any actions.");
("wait_ready", (RErr, [], []), -1, [NotInFish; DeprecatedBy "launch"],
[],
"wait until the qemu subprocess launches (no op)",
"\
This function is a no op.
In versions of the API E<lt> 1.0.71 you had to call this function
just after calling C<guestfs_launch> to wait for the launch
to complete. However this is no longer necessary because
C<guestfs_launch> now does the waiting.
If you see any calls to this function in code then you can just
remove them, unless you want to retain compatibility with older
versions of the API.");
("kill_subprocess", (RErr, [], []), -1, [],
[],
"kill the qemu subprocess",
"\
This kills the qemu subprocess. You should never need to call this.");
("add_drive", (RErr, [String "filename"], []), -1, [],
[],
"add an image to examine or modify",
"\
This function is the equivalent of calling C<guestfs_add_drive_opts>
with no optional parameters, so the disk is added writable, with
the format being detected automatically.
Automatic detection of the format opens you up to a potential
security hole when dealing with untrusted raw-format images.
See CVE-2010-3851 and RHBZ#642934. Specifying the format closes
this security hole. Therefore you should think about replacing
calls to this function with calls to C<guestfs_add_drive_opts>,
and specifying the format.");
("add_cdrom", (RErr, [String "filename"], []), -1, [DeprecatedBy "add_drive_opts"],
[],
"add a CD-ROM disk image to examine",
"\
This function adds a virtual CD-ROM disk image to the guest.
This is equivalent to the qemu parameter I<-cdrom filename>.
Notes:
=over 4
=item *
This call checks for the existence of C<filename>. This
stops you from specifying other types of drive which are supported
by qemu such as C<nbd:> and C<http:> URLs. To specify those, use
the general C<guestfs_config> call instead.
=item *
If you just want to add an ISO file (often you use this as an
efficient way to transfer large files into the guest), then you
should probably use C<guestfs_add_drive_ro> instead.
=back");
("add_drive_ro", (RErr, [String "filename"], []), -1, [FishAlias "add-ro"],
[],
"add a drive in snapshot mode (read-only)",
"\
This function is the equivalent of calling C<guestfs_add_drive_opts>
with the optional parameter C<GUESTFS_ADD_DRIVE_OPTS_READONLY> set to 1,
so the disk is added read-only, with the format being detected
automatically.");
("config", (RErr, [String "qemuparam"; OptString "qemuvalue"], []), -1, [],
[],
"add qemu parameters",
"\
This can be used to add arbitrary qemu command line parameters
of the form I<-param value>. Actually it's not quite arbitrary - we
prevent you from setting some parameters which would interfere with
parameters that we use.
The first character of C<param> string must be a C<-> (dash).
C<value> can be NULL.");
("set_qemu", (RErr, [OptString "qemu"], []), -1, [FishAlias "qemu"],
[],
"set the qemu binary",
"\
Set the qemu binary that we will use.
The default is chosen when the library was compiled by the
configure script.
You can also override this by setting the C<LIBGUESTFS_QEMU>
environment variable.
Setting C<qemu> to C<NULL> restores the default qemu binary.
Note that you should call this function as early as possible
after creating the handle. This is because some pre-launch
operations depend on testing qemu features (by running C<qemu -help>).
If the qemu binary changes, we don't retest features, and
so you might see inconsistent results. Using the environment
variable C<LIBGUESTFS_QEMU> is safest of all since that picks
the qemu binary at the same time as the handle is created.");
("get_qemu", (RConstString "qemu", [], []), -1, [],
[InitNone, Always, TestRun (
[["get_qemu"]])],
"get the qemu binary",
"\
Return the current qemu binary.
This is always non-NULL. If it wasn't set already, then this will
return the default qemu binary name.");
("set_path", (RErr, [OptString "searchpath"], []), -1, [FishAlias "path"],
[],
"set the search path",
"\
Set the path that libguestfs searches for kernel and initrd.img.
The default is C<$libdir/guestfs> unless overridden by setting
C<LIBGUESTFS_PATH> environment variable.
Setting C<path> to C<NULL> restores the default path.");
("get_path", (RConstString "path", [], []), -1, [],
[InitNone, Always, TestRun (
[["get_path"]])],
"get the search path",
"\
Return the current search path.
This is always non-NULL. If it wasn't set already, then this will
return the default path.");
("set_append", (RErr, [OptString "append"], []), -1, [FishAlias "append"],
[],
"add options to kernel command line",
"\
This function is used to add additional options to the
guest kernel command line.
The default is C<NULL> unless overridden by setting
C<LIBGUESTFS_APPEND> environment variable.
Setting C<append> to C<NULL> means I<no> additional options
are passed (libguestfs always adds a few of its own).");
("get_append", (RConstOptString "append", [], []), -1, [],
(* This cannot be tested with the current framework. The
* function can return NULL in normal operations, which the
* test framework interprets as an error.
*)
[],
"get the additional kernel options",
"\
Return the additional kernel options which are added to the
guest kernel command line.
If C<NULL> then no options are added.");
("set_autosync", (RErr, [Bool "autosync"], []), -1, [FishAlias "autosync"],
[],
"set autosync mode",
"\
If C<autosync> is true, this enables autosync. Libguestfs will make a
best effort attempt to make filesystems consistent and synchronized
when the handle is closed
(also if the program exits without closing handles).
This is enabled by default (since libguestfs 1.5.24, previously it was
disabled by default).");
("get_autosync", (RBool "autosync", [], []), -1, [],
[InitNone, Always, TestOutputTrue (
[["get_autosync"]])],
"get autosync mode",
"\
Get the autosync flag.");
("set_verbose", (RErr, [Bool "verbose"], []), -1, [FishAlias "verbose"],
[],
"set verbose mode",
"\
If C<verbose> is true, this turns on verbose messages.
Verbose messages are disabled unless the environment variable
C<LIBGUESTFS_DEBUG> is defined and set to C<1>.
Verbose messages are normally sent to C<stderr>, unless you
register a callback to send them somewhere else (see
C<guestfs_set_event_callback>).");
("get_verbose", (RBool "verbose", [], []), -1, [],
[],
"get verbose mode",
"\
This returns the verbose messages flag.");
("is_ready", (RBool "ready", [], []), -1, [],
[InitNone, Always, TestOutputTrue (
[["is_ready"]])],
"is ready to accept commands",
"\
This returns true iff this handle is ready to accept commands
(in the C<READY> state).
For more information on states, see L<guestfs(3)>.");
("is_config", (RBool "config", [], []), -1, [],
[InitNone, Always, TestOutputFalse (
[["is_config"]])],
"is in configuration state",
"\
This returns true iff this handle is being configured
(in the C<CONFIG> state).
For more information on states, see L<guestfs(3)>.");
("is_launching", (RBool "launching", [], []), -1, [],
[InitNone, Always, TestOutputFalse (
[["is_launching"]])],
"is launching subprocess",
"\
This returns true iff this handle is launching the subprocess
(in the C<LAUNCHING> state).
For more information on states, see L<guestfs(3)>.");
("is_busy", (RBool "busy", [], []), -1, [],
[InitNone, Always, TestOutputFalse (
[["is_busy"]])],
"is busy processing a command",
"\
This returns true iff this handle is busy processing a command
(in the C<BUSY> state).
For more information on states, see L<guestfs(3)>.");
("get_state", (RInt "state", [], []), -1, [],
[],
"get the current state",
"\
This returns the current state as an opaque integer. This is
only useful for printing debug and internal error messages.
For more information on states, see L<guestfs(3)>.");
("set_memsize", (RErr, [Int "memsize"], []), -1, [FishAlias "memsize"],
[InitNone, Always, TestOutputInt (
[["set_memsize"; "500"];
["get_memsize"]], 500)],
"set memory allocated to the qemu subprocess",
"\
This sets the memory size in megabytes allocated to the
qemu subprocess. This only has any effect if called before
C<guestfs_launch>.
You can also change this by setting the environment
variable C<LIBGUESTFS_MEMSIZE> before the handle is
created.
For more information on the architecture of libguestfs,
see L<guestfs(3)>.");
("get_memsize", (RInt "memsize", [], []), -1, [],
[InitNone, Always, TestOutputIntOp (
[["get_memsize"]], ">=", 256)],
"get memory allocated to the qemu subprocess",
"\
This gets the memory size in megabytes allocated to the
qemu subprocess.
If C<guestfs_set_memsize> was not called
on this handle, and if C<LIBGUESTFS_MEMSIZE> was not set,
then this returns the compiled-in default value for memsize.
For more information on the architecture of libguestfs,
see L<guestfs(3)>.");
("get_pid", (RInt "pid", [], []), -1, [FishAlias "pid"],
[InitNone, Always, TestOutputIntOp (
[["get_pid"]], ">=", 1)],
"get PID of qemu subprocess",
"\
Return the process ID of the qemu subprocess. If there is no
qemu subprocess, then this will return an error.
This is an internal call used for debugging and testing.");
("version", (RStruct ("version", "version"), [], []), -1, [],
[InitNone, Always, TestOutputStruct (
[["version"]], [CompareWithInt ("major", 1)])],
"get the library version number",
"\
Return the libguestfs version number that the program is linked
against.
Note that because of dynamic linking this is not necessarily
the version of libguestfs that you compiled against. You can
compile the program, and then at runtime dynamically link
against a completely different C<libguestfs.so> library.
This call was added in version C<1.0.58>. In previous
versions of libguestfs there was no way to get the version
number. From C code you can use dynamic linker functions
to find out if this symbol exists (if it doesn't, then
it's an earlier version).
The call returns a structure with four elements. The first
three (C<major>, C<minor> and C<release>) are numbers and
correspond to the usual version triplet. The fourth element
(C<extra>) is a string and is normally empty, but may be
used for distro-specific information.
To construct the original version string:
C<$major.$minor.$release$extra>
See also: L<guestfs(3)/LIBGUESTFS VERSION NUMBERS>.
I<Note:> Don't use this call to test for availability
of features. In enterprise distributions we backport
features from later versions into earlier versions,
making this an unreliable way to test for features.
Use C<guestfs_available> instead.");
("set_selinux", (RErr, [Bool "selinux"], []), -1, [FishAlias "selinux"],
[InitNone, Always, TestOutputTrue (
[["set_selinux"; "true"];
["get_selinux"]])],
"set SELinux enabled or disabled at appliance boot",
"\
This sets the selinux flag that is passed to the appliance
at boot time. The default is C<selinux=0> (disabled).
Note that if SELinux is enabled, it is always in
Permissive mode (C<enforcing=0>).
For more information on the architecture of libguestfs,
see L<guestfs(3)>.");
("get_selinux", (RBool "selinux", [], []), -1, [],
[],
"get SELinux enabled flag",
"\
This returns the current setting of the selinux flag which
is passed to the appliance at boot time. See C<guestfs_set_selinux>.
For more information on the architecture of libguestfs,
see L<guestfs(3)>.");
("set_trace", (RErr, [Bool "trace"], []), -1, [FishAlias "trace"],
[InitNone, Always, TestOutputFalse (
[["set_trace"; "false"];
["get_trace"]])],
"enable or disable command traces",
"\
If the command trace flag is set to 1, then libguestfs
calls, parameters and return values are traced.
If you want to trace C API calls into libguestfs (and
other libraries) then possibly a better way is to use
the external ltrace(1) command.
Command traces are disabled unless the environment variable
C<LIBGUESTFS_TRACE> is defined and set to C<1>.
Trace messages are normally sent to C<stderr>, unless you
register a callback to send them somewhere else (see
C<guestfs_set_event_callback>).");
("get_trace", (RBool "trace", [], []), -1, [],
[],
"get command trace enabled flag",
"\
Return the command trace flag.");
("set_direct", (RErr, [Bool "direct"], []), -1, [FishAlias "direct"],
[InitNone, Always, TestOutputFalse (
[["set_direct"; "false"];
["get_direct"]])],
"enable or disable direct appliance mode",
"\
If the direct appliance mode flag is enabled, then stdin and
stdout are passed directly through to the appliance once it
is launched.
One consequence of this is that log messages aren't caught
by the library and handled by C<guestfs_set_log_message_callback>,
but go straight to stdout.
You probably don't want to use this unless you know what you
are doing.
The default is disabled.");
("get_direct", (RBool "direct", [], []), -1, [],
[],
"get direct appliance mode flag",
"\
Return the direct appliance mode flag.");
("set_recovery_proc", (RErr, [Bool "recoveryproc"], []), -1, [FishAlias "recovery-proc"],
[InitNone, Always, TestOutputTrue (
[["set_recovery_proc"; "true"];
["get_recovery_proc"]])],
"enable or disable the recovery process",
"\
If this is called with the parameter C<false> then
C<guestfs_launch> does not create a recovery process. The
purpose of the recovery process is to stop runaway qemu
processes in the case where the main program aborts abruptly.
This only has any effect if called before C<guestfs_launch>,
and the default is true.
About the only time when you would want to disable this is
if the main process will fork itself into the background
(\"daemonize\" itself). In this case the recovery process
thinks that the main program has disappeared and so kills
qemu, which is not very helpful.");
("get_recovery_proc", (RBool "recoveryproc", [], []), -1, [],
[],
"get recovery process enabled flag",
"\
Return the recovery process enabled flag.");
("add_drive_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"],
[],
"add a drive specifying the QEMU block emulation to use",
"\
This is the same as C<guestfs_add_drive> but it allows you
to specify the QEMU interface emulation to use at run time.");
("add_drive_ro_with_if", (RErr, [String "filename"; String "iface"], []), -1, [DeprecatedBy "add_drive_opts"],
[],
"add a drive read-only specifying the QEMU block emulation to use",
"\
This is the same as C<guestfs_add_drive_ro> but it allows you
to specify the QEMU interface emulation to use at run time.");
("file_architecture", (RString "arch", [Pathname "filename"], []), -1, [],
[InitISOFS, Always, TestOutput (
[["file_architecture"; "/bin-i586-dynamic"]], "i386");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/bin-sparc-dynamic"]], "sparc");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/bin-win32.exe"]], "i386");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/bin-win64.exe"]], "x86_64");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/bin-x86_64-dynamic"]], "x86_64");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/lib-i586.so"]], "i386");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/lib-sparc.so"]], "sparc");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/lib-win32.dll"]], "i386");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/lib-win64.dll"]], "x86_64");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/lib-x86_64.so"]], "x86_64");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/initrd-x86_64.img"]], "x86_64");
InitISOFS, Always, TestOutput (
[["file_architecture"; "/initrd-x86_64.img.gz"]], "x86_64");],
"detect the architecture of a binary file",
"\
This detects the architecture of the binary C<filename>,
and returns it if known.
Currently defined architectures are:
=over 4
=item \"i386\"
This string is returned for all 32 bit i386, i486, i586, i686 binaries
irrespective of the precise processor requirements of the binary.
=item \"x86_64\"
64 bit x86-64.
=item \"sparc\"
32 bit SPARC.
=item \"sparc64\"
64 bit SPARC V9 and above.
=item \"ia64\"
Intel Itanium.
=item \"ppc\"
32 bit Power PC.
=item \"ppc64\"
64 bit Power PC.
=back
Libguestfs may return other architecture strings in future.
The function works on at least the following types of files:
=over 4
=item *
many types of Un*x and Linux binary
=item *
many types of Un*x and Linux shared library
=item *
Windows Win32 and Win64 binaries
=item *
Windows Win32 and Win64 DLLs
Win32 binaries and DLLs return C<i386>.
Win64 binaries and DLLs return C<x86_64>.
=item *
Linux kernel modules
=item *
Linux new-style initrd images
=item *
some non-x86 Linux vmlinuz kernels
=back
What it can't do currently:
=over 4
=item *
static libraries (libfoo.a)
=item *
Linux old-style initrd as compressed ext2 filesystem (RHEL 3)
=item *
x86 Linux vmlinuz kernels
x86 vmlinuz images (bzImage format) consist of a mix of 16-, 32- and
compressed code, and are horribly hard to unpack. If you want to find
the architecture of a kernel, use the architecture of the associated
initrd or kernel module(s) instead.
=back");
("inspect_os", (RStringList "roots", [], []), -1, [],
[],
"inspect disk and return list of operating systems found",
"\
This function uses other libguestfs functions and certain
heuristics to inspect the disk(s) (usually disks belonging to
a virtual machine), looking for operating systems.
The list returned is empty if no operating systems were found.
If one operating system was found, then this returns a list with
a single element, which is the name of the root filesystem of
this operating system. It is also possible for this function
to return a list containing more than one element, indicating
a dual-boot or multi-boot virtual machine, with each element being
the root filesystem of one of the operating systems.
You can pass the root string(s) returned to other
C<guestfs_inspect_get_*> functions in order to query further
information about each operating system, such as the name
and version.
This function uses other libguestfs features such as
C<guestfs_mount_ro> and C<guestfs_umount_all> in order to mount
and unmount filesystems and look at the contents. This should
be called with no disks currently mounted. The function may also
use Augeas, so any existing Augeas handle will be closed.
This function cannot decrypt encrypted disks. The caller
must do that first (supplying the necessary keys) if the
disk is encrypted.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_list_filesystems>.");
("inspect_get_type", (RString "name", [Device "root"], []), -1, [],
[],
"get type of inspected operating system",
"\
This returns the type of the inspected operating system.
Currently defined types are:
=over 4
=item \"linux\"
Any Linux-based operating system.
=item \"windows\"
Any Microsoft Windows operating system.
=item \"freebsd\"
FreeBSD.
=item \"unknown\"
The operating system type could not be determined.
=back
Future versions of libguestfs may return other strings here.
The caller should be prepared to handle any string.
Please read L<guestfs(3)/INSPECTION> for more details.");
("inspect_get_arch", (RString "arch", [Device "root"], []), -1, [],
[],
"get architecture of inspected operating system",
"\
This returns the architecture of the inspected operating system.
The possible return values are listed under
C<guestfs_file_architecture>.
If the architecture could not be determined, then the
string C<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details.");
("inspect_get_distro", (RString "distro", [Device "root"], []), -1, [],
[],
"get distro of inspected operating system",
"\
This returns the distro (distribution) of the inspected operating
system.
Currently defined distros are:
=over 4
=item \"archlinux\"
Arch Linux.
=item \"centos\"
CentOS.
=item \"debian\"
Debian.
=item \"fedora\"
Fedora.
=item \"gentoo\"
Gentoo.
=item \"linuxmint\"
Linux Mint.
=item \"mandriva\"
Mandriva.
=item \"meego\"
MeeGo.
=item \"pardus\"
Pardus.
=item \"redhat-based\"
Some Red Hat-derived distro.
=item \"rhel\"
Red Hat Enterprise Linux.
=item \"scientificlinux\"
Scientific Linux.
=item \"slackware\"
Slackware.
=item \"ubuntu\"
Ubuntu.
=item \"unknown\"
The distro could not be determined.
=item \"windows\"
Windows does not have distributions. This string is
returned if the OS type is Windows.
=back
Future versions of libguestfs may return other strings here.
The caller should be prepared to handle any string.
Please read L<guestfs(3)/INSPECTION> for more details.");
("inspect_get_major_version", (RInt "major", [Device "root"], []), -1, [],
[],
"get major version of inspected operating system",
"\
This returns the major version number of the inspected operating
system.
Windows uses a consistent versioning scheme which is I<not>
reflected in the popular public names used by the operating system.
Notably the operating system known as \"Windows 7\" is really
version 6.1 (ie. major = 6, minor = 1). You can find out the
real versions corresponding to releases of Windows by consulting
Wikipedia or MSDN.
If the version could not be determined, then C<0> is returned.
Please read L<guestfs(3)/INSPECTION> for more details.");
("inspect_get_minor_version", (RInt "minor", [Device "root"], []), -1, [],
[],
"get minor version of inspected operating system",
"\
This returns the minor version number of the inspected operating
system.
If the version could not be determined, then C<0> is returned.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_major_version>.");
("inspect_get_product_name", (RString "product", [Device "root"], []), -1, [],
[],
"get product name of inspected operating system",
"\
This returns the product name of the inspected operating
system. The product name is generally some freeform string
which can be displayed to the user, but should not be
parsed by programs.
If the product name could not be determined, then the
string C<unknown> is returned.
Please read L<guestfs(3)/INSPECTION> for more details.");
("inspect_get_mountpoints", (RHashtable "mountpoints", [Device "root"], []), -1, [],
[],
"get mountpoints of inspected operating system",
"\
This returns a hash of where we think the filesystems
associated with this operating system should be mounted.
Callers should note that this is at best an educated guess
made by reading configuration files such as C</etc/fstab>.
I<In particular note> that this may return filesystems
which are non-existent or not mountable and callers should
be prepared to handle or ignore failures if they try to
mount them.
Each element in the returned hashtable has a key which
is the path of the mountpoint (eg. C</boot>) and a value
which is the filesystem that would be mounted there
(eg. C</dev/sda1>).
Non-mounted devices such as swap devices are I<not>
returned in this list.
For operating systems like Windows which still use drive
letters, this call will only return an entry for the first
drive \"mounted on\" C</>. For information about the
mapping of drive letters to partitions, see
C<guestfs_inspect_get_drive_mappings>.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_filesystems>.");
("inspect_get_filesystems", (RStringList "filesystems", [Device "root"], []), -1, [],
[],
"get filesystems associated with inspected operating system",
"\
This returns a list of all the filesystems that we think
are associated with this operating system. This includes
the root filesystem, other ordinary filesystems, and
non-mounted devices like swap partitions.
In the case of a multi-boot virtual machine, it is possible
for a filesystem to be shared between operating systems.
Please read L<guestfs(3)/INSPECTION> for more details.
See also C<guestfs_inspect_get_mountpoints>.");
("set_network", (RErr, [Bool "network"], []), -1, [FishAlias "network"],
[],
"set enable network flag",
"\
If C<network> is true, then the network is enabled in the
libguestfs appliance. The default is false.
This affects whether commands are able to access the network
(see L<guestfs(3)/RUNNING COMMANDS>).
You must call this before calling C<guestfs_launch>, otherwise
it has no effect.");
("get_network", (RBool "network", [], []), -1, [],
[],
"get enable network flag",
"\
This returns the enable network flag.");
("list_filesystems", (RHashtable "fses", [], []), -1, [],
[],
"list filesystems",
"\
This inspection command looks for filesystems on partitions,
block devices and logical volumes, returning a list of devices
containing filesystems and their type.
The return value is a hash, where the keys are the devices
containing filesystems, and the values are the filesystem types.
For example:
\"/dev/sda1\" => \"ntfs\"
\"/dev/sda2\" => \"ext2\"
\"/dev/vg_guest/lv_root\" => \"ext4\"
\"/dev/vg_guest/lv_swap\" => \"swap\"
The value can have the special value \"unknown\", meaning the
content of the device is undetermined or empty.
\"swap\" means a Linux swap partition.
This command runs other libguestfs commands, which might include
C<guestfs_mount> and C<guestfs_umount>, and therefore you should
use this soon after launch and only when nothing is mounted.
Not all of the filesystems returned will be mountable. In
particular, swap partitions are returned in the list. Also
this command does not check that each filesystem
found is valid and mountable, and some filesystems might
be mountable but require special options. Filesystems may
not all belong to a single logical operating system
(use C<guestfs_inspect_os> to look for OSes).");
("add_drive_opts", (RErr, [String "filename"], [Bool "readonly"; String "format"; String "iface"]), -1, [FishAlias "add"],
[],
"add an image to examine or modify",
"\
This function adds a virtual machine disk image C<filename> to
libguestfs. The first time you call this function, the disk
appears as C</dev/sda>, the second time as C</dev/sdb>, and