enable build for ocaml bytecode
by Olaf Hering
This is a first attempt to build libguestfs with just a ocaml bytecode
compiler. The three tools written in ocaml will be build only when an
ocamlopt compiler is available.
Olaf
---
Makefile.am | 5 ++++-
configure.ac | 2 ++
ocaml/Makefile.am | 20 +++++++++++++++++---
resize/Makefile.am | 2 +-
sparsify/Makefile.am | 2 +-
sysprep/Makefile.am | 2 +-
6 files changed, 26 insertions(+), 7 deletions(-)
Index: libguestfs-1.20.1/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/Makefile.am
+++ libguestfs-1.20.1/Makefile.am
@@ -74,7 +74,10 @@ if HAVE_PERL
SUBDIRS += perl perl/examples
endif
if HAVE_OCAML
-SUBDIRS += ocaml ocaml/examples
+SUBDIRS += ocaml
+endif
+if HAVE_OCAMLOPT
+SUBDIRS += ocaml/examples
endif
if HAVE_PYTHON
SUBDIRS += python python/examples
Index: libguestfs-1.20.1/configure.ac
===================================================================
--- libguestfs-1.20.1.orig/configure.ac
+++ libguestfs-1.20.1/configure.ac
@@ -865,6 +865,8 @@ AS_IF([test "x$enable_ocaml" != "xno"],
])
AM_CONDITIONAL([HAVE_OCAML],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+ [test "x$OCAMLOPT" != "xno" && test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
AM_CONDITIONAL([HAVE_OCAMLDOC],
[test "x$OCAMLDOC" != "xno"])
Index: libguestfs-1.20.1/ocaml/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/ocaml/Makefile.am
+++ libguestfs-1.20.1/ocaml/Makefile.am
@@ -43,10 +43,20 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/
if HAVE_OCAML
+DATA_HOOK_FILES = META *.so *.a *.cma \
+ *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
-noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
+noinst_DATA = mlguestfs.cma
+if HAVE_OCAMLOPT
+noinst_DATA += mlguestfs.cmxa
+endif
+noinst_DATA += META
# Build the C part into a library, so that automake handles the C
# compilation step for us. Note that we don't directly use this
@@ -101,9 +111,13 @@ TESTS = run-bindtests \
$(patsubst %,%.opt,$(test_progs)))
noinst_DATA += \
- bindtests.bc bindtests.opt \
+ bindtests.bc
+if HAVE_OCAMLOPT
+noinst_DATA += \
+ bindtests.opt \
$(test_progs:%=%.bc) \
$(test_progs:%=%.opt)
+endif
bindtests.bc: bindtests.cmo mlguestfs.cma
mkdir -p t
@@ -217,7 +231,7 @@ install-data-hook:
$(OCAMLFIND) install \
-ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
Index: libguestfs-1.20.1/resize/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/resize/Makefile.am
+++ libguestfs-1.20.1/resize/Makefile.am
@@ -40,7 +40,7 @@ SOURCES = \
resize_utils.ml \
resize_utils_tests.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sparsify/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sparsify/Makefile.am
+++ libguestfs-1.20.1/sparsify/Makefile.am
@@ -36,7 +36,7 @@ SOURCES = \
sparsify_gettext.ml \
sparsify_utils.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sysprep/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sysprep/Makefile.am
+++ libguestfs-1.20.1/sysprep/Makefile.am
@@ -86,7 +86,7 @@ SOURCES = \
utils.ml \
utils.mli
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
10 years, 9 months
[PATCH] sysprep: handle distro specific sysv scripts
by Olaf Hering
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
- make sure scripts exists and can be executed
- add LSB header to avoid insserv warnings later on
- run script only if called with "start"
Update functions, pass only required options.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
index 97cd8a9..c5296a1 100644
--- a/sysprep/firstboot.ml
+++ b/sysprep/firstboot.ml
@@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
let firstboot_sh = sprintf "\
#!/bin/sh -
+### BEGIN INIT INFO
+# Provides: virt-sysprep
+# Required-Start: $null
+# Should-Start: $all
+# Required-Stop: $null
+# Should-Stop: $all
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start scripts to run once at next boot
+# Description: Start scripts to run once at next boot
+# These scripts run the first time the guest boots,
+# and then are deleted. Output or errors from the scripts
+# are written to ~root/virt-sysprep-firstboot.log.
+### END INIT INFO
+
d=%s/scripts
logfile=~root/virt-sysprep-firstboot.log
-for f in $d/* ; do
- echo '=== Running' $f '===' >>$logfile
- $f >>$logfile 2>&1
- rm $f
-done
+if test \"$1\" = \"start\"
+then
+ for f in $d/* ; do
+ if test -x \"$f\"
+ then
+ echo '=== Running' $f '===' >>$logfile
+ $f >>$logfile 2>&1
+ rm -f $f
+ fi
+ done
+fi
" firstboot_dir
let firstboot_service = sprintf "\
@@ -56,7 +77,7 @@ WantedBy=default.target
let failed fs =
ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs
-let rec install_service g root =
+let rec install_service g distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -64,18 +85,18 @@ let rec install_service g root =
(* systemd, else assume sysvinit *)
if g#is_dir "/etc/systemd" then
- install_systemd_service g root
+ install_systemd_service g
else
- install_sysvinit_service g root
+ install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
-and install_systemd_service g root =
+and install_systemd_service g =
g#write (sprintf "%s/firstboot.service" firstboot_dir) firstboot_service;
g#mkdir_p "/etc/systemd/system/default.target.wants";
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
-and install_sysvinit_service g root =
+and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
g#mkdir_p "/etc/rc.d/rc3.d";
g#mkdir_p "/etc/rc.d/rc5.d";
@@ -86,12 +107,51 @@ and install_sysvinit_service g root =
g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
"/etc/rc.d/rc5.d/99virt-sysprep-firstboot"
+(* Make firstboot.sh look like a runlevel script to avoid insserv warnings. *)
+and install_sysvinit_suse g =
+ g#mkdir_p "/etc/init.d/rc2.d";
+ g#mkdir_p "/etc/init.d/rc3.d";
+ g#mkdir_p "/etc/init.d/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_debian g =
+ g#mkdir_p "/etc/init.d";
+ g#mkdir_p "/etc/rc2.d";
+ g#mkdir_p "/etc/rc3.d";
+ g#mkdir_p "/etc/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_service g distro =
+ match distro with
+ | ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") ->
+ install_sysvinit_redhat g
+ | ("opensuse"|"sles"|"suse-based") ->
+ install_sysvinit_suse g
+ | "debian" ->
+ install_sysvinit_debian g
+ | _ ->
+ failed "guest type %s is not supported" distro
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12
11 years
virt-sparsify & TMPDIR
by Evaggelos Balaskas
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
11 years, 10 months
[PATCH] tests: Handle changing QEMUDIR
by Cole Robinson
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
11 years, 10 months
[PATCH] Make internal-only functions and structures private
by Matthew Booth
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(a)/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
11 years, 10 months
[PATCH] build: Fix haskell dependencies and parallel build
by Matthew Booth
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
11 years, 10 months
[PATCH] build: Add common rule for sources shared between daemon and library
by Matthew Booth
---
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
11 years, 10 months
[PATCH 0/3] Use __attribute__((cleanup(...)))
by Richard W.M. Jones
This patch series changes a small part of the library to use
__attribute__((cleanup(...))) to automatically free memory when
pointers go out of the current scope.
In general terms this seems to be a small win although you do have to
use it carefully. For functions where you can completely get rid of
the "exit code paths", it can simplify things. For a good example,
see the 'inspect-icon.c:icon_windows_xp' function before and after the
change. For most functions there is no change or a minor
simplification.
It can however cause problems if you accidentally put a CLEANUP_FREE
annotation on a pointer which is actually returned from the function,
or if you explicitly free something.
If we make this change, then the library will leak memory when
compiled with something that isn't GCC/LLVM. It's likely we have
other dependencies on GCC, since we've never seriously tried compiling
the library with any other compiler.
References
----------
GCC manual:
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html
Previous attempt:
https://www.redhat.com/archives/libguestfs/2013-January/thread.html#00068
11 years, 10 months