diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-22 07:49:50 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-06-22 07:49:50 +0100 |
commit | 4211c7a258debd236017a19c70965bc1b3658edb (patch) | |
tree | 50372cfd72f49b84b753e2aa58c92dfc99b4586f /daemon | |
parent | 57d2dfab18ad3d987d9273bb7c1f42e73e0bbcb2 (diff) | |
download | libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.tar.gz libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.tar.xz libguestfs-4211c7a258debd236017a19c70965bc1b3658edb.zip |
Generated code for 'sh' and 'sh-lines' commands.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/actions.h | 2 | ||||
-rw-r--r-- | daemon/stubs.c | 61 |
2 files changed, 63 insertions, 0 deletions
diff --git a/daemon/actions.h b/daemon/actions.h index c8e285c8..a76498f3 100644 --- a/daemon/actions.h +++ b/daemon/actions.h @@ -131,3 +131,5 @@ extern char **do_find (char *directory); extern int do_e2fsck_f (char *device); extern int do_sleep (int secs); extern int do_ntfs_3g_probe (int rw, char *device); +extern char *do_sh (char *command); +extern char **do_sh_lines (char *command); diff --git a/daemon/stubs.c b/daemon/stubs.c index 78426409..dcdc51c0 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -2771,6 +2771,61 @@ done: xdr_free ((xdrproc_t) xdr_guestfs_ntfs_3g_probe_args, (char *) &args); } +static void sh_stub (XDR *xdr_in) +{ + char *r; + struct guestfs_sh_args args; + char *command; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_sh_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "sh"); + return; + } + command = args.command; + + r = do_sh (command); + if (r == NULL) + /* do_sh has already called reply_with_error */ + goto done; + + struct guestfs_sh_ret ret; + ret.output = r; + reply ((xdrproc_t) &xdr_guestfs_sh_ret, (char *) &ret); + free (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_sh_args, (char *) &args); +} + +static void sh_lines_stub (XDR *xdr_in) +{ + char **r; + struct guestfs_sh_lines_args args; + char *command; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_sh_lines_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "sh_lines"); + return; + } + command = args.command; + + r = do_sh_lines (command); + if (r == NULL) + /* do_sh_lines has already called reply_with_error */ + goto done; + + struct guestfs_sh_lines_ret ret; + ret.lines.lines_len = count_strings (r); + ret.lines.lines_val = r; + reply ((xdrproc_t) &xdr_guestfs_sh_lines_ret, (char *) &ret); + free_strings (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_sh_lines_args, (char *) &args); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -3104,6 +3159,12 @@ void dispatch_incoming_message (XDR *xdr_in) case GUESTFS_PROC_NTFS_3G_PROBE: ntfs_3g_probe_stub (xdr_in); break; + case GUESTFS_PROC_SH: + sh_stub (xdr_in); + break; + case GUESTFS_PROC_SH_LINES: + sh_lines_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); } |