+ 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)
+ /* do_vgcreate has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_vgcreate_args, (char *) &args);
+}
+
+static void lvcreate_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_lvcreate_args args;
+ const char *logvol;
+ const char *volgroup;
+ int mbytes;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_lvcreate_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "lvcreate");
+ return;
+ }
+ logvol = args.logvol;
+ volgroup = args.volgroup;
+ mbytes = args.mbytes;
+
+ r = do_lvcreate (logvol, volgroup, mbytes);
+ if (r == -1)
+ /* do_lvcreate has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_lvcreate_args, (char *) &args);
+}
+
+static void mkfs_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_mkfs_args args;
+ const char *fstype;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_mkfs_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "mkfs");
+ return;
+ }
+ fstype = args.fstype;
+ device = args.device;
+
+ r = do_mkfs (fstype, device);
+ if (r == -1)
+ /* do_mkfs has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_mkfs_args, (char *) &args);
+}
+
+static void sfdisk_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_sfdisk_args args;
+ const char *device;
+ int cyls;
+ int heads;
+ int sectors;
+ char **lines;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_sfdisk_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "sfdisk");
+ return;
+ }
+ device = args.device;
+ cyls = args.cyls;
+ heads = args.heads;
+ sectors = args.sectors;
+ 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)
+ /* do_sfdisk has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_sfdisk_args, (char *) &args);
+}
+
+static void write_file_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_write_file_args args;
+ const char *path;
+ const char *content;
+ int size;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_write_file_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "write_file");
+ return;
+ }
+ path = args.path;
+ content = args.content;
+ size = args.size;
+
+ r = do_write_file (path, content, size);
+ if (r == -1)
+ /* do_write_file has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_write_file_args, (char *) &args);
+}
+
+static void umount_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_umount_args args;
+ const char *pathordevice;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_umount_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "umount");
+ return;
+ }
+ pathordevice = args.pathordevice;
+
+ r = do_umount (pathordevice);
+ if (r == -1)
+ /* do_umount has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_umount_args, (char *) &args);
+}
+
+static void mounts_stub (XDR *xdr_in)
+{
+ char **r;
+
+ r = do_mounts ();
+ if (r == NULL)
+ /* do_mounts has already called reply_with_error */
+ goto done;
+
+ struct guestfs_mounts_ret ret;
+ ret.devices.devices_len = count_strings (r);
+ ret.devices.devices_val = r;
+ reply ((xdrproc_t) &xdr_guestfs_mounts_ret, (char *) &ret);
+ free_strings (r);
+done: ;
+}
+
+static void umount_all_stub (XDR *xdr_in)
+{
+ int r;
+
+ r = do_umount_all ();
+ if (r == -1)
+ /* do_umount_all has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done: ;
+}
+
+static void lvm_remove_all_stub (XDR *xdr_in)
+{
+ int r;
+
+ r = do_lvm_remove_all ();
+ if (r == -1)
+ /* do_lvm_remove_all has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done: ;
+}
+
+static void file_stub (XDR *xdr_in)
+{
+ char *r;
+ struct guestfs_file_args args;
+ const char *path;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_file_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "file");
+ return;
+ }
+ path = args.path;
+
+ r = do_file (path);
+ if (r == NULL)
+ /* do_file has already called reply_with_error */
+ goto done;
+
+ struct guestfs_file_ret ret;
+ ret.description = r;
+ reply ((xdrproc_t) &xdr_guestfs_file_ret, (char *) &ret);
+ free (r);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_file_args, (char *) &args);
+}
+
+static void command_stub (XDR *xdr_in)
+{
+ char *r;
+ struct guestfs_command_args args;
+ char **arguments;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_command_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "command");
+ return;
+ }
+ 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)
+ /* do_command has already called reply_with_error */
+ goto done;
+
+ struct guestfs_command_ret ret;
+ ret.output = r;
+ reply ((xdrproc_t) &xdr_guestfs_command_ret, (char *) &ret);
+ free (r);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_command_args, (char *) &args);
+}
+
+static void command_lines_stub (XDR *xdr_in)
+{
+ char **r;
+ struct guestfs_command_lines_args args;
+ char **arguments;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_command_lines_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "command_lines");
+ return;
+ }
+ 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)
+ /* do_command_lines has already called reply_with_error */
+ goto done;
+
+ struct guestfs_command_lines_ret ret;
+ ret.lines.lines_len = count_strings (r);
+ ret.lines.lines_val = r;
+ reply ((xdrproc_t) &xdr_guestfs_command_lines_ret, (char *) &ret);
+ free_strings (r);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_command_lines_args, (char *) &args);
+}
+
+static void stat_stub (XDR *xdr_in)
+{
+ guestfs_int_stat *r;
+ struct guestfs_stat_args args;
+ const char *path;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_stat_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "stat");
+ return;
+ }
+ path = args.path;
+
+ r = do_stat (path);
+ if (r == NULL)
+ /* do_stat has already called reply_with_error */
+ goto done;
+
+ struct guestfs_stat_ret ret;
+ ret.statbuf = *r;
+ reply ((xdrproc_t) xdr_guestfs_stat_ret, (char *) &ret);
+ xdr_free ((xdrproc_t) xdr_guestfs_stat_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_stat_args, (char *) &args);
+}
+
+static void lstat_stub (XDR *xdr_in)
+{
+ guestfs_int_stat *r;
+ struct guestfs_lstat_args args;
+ const char *path;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_lstat_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "lstat");
+ return;
+ }
+ path = args.path;
+
+ r = do_lstat (path);
+ if (r == NULL)
+ /* do_lstat has already called reply_with_error */
+ goto done;
+
+ struct guestfs_lstat_ret ret;
+ ret.statbuf = *r;
+ reply ((xdrproc_t) xdr_guestfs_lstat_ret, (char *) &ret);
+ xdr_free ((xdrproc_t) xdr_guestfs_lstat_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_lstat_args, (char *) &args);
+}
+
+static void statvfs_stub (XDR *xdr_in)
+{
+ guestfs_int_statvfs *r;
+ struct guestfs_statvfs_args args;
+ const char *path;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_statvfs_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "statvfs");
+ return;
+ }
+ path = args.path;
+
+ r = do_statvfs (path);
+ if (r == NULL)
+ /* do_statvfs has already called reply_with_error */
+ goto done;
+
+ struct guestfs_statvfs_ret ret;
+ ret.statbuf = *r;
+ reply ((xdrproc_t) xdr_guestfs_statvfs_ret, (char *) &ret);
+ xdr_free ((xdrproc_t) xdr_guestfs_statvfs_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_statvfs_args, (char *) &args);
+}
+
+static void tune2fs_l_stub (XDR *xdr_in)
+{
+ char **r;
+ struct guestfs_tune2fs_l_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_tune2fs_l_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "tune2fs_l");
+ return;
+ }
+ device = args.device;
+
+ r = do_tune2fs_l (device);
+ if (r == NULL)
+ /* do_tune2fs_l has already called reply_with_error */
+ goto done;
+
+ struct guestfs_tune2fs_l_ret ret;
+ ret.superblock.superblock_len = count_strings (r);
+ ret.superblock.superblock_val = r;
+ reply ((xdrproc_t) &xdr_guestfs_tune2fs_l_ret, (char *) &ret);
+ free_strings (r);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_tune2fs_l_args, (char *) &args);
+}
+
+static void blockdev_setro_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_setro_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_setro_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setro");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_setro (device);
+ if (r == -1)
+ /* do_blockdev_setro has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setro_args, (char *) &args);
+}
+
+static void blockdev_setrw_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_setrw_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_setrw_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setrw");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_setrw (device);
+ if (r == -1)
+ /* do_blockdev_setrw has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setrw_args, (char *) &args);
+}
+
+static void blockdev_getro_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_getro_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_getro_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getro");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_getro (device);
+ if (r == -1)
+ /* do_blockdev_getro has already called reply_with_error */
+ goto done;
+
+ struct guestfs_blockdev_getro_ret ret;
+ ret.ro = r;
+ reply ((xdrproc_t) &xdr_guestfs_blockdev_getro_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getro_args, (char *) &args);
+}
+
+static void blockdev_getss_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_getss_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_getss_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getss");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_getss (device);
+ if (r == -1)
+ /* do_blockdev_getss has already called reply_with_error */
+ goto done;
+
+ struct guestfs_blockdev_getss_ret ret;
+ ret.sectorsize = r;
+ reply ((xdrproc_t) &xdr_guestfs_blockdev_getss_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getss_args, (char *) &args);
+}
+
+static void blockdev_getbsz_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_getbsz_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_getbsz_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getbsz");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_getbsz (device);
+ if (r == -1)
+ /* do_blockdev_getbsz has already called reply_with_error */
+ goto done;
+
+ struct guestfs_blockdev_getbsz_ret ret;
+ ret.blocksize = r;
+ reply ((xdrproc_t) &xdr_guestfs_blockdev_getbsz_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getbsz_args, (char *) &args);
+}
+
+static void blockdev_setbsz_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_setbsz_args args;
+ const char *device;
+ int blocksize;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_setbsz_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setbsz");
+ return;
+ }
+ device = args.device;
+ blocksize = args.blocksize;
+
+ r = do_blockdev_setbsz (device, blocksize);
+ if (r == -1)
+ /* do_blockdev_setbsz has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setbsz_args, (char *) &args);
+}
+
+static void blockdev_getsz_stub (XDR *xdr_in)
+{
+ int64_t r;
+ struct guestfs_blockdev_getsz_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_getsz_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getsz");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_getsz (device);
+ if (r == -1)
+ /* do_blockdev_getsz has already called reply_with_error */
+ goto done;
+
+ struct guestfs_blockdev_getsz_ret ret;
+ ret.sizeinsectors = r;
+ reply ((xdrproc_t) &xdr_guestfs_blockdev_getsz_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getsz_args, (char *) &args);
+}
+
+static void blockdev_getsize64_stub (XDR *xdr_in)
+{
+ int64_t r;
+ struct guestfs_blockdev_getsize64_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_getsize64_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getsize64");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_getsize64 (device);
+ if (r == -1)
+ /* do_blockdev_getsize64 has already called reply_with_error */
+ goto done;
+
+ struct guestfs_blockdev_getsize64_ret ret;
+ ret.sizeinbytes = r;
+ reply ((xdrproc_t) &xdr_guestfs_blockdev_getsize64_ret, (char *) &ret);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getsize64_args, (char *) &args);
+}
+
+static void blockdev_flushbufs_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_flushbufs_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_flushbufs_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_flushbufs");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_flushbufs (device);
+ if (r == -1)
+ /* do_blockdev_flushbufs has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+done:
+ xdr_free ((xdrproc_t) xdr_guestfs_blockdev_flushbufs_args, (char *) &args);
+}
+
+static void blockdev_rereadpt_stub (XDR *xdr_in)
+{
+ int r;
+ struct guestfs_blockdev_rereadpt_args args;
+ const char *device;
+
+ memset (&args, 0, sizeof args);
+
+ if (!xdr_guestfs_blockdev_rereadpt_args (xdr_in, &args)) {
+ reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_rereadpt");
+ return;
+ }
+ device = args.device;
+
+ r = do_blockdev_rereadpt (device);
+ if (r == -1)
+ /* do_blockdev_rereadpt has already called reply_with_error */
+ goto done;
+
+ reply (NULL, NULL);
+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);