X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fstubs.c;h=f992bdf6c44f493e03e8e36df45de63aae6db96d;hp=937913f3e1105007666cf66ddc44a34dcefa1707;hb=8c3b820c2b687345448e3d74a7101b07ff32688e;hpb=62df226f26bd6ac3c481a7790eb89d760d2f0386 diff --git a/daemon/stubs.c b/daemon/stubs.c index 937913f..f992bdf 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -2127,6 +2127,163 @@ done: xdr_free ((xdrproc_t) xdr_guestfs_zero_args, (char *) &args); } +static void grub_install_stub (XDR *xdr_in) +{ + int r; + struct guestfs_grub_install_args args; + const char *root; + const char *device; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_grub_install_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "grub_install"); + return; + } + root = args.root; + device = args.device; + + r = do_grub_install (root, device); + if (r == -1) + /* do_grub_install has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_grub_install_args, (char *) &args); +} + +static void cp_stub (XDR *xdr_in) +{ + int r; + struct guestfs_cp_args args; + const char *src; + const char *dest; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_cp_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "cp"); + return; + } + src = args.src; + dest = args.dest; + + r = do_cp (src, dest); + if (r == -1) + /* do_cp has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_cp_args, (char *) &args); +} + +static void cp_a_stub (XDR *xdr_in) +{ + int r; + struct guestfs_cp_a_args args; + const char *src; + const char *dest; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_cp_a_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "cp_a"); + return; + } + src = args.src; + dest = args.dest; + + r = do_cp_a (src, dest); + if (r == -1) + /* do_cp_a has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_cp_a_args, (char *) &args); +} + +static void mv_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mv_args args; + const char *src; + const char *dest; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mv_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mv"); + return; + } + src = args.src; + dest = args.dest; + + r = do_mv (src, dest); + if (r == -1) + /* do_mv has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mv_args, (char *) &args); +} + +static void drop_caches_stub (XDR *xdr_in) +{ + int r; + struct guestfs_drop_caches_args args; + int whattodrop; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_drop_caches_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "drop_caches"); + return; + } + whattodrop = args.whattodrop; + + r = do_drop_caches (whattodrop); + if (r == -1) + /* do_drop_caches has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_drop_caches_args, (char *) &args); +} + +static void dmesg_stub (XDR *xdr_in) +{ + char *r; + + r = do_dmesg (); + if (r == NULL) + /* do_dmesg has already called reply_with_error */ + goto done; + + struct guestfs_dmesg_ret ret; + ret.kmsgs = r; + reply ((xdrproc_t) &xdr_guestfs_dmesg_ret, (char *) &ret); + free (r); +done: ; +} + +static void ping_daemon_stub (XDR *xdr_in) +{ + int r; + + r = do_ping_daemon (); + if (r == -1) + /* do_ping_daemon has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: ; +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -2385,6 +2542,27 @@ void dispatch_incoming_message (XDR *xdr_in) case GUESTFS_PROC_ZERO: zero_stub (xdr_in); break; + case GUESTFS_PROC_GRUB_INSTALL: + grub_install_stub (xdr_in); + break; + case GUESTFS_PROC_CP: + cp_stub (xdr_in); + break; + case GUESTFS_PROC_CP_A: + cp_a_stub (xdr_in); + break; + case GUESTFS_PROC_MV: + mv_stub (xdr_in); + break; + case GUESTFS_PROC_DROP_CACHES: + drop_caches_stub (xdr_in); + break; + case GUESTFS_PROC_DMESG: + dmesg_stub (xdr_in); + break; + case GUESTFS_PROC_PING_DAEMON: + ping_daemon_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); }