Fwd: hivex: patch for read support of "li"-records from "ri" intermediate
by Richard W.M. Jones
[The bug which this fixes is:
https://bugzilla.redhat.com/show_bug.cgi?id=717583 ]
----- Forwarded message from Peter Fokker <peter(a)berestijn.nl> -----
Date: Thu, 8 Mar 2012 11:37:06 +0100 (CET)
From: Peter Fokker <peter(a)berestijn.nl>
To: rjones(a)redhat.com
Cc: Peter Fokker <peter(a)berestijn.nl>
Subject: hivex: patch for read support of "li"-records from "ri"
intermediate
User-Agent: SquirrelMail/1.4.9a
Richard,
Thank you for creating the hivex-library. Studying your source code helped
me a great deal to better understand the internals of the Windows Registry.
However, while I was browsing a real-world SOFTWARE-hive (XP, SP3) I
could not browse to the '\Classes' key. Instead I got this (debug)-message:
get_children: returning ENOTSUP because ri-record offset does not
point to lf/lh (0x49020)
I tracked this issue down and I discovered that the intermediate
"ri"-record may not only contain offsets to "lf" and "lh" but to
"li"-records too.
Attached is a patch against hivex.c v1.3.3 that recognises
"li"-records referenced from "ri"-records. For me this fixed the issue
with browsing the '\Classes' key.
Note that I have not fixed the related problem of rewriting
"li"-records when inserting a new subkey or deleting an
existing one. This sure would cause problems when I were to
add/delete a subkey to/from '\Classes'.
I would very much appreciate it if would be so kind to take a look at
my patch, allthough I cannot blame you if you immediately dump this
unsollicited message+patch from some random stranger from The Netherlands.
Kind regards,
--Peter Fokker
--
Peter Fokker <peter(a)berestijn.nl>
Ingenieursbureau PSD +31 35 695 29 99 / +31 644 238 568
Stargardlaan 7 1404 BC Bussum, The Netherlands
----- End forwarded message -----
--
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
12 years, 2 months
[PATCH v6] hivexml: Add byte run reporting functions
by Alex Nelson
This patch adds value_byte_runs and node_byte_runs. Each byte run
represents the offset and length of a data structure within the hive,
one per node, and one or two per value depending on the length of the
value data.
These byte run functions also add additional data sanity checks as a
hive is being parsed, mainly checking that a node address actually
points to a node, and similarly for values.
---
xml/hivexml.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 96 insertions(+), 9 deletions(-)
diff --git a/xml/hivexml.c b/xml/hivexml.c
index 54d9049..a4bc7eb 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -210,11 +210,40 @@ filetime_to_8601 (int64_t windows_ticks)
return ret;
}
+#define BYTE_RUN_BUF_LEN 32
+
+static int
+node_byte_runs (hive_h *h, void *writer_v, hive_node_h node)
+{
+ xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ char buf[1+BYTE_RUN_BUF_LEN];
+ errno = 0;
+ size_t node_struct_length = hivex_node_struct_length (h, node);
+ if (errno) {
+ if (errno == EINVAL) {
+ fprintf (stderr, "node_byte_runs: Invoked on what does not seem to be a node (%zu).\n", node);
+ }
+ return -1;
+ }
+ /* A node has one byte run. */
+ XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_runs"));
+ XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_run"));
+ memset (buf, 0, 1+BYTE_RUN_BUF_LEN);
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", node);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "file_offset", BAD_CAST buf));
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", node_struct_length);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "len", BAD_CAST buf));
+ XML_CHECK (xmlTextWriterEndElement, (writer));
+ XML_CHECK (xmlTextWriterEndElement, (writer));
+ return 0;
+}
+
static int
node_start (hive_h *h, void *writer_v, hive_node_h node, const char *name)
{
int64_t last_modified;
char *timebuf;
+ int ret = 0;
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "node"));
@@ -235,7 +264,8 @@ node_start (hive_h *h, void *writer_v, hive_node_h node, const char *name)
}
}
- return 0;
+ ret = node_byte_runs (h, writer_v, node);
+ return ret;
}
static int
@@ -267,11 +297,53 @@ end_value (xmlTextWriterPtr writer)
}
static int
+value_byte_runs (hive_h *h, void *writer_v, hive_value_h value) {
+ xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ char buf[1+BYTE_RUN_BUF_LEN];
+ size_t value_data_cell_length;
+ errno = 0;
+ size_t value_data_structure_length = hivex_value_struct_length (h, value);
+ if (errno != 0) {
+ if (errno == EINVAL) {
+ fprintf (stderr, "value_byte_runs: Invoked on what does not seem to be a value (%zu).\n", value);
+ }
+ return -1;
+ }
+ hive_value_h value_data_cell_offset = hivex_value_data_cell_offset (h, value, &value_data_cell_length);
+ if (errno != 0)
+ return -1;
+
+ XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_runs"));
+ memset (buf, 0, 1+BYTE_RUN_BUF_LEN);
+
+ /* Write first byte run for data structure */
+ XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_run"));
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", value);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "file_offset", BAD_CAST buf));
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", value_data_structure_length);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "len", BAD_CAST buf));
+ XML_CHECK (xmlTextWriterEndElement, (writer));
+
+ /* Write second byte run for longer values */
+ if (value_data_cell_length > 4) {
+ XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "byte_run"));
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", value_data_cell_offset);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "file_offset", BAD_CAST buf));
+ snprintf (buf, 1+BYTE_RUN_BUF_LEN, "%zu", value_data_cell_length);
+ XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "len", BAD_CAST buf));
+ XML_CHECK (xmlTextWriterEndElement, (writer));
+ }
+ XML_CHECK (xmlTextWriterEndElement, (writer));
+ return 0;
+}
+
+static int
value_string (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
hive_type t, size_t len, const char *key, const char *str)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
const char *type;
+ int ret = 0;
switch (t) {
case hive_t_string: type = "string"; break;
@@ -297,8 +369,9 @@ value_string (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "value"));
XML_CHECK (xmlTextWriterWriteString, (writer, BAD_CAST str));
XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -307,6 +380,7 @@ value_multiple_strings (hive_h *h, void *writer_v, hive_node_h node,
const char *key, char **argv)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ int ret = 0;
start_value (writer, key, "string-list", NULL);
size_t i;
@@ -316,8 +390,9 @@ value_multiple_strings (hive_h *h, void *writer_v, hive_node_h node,
XML_CHECK (xmlTextWriterEndElement, (writer));
}
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -328,6 +403,7 @@ value_string_invalid_utf16 (hive_h *h, void *writer_v, hive_node_h node,
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
const char *type;
+ int ret = 0;
switch (t) {
case hive_t_string: type = "bad-string"; break;
@@ -353,9 +429,10 @@ value_string_invalid_utf16 (hive_h *h, void *writer_v, hive_node_h node,
XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "value"));
XML_CHECK (xmlTextWriterWriteBase64, (writer, str, 0, len));
XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -363,10 +440,12 @@ value_dword (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
hive_type t, size_t len, const char *key, int32_t v)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ int ret = 0;
start_value (writer, key, "int32", NULL);
XML_CHECK (xmlTextWriterWriteFormatAttribute, (writer, BAD_CAST "value", "%" PRIi32, v));
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -374,10 +453,12 @@ value_qword (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
hive_type t, size_t len, const char *key, int64_t v)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ int ret = 0;
start_value (writer, key, "int64", NULL);
XML_CHECK (xmlTextWriterWriteFormatAttribute, (writer, BAD_CAST "value", "%" PRIi64, v));
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -385,12 +466,14 @@ value_binary (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
hive_type t, size_t len, const char *key, const char *v)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ int ret = 0;
start_value (writer, key, "binary", "base64");
XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "value"));
XML_CHECK (xmlTextWriterWriteBase64, (writer, v, 0, len));
XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ ret = value_byte_runs (h, writer_v, value);
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -398,14 +481,16 @@ value_none (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
hive_type t, size_t len, const char *key, const char *v)
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
+ int ret = 0;
start_value (writer, key, "none", "base64");
if (len > 0) {
XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "value"));
XML_CHECK (xmlTextWriterWriteBase64, (writer, v, 0, len));
XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ ret = value_byte_runs (h, writer_v, value);
}
end_value (writer);
- return 0;
+ return ret;
}
static int
@@ -414,6 +499,7 @@ value_other (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
{
xmlTextWriterPtr writer = (xmlTextWriterPtr) writer_v;
const char *type;
+ int ret = 0;
switch (t) {
case hive_t_none:
@@ -440,8 +526,9 @@ value_other (hive_h *h, void *writer_v, hive_node_h node, hive_value_h value,
XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "value"));
XML_CHECK (xmlTextWriterWriteBase64, (writer, v, 0, len));
XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ ret = value_byte_runs (h, writer_v, value);
}
end_value (writer);
- return 0;
+ return ret;
}
--
1.7.4.4
12 years, 7 months
[PATCH 0/4 v1] Remove gettextify, implement OCaml gettext.
by Richard W.M. Jones
Version 1 of the patch, for discussion, but not to be applied. It
does work, but needs a lot more testing.
This removes all the psychopathic gettextify cruft, and replaces it
with a 99 line Makefile.am. A large win, I think.
The third patch implements gettext support in the OCaml tools.
The fourth patch is just for illustration. It shows the consequent
changes to libguestfs.pot and the po files.
Rich.
12 years, 7 months
[PATCH 1/2] sysprep: remove the logfiles configured by logrotate
by Wanlong Gao
Remove the logfiles configured by /etc/logrotate.d/*.
Omit the logfile of "samba" and "sssd" which we removed
them separately .
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
sysprep/sysprep_operation_logfiles.ml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/sysprep/sysprep_operation_logfiles.ml b/sysprep/sysprep_operation_logfiles.ml
index 2ad3726..cf72803 100644
--- a/sysprep/sysprep_operation_logfiles.ml
+++ b/sysprep/sysprep_operation_logfiles.ml
@@ -38,6 +38,27 @@ let globs = List.sort compare [
"/var/log/tallylog*";
"/var/log/wtmp*";
+ (* logfiles configured by /etc/logrotate.d/* *)
+ "/var/log/BackupPC/LOG";
+ "/var/log/ceph/*.log";
+ "/var/log/chrony/*.log";
+ "/var/log/cups/*_log";
+ "/var/log/glusterfs/*glusterd.vol.log";
+ "/var/log/glusterfs/glusterfs.log";
+ "/var/log/httpd/*log";
+ "/var/log/jetty/jetty-console.log";
+ "/var/log/libvirt/libvirtd.log";
+ "/var/log/libvirt/lxc/*.log";
+ "/var/log/libvirt/qemu/*.log";
+ "/var/log/libvirt/uml/*.log";
+ "/var/named/data/named.run";
+ "/var/log/ppp/connect-errors";
+ "/var/account/pacct";
+ "/var/log/setroubleshoot/*.log";
+ "/var/log/squid/*.log";
+ (* And the status file of logrotate *)
+ "/var/lib/logrotate.status";
+
(* yum installation files *)
"/root/install.log";
"/root/install.log.syslog";
--
1.7.10
12 years, 8 months
[PATCH 1/2] gobject: Use generator_built macro to ensure generated files are rebuilt properly.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
---
generator/generator_gobject.ml | 4 ++--
gobject/Makefile.am | 14 +++++++++-----
gobject/Makefile.inc | 4 ++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/generator/generator_gobject.ml b/generator/generator_gobject.ml
index 17c6c36..3096501 100644
--- a/generator/generator_gobject.ml
+++ b/generator/generator_gobject.ml
@@ -193,9 +193,9 @@ let generate_gobject_makefile () =
let sources =
List.map (function n -> sprintf "src/%s.c" n) output_filenames
in
- pr "guestfs_gobject_headers=\\\n include/guestfs-gobject.h \\\n %s\n\n"
+ pr "guestfs_gobject_headers= \\\n include/guestfs-gobject.h \\\n %s\n\n"
(String.concat " \\\n " headers);
- pr "guestfs_gobject_sources=\\\n %s\n" (String.concat " \\\n " sources)
+ pr "guestfs_gobject_sources= \\\n %s\n" (String.concat " \\\n " sources)
let generate_gobject_header () =
generate_header CStyle GPLv2plus;
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index e28a8b1..1aa2e0f 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -17,15 +17,19 @@
SUBDIRS = . docs
+include $(top_srcdir)/subdir-rules.mk
+
include $(srcdir)/Makefile.inc
-BUILT_SOURCES = \
- $(guestfs_gobject_headers) \
- $(guestfs_gobject_sources) \
- bindtests.js
+generator_built = \
+ $(guestfs_gobject_headers) \
+ $(guestfs_gobject_sources) \
+ bindtests.js
+
+BUILT_SOURCES = $(generator_built)
EXTRA_DIST = \
- $(BUILT_SOURCES) \
+ $(generator_built) \
TODO.txt \
bindtests-manual.js \
tests-misc.js \
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 22ea052..c912fef 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -19,7 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-guestfs_gobject_headers=\
+guestfs_gobject_headers= \
include/guestfs-gobject.h \
include/guestfs-gobject/session.h \
include/guestfs-gobject/tristate.h \
@@ -62,7 +62,7 @@ guestfs_gobject_headers=\
include/guestfs-gobject/optargs-mkfs_btrfs.h \
include/guestfs-gobject/optargs-set_e2attrs.h
-guestfs_gobject_sources=\
+guestfs_gobject_sources= \
src/session.c \
src/tristate.c \
src/struct-int_bool.c \
--
1.7.10
12 years, 8 months
[PATCH] Fix broken POD in btrfs_subvolume_set_default
by Matthew Booth
---
generator/generator_actions.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index c237061..a8009f5 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -7180,7 +7180,7 @@ which is mounted at C<fs>.");
"set default btrfs subvolume",
"\
Set the subvolume of the btrfs filesystem C<fs> which will
-be mounted by default. See <guestfs_btrfs_subvolume_list> to
+be mounted by default. See L<guestfs_btrfs_subvolume_list> to
get a list of subvolumes.");
("btrfs_filesystem_sync", (RErr, [Pathname "fs"], []), 327, [Optional "btrfs"; CamelName "BTRFSFilesystemSync"],
--
1.7.10
12 years, 8 months
[PATCH] gobject: Move headers into a subdirectory
by Matthew Booth
The gobject bindings generate a large number of header files, which pollute
/usr/include when installed. This patch moves them all into a guestfs-gobject/
subdirectory. guestfs-gobject.h remains in the same place.
This change also moves generated source files into src/, because it makes the
gobject directory a bit tidier.
---
generator/Makefile.am | 3 +
generator/generator_gobject.ml | 20 ++---
gobject/.gitignore | 3 +
gobject/Makefile.am | 5 +-
gobject/Makefile.inc | 162 ++++++++++++++++++++--------------------
gobject/docs/Makefile.am | 8 +-
6 files changed, 104 insertions(+), 97 deletions(-)
create mode 100644 gobject/.gitignore
diff --git a/generator/Makefile.am b/generator/Makefile.am
index fd37f67..eb6b79d 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -107,6 +107,9 @@ stamp-generator: generator
mkdir -p $(top_srcdir)/ruby/ext/guestfs
mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
mkdir -p $(top_srcdir)/csharp
+ mkdir -p $(top_srcdir)/gobject/src
+ mkdir -p $(top_srcdir)/gobject/include
+ mkdir -p $(top_srcdir)/gobject/include/guestfs-gobject
cd $(top_srcdir) && generator/generator
CLEANFILES = $(noinst_DATA) $(noinst_PROGRAM) *.cmi *.cmo *~
diff --git a/generator/generator_gobject.ml b/generator/generator_gobject.ml
index 312ecb4..17c6c36 100644
--- a/generator/generator_gobject.ml
+++ b/generator/generator_gobject.ml
@@ -126,7 +126,7 @@ let output_filenames =
)
let output_header filename f =
- let header = sprintf "gobject/guestfs-gobject-%s.h" filename in
+ let header = sprintf "gobject/include/guestfs-gobject/%s.h" filename in
let guard = Str.global_replace (Str.regexp "-") "_" filename in
let guard = "GUESTFS_GOBJECT_" ^ String.uppercase guard ^ "_H__" in
output_to header (fun () ->
@@ -152,15 +152,14 @@ G_END_DECLS
)
let output_source filename ?(title=None) ?(shortdesc=None) ?(longdesc=None) f =
- let file = sprintf "guestfs-gobject-%s" filename in
- let source = sprintf "gobject/%s.c" file in
+ let source = sprintf "gobject/src/%s.c" filename in
output_to source (fun () ->
generate_header CStyle GPLv2plus;
pr "#include \"guestfs-gobject.h\"\n\n";
pr "/**\n";
- pr " * SECTION:%s\n" file;
+ pr " * SECTION:%s\n" filename;
(match title with
| Some title ->
@@ -188,19 +187,20 @@ let output_source filename ?(title=None) ?(shortdesc=None) ?(longdesc=None) f =
let generate_gobject_makefile () =
generate_header HashStyle GPLv2plus;
let headers =
- List.map (function n -> sprintf "guestfs-gobject-%s.h" n) output_filenames
+ List.map
+ (function n -> sprintf "include/guestfs-gobject/%s.h" n) output_filenames
in
let sources =
- List.map (function n -> sprintf "guestfs-gobject-%s.c" n) output_filenames
+ List.map (function n -> sprintf "src/%s.c" n) output_filenames
in
- pr "guestfs_gobject_headers=\\\n guestfs-gobject.h \\\n %s\n\n"
+ pr "guestfs_gobject_headers=\\\n include/guestfs-gobject.h \\\n %s\n\n"
(String.concat " \\\n " headers);
pr "guestfs_gobject_sources=\\\n %s\n" (String.concat " \\\n " sources)
let generate_gobject_header () =
generate_header CStyle GPLv2plus;
List.iter
- (function f -> pr "#include <guestfs-gobject-%s.h>\n" f)
+ (function f -> pr "#include <guestfs-gobject/%s.h>\n" f)
output_filenames
let generate_gobject_doc_title () =
@@ -216,7 +216,7 @@ let generate_gobject_doc_title () =
";
List.iter (
- function n -> pr " <xi:include href=\"xml/guestfs-gobject-%s.xml\"/>\n" n
+ function n -> pr " <xi:include href=\"xml/%s.xml\"/>\n" n
) output_filenames;
pr "</chapter>\n"
@@ -1286,7 +1286,7 @@ guestfs_session_close(GuestfsSession *session, GError **err)
let generate_gobject () =
output_to "gobject/Makefile.inc" generate_gobject_makefile;
- output_to "gobject/guestfs-gobject.h" generate_gobject_header;
+ output_to "gobject/include/guestfs-gobject.h" generate_gobject_header;
output_to "gobject/docs/guestfs-title.sgml" generate_gobject_doc_title;
generate_gobject_structs;
diff --git a/gobject/.gitignore b/gobject/.gitignore
new file mode 100644
index 0000000..9dbad7b
--- /dev/null
+++ b/gobject/.gitignore
@@ -0,0 +1,3 @@
+# Generated sources
+/include
+/src
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index d482d21..e28a8b1 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -39,7 +39,8 @@ libguestfs_gobject_1_0_ladir = $(includedir)
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 $(GOBJECT_CFLAGS)
+libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/src -I$(srcdir)/include \
+ $(GOBJECT_CFLAGS)
libguestfs_gobject_1_0_la_LIBS = $(GOBJECT_LIBS)
libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/src
libguestfs_gobject_1_0_la_LIBADD = -lguestfs
@@ -56,7 +57,7 @@ introspection_sources = \
Guestfs-1.0.gir: $(libname)
Guestfs_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
-Guestfs_1_0_gir_CFLAGS = $(INCLUDES) -I$(srcdir)
+Guestfs_1_0_gir_CFLAGS = $(INCLUDES) -I$(srcdir)/include
Guestfs_1_0_gir_LIBS = $(libname)
Guestfs_1_0_gir_FILES = $(introspection_sources)
INTROSPECTION_GIRS += Guestfs-1.0.gir
diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
index 69bb44b..22ea052 100644
--- a/gobject/Makefile.inc
+++ b/gobject/Makefile.inc
@@ -20,86 +20,86 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
guestfs_gobject_headers=\
- guestfs-gobject.h \
- guestfs-gobject-session.h \
- guestfs-gobject-tristate.h \
- guestfs-gobject-struct-int_bool.h \
- guestfs-gobject-struct-lvm_pv.h \
- guestfs-gobject-struct-lvm_vg.h \
- guestfs-gobject-struct-lvm_lv.h \
- guestfs-gobject-struct-stat.h \
- guestfs-gobject-struct-statvfs.h \
- guestfs-gobject-struct-dirent.h \
- guestfs-gobject-struct-version.h \
- guestfs-gobject-struct-xattr.h \
- guestfs-gobject-struct-inotify_event.h \
- guestfs-gobject-struct-partition.h \
- guestfs-gobject-struct-application.h \
- guestfs-gobject-struct-isoinfo.h \
- guestfs-gobject-struct-mdstat.h \
- guestfs-gobject-struct-btrfssubvolume.h \
- guestfs-gobject-optargs-test0.h \
- guestfs-gobject-optargs-add_drive_opts.h \
- guestfs-gobject-optargs-add_domain.h \
- guestfs-gobject-optargs-inspect_get_icon.h \
- guestfs-gobject-optargs-mount_local.h \
- guestfs-gobject-optargs-umount_local.h \
- guestfs-gobject-optargs-mkfs_opts.h \
- guestfs-gobject-optargs-mount_9p.h \
- guestfs-gobject-optargs-ntfsresize_opts.h \
- guestfs-gobject-optargs-btrfs_filesystem_resize.h \
- guestfs-gobject-optargs-compress_out.h \
- guestfs-gobject-optargs-compress_device_out.h \
- guestfs-gobject-optargs-copy_device_to_device.h \
- guestfs-gobject-optargs-copy_device_to_file.h \
- guestfs-gobject-optargs-copy_file_to_device.h \
- guestfs-gobject-optargs-copy_file_to_file.h \
- guestfs-gobject-optargs-tune2fs.h \
- guestfs-gobject-optargs-md_create.h \
- guestfs-gobject-optargs-e2fsck.h \
- guestfs-gobject-optargs-ntfsfix.h \
- guestfs-gobject-optargs-ntfsclone_out.h \
- guestfs-gobject-optargs-mkfs_btrfs.h \
- guestfs-gobject-optargs-set_e2attrs.h
+ include/guestfs-gobject.h \
+ include/guestfs-gobject/session.h \
+ include/guestfs-gobject/tristate.h \
+ include/guestfs-gobject/struct-int_bool.h \
+ include/guestfs-gobject/struct-lvm_pv.h \
+ include/guestfs-gobject/struct-lvm_vg.h \
+ include/guestfs-gobject/struct-lvm_lv.h \
+ include/guestfs-gobject/struct-stat.h \
+ include/guestfs-gobject/struct-statvfs.h \
+ include/guestfs-gobject/struct-dirent.h \
+ include/guestfs-gobject/struct-version.h \
+ include/guestfs-gobject/struct-xattr.h \
+ include/guestfs-gobject/struct-inotify_event.h \
+ include/guestfs-gobject/struct-partition.h \
+ include/guestfs-gobject/struct-application.h \
+ include/guestfs-gobject/struct-isoinfo.h \
+ include/guestfs-gobject/struct-mdstat.h \
+ include/guestfs-gobject/struct-btrfssubvolume.h \
+ include/guestfs-gobject/optargs-test0.h \
+ include/guestfs-gobject/optargs-add_drive_opts.h \
+ include/guestfs-gobject/optargs-add_domain.h \
+ include/guestfs-gobject/optargs-inspect_get_icon.h \
+ include/guestfs-gobject/optargs-mount_local.h \
+ include/guestfs-gobject/optargs-umount_local.h \
+ include/guestfs-gobject/optargs-mkfs_opts.h \
+ include/guestfs-gobject/optargs-mount_9p.h \
+ include/guestfs-gobject/optargs-ntfsresize_opts.h \
+ include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \
+ include/guestfs-gobject/optargs-compress_out.h \
+ include/guestfs-gobject/optargs-compress_device_out.h \
+ include/guestfs-gobject/optargs-copy_device_to_device.h \
+ include/guestfs-gobject/optargs-copy_device_to_file.h \
+ include/guestfs-gobject/optargs-copy_file_to_device.h \
+ include/guestfs-gobject/optargs-copy_file_to_file.h \
+ include/guestfs-gobject/optargs-tune2fs.h \
+ include/guestfs-gobject/optargs-md_create.h \
+ include/guestfs-gobject/optargs-e2fsck.h \
+ include/guestfs-gobject/optargs-ntfsfix.h \
+ include/guestfs-gobject/optargs-ntfsclone_out.h \
+ include/guestfs-gobject/optargs-mkfs_btrfs.h \
+ include/guestfs-gobject/optargs-set_e2attrs.h
guestfs_gobject_sources=\
- guestfs-gobject-session.c \
- guestfs-gobject-tristate.c \
- guestfs-gobject-struct-int_bool.c \
- guestfs-gobject-struct-lvm_pv.c \
- guestfs-gobject-struct-lvm_vg.c \
- guestfs-gobject-struct-lvm_lv.c \
- guestfs-gobject-struct-stat.c \
- guestfs-gobject-struct-statvfs.c \
- guestfs-gobject-struct-dirent.c \
- guestfs-gobject-struct-version.c \
- guestfs-gobject-struct-xattr.c \
- guestfs-gobject-struct-inotify_event.c \
- guestfs-gobject-struct-partition.c \
- guestfs-gobject-struct-application.c \
- guestfs-gobject-struct-isoinfo.c \
- guestfs-gobject-struct-mdstat.c \
- guestfs-gobject-struct-btrfssubvolume.c \
- guestfs-gobject-optargs-test0.c \
- guestfs-gobject-optargs-add_drive_opts.c \
- guestfs-gobject-optargs-add_domain.c \
- guestfs-gobject-optargs-inspect_get_icon.c \
- guestfs-gobject-optargs-mount_local.c \
- guestfs-gobject-optargs-umount_local.c \
- guestfs-gobject-optargs-mkfs_opts.c \
- guestfs-gobject-optargs-mount_9p.c \
- guestfs-gobject-optargs-ntfsresize_opts.c \
- guestfs-gobject-optargs-btrfs_filesystem_resize.c \
- guestfs-gobject-optargs-compress_out.c \
- guestfs-gobject-optargs-compress_device_out.c \
- guestfs-gobject-optargs-copy_device_to_device.c \
- guestfs-gobject-optargs-copy_device_to_file.c \
- guestfs-gobject-optargs-copy_file_to_device.c \
- guestfs-gobject-optargs-copy_file_to_file.c \
- guestfs-gobject-optargs-tune2fs.c \
- guestfs-gobject-optargs-md_create.c \
- guestfs-gobject-optargs-e2fsck.c \
- guestfs-gobject-optargs-ntfsfix.c \
- guestfs-gobject-optargs-ntfsclone_out.c \
- guestfs-gobject-optargs-mkfs_btrfs.c \
- guestfs-gobject-optargs-set_e2attrs.c
+ src/session.c \
+ src/tristate.c \
+ src/struct-int_bool.c \
+ src/struct-lvm_pv.c \
+ src/struct-lvm_vg.c \
+ src/struct-lvm_lv.c \
+ src/struct-stat.c \
+ src/struct-statvfs.c \
+ src/struct-dirent.c \
+ src/struct-version.c \
+ src/struct-xattr.c \
+ src/struct-inotify_event.c \
+ src/struct-partition.c \
+ src/struct-application.c \
+ src/struct-isoinfo.c \
+ src/struct-mdstat.c \
+ src/struct-btrfssubvolume.c \
+ src/optargs-test0.c \
+ src/optargs-add_drive_opts.c \
+ src/optargs-add_domain.c \
+ src/optargs-inspect_get_icon.c \
+ src/optargs-mount_local.c \
+ src/optargs-umount_local.c \
+ src/optargs-mkfs_opts.c \
+ src/optargs-mount_9p.c \
+ src/optargs-ntfsresize_opts.c \
+ src/optargs-btrfs_filesystem_resize.c \
+ src/optargs-compress_out.c \
+ src/optargs-compress_device_out.c \
+ src/optargs-copy_device_to_device.c \
+ src/optargs-copy_device_to_file.c \
+ src/optargs-copy_file_to_device.c \
+ src/optargs-copy_file_to_file.c \
+ src/optargs-tune2fs.c \
+ src/optargs-md_create.c \
+ src/optargs-e2fsck.c \
+ src/optargs-ntfsfix.c \
+ src/optargs-ntfsclone_out.c \
+ src/optargs-mkfs_btrfs.c \
+ src/optargs-set_e2attrs.c
diff --git a/gobject/docs/Makefile.am b/gobject/docs/Makefile.am
index 4ea8a28..f43ec9c 100644
--- a/gobject/docs/Makefile.am
+++ b/gobject/docs/Makefile.am
@@ -28,7 +28,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# gtk-doc will search all .c and .h files beneath these paths
# for inline comments documenting functions and macros.
# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk
-DOC_SOURCE_DIR=$(srcdir)/..
+DOC_SOURCE_DIR=$(srcdir)/../src $(srcdir)/../include
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
@@ -55,8 +55,8 @@ FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
-HFILE_GLOB=$(srcdir)/../*.h
-CFILE_GLOB=$(srcdir)/../*.c
+HFILE_GLOB=$(srcdir)/../include/guestfs-gobject/*.h
+CFILE_GLOB=$(srcdir)/../src/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
@@ -64,7 +64,7 @@ EXTRA_HFILES=
# Header files or dirs to ignore when scanning. Use base file/dir names
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
-IGNORE_HFILES=$(srcdir)/../guestfs-gobject.h
+IGNORE_HFILES=
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
--
1.7.10
12 years, 8 months
[PATCH 1/3] gobject: NFC generated code formatting fix
by Matthew Booth
---
generator/generator_gobject.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generator/generator_gobject.ml b/generator/generator_gobject.ml
index e4c175b..48ddbf0 100644
--- a/generator/generator_gobject.ml
+++ b/generator/generator_gobject.ml
@@ -391,7 +391,7 @@ let generate_gobject_optargs_source name optargs flags () =
pr "G_DEFINE_TYPE(%s, guestfs_%s, G_TYPE_OBJECT);\n\n" camel_name name;
pr "enum {\n";
- pr "PROP_GUESTFS_%s_PROP0" uc_name;
+ pr " PROP_GUESTFS_%s_PROP0" uc_name;
List.iter (
fun optargt ->
let uc_optname = String.uppercase (name_of_optargt optargt) in
--
1.7.10
12 years, 8 months
Change to unstable mkfs-btrfs API
by Richard W.M. Jones
I'm going to change the mkfs-btrfs API so its single and only
parameter is a list of devices (instead of a single device).
btrfs filesystems can span multiple devices, so this is necessary to
create such filesystems, eg:
mkfs-btrfs ["/dev/vda1", "/dev/vdb1"]
mount "/dev/vda1", "/"
would create a filesystem across two devices and mount it.
Note this changes the API, but this API has not yet been released in a
stable version of libguestfs, so we're allowed to do this.
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 Xen guests.
http://et.redhat.com/~rjones/virt-p2v
12 years, 8 months
[PATCH 1/3] sysprep: remove the db and log of sssd
by Wanlong Gao
Remove the db and log of sssd.
Signed-off-by: Wanlong Gao <gaowanlong(a)cn.fujitsu.com>
---
sysprep/Makefile.am | 2 ++
sysprep/sysprep_operation_sssd_db_log.ml | 50 ++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 sysprep/sysprep_operation_sssd_db_log.ml
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 78b1fa1..f4efcb8 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -49,6 +49,7 @@ SOURCES = \
sysprep_operation_smolt_uuid.ml \
sysprep_operation_ssh_hostkeys.ml \
sysprep_operation_ssh_userdir.ml \
+ sysprep_operation_sssd_db_log.ml \
sysprep_operation_udev_persistent_net.ml \
sysprep_operation_user_account.ml \
sysprep_operation_utmp.ml \
@@ -77,6 +78,7 @@ OBJECTS = \
sysprep_operation_smolt_uuid.cmx \
sysprep_operation_ssh_hostkeys.cmx \
sysprep_operation_ssh_userdir.cmx \
+ sysprep_operation_sssd_db_log.cmx \
sysprep_operation_udev_persistent_net.cmx \
sysprep_operation_user_account.ml \
sysprep_operation_utmp.cmx \
diff --git a/sysprep/sysprep_operation_sssd_db_log.ml b/sysprep/sysprep_operation_sssd_db_log.ml
new file mode 100644
index 0000000..b351962
--- /dev/null
+++ b/sysprep/sysprep_operation_sssd_db_log.ml
@@ -0,0 +1,50 @@
+(* virt-sysprep
+ * Copyright (C) 2012 FUJITSU LIMITED
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+open Sysprep_operation
+
+module G = Guestfs
+
+let sssd_db_log_perform g root =
+ let typ = g#inspect_get_type root in
+ if typ <> "windows" then (
+ let paths = [ "/var/log/sssd/*";
+ "/var/lib/sss/db/*" ] in
+ List.iter (
+ fun path ->
+ let files = g#glob_expand path in
+ Array.iter (
+ fun file ->
+ try g#rm file with G.Error _ -> ()
+ ) files;
+ ) paths;
+
+ []
+ )
+ else []
+
+let sssd_db_log_op = {
+ name = "sssd-db-log";
+ enabled_by_default = true;
+ heading = "Remove the db and log of sssd";
+ pod_description = None;
+ extra_args = [];
+ perform = sssd_db_log_perform;
+}
+
+let () = register_operation sssd_db_log_op
--
1.7.10
12 years, 8 months