Libguestfs
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- 4 participants
- 7463 discussions
It looks to me that the windows 2008 image I am attempting to convert is
not being detected as windows but is being updated as a Linux system.
When PXE booted the server with the p2v image I ended up with this
error:
Failed to launch guestfs appliance. Try running again with
LIBGUESTFS_DEBUG=1 for more information
The system image transferred and I was able to create an XML file to
boot it under kvm with IDE disks.
I undefined it and attempted to convert the system into another storage
pool to help in the debugging and I ended up with the same error.
This is what I ran:
LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1 virt-v2v -i libvirtxml -os
external --network default window2008_r1.xml 2>&1 | tee virt-v2v.log
This is the log file that was produced:
"
libguestfs: new guestfs handle 0x32df9a0
libguestfs: trace: add_drive_opts
"/run/media/jkates/WD-3TB-DSK-B/p2v/window2008_r1-cciss_c0d0"
"format:raw" "iface:ide" "name:hda"
libguestfs: trace: add_drive_opts = 0
libguestfs: trace: add_drive_opts "/tmp/JxIRaWzMVf" "readonly:true"
"format:raw" "iface:ide"
libguestfs: trace: add_drive_opts = 0
libguestfs: trace: set_network true
libguestfs: trace: set_network = 0
libguestfs: trace: launch
libguestfs: [00000ms] febootstrap-supermin-helper --verbose -f checksum
'/usr/lib64/guestfs/supermin.d' x86_64
supermin helper [00000ms] whitelist = (not specified), host_cpu =
x86_64, kernel = (null), initrd = (null), appliance = (null)
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.6.11-5.fc17.x86_64 is a directory
picked vmlinuz-3.6.11-5.fc17.x86_64 because
modpath /lib/modules/3.6.11-5.fc17.x86_64 exists
checking modpath /lib/modules/3.7.3-101.fc17.x86_64 is a directory
picked vmlinuz-3.7.3-101.fc17.x86_64 because
modpath /lib/modules/3.7.3-101.fc17.x86_64 exists
checking modpath /lib/modules/3.7.5-101.fc17.x86_64 is a directory
picked vmlinuz-3.7.5-101.fc17.x86_64 because
modpath /lib/modules/3.7.5-101.fc17.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [00000ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00000ms]
visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [00000ms]
visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [00001ms]
visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [00054ms]
visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [00054ms]
visiting /usr/lib64/guestfs/supermin.d/ntfs.hostfiles
supermin helper [00055ms]
visiting /usr/lib64/guestfs/supermin.d/ntfs.img
supermin helper [00055ms] adding kernel modules
supermin helper [00134ms] finished creating appliance
libguestfs: [00146ms] begin building supermin appliance
libguestfs: [00146ms] run febootstrap-supermin-helper
libguestfs: [00146ms] febootstrap-supermin-helper --verbose -f
ext2 /usr/lib64/guestfs/supermin.d
x86_64 /var/tmp/guestfs.ohng6U/kernel /var/tmp/guestfs.ohng6U/initrd /var/tmp/guestfs.ohng6U/root
supermin helper [00000ms] whitelist = (not specified), host_cpu =
x86_64, kernel = /var/tmp/guestfs.ohng6U/kernel, initrd
= /var/tmp/guestfs.ohng6U/initrd, appliance
= /var/tmp/guestfs.ohng6U/root
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.6.11-5.fc17.x86_64 is a directory
picked vmlinuz-3.6.11-5.fc17.x86_64 because
modpath /lib/modules/3.6.11-5.fc17.x86_64 exists
checking modpath /lib/modules/3.7.3-101.fc17.x86_64 is a directory
picked vmlinuz-3.7.3-101.fc17.x86_64 because
modpath /lib/modules/3.7.3-101.fc17.x86_64 exists
checking modpath /lib/modules/3.7.5-101.fc17.x86_64 is a directory
picked vmlinuz-3.7.5-101.fc17.x86_64 because
modpath /lib/modules/3.7.5-101.fc17.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [00393ms] finished mke2fs
supermin helper [00394ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00394ms]
visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [03635ms]
visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [03646ms]
visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [08967ms]
visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [08968ms]
visiting /usr/lib64/guestfs/supermin.d/ntfs.hostfiles
supermin helper [08973ms]
visiting /usr/lib64/guestfs/supermin.d/ntfs.img
febootstrap-supermin-helper: ext2fs_unlink_inode: Ext2 inode is not a
directory
libguestfs: trace: launch = -1 (error)
virt-v2v: Failed to launch guestfs appliance. Try running again with
LIBGUESTFS_DEBUG=1 for more information
libguestfs: trace: close
libguestfs: closing guestfs handle 0x32df9a0 (state 0)
virt-v2v: Transferring storage volume window2008_r1-cciss_c0d0:
72833679360 bytes
"
I redefined the guest and I ran this:
[root@W520 v2v]# virt-inspector window2008_r1
febootstrap-supermin-helper: ext2fs_unlink_inode: Ext2 inode is not a
directory
libguestfs: error: external command failed, see earlier error messages
This is a list of the RPM files that I think might be relevant:
libguestfs-winsupport-1.0-7.el6.x86_64
libguestfs-tools-c-1.18.11-2.fc17.x86_64
libguestfs-1.18.11-2.fc17.x86_64
libguestfs-tools-1.18.11-2.fc17.x86_64
virtio-win-1.5.3-1.el6_3.noarch
virt-manager-0.9.4-3.fc17.noarch
libvirt-daemon-config-nwfilter-0.9.11.9-1.fc17.x86_64
libvirt-0.9.11.9-1.fc17.x86_64
libvirt-python-0.9.11.9-1.fc17.x86_64
virt-v2v-0.9.0-1.fc17.x86_64
libvirt-daemon-config-network-0.9.11.9-1.fc17.x86_64
virt-manager-common-0.9.4-3.fc17.noarch
libvirt-daemon-0.9.11.9-1.fc17.x86_64
libvirt-client-0.9.11.9-1.fc17.x86_64
python-virtinst-0.600.3-2.fc17.noarch
Any help or suggestions of what to attempt next would be appreciated.
-Jason
--
----------------------------------------------------------------------------
Jason A. Kates (jason(a)kates.org)
Fax: 208-975-1514
Phone: 660-960-0070
============================================================================
3
4
The visibility field in action replaces in_fish, in_docs and internal.
The defined types are:
VPublic:
A public API. This is exported and documented in all language
bindings, and in guestfish.
VStateTest:
A public API which queries the library state machine. It is exported
and documented in all language bindings, but not guestfish.
VBindTest:
An internal API used only for testing language bindings. It is
guarded by GUESTFS_PRIVATE in the C api, but exported by all other
language bindings as it is required for testing. If language
bindings offer any way to guard use of these apis, that mechanism
should be used. It is not documented anywhere.
VDebug:
A debugging API. It is exported by all language bindings, and in
guestfish, but is not documented anywhere.
VInternal:
An internal-only API. It is guarded by GUESTFS_PRIVATE in the C api,
and not exported at all in any other language binding. It is not
documented anywhere.
---
generator/actions.ml | 90 ++++++++++++++++++++++++++++++++++++---------------
generator/actions.mli | 24 ++++++++++++++
generator/c.ml | 7 ++--
generator/csharp.ml | 4 +--
generator/erlang.ml | 10 +++---
generator/fish.ml | 46 +++++++++-----------------
generator/gobject.ml | 6 ++--
generator/haskell.ml | 4 +--
generator/java.ml | 52 ++++++++++++++---------------
generator/lua.ml | 8 ++---
generator/main.ml | 4 +--
generator/ocaml.ml | 18 +++++------
generator/perl.ml | 14 ++++----
generator/php.ml | 6 ++--
generator/python.ml | 26 +++++++--------
generator/ruby.ml | 35 ++++++++++----------
generator/types.ml | 13 +++++---
17 files changed, 208 insertions(+), 159 deletions(-)
diff --git a/generator/actions.ml b/generator/actions.ml
index a97b867..8d31317 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -27,8 +27,8 @@ open Utils
let defaults = { name = ""; style = RErr, [], []; proc_nr = None;
tests = []; shortdesc = ""; longdesc = "";
protocol_limit_warning = false; fish_alias = [];
- fish_output = None; in_fish = true; in_docs = true;
- internal = false; deprecated_by = None; optional = None;
+ fish_output = None; visibility = VPublic;
+ deprecated_by = None; optional = None;
progress = false; camel_name = "";
cancellable = false; config_only = false;
once_had_no_optargs = false; blocking = true;
@@ -76,7 +76,7 @@ let test_functions = [
{ defaults with
name = "internal_test";
style = RErr, test_all_args, test_all_optargs;
- in_fish = false; in_docs = false; internal = true; cancellable = true;
+ visibility = VBindTest; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -92,7 +92,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_only_optargs";
style = RErr, [], [OInt "test"];
- in_fish = false; in_docs = false; internal = true; cancellable = true;
+ visibility = VBindTest; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -108,7 +108,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_63_optargs";
style = RErr, [], [OInt "opt1"; OInt "opt2"; OInt "opt3"; OInt "opt4"; OInt "opt5"; OInt "opt6"; OInt "opt7"; OInt "opt8"; OInt "opt9"; OInt "opt10"; OInt "opt11"; OInt "opt12"; OInt "opt13"; OInt "opt14"; OInt "opt15"; OInt "opt16"; OInt "opt17"; OInt "opt18"; OInt "opt19"; OInt "opt20"; OInt "opt21"; OInt "opt22"; OInt "opt23"; OInt "opt24"; OInt "opt25"; OInt "opt26"; OInt "opt27"; OInt "opt28"; OInt "opt29"; OInt "opt30"; OInt "opt31"; OInt "opt32"; OInt "opt33"; OInt "opt34"; OInt "opt35"; OInt "opt36"; OInt "opt37"; OInt "opt38"; OInt "opt39"; OInt "opt40"; OInt "opt41"; OInt "opt42"; OInt "opt43"; OInt "opt44"; OInt "opt45"; OInt "opt46"; OInt "opt47"; OInt "opt48"; OInt "opt49"; OInt "opt50"; OInt "opt51"; OInt "opt52"; OInt "opt53"; OInt "opt54"; OInt "opt55"; OInt "opt56"; OInt "opt57"; OInt "opt58"; OInt "opt59"; OInt "opt60"; OInt "opt61"; OInt "opt62"; OInt "opt63"];
- in_fish = false; in_docs = false; internal = true; cancellable = true;
+ visibility = VBindTest; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -128,7 +128,7 @@ You probably don't want to call this function." }
{ defaults with
name = name;
style = ret, [String "val"], [];
- in_fish = false; in_docs = false; internal = true;
+ visibility = VBindTest;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -142,7 +142,7 @@ You probably don't want to call this function." };
{ defaults with
name = name ^ "err";
style = ret, [], [];
- in_fish = false; in_docs = false; internal = true;
+ visibility = VBindTest;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -166,7 +166,7 @@ let non_daemon_functions = test_functions @ [
{ defaults with
name = "internal_test_set_output";
style = RErr, [String "filename"], [];
- in_fish = false; in_docs = false; internal = true;
+ visibility = VBindTest;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -181,7 +181,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_close_output";
style = RErr, [], [];
- in_fish = false; in_docs = false; internal = true;
+ visibility = VBindTest;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -214,7 +214,8 @@ very cheap to create, so create a new one for each launch." };
{ defaults with
name = "wait_ready";
style = RErr, [], [];
- in_fish = false; deprecated_by = Some "launch";
+ visibility = VStateTest;
+ deprecated_by = Some "launch";
blocking = false;
shortdesc = "wait until the qemu subprocess launches (no op)";
longdesc = "\
@@ -434,6 +435,7 @@ This returns the verbose messages flag." };
{ defaults with
name = "is_ready";
style = RBool "ready", [], [];
+ visibility = VStateTest;
blocking = false;
tests = [
InitNone, Always, TestOutputTrue (
@@ -464,6 +466,7 @@ For more information on states, see L<guestfs(3)>." };
{ defaults with
name = "is_launching";
style = RBool "launching", [], [];
+ visibility = VStateTest;
blocking = false;
tests = [
InitNone, Always, TestOutputFalse (
@@ -479,7 +482,7 @@ For more information on states, see L<guestfs(3)>." };
{ defaults with
name = "is_busy";
style = RBool "busy", [], [];
- in_docs = false;
+ visibility = VStateTest;
blocking = false;
tests = [
InitNone, Always, TestOutputFalse (
@@ -487,13 +490,15 @@ For more information on states, see L<guestfs(3)>." };
];
shortdesc = "is busy processing a command";
longdesc = "\
-This always returns false. Do not use this function.
+This always returns false. This function is deprecated with no
+replacement. Do not use this function.
For more information on states, see L<guestfs(3)>." };
{ defaults with
name = "get_state";
style = RInt "state", [], [];
+ visibility = VStateTest;
blocking = false;
shortdesc = "get the current state";
longdesc = "\
@@ -1345,7 +1350,7 @@ Please read L<guestfs(3)/INSPECTION> for more details." };
{ defaults with
name = "debug_drives";
style = RStringList "cmdline", [], [];
- in_docs = false;
+ visibility = VDebug;
blocking = false;
shortdesc = "debug the drives (internal use only)";
longdesc = "\
@@ -4231,7 +4236,7 @@ as for the L<mount(8)> I<-o> and I<-t> flags." };
name = "debug";
style = RString "result", [String "subcmd"; StringList "extraargs"], [];
proc_nr = Some 76;
- in_docs = false;
+ visibility = VDebug;
shortdesc = "debugging and internals";
longdesc = "\
The C<guestfs_debug> command exposes some internals of
@@ -6825,7 +6830,7 @@ yourself (Augeas support makes this relatively easy)." };
name = "internal_lstatlist";
style = RStructList ("statbufs", "stat"), [Pathname "path"; StringList "names"], [];
proc_nr = Some 204;
- in_docs = false; in_fish = false; internal = true;
+ visibility = VInternal;
shortdesc = "lstat on multiple files";
longdesc = "\
This call allows you to perform the C<guestfs_lstat> operation
@@ -6849,7 +6854,7 @@ into smaller groups of names." };
name = "internal_lxattrlist";
style = RStructList ("xattrs", "xattr"), [Pathname "path"; StringList "names"], [];
proc_nr = Some 205;
- in_docs = false; in_fish = false; internal = true;
+ visibility = VInternal;
optional = Some "linuxxattrs";
shortdesc = "lgetxattr on multiple files";
longdesc = "\
@@ -6879,7 +6884,7 @@ into smaller groups of names." };
name = "internal_readlinklist";
style = RStringList "links", [Pathname "path"; StringList "names"], [];
proc_nr = Some 206;
- in_docs = false; in_fish = false; internal = true;
+ visibility = VInternal;
shortdesc = "readlink on multiple files";
longdesc = "\
This call allows you to do a C<readlink> operation
@@ -7602,7 +7607,8 @@ unless it has been set by calling C<guestfs_umask>." };
name = "debug_upload";
style = RErr, [FileIn "filename"; String "tmpname"; Int "mode"], [];
proc_nr = Some 241;
- in_docs = false; cancellable = true;
+ visibility = VDebug;
+ cancellable = true;
shortdesc = "upload a file to the appliance (internal use only)";
longdesc = "\
The C<guestfs_debug_upload> command uploads a file to
@@ -7677,7 +7683,7 @@ to ensure the length of the file is exactly C<len> bytes." };
name = "internal_write";
style = RErr, [Pathname "path"; BufferIn "content"], [];
proc_nr = Some 246;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
protocol_limit_warning = true;
tests = [
InitScratchFS, Always, TestOutput (
@@ -8391,7 +8397,7 @@ See also L<guestfs(3)/RESIZE2FS ERRORS>." };
name = "internal_autosync";
style = RErr, [], [];
proc_nr = Some 282;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
shortdesc = "internal autosync operation";
longdesc = "\
This command performs the autosync operation just before the
@@ -8537,7 +8543,7 @@ See also L<btrfs(8)>." };
name = "internal_write_append";
style = RErr, [Pathname "path"; BufferIn "content"], [];
proc_nr = Some 290;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
protocol_limit_warning = true;
tests = [
InitScratchFS, Always, TestOutput (
@@ -10302,7 +10308,7 @@ are the full raw block device and partition names
name = "internal_hot_add_drive";
style = RErr, [String "label"], [];
proc_nr = Some 370;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -10312,7 +10318,7 @@ This function is used internally when hotplugging drives." };
name = "internal_hot_remove_drive_precheck";
style = RErr, [String "label"], [];
proc_nr = Some 371;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -10322,7 +10328,7 @@ This function is used internally when hotplugging drives." };
name = "internal_hot_remove_drive";
style = RErr, [String "label"], [];
proc_nr = Some 372;
- in_fish = false; in_docs = false; internal = true;
+ visibility = VInternal;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -11054,11 +11060,37 @@ let non_daemon_functions, daemon_functions =
(* All functions. *)
let all_functions = non_daemon_functions @ daemon_functions
+let is_external =
+ fun x -> match x.visibility with
+ | VPublic | VStateTest | VBindTest | VDebug -> true
+ | VInternal -> false
+
+let is_internal =
+ fun x -> match x.visibility with
+ | VPublic | VStateTest | VBindTest | VDebug -> false
+ | VInternal -> true
+
+let is_documented =
+ fun x -> match x.visibility with
+ | VPublic | VStateTest -> true
+ | VBindTest | VDebug | VInternal -> false
+
+let is_fish =
+ fun x -> match x.visibility with
+ | VPublic | VDebug -> true
+ | VStateTest | VBindTest | VInternal -> false
+
let external_functions =
- List.filter (fun x -> not x.internal) all_functions
+ List.filter is_external all_functions
let internal_functions =
- List.filter (fun x -> x.internal) all_functions
+ List.filter is_internal all_functions
+
+let documented_functions =
+ List.filter is_documented all_functions
+
+let fish_functions =
+ List.filter is_fish all_functions
(* In some places we want the functions to be displayed sorted
* alphabetically, so this is useful:
@@ -11071,6 +11103,12 @@ let external_functions_sorted =
let internal_functions_sorted =
List.sort action_compare internal_functions
+let documented_functions_sorted =
+ List.sort action_compare documented_functions
+
+let fish_functions_sorted =
+ List.sort action_compare fish_functions
+
(* This is used to generate the src/MAX_PROC_NR file which
* contains the maximum procedure number, a surrogate for the
* ABI version number. See src/Makefile.am for the details.
diff --git a/generator/actions.mli b/generator/actions.mli
index 26ae7e9..5641e57 100644
--- a/generator/actions.mli
+++ b/generator/actions.mli
@@ -29,12 +29,30 @@ val daemon_functions : Types.action list
val all_functions : Types.action list
(** Concatenation of [non_daemon_functions] and [daemon_functions] lists. *)
+val is_external : Types.action -> bool
+(** Returns true if function is external, false otherwise *)
+
+val is_internal : Types.action -> bool
+(** Returns true if function is internal, false otherwise *)
+
+val is_documented : Types.action -> bool
+(** Returns true if function should be documented, false otherwise *)
+
+val is_fish : Types.action -> bool
+(** Returns true if function should be in guestfish, false otherwise *)
+
val external_functions : Types.action list
(** [all_functions] filtered for external functions **)
val internal_functions : Types.action list
(** [all_functions] filtered for internal functions **)
+val documented_functions : Types.action list
+(** [all_functions] filtered for functions requiring documentation **)
+
+val fish_functions : Types.action list
+(** [all_functions] filtered for functions in guestfish **)
+
val all_functions_sorted : Types.action list
(** [all_functions] but sorted by name. *)
@@ -44,6 +62,12 @@ val external_functions_sorted : Types.action list
val internal_functions_sorted : Types.action list
(** [internal_functions] but sorted by name. *)
+val documented_functions_sorted : Types.action list
+(** [documented_functions] but sorted by name. *)
+
+val fish_functions_sorted : Types.action list
+(** [fish_functions] but sorted by name. *)
+
val test_functions : Types.action list
(** Internal test functions used to test the language bindings. *)
diff --git a/generator/c.ml b/generator/c.ml
index e0ce7e1..9ca477b 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -196,13 +196,12 @@ and generate_c_call_args ?handle ?(implicit_size_ptr = "&size")
and generate_actions_pod () =
List.iter (
function
- | { in_docs = false } -> ()
- | ({ in_docs = true; once_had_no_optargs = false } as f) ->
+ | ({ once_had_no_optargs = false } as f) ->
generate_actions_pod_entry f
- | ({ in_docs = true; once_had_no_optargs = true } as f) ->
+ | ({ once_had_no_optargs = true } as f) ->
generate_actions_pod_back_compat_entry f;
generate_actions_pod_entry f
- ) all_functions_sorted
+ ) documented_functions_sorted
and generate_actions_pod_entry ({ c_name = c_name;
style = ret, args, optargs as style } as f) =
diff --git a/generator/csharp.ml b/generator/csharp.ml
index bc92cf1..0fbd02c 100644
--- a/generator/csharp.ml
+++ b/generator/csharp.ml
@@ -131,7 +131,7 @@ namespace Guestfs
) cols;
pr " }\n";
pr "\n"
- ) structs;
+ ) external_structs;
(* Generate C# function bindings. *)
List.iter (
@@ -286,7 +286,7 @@ namespace Guestfs
pr "\n";
List.iter generate_alias non_c_aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr " }
}
diff --git a/generator/erlang.ml b/generator/erlang.ml
index b7d4e6c..6242338 100644
--- a/generator/erlang.ml
+++ b/generator/erlang.ml
@@ -50,7 +50,7 @@ let rec generate_erlang_erl () =
in
export name;
List.iter export aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\n";
@@ -178,7 +178,7 @@ loop(Port) ->
) aliases;
pr "\n"
- ) all_functions_sorted
+ ) external_functions_sorted
and generate_erlang_c () =
generate_header CStyle GPLv2plus;
@@ -279,7 +279,7 @@ extern void free_strings (char **r);
(* generate the function for typ *)
emit_copy_list_function typ
| typ, _ -> () (* empty *)
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by external_functions);
(* The wrapper functions. *)
List.iter (
@@ -461,7 +461,7 @@ extern void free_strings (char **r);
pr "}\n";
pr "\n";
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\
@@ -480,7 +480,7 @@ dispatch (ETERM *message)
pr "if (atom_equals (fun, \"%s\"))\n" name;
pr " return run_%s (message);\n" name;
pr " else ";
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "return unknown_function (fun);
}
diff --git a/generator/fish.ml b/generator/fish.ml
index 077a0b4..411cf11 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -31,6 +31,9 @@ open Prepopts
open C
open Events
+let fish_functions_and_commands_sorted =
+ List.sort action_compare (fish_functions_sorted @ fish_commands)
+
let doc_opttype_of = function
| OBool n -> "true|false"
| OInt n
@@ -47,13 +50,6 @@ let get_aliases { fish_alias = fish_alias; non_c_aliases = non_c_aliases } =
let generate_fish_cmds () =
generate_header CStyle GPLv2plus;
- let all_functions =
- List.filter (fun { in_fish = b } -> b) all_functions in
- let all_functions_sorted =
- List.filter (fun { in_fish = b } -> b) all_functions_sorted in
-
- let all_functions_and_fish_commands_sorted =
- List.sort action_compare (all_functions_sorted @ fish_commands) in
pr "#include <config.h>\n";
pr "\n";
@@ -84,7 +80,7 @@ let generate_fish_cmds () =
fun { name = name } ->
pr "static int run_%s (const char *cmd, size_t argc, char *argv[]);\n"
name
- ) all_functions;
+ ) fish_functions;
pr "\n";
@@ -174,7 +170,7 @@ Guestfish will prompt for these separately."
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
- ) all_functions;
+ ) fish_functions;
(* list_commands function, which implements guestfish -h *)
pr "void\n";
@@ -187,7 +183,7 @@ Guestfish will prompt for these separately."
let name = replace_char name '_' '-' in
pr " printf (\"%%-20s %%s\\n\", \"%s\", _(\"%s\"));\n"
name shortdesc
- ) all_functions_and_fish_commands_sorted;
+ ) fish_functions_and_commands_sorted;
pr " printf (\" %%s\\n\",";
pr " _(\"Use -h <cmd> / help <cmd> to show detailed help for a command.\"));\n";
pr "}\n";
@@ -288,7 +284,7 @@ Guestfish will prompt for these separately."
(* generate the function for typ *)
emit_print_list_function typ
| typ, _ -> () (* empty *)
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by fish_functions);
(* Emit a print_TYPE function definition only if that function is used. *)
List.iter (
@@ -301,7 +297,7 @@ Guestfish will prompt for these separately."
pr "}\n";
pr "\n";
| typ, _ -> () (* empty *)
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by fish_functions);
(* run_<action> actions *)
List.iter (
@@ -639,7 +635,7 @@ Guestfish will prompt for these separately."
pr " return ret;\n";
pr "}\n";
pr "\n"
- ) all_functions;
+ ) fish_functions;
(* run_action function *)
pr "int\n";
@@ -678,12 +674,6 @@ and generate_fish_cmds_h () =
and generate_fish_cmds_gperf () =
generate_header CStyle GPLv2plus;
- let all_functions_sorted =
- List.filter (fun { in_fish = b } -> b) all_functions_sorted in
-
- let all_functions_and_fish_commands_sorted =
- List.sort action_compare (all_functions_sorted @ fish_commands) in
-
pr "\
%%language=ANSI-C
%%define lookup-function-name lookup_fish_command
@@ -705,7 +695,7 @@ and generate_fish_cmds_gperf () =
List.iter (
fun { name = name } ->
pr "extern struct command_entry %s_cmd_entry;\n" name
- ) all_functions_and_fish_commands_sorted;
+ ) fish_functions_and_commands_sorted;
pr "\
%%}
@@ -732,15 +722,12 @@ struct command_table;
fun alias ->
pr "%s, &%s_cmd_entry\n" alias name;
) aliases;
- ) all_functions_and_fish_commands_sorted
+ ) fish_functions_and_commands_sorted
(* Readline completion for guestfish. *)
and generate_fish_completion () =
generate_header CStyle GPLv2plus;
- let all_functions =
- List.filter (fun { in_fish = b } -> b) all_functions in
-
pr "\
#include <config.h>
@@ -769,7 +756,7 @@ static const char *const commands[] = {
let aliases = get_aliases f in
let name2 = replace_char name '_' '-' in
name2 :: aliases
- ) (all_functions @ fish_commands) in
+ ) (fish_functions_and_commands_sorted) in
let commands = List.flatten commands in
List.iter (pr " \"%s\",\n") commands;
@@ -829,10 +816,9 @@ do_completion (const char *text, int start, int end)
(* Generate the POD documentation for guestfish. *)
and generate_fish_actions_pod () =
- let all_functions_sorted =
- List.filter (
- fun { in_fish = in_fish; in_docs = in_docs } -> in_fish && in_docs
- ) all_functions_sorted in
+ let fishdoc_functions_sorted =
+ List.filter is_documented fish_functions_sorted
+ in
let rex = Str.regexp "C<guestfs_\\([^>]+\\)>" in
@@ -895,7 +881,7 @@ Guestfish will prompt for these separately.\n\n";
match deprecation_notice ~replace_underscores:true f with
| None -> ()
| Some txt -> pr "%s\n\n" txt
- ) all_functions_sorted
+ ) fishdoc_functions_sorted
(* Generate documentation for guestfish-only commands. *)
and generate_fish_commands_pod () =
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 519cb26..801ffb4 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -115,7 +115,7 @@ let filenames =
function
| { style = _, _, (_::_) } -> true
| { style = _, _, [] } -> false
- ) all_functions
+ ) external_functions
)
let header_start filename =
@@ -697,7 +697,7 @@ gboolean guestfs_session_close(GuestfsSession *session, GError **err);
fun ({ name = name; style = style } as f) ->
generate_gobject_proto name style f;
pr ";\n";
- ) all_functions;
+ ) external_functions;
header_end filename
@@ -1279,4 +1279,4 @@ guestfs_session_close(GuestfsSession *session, GError **err)
);
pr "}\n";
- ) all_functions
+ ) external_functions
diff --git a/generator/haskell.ml b/generator/haskell.ml
index 396eeb7..cee9e28 100644
--- a/generator/haskell.ml
+++ b/generator/haskell.ml
@@ -60,7 +60,7 @@ module Guestfs (
List.iter (
fun { name = name; style = style } ->
if can_generate style then pr ",\n %s" name
- ) all_functions;
+ ) external_functions;
pr "
) where
@@ -208,7 +208,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
);
pr "\n";
)
- ) all_functions
+ ) external_functions
and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
pr "%s -> " handle;
diff --git a/generator/java.ml b/generator/java.ml
index 4375b81..45fb569 100644
--- a/generator/java.ml
+++ b/generator/java.ml
@@ -246,11 +246,11 @@ public class GuestFS {
(* Methods. *)
List.iter (
- fun ({ name = name; style = (ret, args, optargs as style);
- in_docs = in_docs; shortdesc = shortdesc;
- longdesc = longdesc; non_c_aliases = non_c_aliases } as f) ->
- if in_docs then (
- let doc = replace_str longdesc "C<guestfs_" "C<g." in
+ fun f ->
+ let ret, args, optargs = f.style in
+
+ if is_documented f then (
+ let doc = replace_str f.longdesc "C<guestfs_" "C<g." in
let doc =
if optargs <> [] then
doc ^ "\n\nOptional arguments are supplied in the final Map<String,Object> parameter, which is a hash of the argument name to its value (cast to Object). Pass an empty Map or null for no optional arguments."
@@ -263,7 +263,7 @@ public class GuestFS {
match deprecation_notice f with
| None -> doc
| Some txt -> doc ^ "\n\n" ^ txt in
- let doc = pod2text ~width:60 name doc in
+ let doc = pod2text ~width:60 f.name doc in
let doc = List.map ( (* RHBZ#501883 *)
function
| "" -> "<p>"
@@ -272,19 +272,19 @@ public class GuestFS {
let doc = String.concat "\n * " doc in
pr " /**\n";
- pr " * %s\n" shortdesc;
+ pr " * %s\n" f.shortdesc;
pr " * <p>\n";
pr " * %s\n" doc;
pr " * @throws LibGuestFSException\n";
pr " */\n";
);
pr " ";
- generate_java_prototype ~public:true ~semicolon:false name style;
+ generate_java_prototype ~public:true ~semicolon:false f.name f.style;
pr "\n";
pr " {\n";
pr " if (g == 0)\n";
pr " throw new LibGuestFSException (\"%s: handle is closed\");\n"
- name;
+ f.name;
if optargs <> [] then (
pr "\n";
pr " /* Unpack optional args. */\n";
@@ -313,12 +313,12 @@ public class GuestFS {
pr "\n";
(match ret with
| RErr ->
- pr " _%s " name;
- generate_java_call_args ~handle:"g" style;
+ pr " _%s " f.name;
+ generate_java_call_args ~handle:"g" f.style;
pr ";\n"
| RHashtable _ ->
- pr " String[] r = _%s " name;
- generate_java_call_args ~handle:"g" style;
+ pr " String[] r = _%s " f.name;
+ generate_java_call_args ~handle:"g" f.style;
pr ";\n";
pr "\n";
pr " HashMap<String, String> rhash = new HashMap<String, String> ();\n";
@@ -326,8 +326,8 @@ public class GuestFS {
pr " rhash.put (r[i], r[i+1]);\n";
pr " return rhash;\n"
| _ ->
- pr " return _%s " name;
- generate_java_call_args ~handle:"g" style;
+ pr " return _%s " f.name;
+ generate_java_call_args ~handle:"g" f.style;
pr ";\n"
);
pr " }\n";
@@ -340,14 +340,14 @@ public class GuestFS {
if optargs <> [] then (
pr " ";
generate_java_prototype ~public:true ~semicolon:false
- name (ret, args, []);
+ f.name (ret, args, []);
pr "\n";
pr " {\n";
(match ret with
| RErr -> pr " "
| _ -> pr " return "
);
- pr "%s (" name;
+ pr "%s (" f.name;
List.iter (fun arg -> pr "%s, " (name_of_argt arg)) args;
pr "null);\n";
pr " }\n";
@@ -358,14 +358,14 @@ public class GuestFS {
List.iter (
fun alias ->
pr " ";
- generate_java_prototype ~public:true ~semicolon:false alias style;
+ generate_java_prototype ~public:true ~semicolon:false alias f.style;
pr "\n";
pr " {\n";
(match ret with
| RErr -> pr " "
| _ -> pr " return "
);
- pr "%s (" name;
+ pr "%s (" f.name;
let needs_comma = ref false in
List.iter (
fun arg ->
@@ -392,20 +392,20 @@ public class GuestFS {
| RErr -> pr " "
| _ -> pr " return "
);
- pr "%s (" name;
+ pr "%s (" f.name;
List.iter (fun arg -> pr "%s, " (name_of_argt arg)) args;
pr "null);\n";
pr " }\n";
pr "\n"
)
- ) non_c_aliases;
+ ) f.non_c_aliases;
(* Prototype for the native method. *)
pr " ";
- generate_java_prototype ~privat:true ~native:true name style;
+ generate_java_prototype ~privat:true ~native:true f.name f.style;
pr "\n";
pr "\n";
- ) all_functions;
+ ) external_functions;
pr "}\n"
@@ -1099,7 +1099,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
pr "}\n";
pr "\n"
- ) all_functions
+ ) external_functions
and generate_java_struct_return typ jtyp cols =
pr " cl = (*env)->FindClass (env, \"com/redhat/et/libguestfs/%s\");\n" jtyp;
@@ -1190,7 +1190,7 @@ and generate_java_struct_list_return typ jtyp cols =
and generate_java_makefile_inc () =
generate_header HashStyle GPLv2plus;
- let jtyps = List.map (fun { s_camel_name = jtyp } -> jtyp) structs in
+ let jtyps = List.map (fun { s_camel_name = jtyp } -> jtyp) external_structs in
let jtyps = List.sort compare jtyps in
pr "java_built_sources = \\\n";
@@ -1200,7 +1200,7 @@ and generate_java_makefile_inc () =
pr "\tcom/redhat/et/libguestfs/GuestFS.java\n"
and generate_java_gitignore () =
- let jtyps = List.map (fun { s_camel_name = jtyp } -> jtyp) structs in
+ let jtyps = List.map (fun { s_camel_name = jtyp } -> jtyp) external_structs in
let jtyps = List.sort compare jtyps in
List.iter (pr "%s.java\n") jtyps
diff --git a/generator/lua.ml b/generator/lua.ml
index 042a8a0..1878844 100644
--- a/generator/lua.ml
+++ b/generator/lua.ml
@@ -107,7 +107,7 @@ static void free_strings (char **r);
| typ, (RStructListOnly | RStructAndList) ->
pr "static void push_%s (lua_State *L, struct guestfs_%s *v);\n" typ typ;
pr "static void push_%s_list (lua_State *L, struct guestfs_%s_list *v);\n" typ typ
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by external_functions);
pr "\
@@ -629,7 +629,7 @@ guestfs_lua_delete_event_callback (lua_State *L)
pr " return 1;\n";
pr "}\n";
pr "\n"
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\
static struct userdata *
@@ -866,7 +866,7 @@ push_event (lua_State *L, uint64_t event)
| typ, (RStructListOnly | RStructAndList) ->
generate_push_struct typ;
generate_push_struct_list typ
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by external_functions);
pr "\
void
@@ -904,7 +904,7 @@ static luaL_Reg methods[] = {
List.iter (
fun { name = name } -> pr " { \"%s\", guestfs_lua_%s },\n" name name
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\
diff --git a/generator/main.ml b/generator/main.ml
index 1d35a53..0216140 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -136,7 +136,7 @@ Run it from the top source directory using the command
let cols = cols_of_struct typ in
let filename = sprintf "java/com/redhat/et/libguestfs/%s.java" jtyp in
output_to filename (generate_java_struct jtyp cols)
- ) structs;
+ ) external_structs;
delete_except_generated
~skip:["java/com/redhat/et/libguestfs/LibGuestFSException.java";
"java/com/redhat/et/libguestfs/EventCallback.java"]
@@ -186,7 +186,7 @@ Run it from the top source directory using the command
output_to filename
(generate_gobject_optargs_source short name optargs f)
| { style = _, _, [] } -> ()
- ) all_functions;
+ ) external_functions;
delete_except_generated "gobject/include/guestfs-gobject/optargs-*.h";
delete_except_generated "gobject/src/optargs-*.c";
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 0b1f96b..d922c0f 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -130,12 +130,12 @@ val user_cancel : t -> unit
(* The actions. *)
List.iter (
- fun { name = name; style = style; deprecated_by = deprecated_by;
+ fun ({ name = name; style = style; deprecated_by = deprecated_by;
non_c_aliases = non_c_aliases;
- in_docs = in_docs; shortdesc = shortdesc } ->
+ shortdesc = shortdesc } as f) ->
generate_ocaml_prototype name style;
- if in_docs then (
+ if is_documented f then (
pr "(** %s" shortdesc;
(match deprecated_by with
| None -> ()
@@ -152,7 +152,7 @@ val user_cancel : t -> unit
generate_ocaml_prototype alias style;
pr "\n";
) non_c_aliases;
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\
(** {2 Object-oriented API}
@@ -203,7 +203,7 @@ class guestfs : ?environment:bool -> ?close_on_exit:bool -> unit -> object
generate_ocaml_function_type style;
pr "\n"
) non_c_aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "end\n"
@@ -268,7 +268,7 @@ let () =
fun { name = name; style = style; non_c_aliases = non_c_aliases } ->
generate_ocaml_prototype ~is_external:true name style;
List.iter (fun alias -> pr "let %s = %s\n" alias name) non_c_aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
(* OO API. *)
pr "
@@ -297,7 +297,7 @@ class guestfs ?environment ?close_on_exit () =
);
List.iter
(fun alias -> pr " method %s = self#%s\n" alias name) non_c_aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr " end\n"
@@ -431,7 +431,7 @@ copy_table (char * const * argv)
(* generate the function for typ *)
emit_ocaml_copy_list_function typ
| typ, _ -> () (* empty *)
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by external_functions);
(* The wrappers. *)
List.iter (
@@ -669,7 +669,7 @@ copy_table (char * const * argv)
pr "}\n";
pr "\n"
)
- ) all_functions_sorted
+ ) external_functions_sorted
and generate_ocaml_structure_decls () =
List.iter (
diff --git a/generator/perl.ml b/generator/perl.ml
index ddae5bb..9133bcf 100644
--- a/generator/perl.ml
+++ b/generator/perl.ml
@@ -560,7 +560,7 @@ user_cancel (g)
);
pr "\n"
- ) all_functions
+ ) external_functions
and generate_perl_struct_list_code typ cols name style n =
pr " if (r == NULL)\n";
@@ -858,10 +858,8 @@ handlers and threads.
* they are pulled in from the XS code automatically.
*)
List.iter (
- function
- | { in_docs = false } -> ()
- | ({ name = name; style = style; in_docs = true;
- longdesc = longdesc; non_c_aliases = non_c_aliases } as f) ->
+ fun ({ name = name; style = style;
+ longdesc = longdesc; non_c_aliases = non_c_aliases } as f) ->
let longdesc = replace_str longdesc "C<guestfs_" "C<$g-E<gt>" in
pr "=item ";
generate_perl_prototype name style;
@@ -891,7 +889,7 @@ handlers and threads.
pr "=pod\n";
pr "\n";
) non_c_aliases
- ) all_functions_sorted;
+ ) documented_functions_sorted;
pr "=cut\n\n";
@@ -956,7 +954,7 @@ handlers and threads.
pr " name => \"%s\",\n" name;
pr " description => %S,\n" shortdesc;
pr " },\n";
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr ");\n\n";
pr "# Add aliases to the introspection hash.\n";
@@ -969,7 +967,7 @@ handlers and threads.
pr "$guestfs_introspection{%s} = \\%%ielem%d;\n" alias !i;
incr i
) non_c_aliases
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\n";
(* End of file. *)
diff --git a/generator/php.ml b/generator/php.ml
index 4ed7b30..d457507 100644
--- a/generator/php.ml
+++ b/generator/php.ml
@@ -53,7 +53,7 @@ PHP_FUNCTION (guestfs_last_error);
List.iter (
fun { name = name } -> pr "PHP_FUNCTION (guestfs_%s);\n" name
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "\
@@ -113,7 +113,7 @@ static zend_function_entry guestfs_php_functions[] = {
List.iter (
fun { name = name } -> pr " PHP_FE (guestfs_%s, NULL)\n" name
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr " { NULL, NULL, NULL }
};
@@ -506,7 +506,7 @@ PHP_FUNCTION (guestfs_last_error)
pr "}\n";
pr "\n"
- ) all_functions_sorted
+ ) external_functions_sorted
and generate_php_struct_code typ cols =
pr " array_init (return_value);\n";
diff --git a/generator/python.ml b/generator/python.ml
index 3863c71..64c5a8d 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -249,7 +249,7 @@ free_strings (char **argv)
(* generate the function for typ *)
emit_put_list_function typ
| typ, _ -> () (* empty *)
- ) (rstructs_used_by all_functions);
+ ) (rstructs_used_by external_functions);
(* Python wrapper functions. *)
List.iter (
@@ -528,7 +528,7 @@ free_strings (char **argv)
pr " return py_r;\n";
pr "}\n";
pr "\n"
- ) all_functions;
+ ) external_functions;
(* Table of functions. *)
pr "static PyMethodDef methods[] = {\n";
@@ -542,7 +542,7 @@ free_strings (char **argv)
fun { name = name } ->
pr " { (char *) \"%s\", py_guestfs_%s, METH_VARARGS, NULL },\n"
name name
- ) all_functions;
+ ) external_functions;
pr " { NULL, NULL, 0, NULL }\n";
pr "};\n";
pr "\n";
@@ -734,9 +734,9 @@ class GuestFS(object):
";
List.iter (
- fun ({ name = name; style = ret, args, optargs; in_docs = in_docs;
- longdesc = longdesc; non_c_aliases = non_c_aliases } as f) ->
- pr " def %s (self" name;
+ fun f ->
+ let ret, args, optargs = f.style in
+ pr " def %s (self" f.name;
List.iter (fun arg -> pr ", %s" (name_of_argt arg)) args;
List.iter (
fun optarg ->
@@ -744,8 +744,8 @@ class GuestFS(object):
) optargs;
pr "):\n";
- if in_docs then (
- let doc = replace_str longdesc "C<guestfs_" "C<g." in
+ if is_documented f then (
+ let doc = replace_str f.longdesc "C<guestfs_" "C<g." in
let doc =
match ret with
| RErr | RInt _ | RInt64 _ | RBool _
@@ -767,7 +767,7 @@ class GuestFS(object):
match deprecation_notice f with
| None -> doc
| Some txt -> doc ^ "\n\n" ^ txt in
- let doc = pod2text ~width:60 name doc in
+ let doc = pod2text ~width:60 f.name doc in
let doc = List.map (fun line -> replace_str line "\\" "\\\\") doc in
let doc = String.concat "\n " doc in
pr " \"\"\"%s\"\"\"\n" doc;
@@ -786,7 +786,7 @@ class GuestFS(object):
pr " %s = list (%s)\n" n n
) args;
pr " self._check_not_closed ()\n";
- pr " return libguestfsmod.%s (self._o" name;
+ pr " return libguestfsmod.%s (self._o" f.name;
List.iter (fun arg -> pr ", %s" (name_of_argt arg))
(args @ args_of_optargs optargs);
pr ")\n\n";
@@ -794,6 +794,6 @@ class GuestFS(object):
(* Aliases. *)
List.iter (
fun alias ->
- pr " %s = %s\n\n" alias name
- ) non_c_aliases
- ) all_functions
+ pr " %s = %s\n\n" alias f.name
+ ) f.non_c_aliases
+ ) external_functions
diff --git a/generator/ruby.ml b/generator/ruby.ml
index 0114aca..706c726 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -393,13 +393,12 @@ ruby_user_cancel (VALUE gv)
";
List.iter (
- fun ({ name = name; style = (ret, args, optargs as style);
- in_docs = in_docs;
- c_function = c_function; c_optarg_prefix = c_optarg_prefix;
- shortdesc = shortdesc; longdesc = longdesc } as f) ->
+ fun f ->
+ let ret, args, optargs = f.style in
+
(* Generate rdoc. *)
- if in_docs then (
- let doc = replace_str longdesc "C<guestfs_" "C<g." in
+ if is_documented f then (
+ let doc = replace_str f.longdesc "C<guestfs_" "C<g." in
let doc =
if optargs <> [] then
doc ^ "\n\nOptional arguments are supplied in the final hash parameter, which is a hash of the argument name to its value. Pass an empty {} for no optional arguments."
@@ -412,7 +411,7 @@ ruby_user_cancel (VALUE gv)
match deprecation_notice f with
| None -> doc
| Some txt -> doc ^ "\n\n" ^ txt in
- let doc = pod2text ~width:60 name doc in
+ let doc = pod2text ~width:60 f.name doc in
let doc = String.concat "\n * " doc in
let doc = trim doc in
@@ -452,7 +451,7 @@ ruby_user_cancel (VALUE gv)
* (For the C API documentation for this function, see
* +guestfs_%s+[http://libguestfs.org/guestfs.3.html#guestfs_%s]).
*/
-" name args ret shortdesc doc name name
+" f.name args ret f.shortdesc doc f.name f.name
);
(* Generate the function. Prototype is completely different
@@ -462,7 +461,7 @@ ruby_user_cancel (VALUE gv)
* http://stackoverflow.com/questions/7626745/extending-ruby-in-c-how-to-speci…
*)
pr "static VALUE\n";
- pr "ruby_guestfs_%s (" name;
+ pr "ruby_guestfs_%s (" f.name;
if optargs = [] then (
pr "VALUE gv";
List.iter
@@ -476,7 +475,7 @@ ruby_user_cancel (VALUE gv)
pr " Data_Get_Struct (gv, guestfs_h, g);\n";
pr " if (!g)\n";
pr " rb_raise (rb_eArgError, \"%%s: used handle after closing it\", \"%s\");\n"
- name;
+ f.name;
pr "\n";
(* For optargs case, get the arg VALUEs into local variables.
@@ -509,7 +508,7 @@ ruby_user_cancel (VALUE gv)
pr " const char *%s = RSTRING_PTR (%sv);\n" n n;
pr " if (!%s)\n" n;
pr " rb_raise (rb_eTypeError, \"expected string for parameter %%s of %%s\",\n";
- pr " \"%s\", \"%s\");\n" n name;
+ pr " \"%s\", \"%s\");\n" n f.name;
pr " size_t %s_size = RSTRING_LEN (%sv);\n" n n
| OptString n ->
pr " const char *%s = !NIL_P (%sv) ? StringValueCStr (%sv) : NULL;\n" n n n
@@ -541,8 +540,8 @@ ruby_user_cancel (VALUE gv)
(* Optional arguments are passed in a final hash parameter. *)
if optargs <> [] then (
pr " Check_Type (optargsv, T_HASH);\n";
- pr " struct %s optargs_s = { .bitmask = 0 };\n" c_function;
- pr " struct %s *optargs = &optargs_s;\n" c_function;
+ pr " struct %s optargs_s = { .bitmask = 0 };\n" f.c_function;
+ pr " struct %s *optargs = &optargs_s;\n" f.c_function;
pr " volatile VALUE v;\n";
List.iter (
fun argt ->
@@ -575,7 +574,7 @@ ruby_user_cancel (VALUE gv)
pr " optargs_s.%s = r;\n" n;
pr " }\n"
);
- pr " optargs_s.bitmask |= %s_%s_BITMASK;\n" c_optarg_prefix uc_n;
+ pr " optargs_s.bitmask |= %s_%s_BITMASK;\n" f.c_optarg_prefix uc_n;
pr " }\n";
) optargs;
pr "\n";
@@ -597,8 +596,8 @@ ruby_user_cancel (VALUE gv)
);
pr "\n";
- pr " r = %s " c_function;
- generate_c_call_args ~handle:"g" style;
+ pr " r = %s " f.c_function;
+ generate_c_call_args ~handle:"g" f.style;
pr ";\n";
List.iter (
@@ -674,7 +673,7 @@ ruby_user_cancel (VALUE gv)
pr "}\n";
pr "\n"
- ) all_functions;
+ ) external_functions;
pr "\
extern void Init__guestfs (void); /* keep GCC warnings happy */
@@ -727,7 +726,7 @@ Init__guestfs (void)
pr " rb_define_method (c_guestfs, \"%s\",\n" alias;
pr " ruby_guestfs_%s, %d);\n" name nr_args
) non_c_aliases
- ) all_functions;
+ ) external_functions;
pr "}\n"
diff --git a/generator/types.ml b/generator/types.ml
index 26bf746..c809d2b 100644
--- a/generator/types.ml
+++ b/generator/types.ml
@@ -370,6 +370,14 @@ and test_init =
and seq = cmd list
and cmd = string list
+type visibility =
+ | VPublic (* Part of the public API *)
+ | VStateTest (* A function which tests the state
+ of the appliance *)
+ | VBindTest (* Only used for testing language bindings *)
+ | VDebug (* Exported everywhere, but not documented *)
+ | VInternal (* Not exported *)
+
(* Type of an action as declared in Actions module. *)
type action = {
name : string; (* name, not including "guestfs_" *)
@@ -383,10 +391,7 @@ type action = {
protocol_limit_warning : bool; (* warn about protocol size limits *)
fish_alias : string list; (* alias(es) for this cmd in guestfish *)
fish_output : fish_output_t option; (* how to display output in guestfish *)
- in_fish : bool; (* export via guestfish *)
- in_docs : bool; (* add this function to documentation *)
- internal: bool; (* function is not part of the
- external api *)
+ visibility: visibility; (* The visbility of function *)
deprecated_by : string option; (* function is deprecated, use .. instead *)
optional : string option; (* function is part of an optional group *)
progress : bool; (* function can generate progress messages *)
--
1.8.1
2
2
Because of the confusion generated by calling something 'febootstrap'
which didn't have anything to do with Fedora and didn't generate
bootstrap filesystems, I have renamed 'febootstrap' as 'supermin'.
I also bumped the version number up to 4.1.0.
New home page: http://people.redhat.com/~rjones/supermin/
Downloads: http://libguestfs.org/download/supermin/
Git repo: https://github.com/libguestfs/supermin
At present this probably breaks a few things, but I'll fix them as I
go along. Also this will require new Fedora and (?)Debian packages.
libguestfs will be able to use either febootstrap 3.21 or supermin 4.x,
at least for a while. If we add major new features into supermin,
then it might be that febootstrap can no longer be used, but I don't
see that happening soon.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
1
1
https://bugzilla.redhat.com/show_bug.cgi?id=907554
In particular comments 2 & 3.
We could change libguestfs's guestfs_mkfs (internally) so it always
does an implicit wipefs on the filesystem. wipefs is not too onerous --
in particular I believe it only writes to a few chosen areas of the
disk. Especially considering that we're about to run mkfs anyway
which for some filesystems writes a lot of blocks.
Thoughts?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
2
2
I use my "custom" TMPDIR variable with virt-sparsify.
I just type:
export -p TMPDIR=/mnt/vm/tmpdir
I do that for a couple reasons:
either my /tmp is on a ramdisk or /tmp is on my (ssd) rootfs and i
dont want to "full" my / with the temporally files.
Thats said, i was thinking to "ask" OR sending a patch for adding a
tmpdir OPTION for virt-sparsify
like
virt-sparsify -t /mnt/vm/tmpdir f18.qcow2 f18.qcow2.spars
before contribute .... i was eager to ask for your thoughts.
Do you believe this would be useful or too much trouble for nothing ?
Do you believe that we could use a TMPDIR option for liguestfs in general ?
Thank you
--
Evaggelos Balaskas - Unix System Engineer
http://gr.linkedin.com/in/evaggelosbalaskas
2
1
qemu-wrapper isn't regenerated if QEMUDIR is changed, so just
delete it and force regeneration.
Additionally we can drop the silent binary check, since
check-with-upstream-qemu-1 already does a similar test with --version
that will actually report an error to the user.
---
Makefile.am | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 42052c0..6e5e30a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -357,9 +357,8 @@ QEMUDIR = $(HOME)/d/qemu
QEMUBINARY = $(QEMUDIR)/x86_64-softmmu/qemu-system-x86_64
check-with-upstream-qemu:
- @if $(QEMUBINARY) --help >/dev/null 2>&1; then \
- $(MAKE) check-with-upstream-qemu-1 || exit $$?; \
- fi
+ rm -f $(top_builddir)/qemu-wrapper.sh
+ $(MAKE) check-with-upstream-qemu-1 || exit $$?
check-with-upstream-qemu-1: $(top_builddir)/qemu-wrapper.sh
$(QEMUBINARY) --version
--
1.8.1
2
1
Certain functions are intended to be internal only, but we currently
export them anyway. This change moves them into a separate section of
guestfs.h protected by a GUESTFS_PRIVATE variable. This change also
enables private structs, but doesn't implement any.
This change only affects the C api. Language bindings aren't affected,
but probably should be in the future.
---
align/Makefile.am | 2 +-
df/Makefile.am | 2 +-
erlang/Makefile.am | 1 +
generator/actions.ml | 46 +++++++++++++++++++++++--------------
generator/actions.mli | 12 ++++++++++
generator/c.ml | 52 +++++++++++++++++++++++++++++++-----------
generator/erlang.ml | 2 +-
generator/fish.ml | 2 +-
generator/gobject.ml | 2 +-
generator/main.ml | 2 +-
generator/ocaml.ml | 4 ++--
generator/python.ml | 2 +-
generator/structs.ml | 8 ++++++-
generator/structs.mli | 7 ++++++
generator/types.ml | 2 ++
gobject/Makefile.am | 1 +
java/Makefile.am | 2 +-
lua/Makefile.am | 1 +
ocaml/Makefile.am | 2 +-
perl/Makefile.PL.in | 2 +-
php/Makefile.am | 1 +
python/Makefile.am | 2 +-
ruby/ext/guestfs/extconf.rb.in | 2 +-
src/Makefile.am | 2 +-
tests/c-api/Makefile.am | 1 +
25 files changed, 116 insertions(+), 46 deletions(-)
diff --git a/align/Makefile.am b/align/Makefile.am
index cd80c19..857253f 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -41,7 +41,7 @@ virt_alignment_scan_SOURCES = \
virt_alignment_scan_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
diff --git a/df/Makefile.am b/df/Makefile.am
index eeec484..52cb4ab 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -44,7 +44,7 @@ virt_df_SOURCES = \
virt_df_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
diff --git a/erlang/Makefile.am b/erlang/Makefile.am
index 8c1e887..c593630 100644
--- a/erlang/Makefile.am
+++ b/erlang/Makefile.am
@@ -45,6 +45,7 @@ erl_guestfs_CFLAGS = \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-I$(ERLANG_LIB_DIR_erl_interface)/include \
+ -DGUESTFS_PRIVATE=1 \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS)
diff --git a/generator/actions.ml b/generator/actions.ml
index 94f728f..a97b867 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -28,7 +28,7 @@ let defaults = { name = ""; style = RErr, [], []; proc_nr = None;
tests = []; shortdesc = ""; longdesc = "";
protocol_limit_warning = false; fish_alias = [];
fish_output = None; in_fish = true; in_docs = true;
- deprecated_by = None; optional = None;
+ internal = false; deprecated_by = None; optional = None;
progress = false; camel_name = "";
cancellable = false; config_only = false;
once_had_no_optargs = false; blocking = true;
@@ -76,7 +76,7 @@ let test_functions = [
{ defaults with
name = "internal_test";
style = RErr, test_all_args, test_all_optargs;
- in_fish = false; in_docs = false; cancellable = true;
+ in_fish = false; in_docs = false; internal = true; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -92,7 +92,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_only_optargs";
style = RErr, [], [OInt "test"];
- in_fish = false; in_docs = false; cancellable = true;
+ in_fish = false; in_docs = false; internal = true; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -108,7 +108,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_63_optargs";
style = RErr, [], [OInt "opt1"; OInt "opt2"; OInt "opt3"; OInt "opt4"; OInt "opt5"; OInt "opt6"; OInt "opt7"; OInt "opt8"; OInt "opt9"; OInt "opt10"; OInt "opt11"; OInt "opt12"; OInt "opt13"; OInt "opt14"; OInt "opt15"; OInt "opt16"; OInt "opt17"; OInt "opt18"; OInt "opt19"; OInt "opt20"; OInt "opt21"; OInt "opt22"; OInt "opt23"; OInt "opt24"; OInt "opt25"; OInt "opt26"; OInt "opt27"; OInt "opt28"; OInt "opt29"; OInt "opt30"; OInt "opt31"; OInt "opt32"; OInt "opt33"; OInt "opt34"; OInt "opt35"; OInt "opt36"; OInt "opt37"; OInt "opt38"; OInt "opt39"; OInt "opt40"; OInt "opt41"; OInt "opt42"; OInt "opt43"; OInt "opt44"; OInt "opt45"; OInt "opt46"; OInt "opt47"; OInt "opt48"; OInt "opt49"; OInt "opt50"; OInt "opt51"; OInt "opt52"; OInt "opt53"; OInt "opt54"; OInt "opt55"; OInt "opt56"; OInt "opt57"; OInt "opt58"; OInt "opt59"; OInt "opt60"; OInt "opt61"; OInt "opt62"; OInt "opt63"];
- in_fish = false; in_docs = false; cancellable = true;
+ in_fish = false; in_docs = false; internal = true; cancellable = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -128,7 +128,7 @@ You probably don't want to call this function." }
{ defaults with
name = name;
style = ret, [String "val"], [];
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -142,7 +142,7 @@ You probably don't want to call this function." };
{ defaults with
name = name ^ "err";
style = ret, [], [];
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -166,7 +166,7 @@ let non_daemon_functions = test_functions @ [
{ defaults with
name = "internal_test_set_output";
style = RErr, [String "filename"], [];
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -181,7 +181,7 @@ You probably don't want to call this function." };
{ defaults with
name = "internal_test_close_output";
style = RErr, [], [];
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
blocking = false;
shortdesc = "internal test function - do not use";
longdesc = "\
@@ -6825,7 +6825,7 @@ yourself (Augeas support makes this relatively easy)." };
name = "internal_lstatlist";
style = RStructList ("statbufs", "stat"), [Pathname "path"; StringList "names"], [];
proc_nr = Some 204;
- in_docs = false; in_fish = false;
+ in_docs = false; in_fish = false; internal = true;
shortdesc = "lstat on multiple files";
longdesc = "\
This call allows you to perform the C<guestfs_lstat> operation
@@ -6849,7 +6849,7 @@ into smaller groups of names." };
name = "internal_lxattrlist";
style = RStructList ("xattrs", "xattr"), [Pathname "path"; StringList "names"], [];
proc_nr = Some 205;
- in_docs = false; in_fish = false;
+ in_docs = false; in_fish = false; internal = true;
optional = Some "linuxxattrs";
shortdesc = "lgetxattr on multiple files";
longdesc = "\
@@ -6879,7 +6879,7 @@ into smaller groups of names." };
name = "internal_readlinklist";
style = RStringList "links", [Pathname "path"; StringList "names"], [];
proc_nr = Some 206;
- in_docs = false; in_fish = false;
+ in_docs = false; in_fish = false; internal = true;
shortdesc = "readlink on multiple files";
longdesc = "\
This call allows you to do a C<readlink> operation
@@ -7677,7 +7677,7 @@ to ensure the length of the file is exactly C<len> bytes." };
name = "internal_write";
style = RErr, [Pathname "path"; BufferIn "content"], [];
proc_nr = Some 246;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
protocol_limit_warning = true;
tests = [
InitScratchFS, Always, TestOutput (
@@ -8391,7 +8391,7 @@ See also L<guestfs(3)/RESIZE2FS ERRORS>." };
name = "internal_autosync";
style = RErr, [], [];
proc_nr = Some 282;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
shortdesc = "internal autosync operation";
longdesc = "\
This command performs the autosync operation just before the
@@ -8537,7 +8537,7 @@ See also L<btrfs(8)>." };
name = "internal_write_append";
style = RErr, [Pathname "path"; BufferIn "content"], [];
proc_nr = Some 290;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
protocol_limit_warning = true;
tests = [
InitScratchFS, Always, TestOutput (
@@ -10302,7 +10302,7 @@ are the full raw block device and partition names
name = "internal_hot_add_drive";
style = RErr, [String "label"], [];
proc_nr = Some 370;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -10312,7 +10312,7 @@ This function is used internally when hotplugging drives." };
name = "internal_hot_remove_drive_precheck";
style = RErr, [String "label"], [];
proc_nr = Some 371;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -10322,7 +10322,7 @@ This function is used internally when hotplugging drives." };
name = "internal_hot_remove_drive";
style = RErr, [String "label"], [];
proc_nr = Some 372;
- in_fish = false; in_docs = false;
+ in_fish = false; in_docs = false; internal = true;
tests = [];
shortdesc = "internal hotplugging operation";
longdesc = "\
@@ -11054,11 +11054,23 @@ let non_daemon_functions, daemon_functions =
(* All functions. *)
let all_functions = non_daemon_functions @ daemon_functions
+let external_functions =
+ List.filter (fun x -> not x.internal) all_functions
+
+let internal_functions =
+ List.filter (fun x -> x.internal) all_functions
+
(* In some places we want the functions to be displayed sorted
* alphabetically, so this is useful:
*)
let all_functions_sorted = List.sort action_compare all_functions
+let external_functions_sorted =
+ List.sort action_compare external_functions
+
+let internal_functions_sorted =
+ List.sort action_compare internal_functions
+
(* This is used to generate the src/MAX_PROC_NR file which
* contains the maximum procedure number, a surrogate for the
* ABI version number. See src/Makefile.am for the details.
diff --git a/generator/actions.mli b/generator/actions.mli
index 1ad509a..26ae7e9 100644
--- a/generator/actions.mli
+++ b/generator/actions.mli
@@ -29,9 +29,21 @@ val daemon_functions : Types.action list
val all_functions : Types.action list
(** Concatenation of [non_daemon_functions] and [daemon_functions] lists. *)
+val external_functions : Types.action list
+(** [all_functions] filtered for external functions **)
+
+val internal_functions : Types.action list
+(** [all_functions] filtered for internal functions **)
+
val all_functions_sorted : Types.action list
(** [all_functions] but sorted by name. *)
+val external_functions_sorted : Types.action list
+(** [external_functions] but sorted by name. *)
+
+val internal_functions_sorted : Types.action list
+(** [internal_functions] but sorted by name. *)
+
val test_functions : Types.action list
(** Internal test functions used to test the language bindings. *)
diff --git a/generator/c.ml b/generator/c.ml
index f0102df..76397d6 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -576,7 +576,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
*)
(* Public structures. *)
- List.iter (
+ let generate_all_structs = List.iter (
fun { s_name = typ; s_cols = cols } ->
pr "struct guestfs_%s {\n" typ;
List.iter (
@@ -603,7 +603,9 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
pr "extern GUESTFS_DLL_PUBLIC void guestfs_free_%s (struct guestfs_%s *);\n" typ typ;
pr "extern GUESTFS_DLL_PUBLIC void guestfs_free_%s_list (struct guestfs_%s_list *);\n" typ typ;
pr "\n"
- ) structs;
+ ) in
+
+ generate_all_structs external_structs;
pr "\
/* Actions. */
@@ -673,7 +675,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
pr "\n"
in
- List.iter (
+ let generate_all_headers = List.iter (
fun ({ name = name; style = ret, args, _ } as f) ->
(* If once_had_no_optargs is set, then we need to generate a
* <name>_opts variant, plus a backwards-compatible wrapper
@@ -685,18 +687,19 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char *
)
else
generate_action_header f
- ) all_functions_sorted;
+ ) in
+
+ generate_all_headers external_functions_sorted;
pr "\
-#if GUESTFS_PRIVATE_FUNCTIONS
-
-/* Private functions.
- *
- * These are NOT part of the public, stable API, and can change at any
- * time! We export them because they are used by some of the language
- * bindings.
+#if GUESTFS_PRIVATE
+/* Symbols protected by GUESTFS_PRIVATE are NOT part of the public,
+ * stable API, and can change at any time! We export them because
+ * they are used by some of the language bindings.
*/
+/* Private functions. */
+
extern GUESTFS_DLL_PUBLIC void *guestfs___safe_malloc (guestfs_h *g, size_t nbytes);
extern GUESTFS_DLL_PUBLIC void *guestfs___safe_calloc (guestfs_h *g, size_t n, size_t s);
extern GUESTFS_DLL_PUBLIC char *guestfs___safe_strdup (guestfs_h *g, const char *str);
@@ -704,7 +707,30 @@ extern GUESTFS_DLL_PUBLIC void *guestfs___safe_memdup (guestfs_h *g, const void
extern GUESTFS_DLL_PUBLIC int guestfs___for_each_disk (guestfs_h *g, /* virDomainPtr */ void *dom, int (*)(guestfs_h *g, const char *filename, const char *format, int readonly, void *data), void *data);
-#endif /* End of private functions. */
+";
+
+ generate_all_headers internal_functions_sorted;
+
+ pr "\
+/* Private structures. */
+
+";
+
+ generate_all_structs internal_structs;
+
+pr "\
+/* Deprecated macros for internal functions. */
+
+";
+
+ List.iter (
+ fun { name = shortname } ->
+ pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
+ ) internal_functions_sorted;
+
+pr "\
+
+#endif /* End of GUESTFS_PRIVATE. */
/* Deprecated macros. Use GUESTFS_HAVE_* instead. */
@@ -727,7 +753,7 @@ extern GUESTFS_DLL_PUBLIC int guestfs___for_each_disk (guestfs_h *g, /* virDomai
List.iter (
fun { name = shortname } ->
pr "#define LIBGUESTFS_HAVE_%s 1\n" (String.uppercase shortname);
- ) all_functions_sorted;
+ ) external_functions_sorted;
pr "
/* End of deprecated macros. */
diff --git a/generator/erlang.ml b/generator/erlang.ml
index 90c7d08..b7d4e6c 100644
--- a/generator/erlang.ml
+++ b/generator/erlang.ml
@@ -270,7 +270,7 @@ extern void free_strings (char **r);
pr " return erl_mk_list (t, %d);\n" (List.length cols);
pr "}\n";
pr "\n";
- ) structs;
+ ) external_structs;
(* Emit a copy_TYPE_list function definition only if that function is used. *)
List.iter (
diff --git a/generator/fish.ml b/generator/fish.ml
index f7e111f..077a0b4 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -279,7 +279,7 @@ Guestfish will prompt for these separately."
) cols;
pr "}\n";
pr "\n";
- ) structs;
+ ) external_structs;
(* Emit a print_TYPE_list function definition only if that function is used. *)
List.iter (
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 2000c13..519cb26 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -107,7 +107,7 @@ let filenames =
"session" :: "tristate" ::
(* structs *)
- List.map (fun { s_name = typ } -> "struct-" ^ typ) structs @
+ List.map (fun { s_name = typ } -> "struct-" ^ typ) external_structs @
(* optargs *)
List.map (function { name = name } -> "optargs-" ^ name) (
diff --git a/generator/main.ml b/generator/main.ml
index 69ebe05..1d35a53 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -170,7 +170,7 @@ Run it from the top source directory using the command
output_to filename (generate_gobject_struct_header short typ cols);
let filename = sprintf "gobject/src/%s.c" short in
output_to filename (generate_gobject_struct_source short typ cols)
- ) structs;
+ ) external_structs;
delete_except_generated "gobject/include/guestfs-gobject/struct-*.h";
delete_except_generated "gobject/src/struct-*.c";
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 15efa80..0b1f96b 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -422,7 +422,7 @@ copy_table (char * const * argv)
pr " CAMLreturn (rv);\n";
pr "}\n";
pr "\n";
- ) structs;
+ ) external_structs;
(* Emit a copy_TYPE_list function definition only if that function is used. *)
List.iter (
@@ -687,7 +687,7 @@ and generate_ocaml_structure_decls () =
) cols;
pr "}\n";
pr "\n"
- ) structs
+ ) external_structs
and generate_ocaml_prototype ?(is_external = false) name style =
if is_external then pr "external " else pr "val ";
diff --git a/generator/python.ml b/generator/python.ml
index 5bfb1b1..3863c71 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -240,7 +240,7 @@ free_strings (char **argv)
pr "};\n";
pr "\n";
- ) structs;
+ ) external_structs;
(* Emit a put_TYPE_list function definition only if that function is used. *)
List.iter (
diff --git a/generator/structs.ml b/generator/structs.ml
index 207da90..da52dfe 100644
--- a/generator/structs.ml
+++ b/generator/structs.ml
@@ -26,6 +26,7 @@ type struc = {
s_name : string;
s_cols : cols;
s_camel_name : string;
+ s_internal : bool;
s_unused : unit; (* Silences warning 23 when using 'defaults with ...' *)
}
@@ -94,7 +95,8 @@ let lvm_lv_cols = [
"modules", FString;
]
-let defaults = { s_name = ""; s_cols = []; s_camel_name = ""; s_unused = () }
+let defaults = { s_name = ""; s_cols = []; s_camel_name = "";
+ s_internal = false; s_unused = () }
(* Names and fields in all structures (in RStruct and RStructList)
* that we support.
@@ -369,3 +371,7 @@ let lookup_struct name =
let camel_name_of_struct name = (lookup_struct name).s_camel_name
let cols_of_struct name = (lookup_struct name).s_cols
+
+let external_structs = List.filter (fun x -> not x.s_internal) structs
+
+let internal_structs = List.filter (fun x -> x.s_internal) structs
diff --git a/generator/structs.mli b/generator/structs.mli
index f0c2ba6..20fba86 100644
--- a/generator/structs.mli
+++ b/generator/structs.mli
@@ -27,6 +27,7 @@ type struc = {
s_name : string; (** Regular name. *)
s_cols : cols; (** Columns. *)
s_camel_name : string; (** Camel-cased name. *)
+ s_internal : bool; (** Internal only. *)
s_unused : unit;
}
@@ -48,3 +49,9 @@ val camel_name_of_struct : string -> string
val cols_of_struct : string -> cols
(** Lookup struct by name, return the s_cols field. *)
+
+val external_structs : struc list
+(** Only external structs *)
+
+val internal_structs : struc list
+(** Only internal structs *)
diff --git a/generator/types.ml b/generator/types.ml
index 178dda2..26bf746 100644
--- a/generator/types.ml
+++ b/generator/types.ml
@@ -385,6 +385,8 @@ type action = {
fish_output : fish_output_t option; (* how to display output in guestfish *)
in_fish : bool; (* export via guestfish *)
in_docs : bool; (* add this function to documentation *)
+ internal: bool; (* function is not part of the
+ external api *)
deprecated_by : string option; (* function is deprecated, use .. instead *)
optional : string option; (* function is part of an optional group *)
progress : bool; (* function can generate progress messages *)
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index 864b6b1..a8efec3 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -52,6 +52,7 @@ libguestfs_gobject_1_0_ladir = $(includedir)/guestfs-gobject
libguestfs_gobject_1_0_la_HEADERS = $(guestfs_gobject_headers)
libguestfs_gobject_1_0_la_SOURCES = $(guestfs_gobject_sources)
libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/src -I$(srcdir)/include \
+ -DGUESTFS_PRIVATE=1 \
$(GOBJECT_CFLAGS)
libguestfs_gobject_1_0_la_LIBS = $(GOBJECT_LIBS)
libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/src
diff --git a/java/Makefile.am b/java/Makefile.am
index 449f40b..5f6499b 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -79,7 +79,7 @@ libguestfs_jni_la_SOURCES = \
libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) -shared
libguestfs_jni_la_CFLAGS = \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-I$(top_srcdir)/src -I$(top_builddir)/src \
$(JNI_CFLAGS)
diff --git a/lua/Makefile.am b/lua/Makefile.am
index 9b0f7de..621366e 100644
--- a/lua/Makefile.am
+++ b/lua/Makefile.am
@@ -41,6 +41,7 @@ libluaguestfs_la_SOURCES = lua-guestfs.c
libluaguestfs_la_CFLAGS = \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-I$(top_srcdir)/src -I$(top_builddir)/src \
+ -DGUESTFS_PRIVATE=1 \
$(LUA_CFLAGS)
libluaguestfs_la_LIBADD = $(top_builddir)/src/libguestfs.la
libluaguestfs_la_LDFLAGS = -avoid-version -shared
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 3bd2a78..f935282 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -64,7 +64,7 @@ mlguestfs.cmxa: libguestfsocaml.a guestfs.cmx
-L$(top_builddir)/src/.libs -lguestfs
libguestfsocaml_a_CFLAGS = \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
-I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
-I$(top_srcdir)/src -I$(top_builddir)/src \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index 11a976a..5487e98 100644
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -27,5 +27,5 @@ WriteMakefile (
LIBS => '-L@top_builddir@/src/.libs -lguestfs',
INC => '-I@top_builddir@/src -I@top_srcdir@/src',
TYPEMAPS => [ '@srcdir@/typemap' ],
- CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE_FUNCTIONS=1 @CFLAGS@',
+ CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE=1 @CFLAGS@',
);
diff --git a/php/Makefile.am b/php/Makefile.am
index 220f13a..a369060 100644
--- a/php/Makefile.am
+++ b/php/Makefile.am
@@ -43,6 +43,7 @@ all: extension/config.h
$(MAKE) -C extension \
EXTRA_INCLUDES="-I$(abs_srcdir)/../src" \
EXTRA_LDFLAGS="-L$(abs_srcdir)/../src/.libs -lguestfs" \
+ EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \
all
extension/config.h: extension/config.m4 ../config.status
diff --git a/python/Makefile.am b/python/Makefile.am
index d03bfcf..209f9ca 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -41,7 +41,7 @@ python_LTLIBRARIES = libguestfsmod.la
libguestfsmod_la_SOURCES = guestfs-py.c guestfs-py.h guestfs-py-byhand.c
libguestfsmod_la_CFLAGS = \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-I$(PYTHON_INCLUDEDIR) \
-I$(top_srcdir)/src -I$(top_builddir)/src
diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in
index 15259ea..269ca81 100644
--- a/ruby/ext/guestfs/extconf.rb.in
+++ b/ruby/ext/guestfs/extconf.rb.in
@@ -30,7 +30,7 @@ unless have_library("guestfs", "guestfs_create", "guestfs.h")
end
$CFLAGS =
- "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE_FUNCTIONS=1 " <<
+ "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " <<
"@WARN_CFLAGS@ @WERROR_CFLAGS@"
create_header
diff --git a/src/Makefile.am b/src/Makefile.am
index 1057245..acdbe74 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,7 +195,7 @@ libguestfs_la_LIBADD += liberrnostring.la libprotocol.la
libguestfs_la_CFLAGS = \
-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
-DGUESTFS_WARN_DEPRECATED=1 \
- -DGUESTFS_PRIVATE_FUNCTIONS=1 \
+ -DGUESTFS_PRIVATE=1 \
-DLIBOSINFO_DB_PATH='"$(datadir)/libosinfo/db"' \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS) \
diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am
index 25078c9..0b664d3 100644
--- a/tests/c-api/Makefile.am
+++ b/tests/c-api/Makefile.am
@@ -72,6 +72,7 @@ TESTS_ENVIRONMENT = \
tests_SOURCES = tests.c
tests_CFLAGS = \
-I$(top_srcdir)/src -I$(top_builddir)/src \
+ -DGUESTFS_PRIVATE=1 \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS)
tests_LDADD = $(top_builddir)/src/libguestfs.la
--
1.8.1
2
1
Without this change all the tests in the haskell bindings are rebuilt
every time. The primary motivation for this change is to fix this.
The fix for the above also allows parallel builds to be re-enabled.
---
haskell/Makefile.am | 56 +++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 15 deletions(-)
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index 531e404..5328ca0 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -46,25 +46,51 @@ $(all_targets): $(top_builddir)/src/libguestfs.la
all: $(all_targets)
-Guestfs.o: $(srcdir)/Guestfs.hs
- $(GHC) $(GHCFLAGS) -c $< -o $@
+built_tests = Bindtests Guestfs010Load Guestfs030Config Guestfs050LVCreate
-Bindtests: $(srcdir)/Bindtests.hs Guestfs.o
- $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
+# Building with ghc --make doesn't work properly here because it
+# always rebuilds Guestfs.o despite it being up to date. So if you:
+#
+# * build Guestfs010Load, then build it again, the second time it will
+# not be rebuilt.
+#
+# * build Guestfs010Load, then build Guestfs030Config, then build
+# Guestfs010Load again, it will be rebuilt every time.
+#
+# In the second case, building Guestfs030Config rebuilt Guestfs.o. As
+# this is a dependency of Guestfs010Load, Guestfs010Load is now
+# unnecessarily out of date.
+#
+# Because the default target builds all of the above, they will all be
+# rebuilt every time.
+#
+# An obvious choice would be to remove the Guestfs.o dependency, but
+# this would potentially result in corruption during a parallel build
+# as multiple ghc processes rebuild Guestfs.o simultaneously. I had
+# hoped that the solution below would work. It correctly builds
+# Guestfs010Load and Guestfs030Config, but Guestfs050LVCreate requires
+# additional link options which I haven't been able to work out.
+
+#Guestfs.o: $(srcdir)/Guestfs.hs
+# $(GHC) $(GHCFLAGS) -c $< -o $@
+#
+#$(built_tests:%=%.o): %.o: %.hs Guestfs.o
+# $(GHC) $(GHCFLAGS) -main-is $(basename $<) -c $< -o $@
+#
+#$(built_tests): %: %.o Guestfs.o
+# $(GHC) $(GHCFLAGS) -main-is $@ -o $@ $< Guestfs.o -lguestfs
-Guestfs010Load: $(srcdir)/Guestfs010Load.hs Guestfs.o
- $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
+# The solution below isn't ideal. It uses --make and avoids the
+# parallel make problem by putting object files in separate
+# directories per target.
-Guestfs030Config: $(srcdir)/Guestfs030Config.hs Guestfs.o
- $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
+$(built_tests): %: %.hs Guestfs.hs
+ $(GHC) $(GHCFLAGS) --make -main-is $@ -odir .$@ -o $@ $< Guestfs.hs -lguestfs
-Guestfs050LVCreate: $(srcdir)/Guestfs050LVCreate.hs Guestfs.o
- $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
-CLEANFILES = $(all_targets) *~ *.hi *.o
+CLEANFILES = $(all_targets) *~ *.hi *.o test.img
-endif
+clean-local:
+ -rm -rf $(built_tests:%=.%)
-# Building in parallel causes linker corruption errors since it
-# appears that multiple runs of ghc conflict with each other.
-.NOTPARALLEL:
+endif
--
1.8.1
1
0
[PATCH] build: Add common rule for sources shared between daemon and library
by Matthew Booth 29 Jan '13
by Matthew Booth 29 Jan '13
29 Jan '13
---
daemon/Makefile.am | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index b7731ac..e1e2a10 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -39,6 +39,17 @@ EXTRA_DIST = \
$(BUILT_SOURCES) \
guestfsd.pod
+SHARED_WITH_LIBRARY = \
+ guestfs_protocol.c \
+ guestfs_protocol.h \
+ errnostring-gperf.gperf \
+ errnostring.c \
+ errnostring.h
+
+$(SHARED_WITH_LIBRARY): %: $(libsrcdir)/%
+ rm -f $@
+ ln $< $@
+
noinst_LIBRARIES = libprotocol.a
# This convenience library is solely to compile its generated sources with
@@ -46,12 +57,6 @@ noinst_LIBRARIES = libprotocol.a
libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h
libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
-guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
- rm -f $@
- ln $< $@
-guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
- rm -f $@
- ln $< $@
$(libsrcdir)/guestfs_protocol.c: force
$(MAKE) -C $(libsrcdir) guestfs_protocol.c
$(libsrcdir)/guestfs_protocol.h: force
@@ -70,15 +75,6 @@ errnostring-gperf.c: errnostring-gperf.gperf
rm -f $@
$(GPERF) -t $< > $@-t
mv $@-t $@
-errnostring-gperf.gperf: $(libsrcdir)/errnostring-gperf.gperf
- rm -f $@
- ln $< $@
-errnostring.c: $(libsrcdir)/errnostring.c
- rm -f $@
- ln $< $@
-errnostring.h: $(libsrcdir)/errnostring.h
- rm -f $@
- ln $< $@
if INSTALL_DAEMON
sbin_PROGRAMS = guestfsd
--
1.8.1
1
0
Currently Fedora packages are broken. You'll see this error when
libguestfs tries any inspection-related operation:
aug_init: Augeas initialization failed
The bug and explanation is here (thanks Dominic Cleal):
https://bugzilla.redhat.com/show_bug.cgi?id=894241#c11
This bug is fixed in the following packages:
Fedora 17: http://koji.fedoraproject.org/koji/buildinfo?buildID=379590 [*]
Fedora 18: http://koji.fedoraproject.org/koji/buildinfo?buildID=378954
Rawhide: http://koji.fedoraproject.org/koji/buildinfo?buildID=379391 [*]
[*] = at time of writing, still building
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
2
3