X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fstubs.c;h=0e5b35134ae6db9b0c72ad8fc38716100b6c8f4e;hp=ee27997729ebb6da0aad2b29b38fe1d8dbfda07f;hb=16d6d9851ad33fde675b45c27725ea394b718c7a;hpb=e118c14b9552de311cbc1734e03a3226b484c1e8 diff --git a/daemon/stubs.c b/daemon/stubs.c index ee27997..0e5b351 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -2153,6 +2153,250 @@ 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: ; +} + +static void equal_stub (XDR *xdr_in) +{ + int r; + struct guestfs_equal_args args; + const char *file1; + const char *file2; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_equal_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "equal"); + return; + } + file1 = args.file1; + file2 = args.file2; + + r = do_equal (file1, file2); + if (r == -1) + /* do_equal has already called reply_with_error */ + goto done; + + struct guestfs_equal_ret ret; + ret.equality = r; + reply ((xdrproc_t) &xdr_guestfs_equal_ret, (char *) &ret); +done: + xdr_free ((xdrproc_t) xdr_guestfs_equal_args, (char *) &args); +} + +static void strings_stub (XDR *xdr_in) +{ + char **r; + struct guestfs_strings_args args; + const char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_strings_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "strings"); + return; + } + path = args.path; + + r = do_strings (path); + if (r == NULL) + /* do_strings has already called reply_with_error */ + goto done; + + struct guestfs_strings_ret ret; + ret.stringsout.stringsout_len = count_strings (r); + ret.stringsout.stringsout_val = r; + reply ((xdrproc_t) &xdr_guestfs_strings_ret, (char *) &ret); + free_strings (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_strings_args, (char *) &args); +} + +static void strings_e_stub (XDR *xdr_in) +{ + char **r; + struct guestfs_strings_e_args args; + const char *encoding; + const char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_strings_e_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "strings_e"); + return; + } + encoding = args.encoding; + path = args.path; + + r = do_strings_e (encoding, path); + if (r == NULL) + /* do_strings_e has already called reply_with_error */ + goto done; + + struct guestfs_strings_e_ret ret; + ret.stringsout.stringsout_len = count_strings (r); + ret.stringsout.stringsout_val = r; + reply ((xdrproc_t) &xdr_guestfs_strings_e_ret, (char *) &ret); + free_strings (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_strings_e_args, (char *) &args); +} + +static void hexdump_stub (XDR *xdr_in) +{ + char *r; + struct guestfs_hexdump_args args; + const char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_hexdump_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "hexdump"); + return; + } + path = args.path; + + r = do_hexdump (path); + if (r == NULL) + /* do_hexdump has already called reply_with_error */ + goto done; + + struct guestfs_hexdump_ret ret; + ret.dump = r; + reply ((xdrproc_t) &xdr_guestfs_hexdump_ret, (char *) &ret); + free (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_hexdump_args, (char *) &args); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -2414,6 +2658,36 @@ void dispatch_incoming_message (XDR *xdr_in) 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; + case GUESTFS_PROC_EQUAL: + equal_stub (xdr_in); + break; + case GUESTFS_PROC_STRINGS: + strings_stub (xdr_in); + break; + case GUESTFS_PROC_STRINGS_E: + strings_e_stub (xdr_in); + break; + case GUESTFS_PROC_HEXDUMP: + hexdump_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); }