name style
) all_functions
+(* Generate the guestfs-internal-actions.h file. *)
+and generate_internal_actions_h () =
+ generate_header CStyle LGPLv2;
+ List.iter (
+ fun (shortname, style, _, _, _, _, _) ->
+ let name = "guestfs__" ^ shortname in
+ generate_prototype ~single_line:true ~newline:true ~handle:"handle"
+ name style
+ ) non_daemon_functions
+
(* Generate the client-side dispatch stubs. *)
and generate_client_actions () =
generate_header CStyle LGPLv2;
#include <stdlib.h>
#include \"guestfs.h\"
+#include \"guestfs-internal-actions.h\"
#include \"guestfs_protocol.h\"
#define error guestfs_error
";
+ (* For non-daemon functions, generate a wrapper around each function. *)
+ List.iter (
+ fun (shortname, style, _, _, _, _, _) ->
+ let name = "guestfs_" ^ shortname in
+
+ generate_prototype ~extern:false ~semicolon:false ~newline:true
+ ~handle:"g" name style;
+ pr "{\n";
+ pr " return guestfs__%s " shortname;
+ generate_c_call_args ~handle:"g" style;
+ pr ";\n";
+ pr "}\n";
+ pr "\n"
+ ) non_daemon_functions;
+
(* Client-side stubs for each function. *)
List.iter (
fun (shortname, style, _, _, _, _, _) ->
#include <string.h>
#include \"guestfs.h\"
+#include \"guestfs-internal-actions.h\"
#include \"guestfs_protocol.h\"
#define error guestfs_error
let () =
let (name, style, _, _, _, _, _) = test0 in
generate_prototype ~extern:false ~semicolon:false ~newline:true
- ~handle:"g" ~prefix:"guestfs_" name style;
+ ~handle:"g" ~prefix:"guestfs__" name style;
pr "{\n";
List.iter (
function
if String.sub name (String.length name - 3) 3 <> "err" then (
pr "/* Test normal return. */\n";
generate_prototype ~extern:false ~semicolon:false ~newline:true
- ~handle:"g" ~prefix:"guestfs_" name style;
+ ~handle:"g" ~prefix:"guestfs__" name style;
pr "{\n";
(match fst style with
| RErr ->
) else (
pr "/* Test error return. */\n";
generate_prototype ~extern:false ~semicolon:false ~newline:true
- ~handle:"g" ~prefix:"guestfs_" name style;
+ ~handle:"g" ~prefix:"guestfs__" name style;
pr "{\n";
pr " error (g, \"error\");\n";
(match fst style with
generate_actions_h ();
close ();
+ let close = output_to "src/guestfs-internal-actions.h" in
+ generate_internal_actions_h ();
+ close ();
+
let close = output_to "src/guestfs-actions.c" in
generate_client_actions ();
close ();
#endif
#include "guestfs.h"
+#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
#include "ignore-value.h"
}
int
-guestfs_set_verbose (guestfs_h *g, int v)
+guestfs__set_verbose (guestfs_h *g, int v)
{
g->verbose = !!v;
return 0;
}
int
-guestfs_get_verbose (guestfs_h *g)
+guestfs__get_verbose (guestfs_h *g)
{
return g->verbose;
}
int
-guestfs_set_autosync (guestfs_h *g, int a)
+guestfs__set_autosync (guestfs_h *g, int a)
{
g->autosync = !!a;
return 0;
}
int
-guestfs_get_autosync (guestfs_h *g)
+guestfs__get_autosync (guestfs_h *g)
{
return g->autosync;
}
int
-guestfs_set_path (guestfs_h *g, const char *path)
+guestfs__set_path (guestfs_h *g, const char *path)
{
free (g->path);
g->path = NULL;
}
const char *
-guestfs_get_path (guestfs_h *g)
+guestfs__get_path (guestfs_h *g)
{
return g->path;
}
int
-guestfs_set_qemu (guestfs_h *g, const char *qemu)
+guestfs__set_qemu (guestfs_h *g, const char *qemu)
{
free (g->qemu);
g->qemu = NULL;
}
const char *
-guestfs_get_qemu (guestfs_h *g)
+guestfs__get_qemu (guestfs_h *g)
{
return g->qemu;
}
int
-guestfs_set_append (guestfs_h *g, const char *append)
+guestfs__set_append (guestfs_h *g, const char *append)
{
free (g->append);
g->append = NULL;
}
const char *
-guestfs_get_append (guestfs_h *g)
+guestfs__get_append (guestfs_h *g)
{
return g->append;
}
int
-guestfs_set_memsize (guestfs_h *g, int memsize)
+guestfs__set_memsize (guestfs_h *g, int memsize)
{
g->memsize = memsize;
return 0;
}
int
-guestfs_get_memsize (guestfs_h *g)
+guestfs__get_memsize (guestfs_h *g)
{
return g->memsize;
}
int
-guestfs_set_selinux (guestfs_h *g, int selinux)
+guestfs__set_selinux (guestfs_h *g, int selinux)
{
g->selinux = selinux;
return 0;
}
int
-guestfs_get_selinux (guestfs_h *g)
+guestfs__get_selinux (guestfs_h *g)
{
return g->selinux;
}
int
-guestfs_get_pid (guestfs_h *g)
+guestfs__get_pid (guestfs_h *g)
{
if (g->pid > 0)
return g->pid;
}
struct guestfs_version *
-guestfs_version (guestfs_h *g)
+guestfs__version (guestfs_h *g)
{
struct guestfs_version *r;
}
int
-guestfs_config (guestfs_h *g,
- const char *qemu_param, const char *qemu_value)
+guestfs__config (guestfs_h *g,
+ const char *qemu_param, const char *qemu_value)
{
if (qemu_param[0] != '-') {
error (g, _("guestfs_config: parameter must begin with '-' character"));
}
int
-guestfs_add_drive (guestfs_h *g, const char *filename)
+guestfs__add_drive (guestfs_h *g, const char *filename)
{
size_t len = strlen (filename) + 64;
char buf[len];
}
int
-guestfs_add_drive_ro (guestfs_h *g, const char *filename)
+guestfs__add_drive_ro (guestfs_h *g, const char *filename)
{
size_t len = strlen (filename) + 64;
char buf[len];
}
int
-guestfs_add_cdrom (guestfs_h *g, const char *filename)
+guestfs__add_cdrom (guestfs_h *g, const char *filename)
{
if (strchr (filename, ',') != NULL) {
error (g, _("filename cannot contain ',' (comma) character"));
"initramfs." REPO "." host_cpu ".supermin.hostfiles";
int
-guestfs_launch (guestfs_h *g)
+guestfs__launch (guestfs_h *g)
{
const char *tmpdir;
char dir_template[PATH_MAX];
}
int
-guestfs_wait_ready (guestfs_h *g)
+guestfs__wait_ready (guestfs_h *g)
{
int finished = 0, r;
}
int
-guestfs_kill_subprocess (guestfs_h *g)
+guestfs__kill_subprocess (guestfs_h *g)
{
if (g->state == CONFIG) {
error (g, _("no subprocess to kill"));
/* Access current state. */
int
-guestfs_is_config (guestfs_h *g)
+guestfs__is_config (guestfs_h *g)
{
return g->state == CONFIG;
}
int
-guestfs_is_launching (guestfs_h *g)
+guestfs__is_launching (guestfs_h *g)
{
return g->state == LAUNCHING;
}
int
-guestfs_is_ready (guestfs_h *g)
+guestfs__is_ready (guestfs_h *g)
{
return g->state == READY;
}
int
-guestfs_is_busy (guestfs_h *g)
+guestfs__is_busy (guestfs_h *g)
{
return g->state == BUSY;
}
int
-guestfs_get_state (guestfs_h *g)
+guestfs__get_state (guestfs_h *g)
{
return g->state;
}
int
-guestfs_set_ready (guestfs_h *g)
+guestfs__set_ready (guestfs_h *g)
{
if (g->state != BUSY) {
error (g, _("guestfs_set_ready: called when in state %d != BUSY"),
}
int
-guestfs_set_busy (guestfs_h *g)
+guestfs__set_busy (guestfs_h *g)
{
if (g->state != READY) {
error (g, _("guestfs_set_busy: called when in state %d != READY"),
}
int
-guestfs_end_busy (guestfs_h *g)
+guestfs__end_busy (guestfs_h *g)
{
switch (g->state)
{