diff options
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/actions.h | 3 | ||||
-rw-r--r-- | daemon/stubs.c | 87 |
2 files changed, 90 insertions, 0 deletions
diff --git a/daemon/actions.h b/daemon/actions.h index 5e2fb41b..d43617be 100644 --- a/daemon/actions.h +++ b/daemon/actions.h @@ -107,3 +107,6 @@ extern char *do_get_e2uuid (const char *device); extern int do_fsck (const char *fstype, const char *device); extern int do_zero (const char *device); extern int do_grub_install (const char *root, const char *device); +extern int do_cp (const char *src, const char *dest); +extern int do_cp_a (const char *src, const char *dest); +extern int do_mv (const char *src, const char *dest); diff --git a/daemon/stubs.c b/daemon/stubs.c index ee279977..ddd3fced 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -2153,6 +2153,84 @@ 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); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -2414,6 +2492,15 @@ 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; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); } |