Generated code for grub-install command.
[libguestfs.git] / daemon / stubs.c
index 3039404..ee27997 100644 (file)
@@ -19,7 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#define _GNU_SOURCE // for strchrnul
+#include <config.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -940,9 +940,14 @@ static void vgcreate_stub (XDR *xdr_in)
     return;
   }
   volgroup = args.volgroup;
-  args.physvols.physvols_val = realloc (args.physvols.physvols_val, sizeof (char *) * (args.physvols.physvols_len+1));
-  args.physvols.physvols_val[args.physvols.physvols_len] = NULL;
-  physvols = args.physvols.physvols_val;
+  physvols = realloc (args.physvols.physvols_val,
+                sizeof (char *) * (args.physvols.physvols_len+1));
+  if (physvols == NULL) {
+    reply_with_perror ("realloc");
+    goto done;
+  }
+  physvols[args.physvols.physvols_len] = NULL;
+  args.physvols.physvols_val = physvols;
 
   r = do_vgcreate (volgroup, physvols);
   if (r == -1)
@@ -1028,9 +1033,14 @@ static void sfdisk_stub (XDR *xdr_in)
   cyls = args.cyls;
   heads = args.heads;
   sectors = args.sectors;
-  args.lines.lines_val = realloc (args.lines.lines_val, sizeof (char *) * (args.lines.lines_len+1));
-  args.lines.lines_val[args.lines.lines_len] = NULL;
-  lines = args.lines.lines_val;
+  lines = realloc (args.lines.lines_val,
+                sizeof (char *) * (args.lines.lines_len+1));
+  if (lines == NULL) {
+    reply_with_perror ("realloc");
+    goto done;
+  }
+  lines[args.lines.lines_len] = NULL;
+  args.lines.lines_val = lines;
 
   r = do_sfdisk (device, cyls, heads, sectors, lines);
   if (r == -1)
@@ -1176,9 +1186,14 @@ static void command_stub (XDR *xdr_in)
     reply_with_error ("%s: daemon failed to decode procedure arguments", "command");
     return;
   }
-  args.arguments.arguments_val = realloc (args.arguments.arguments_val, sizeof (char *) * (args.arguments.arguments_len+1));
-  args.arguments.arguments_val[args.arguments.arguments_len] = NULL;
-  arguments = args.arguments.arguments_val;
+  arguments = realloc (args.arguments.arguments_val,
+                sizeof (char *) * (args.arguments.arguments_len+1));
+  if (arguments == NULL) {
+    reply_with_perror ("realloc");
+    goto done;
+  }
+  arguments[args.arguments.arguments_len] = NULL;
+  args.arguments.arguments_val = arguments;
 
   r = do_command (arguments);
   if (r == NULL)
@@ -1205,9 +1220,14 @@ static void command_lines_stub (XDR *xdr_in)
     reply_with_error ("%s: daemon failed to decode procedure arguments", "command_lines");
     return;
   }
-  args.arguments.arguments_val = realloc (args.arguments.arguments_val, sizeof (char *) * (args.arguments.arguments_len+1));
-  args.arguments.arguments_val[args.arguments.arguments_len] = NULL;
-  arguments = args.arguments.arguments_val;
+  arguments = realloc (args.arguments.arguments_val,
+                sizeof (char *) * (args.arguments.arguments_len+1));
+  if (arguments == NULL) {
+    reply_with_perror ("realloc");
+    goto done;
+  }
+  arguments[args.arguments.arguments_len] = NULL;
+  args.arguments.arguments_val = arguments;
 
   r = do_command_lines (arguments);
   if (r == NULL)
@@ -1661,6 +1681,478 @@ 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;
+  extraargs = realloc (args.extraargs.extraargs_val,
+                sizeof (char *) * (args.extraargs.extraargs_len+1));
+  if (extraargs == NULL) {
+    reply_with_perror ("realloc");
+    goto done;
+  }
+  extraargs[args.extraargs.extraargs_len] = NULL;
+  args.extraargs.extraargs_val = extraargs;
+
+  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);
+}
+
+static void set_e2label_stub (XDR *xdr_in)
+{
+  int r;
+  struct guestfs_set_e2label_args args;
+  const char *device;
+  const char *label;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_set_e2label_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "set_e2label");
+    return;
+  }
+  device = args.device;
+  label = args.label;
+
+  r = do_set_e2label (device, label);
+  if (r == -1)
+    /* do_set_e2label has already called reply_with_error */
+    goto done;
+
+  reply (NULL, NULL);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_set_e2label_args, (char *) &args);
+}
+
+static void get_e2label_stub (XDR *xdr_in)
+{
+  char *r;
+  struct guestfs_get_e2label_args args;
+  const char *device;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_get_e2label_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "get_e2label");
+    return;
+  }
+  device = args.device;
+
+  r = do_get_e2label (device);
+  if (r == NULL)
+    /* do_get_e2label has already called reply_with_error */
+    goto done;
+
+  struct guestfs_get_e2label_ret ret;
+  ret.label = r;
+  reply ((xdrproc_t) &xdr_guestfs_get_e2label_ret, (char *) &ret);
+  free (r);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_get_e2label_args, (char *) &args);
+}
+
+static void set_e2uuid_stub (XDR *xdr_in)
+{
+  int r;
+  struct guestfs_set_e2uuid_args args;
+  const char *device;
+  const char *uuid;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_set_e2uuid_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "set_e2uuid");
+    return;
+  }
+  device = args.device;
+  uuid = args.uuid;
+
+  r = do_set_e2uuid (device, uuid);
+  if (r == -1)
+    /* do_set_e2uuid has already called reply_with_error */
+    goto done;
+
+  reply (NULL, NULL);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_set_e2uuid_args, (char *) &args);
+}
+
+static void get_e2uuid_stub (XDR *xdr_in)
+{
+  char *r;
+  struct guestfs_get_e2uuid_args args;
+  const char *device;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_get_e2uuid_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "get_e2uuid");
+    return;
+  }
+  device = args.device;
+
+  r = do_get_e2uuid (device);
+  if (r == NULL)
+    /* do_get_e2uuid has already called reply_with_error */
+    goto done;
+
+  struct guestfs_get_e2uuid_ret ret;
+  ret.uuid = r;
+  reply ((xdrproc_t) &xdr_guestfs_get_e2uuid_ret, (char *) &ret);
+  free (r);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_get_e2uuid_args, (char *) &args);
+}
+
+static void fsck_stub (XDR *xdr_in)
+{
+  int r;
+  struct guestfs_fsck_args args;
+  const char *fstype;
+  const char *device;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_fsck_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "fsck");
+    return;
+  }
+  fstype = args.fstype;
+  device = args.device;
+
+  r = do_fsck (fstype, device);
+  if (r == -1)
+    /* do_fsck has already called reply_with_error */
+    goto done;
+
+  struct guestfs_fsck_ret ret;
+  ret.status = r;
+  reply ((xdrproc_t) &xdr_guestfs_fsck_ret, (char *) &ret);
+done:
+  xdr_free ((xdrproc_t) xdr_guestfs_fsck_args, (char *) &args);
+}
+
+static void zero_stub (XDR *xdr_in)
+{
+  int r;
+  struct guestfs_zero_args args;
+  const char *device;
+
+  memset (&args, 0, sizeof args);
+
+  if (!xdr_guestfs_zero_args (xdr_in, &args)) {
+    reply_with_error ("%s: daemon failed to decode procedure arguments", "zero");
+    return;
+  }
+  device = args.device;
+
+  r = do_zero (device);
+  if (r == -1)
+    /* do_zero has already called reply_with_error */
+    goto done;
+
+  reply (NULL, NULL);
+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);
+}
+
 void dispatch_incoming_message (XDR *xdr_in)
 {
   switch (proc_nr) {
@@ -1868,6 +2360,60 @@ void dispatch_incoming_message (XDR *xdr_in)
     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;
+    case GUESTFS_PROC_SET_E2LABEL:
+      set_e2label_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_GET_E2LABEL:
+      get_e2label_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_SET_E2UUID:
+      set_e2uuid_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_GET_E2UUID:
+      get_e2uuid_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_FSCK:
+      fsck_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_ZERO:
+      zero_stub (xdr_in);
+      break;
+    case GUESTFS_PROC_GRUB_INSTALL:
+      grub_install_stub (xdr_in);
+      break;
     default:
       reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
   }