summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-07-02 15:11:59 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-07-02 15:11:59 +0100
commit62e41312acd0f7fe7f3622a73d6f6efc27b1b511 (patch)
tree92b9dc5cc25eab18154828a9b69223fa27687f5a /src
parentc127ad3d4a494abb2d9bb4fb6eaa179431d2411a (diff)
downloadlibguestfs-62e41312acd0f7fe7f3622a73d6f6efc27b1b511.tar.gz
libguestfs-62e41312acd0f7fe7f3622a73d6f6efc27b1b511.tar.xz
libguestfs-62e41312acd0f7fe7f3622a73d6f6efc27b1b511.zip
Add list of function_names to the daemon.
Messages which include the proc_nr can now also include the name of the actual function being called.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 29e66513..f41413e8 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4318,6 +4318,22 @@ and generate_daemon_actions () =
) ["pv", pv_cols; "vg", vg_cols; "lv", lv_cols]
+(* Generate a list of function names, for debugging in the daemon.. *)
+and generate_daemon_names () =
+ generate_header CStyle GPLv2;
+
+ pr "#include <config.h>\n";
+ pr "\n";
+ pr "#include \"daemon.h\"\n";
+ pr "\n";
+
+ pr "/* This array is indexed by proc_nr. See guestfs_protocol.x. */\n";
+ pr "const char *function_names[] = {\n";
+ List.iter (
+ fun (name, _, proc_nr, _, _, _, _) -> pr " [%d] = \"%s\",\n" proc_nr name
+ ) daemon_functions;
+ pr "};\n";
+
(* Generate the tests. *)
and generate_tests () =
generate_header CStyle GPLv2;
@@ -8610,6 +8626,10 @@ Run it from the top source directory using the command
generate_daemon_actions ();
close ();
+ let close = output_to "daemon/names.c" in
+ generate_daemon_names ();
+ close ();
+
let close = output_to "capitests/tests.c" in
generate_tests ();
close ();