X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fstubs.c;h=02c76f1e52037ff49c46c8285ce36511635ebff5;hb=b176abd7bb39ba69ecb523138732dba4b91f4090;hp=dfadb838eb0fb41ae8a2c850b5624ffee1d188e9;hpb=1e60354dc8fb306fa139ae744a596f4f5bcbd9a7;p=libguestfs.git diff --git a/daemon/stubs.c b/daemon/stubs.c index dfadb83..02c76f1 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -19,7 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE // for strchrnul +#include #include #include @@ -1584,6 +1584,366 @@ done: xdr_free ((xdrproc_t) xdr_guestfs_blockdev_rereadpt_args, (char *) &args); } +static void upload_stub (XDR *xdr_in) +{ + int r; + struct guestfs_upload_args args; + const char *remotefilename; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_upload_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "upload"); + return; + } + remotefilename = args.remotefilename; + + r = do_upload (remotefilename); + if (r == -1) + /* do_upload has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_upload_args, (char *) &args); +} + +static void download_stub (XDR *xdr_in) +{ + int r; + struct guestfs_download_args args; + const char *remotefilename; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_download_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "download"); + return; + } + remotefilename = args.remotefilename; + + r = do_download (remotefilename); + if (r == -1) + /* do_download has already called reply_with_error */ + goto done; + + /* do_download has already sent a reply */ +done: + xdr_free ((xdrproc_t) xdr_guestfs_download_args, (char *) &args); +} + +static void checksum_stub (XDR *xdr_in) +{ + char *r; + struct guestfs_checksum_args args; + const char *csumtype; + const char *path; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_checksum_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "checksum"); + return; + } + csumtype = args.csumtype; + path = args.path; + + r = do_checksum (csumtype, path); + if (r == NULL) + /* do_checksum has already called reply_with_error */ + goto done; + + struct guestfs_checksum_ret ret; + ret.checksum = r; + reply ((xdrproc_t) &xdr_guestfs_checksum_ret, (char *) &ret); + free (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_checksum_args, (char *) &args); +} + +static void tar_in_stub (XDR *xdr_in) +{ + int r; + struct guestfs_tar_in_args args; + const char *directory; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_tar_in_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "tar_in"); + return; + } + directory = args.directory; + + r = do_tar_in (directory); + if (r == -1) + /* do_tar_in has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_tar_in_args, (char *) &args); +} + +static void tar_out_stub (XDR *xdr_in) +{ + int r; + struct guestfs_tar_out_args args; + const char *directory; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_tar_out_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "tar_out"); + return; + } + directory = args.directory; + + r = do_tar_out (directory); + if (r == -1) + /* do_tar_out has already called reply_with_error */ + goto done; + + /* do_tar_out has already sent a reply */ +done: + xdr_free ((xdrproc_t) xdr_guestfs_tar_out_args, (char *) &args); +} + +static void tgz_in_stub (XDR *xdr_in) +{ + int r; + struct guestfs_tgz_in_args args; + const char *directory; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_tgz_in_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "tgz_in"); + return; + } + directory = args.directory; + + r = do_tgz_in (directory); + if (r == -1) + /* do_tgz_in has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_tgz_in_args, (char *) &args); +} + +static void tgz_out_stub (XDR *xdr_in) +{ + int r; + struct guestfs_tgz_out_args args; + const char *directory; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_tgz_out_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "tgz_out"); + return; + } + directory = args.directory; + + r = do_tgz_out (directory); + if (r == -1) + /* do_tgz_out has already called reply_with_error */ + goto done; + + /* do_tgz_out has already sent a reply */ +done: + xdr_free ((xdrproc_t) xdr_guestfs_tgz_out_args, (char *) &args); +} + +static void mount_ro_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mount_ro_args args; + const char *device; + const char *mountpoint; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mount_ro_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_ro"); + return; + } + device = args.device; + mountpoint = args.mountpoint; + + r = do_mount_ro (device, mountpoint); + if (r == -1) + /* do_mount_ro has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mount_ro_args, (char *) &args); +} + +static void mount_options_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mount_options_args args; + const char *options; + const char *device; + const char *mountpoint; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mount_options_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_options"); + return; + } + options = args.options; + device = args.device; + mountpoint = args.mountpoint; + + r = do_mount_options (options, device, mountpoint); + if (r == -1) + /* do_mount_options has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mount_options_args, (char *) &args); +} + +static void mount_vfs_stub (XDR *xdr_in) +{ + int r; + struct guestfs_mount_vfs_args args; + const char *options; + const char *vfstype; + const char *device; + const char *mountpoint; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_mount_vfs_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_vfs"); + return; + } + options = args.options; + vfstype = args.vfstype; + device = args.device; + mountpoint = args.mountpoint; + + r = do_mount_vfs (options, vfstype, device, mountpoint); + if (r == -1) + /* do_mount_vfs has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_mount_vfs_args, (char *) &args); +} + +static void debug_stub (XDR *xdr_in) +{ + char *r; + struct guestfs_debug_args args; + const char *subcmd; + char **extraargs; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_debug_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "debug"); + return; + } + subcmd = args.subcmd; + args.extraargs.extraargs_val = realloc (args.extraargs.extraargs_val, sizeof (char *) * (args.extraargs.extraargs_len+1)); + args.extraargs.extraargs_val[args.extraargs.extraargs_len] = NULL; + extraargs = args.extraargs.extraargs_val; + + r = do_debug (subcmd, extraargs); + if (r == NULL) + /* do_debug has already called reply_with_error */ + goto done; + + struct guestfs_debug_ret ret; + ret.result = r; + reply ((xdrproc_t) &xdr_guestfs_debug_ret, (char *) &ret); + free (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_debug_args, (char *) &args); +} + +static void lvremove_stub (XDR *xdr_in) +{ + int r; + struct guestfs_lvremove_args args; + const char *device; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_lvremove_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "lvremove"); + return; + } + device = args.device; + + r = do_lvremove (device); + if (r == -1) + /* do_lvremove has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_lvremove_args, (char *) &args); +} + +static void vgremove_stub (XDR *xdr_in) +{ + int r; + struct guestfs_vgremove_args args; + const char *vgname; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_vgremove_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "vgremove"); + return; + } + vgname = args.vgname; + + r = do_vgremove (vgname); + if (r == -1) + /* do_vgremove has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_vgremove_args, (char *) &args); +} + +static void pvremove_stub (XDR *xdr_in) +{ + int r; + struct guestfs_pvremove_args args; + const char *device; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_pvremove_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "pvremove"); + return; + } + device = args.device; + + r = do_pvremove (device); + if (r == -1) + /* do_pvremove has already called reply_with_error */ + goto done; + + reply (NULL, NULL); +done: + xdr_free ((xdrproc_t) xdr_guestfs_pvremove_args, (char *) &args); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -1782,6 +2142,48 @@ void dispatch_incoming_message (XDR *xdr_in) case GUESTFS_PROC_BLOCKDEV_REREADPT: blockdev_rereadpt_stub (xdr_in); break; + case GUESTFS_PROC_UPLOAD: + upload_stub (xdr_in); + break; + case GUESTFS_PROC_DOWNLOAD: + download_stub (xdr_in); + break; + case GUESTFS_PROC_CHECKSUM: + checksum_stub (xdr_in); + break; + case GUESTFS_PROC_TAR_IN: + tar_in_stub (xdr_in); + break; + case GUESTFS_PROC_TAR_OUT: + tar_out_stub (xdr_in); + break; + case GUESTFS_PROC_TGZ_IN: + tgz_in_stub (xdr_in); + break; + case GUESTFS_PROC_TGZ_OUT: + tgz_out_stub (xdr_in); + break; + case GUESTFS_PROC_MOUNT_RO: + mount_ro_stub (xdr_in); + break; + case GUESTFS_PROC_MOUNT_OPTIONS: + mount_options_stub (xdr_in); + break; + case GUESTFS_PROC_MOUNT_VFS: + mount_vfs_stub (xdr_in); + break; + case GUESTFS_PROC_DEBUG: + debug_stub (xdr_in); + break; + case GUESTFS_PROC_LVREMOVE: + lvremove_stub (xdr_in); + break; + case GUESTFS_PROC_VGREMOVE: + vgremove_stub (xdr_in); + break; + case GUESTFS_PROC_PVREMOVE: + pvremove_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); }