1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include <rpc/types.h>
33 #include "../src/guestfs_protocol.h"
36 static void mount_stub (XDR *xdr_in)
39 struct guestfs_mount_args args;
41 const char *mountpoint;
43 memset (&args, 0, sizeof args);
45 if (!xdr_guestfs_mount_args (xdr_in, &args)) {
46 reply_with_error ("%s: daemon failed to decode procedure arguments", "mount");
50 mountpoint = args.mountpoint;
52 r = do_mount (device, mountpoint);
54 /* do_mount has already called reply_with_error */
59 xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
62 static void sync_stub (XDR *xdr_in)
68 /* do_sync has already called reply_with_error */
75 static void touch_stub (XDR *xdr_in)
78 struct guestfs_touch_args args;
81 memset (&args, 0, sizeof args);
83 if (!xdr_guestfs_touch_args (xdr_in, &args)) {
84 reply_with_error ("%s: daemon failed to decode procedure arguments", "touch");
91 /* do_touch has already called reply_with_error */
96 xdr_free ((xdrproc_t) xdr_guestfs_touch_args, (char *) &args);
99 static void cat_stub (XDR *xdr_in)
102 struct guestfs_cat_args args;
105 memset (&args, 0, sizeof args);
107 if (!xdr_guestfs_cat_args (xdr_in, &args)) {
108 reply_with_error ("%s: daemon failed to decode procedure arguments", "cat");
115 /* do_cat has already called reply_with_error */
118 struct guestfs_cat_ret ret;
120 reply ((xdrproc_t) &xdr_guestfs_cat_ret, (char *) &ret);
123 xdr_free ((xdrproc_t) xdr_guestfs_cat_args, (char *) &args);
126 static void ll_stub (XDR *xdr_in)
129 struct guestfs_ll_args args;
130 const char *directory;
132 memset (&args, 0, sizeof args);
134 if (!xdr_guestfs_ll_args (xdr_in, &args)) {
135 reply_with_error ("%s: daemon failed to decode procedure arguments", "ll");
138 directory = args.directory;
140 r = do_ll (directory);
142 /* do_ll has already called reply_with_error */
145 struct guestfs_ll_ret ret;
147 reply ((xdrproc_t) &xdr_guestfs_ll_ret, (char *) &ret);
150 xdr_free ((xdrproc_t) xdr_guestfs_ll_args, (char *) &args);
153 static void ls_stub (XDR *xdr_in)
156 struct guestfs_ls_args args;
157 const char *directory;
159 memset (&args, 0, sizeof args);
161 if (!xdr_guestfs_ls_args (xdr_in, &args)) {
162 reply_with_error ("%s: daemon failed to decode procedure arguments", "ls");
165 directory = args.directory;
167 r = do_ls (directory);
169 /* do_ls has already called reply_with_error */
172 struct guestfs_ls_ret ret;
173 ret.listing.listing_len = count_strings (r);
174 ret.listing.listing_val = r;
175 reply ((xdrproc_t) &xdr_guestfs_ls_ret, (char *) &ret);
178 xdr_free ((xdrproc_t) xdr_guestfs_ls_args, (char *) &args);
181 static void list_devices_stub (XDR *xdr_in)
185 r = do_list_devices ();
187 /* do_list_devices has already called reply_with_error */
190 struct guestfs_list_devices_ret ret;
191 ret.devices.devices_len = count_strings (r);
192 ret.devices.devices_val = r;
193 reply ((xdrproc_t) &xdr_guestfs_list_devices_ret, (char *) &ret);
198 static void list_partitions_stub (XDR *xdr_in)
202 r = do_list_partitions ();
204 /* do_list_partitions has already called reply_with_error */
207 struct guestfs_list_partitions_ret ret;
208 ret.partitions.partitions_len = count_strings (r);
209 ret.partitions.partitions_val = r;
210 reply ((xdrproc_t) &xdr_guestfs_list_partitions_ret, (char *) &ret);
215 static void pvs_stub (XDR *xdr_in)
221 /* do_pvs has already called reply_with_error */
224 struct guestfs_pvs_ret ret;
225 ret.physvols.physvols_len = count_strings (r);
226 ret.physvols.physvols_val = r;
227 reply ((xdrproc_t) &xdr_guestfs_pvs_ret, (char *) &ret);
232 static void vgs_stub (XDR *xdr_in)
238 /* do_vgs has already called reply_with_error */
241 struct guestfs_vgs_ret ret;
242 ret.volgroups.volgroups_len = count_strings (r);
243 ret.volgroups.volgroups_val = r;
244 reply ((xdrproc_t) &xdr_guestfs_vgs_ret, (char *) &ret);
249 static void lvs_stub (XDR *xdr_in)
255 /* do_lvs has already called reply_with_error */
258 struct guestfs_lvs_ret ret;
259 ret.logvols.logvols_len = count_strings (r);
260 ret.logvols.logvols_val = r;
261 reply ((xdrproc_t) &xdr_guestfs_lvs_ret, (char *) &ret);
266 static void pvs_full_stub (XDR *xdr_in)
268 guestfs_lvm_int_pv_list *r;
272 /* do_pvs_full has already called reply_with_error */
275 struct guestfs_pvs_full_ret ret;
277 reply ((xdrproc_t) xdr_guestfs_pvs_full_ret, (char *) &ret);
278 xdr_free ((xdrproc_t) xdr_guestfs_pvs_full_ret, (char *) &ret);
282 static void vgs_full_stub (XDR *xdr_in)
284 guestfs_lvm_int_vg_list *r;
288 /* do_vgs_full has already called reply_with_error */
291 struct guestfs_vgs_full_ret ret;
293 reply ((xdrproc_t) xdr_guestfs_vgs_full_ret, (char *) &ret);
294 xdr_free ((xdrproc_t) xdr_guestfs_vgs_full_ret, (char *) &ret);
298 static void lvs_full_stub (XDR *xdr_in)
300 guestfs_lvm_int_lv_list *r;
304 /* do_lvs_full has already called reply_with_error */
307 struct guestfs_lvs_full_ret ret;
309 reply ((xdrproc_t) xdr_guestfs_lvs_full_ret, (char *) &ret);
310 xdr_free ((xdrproc_t) xdr_guestfs_lvs_full_ret, (char *) &ret);
314 static void read_lines_stub (XDR *xdr_in)
317 struct guestfs_read_lines_args args;
320 memset (&args, 0, sizeof args);
322 if (!xdr_guestfs_read_lines_args (xdr_in, &args)) {
323 reply_with_error ("%s: daemon failed to decode procedure arguments", "read_lines");
328 r = do_read_lines (path);
330 /* do_read_lines has already called reply_with_error */
333 struct guestfs_read_lines_ret ret;
334 ret.lines.lines_len = count_strings (r);
335 ret.lines.lines_val = r;
336 reply ((xdrproc_t) &xdr_guestfs_read_lines_ret, (char *) &ret);
339 xdr_free ((xdrproc_t) xdr_guestfs_read_lines_args, (char *) &args);
342 static void aug_init_stub (XDR *xdr_in)
345 struct guestfs_aug_init_args args;
349 memset (&args, 0, sizeof args);
351 if (!xdr_guestfs_aug_init_args (xdr_in, &args)) {
352 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_init");
358 r = do_aug_init (root, flags);
360 /* do_aug_init has already called reply_with_error */
365 xdr_free ((xdrproc_t) xdr_guestfs_aug_init_args, (char *) &args);
368 static void aug_close_stub (XDR *xdr_in)
374 /* do_aug_close has already called reply_with_error */
381 static void aug_defvar_stub (XDR *xdr_in)
384 struct guestfs_aug_defvar_args args;
388 memset (&args, 0, sizeof args);
390 if (!xdr_guestfs_aug_defvar_args (xdr_in, &args)) {
391 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_defvar");
395 expr = args.expr ? *args.expr : NULL;
397 r = do_aug_defvar (name, expr);
399 /* do_aug_defvar has already called reply_with_error */
402 struct guestfs_aug_defvar_ret ret;
404 reply ((xdrproc_t) &xdr_guestfs_aug_defvar_ret, (char *) &ret);
406 xdr_free ((xdrproc_t) xdr_guestfs_aug_defvar_args, (char *) &args);
409 static void aug_defnode_stub (XDR *xdr_in)
411 guestfs_aug_defnode_ret *r;
412 struct guestfs_aug_defnode_args args;
417 memset (&args, 0, sizeof args);
419 if (!xdr_guestfs_aug_defnode_args (xdr_in, &args)) {
420 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_defnode");
427 r = do_aug_defnode (name, expr, val);
429 /* do_aug_defnode has already called reply_with_error */
432 reply ((xdrproc_t) xdr_guestfs_aug_defnode_ret, (char *) r);
433 xdr_free ((xdrproc_t) xdr_guestfs_aug_defnode_ret, (char *) r);
435 xdr_free ((xdrproc_t) xdr_guestfs_aug_defnode_args, (char *) &args);
438 static void aug_get_stub (XDR *xdr_in)
441 struct guestfs_aug_get_args args;
444 memset (&args, 0, sizeof args);
446 if (!xdr_guestfs_aug_get_args (xdr_in, &args)) {
447 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_get");
452 r = do_aug_get (path);
454 /* do_aug_get has already called reply_with_error */
457 struct guestfs_aug_get_ret ret;
459 reply ((xdrproc_t) &xdr_guestfs_aug_get_ret, (char *) &ret);
462 xdr_free ((xdrproc_t) xdr_guestfs_aug_get_args, (char *) &args);
465 static void aug_set_stub (XDR *xdr_in)
468 struct guestfs_aug_set_args args;
472 memset (&args, 0, sizeof args);
474 if (!xdr_guestfs_aug_set_args (xdr_in, &args)) {
475 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_set");
481 r = do_aug_set (path, val);
483 /* do_aug_set has already called reply_with_error */
488 xdr_free ((xdrproc_t) xdr_guestfs_aug_set_args, (char *) &args);
491 static void aug_insert_stub (XDR *xdr_in)
494 struct guestfs_aug_insert_args args;
499 memset (&args, 0, sizeof args);
501 if (!xdr_guestfs_aug_insert_args (xdr_in, &args)) {
502 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_insert");
507 before = args.before;
509 r = do_aug_insert (path, label, before);
511 /* do_aug_insert has already called reply_with_error */
516 xdr_free ((xdrproc_t) xdr_guestfs_aug_insert_args, (char *) &args);
519 static void aug_rm_stub (XDR *xdr_in)
522 struct guestfs_aug_rm_args args;
525 memset (&args, 0, sizeof args);
527 if (!xdr_guestfs_aug_rm_args (xdr_in, &args)) {
528 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_rm");
533 r = do_aug_rm (path);
535 /* do_aug_rm has already called reply_with_error */
538 struct guestfs_aug_rm_ret ret;
540 reply ((xdrproc_t) &xdr_guestfs_aug_rm_ret, (char *) &ret);
542 xdr_free ((xdrproc_t) xdr_guestfs_aug_rm_args, (char *) &args);
545 static void aug_mv_stub (XDR *xdr_in)
548 struct guestfs_aug_mv_args args;
552 memset (&args, 0, sizeof args);
554 if (!xdr_guestfs_aug_mv_args (xdr_in, &args)) {
555 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_mv");
561 r = do_aug_mv (src, dest);
563 /* do_aug_mv has already called reply_with_error */
568 xdr_free ((xdrproc_t) xdr_guestfs_aug_mv_args, (char *) &args);
571 static void aug_match_stub (XDR *xdr_in)
574 struct guestfs_aug_match_args args;
577 memset (&args, 0, sizeof args);
579 if (!xdr_guestfs_aug_match_args (xdr_in, &args)) {
580 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_match");
585 r = do_aug_match (path);
587 /* do_aug_match has already called reply_with_error */
590 struct guestfs_aug_match_ret ret;
591 ret.matches.matches_len = count_strings (r);
592 ret.matches.matches_val = r;
593 reply ((xdrproc_t) &xdr_guestfs_aug_match_ret, (char *) &ret);
596 xdr_free ((xdrproc_t) xdr_guestfs_aug_match_args, (char *) &args);
599 static void aug_save_stub (XDR *xdr_in)
605 /* do_aug_save has already called reply_with_error */
612 static void aug_load_stub (XDR *xdr_in)
618 /* do_aug_load has already called reply_with_error */
625 static void aug_ls_stub (XDR *xdr_in)
628 struct guestfs_aug_ls_args args;
631 memset (&args, 0, sizeof args);
633 if (!xdr_guestfs_aug_ls_args (xdr_in, &args)) {
634 reply_with_error ("%s: daemon failed to decode procedure arguments", "aug_ls");
639 r = do_aug_ls (path);
641 /* do_aug_ls has already called reply_with_error */
644 struct guestfs_aug_ls_ret ret;
645 ret.matches.matches_len = count_strings (r);
646 ret.matches.matches_val = r;
647 reply ((xdrproc_t) &xdr_guestfs_aug_ls_ret, (char *) &ret);
650 xdr_free ((xdrproc_t) xdr_guestfs_aug_ls_args, (char *) &args);
653 static void rm_stub (XDR *xdr_in)
656 struct guestfs_rm_args args;
659 memset (&args, 0, sizeof args);
661 if (!xdr_guestfs_rm_args (xdr_in, &args)) {
662 reply_with_error ("%s: daemon failed to decode procedure arguments", "rm");
669 /* do_rm has already called reply_with_error */
674 xdr_free ((xdrproc_t) xdr_guestfs_rm_args, (char *) &args);
677 static void rmdir_stub (XDR *xdr_in)
680 struct guestfs_rmdir_args args;
683 memset (&args, 0, sizeof args);
685 if (!xdr_guestfs_rmdir_args (xdr_in, &args)) {
686 reply_with_error ("%s: daemon failed to decode procedure arguments", "rmdir");
693 /* do_rmdir has already called reply_with_error */
698 xdr_free ((xdrproc_t) xdr_guestfs_rmdir_args, (char *) &args);
701 static void rm_rf_stub (XDR *xdr_in)
704 struct guestfs_rm_rf_args args;
707 memset (&args, 0, sizeof args);
709 if (!xdr_guestfs_rm_rf_args (xdr_in, &args)) {
710 reply_with_error ("%s: daemon failed to decode procedure arguments", "rm_rf");
717 /* do_rm_rf has already called reply_with_error */
722 xdr_free ((xdrproc_t) xdr_guestfs_rm_rf_args, (char *) &args);
725 static void mkdir_stub (XDR *xdr_in)
728 struct guestfs_mkdir_args args;
731 memset (&args, 0, sizeof args);
733 if (!xdr_guestfs_mkdir_args (xdr_in, &args)) {
734 reply_with_error ("%s: daemon failed to decode procedure arguments", "mkdir");
741 /* do_mkdir has already called reply_with_error */
746 xdr_free ((xdrproc_t) xdr_guestfs_mkdir_args, (char *) &args);
749 static void mkdir_p_stub (XDR *xdr_in)
752 struct guestfs_mkdir_p_args args;
755 memset (&args, 0, sizeof args);
757 if (!xdr_guestfs_mkdir_p_args (xdr_in, &args)) {
758 reply_with_error ("%s: daemon failed to decode procedure arguments", "mkdir_p");
763 r = do_mkdir_p (path);
765 /* do_mkdir_p has already called reply_with_error */
770 xdr_free ((xdrproc_t) xdr_guestfs_mkdir_p_args, (char *) &args);
773 static void chmod_stub (XDR *xdr_in)
776 struct guestfs_chmod_args args;
780 memset (&args, 0, sizeof args);
782 if (!xdr_guestfs_chmod_args (xdr_in, &args)) {
783 reply_with_error ("%s: daemon failed to decode procedure arguments", "chmod");
789 r = do_chmod (mode, path);
791 /* do_chmod has already called reply_with_error */
796 xdr_free ((xdrproc_t) xdr_guestfs_chmod_args, (char *) &args);
799 static void chown_stub (XDR *xdr_in)
802 struct guestfs_chown_args args;
807 memset (&args, 0, sizeof args);
809 if (!xdr_guestfs_chown_args (xdr_in, &args)) {
810 reply_with_error ("%s: daemon failed to decode procedure arguments", "chown");
817 r = do_chown (owner, group, path);
819 /* do_chown has already called reply_with_error */
824 xdr_free ((xdrproc_t) xdr_guestfs_chown_args, (char *) &args);
827 static void exists_stub (XDR *xdr_in)
830 struct guestfs_exists_args args;
833 memset (&args, 0, sizeof args);
835 if (!xdr_guestfs_exists_args (xdr_in, &args)) {
836 reply_with_error ("%s: daemon failed to decode procedure arguments", "exists");
841 r = do_exists (path);
843 /* do_exists has already called reply_with_error */
846 struct guestfs_exists_ret ret;
848 reply ((xdrproc_t) &xdr_guestfs_exists_ret, (char *) &ret);
850 xdr_free ((xdrproc_t) xdr_guestfs_exists_args, (char *) &args);
853 static void is_file_stub (XDR *xdr_in)
856 struct guestfs_is_file_args args;
859 memset (&args, 0, sizeof args);
861 if (!xdr_guestfs_is_file_args (xdr_in, &args)) {
862 reply_with_error ("%s: daemon failed to decode procedure arguments", "is_file");
867 r = do_is_file (path);
869 /* do_is_file has already called reply_with_error */
872 struct guestfs_is_file_ret ret;
874 reply ((xdrproc_t) &xdr_guestfs_is_file_ret, (char *) &ret);
876 xdr_free ((xdrproc_t) xdr_guestfs_is_file_args, (char *) &args);
879 static void is_dir_stub (XDR *xdr_in)
882 struct guestfs_is_dir_args args;
885 memset (&args, 0, sizeof args);
887 if (!xdr_guestfs_is_dir_args (xdr_in, &args)) {
888 reply_with_error ("%s: daemon failed to decode procedure arguments", "is_dir");
893 r = do_is_dir (path);
895 /* do_is_dir has already called reply_with_error */
898 struct guestfs_is_dir_ret ret;
900 reply ((xdrproc_t) &xdr_guestfs_is_dir_ret, (char *) &ret);
902 xdr_free ((xdrproc_t) xdr_guestfs_is_dir_args, (char *) &args);
905 static void pvcreate_stub (XDR *xdr_in)
908 struct guestfs_pvcreate_args args;
911 memset (&args, 0, sizeof args);
913 if (!xdr_guestfs_pvcreate_args (xdr_in, &args)) {
914 reply_with_error ("%s: daemon failed to decode procedure arguments", "pvcreate");
917 device = args.device;
919 r = do_pvcreate (device);
921 /* do_pvcreate has already called reply_with_error */
926 xdr_free ((xdrproc_t) xdr_guestfs_pvcreate_args, (char *) &args);
929 static void vgcreate_stub (XDR *xdr_in)
932 struct guestfs_vgcreate_args args;
933 const char *volgroup;
936 memset (&args, 0, sizeof args);
938 if (!xdr_guestfs_vgcreate_args (xdr_in, &args)) {
939 reply_with_error ("%s: daemon failed to decode procedure arguments", "vgcreate");
942 volgroup = args.volgroup;
943 physvols = realloc (args.physvols.physvols_val,
944 sizeof (char *) * (args.physvols.physvols_len+1));
945 if (physvols == NULL) {
946 reply_with_perror ("realloc");
949 physvols[args.physvols.physvols_len] = NULL;
950 args.physvols.physvols_val = physvols;
952 r = do_vgcreate (volgroup, physvols);
954 /* do_vgcreate has already called reply_with_error */
959 xdr_free ((xdrproc_t) xdr_guestfs_vgcreate_args, (char *) &args);
962 static void lvcreate_stub (XDR *xdr_in)
965 struct guestfs_lvcreate_args args;
967 const char *volgroup;
970 memset (&args, 0, sizeof args);
972 if (!xdr_guestfs_lvcreate_args (xdr_in, &args)) {
973 reply_with_error ("%s: daemon failed to decode procedure arguments", "lvcreate");
976 logvol = args.logvol;
977 volgroup = args.volgroup;
978 mbytes = args.mbytes;
980 r = do_lvcreate (logvol, volgroup, mbytes);
982 /* do_lvcreate has already called reply_with_error */
987 xdr_free ((xdrproc_t) xdr_guestfs_lvcreate_args, (char *) &args);
990 static void mkfs_stub (XDR *xdr_in)
993 struct guestfs_mkfs_args args;
997 memset (&args, 0, sizeof args);
999 if (!xdr_guestfs_mkfs_args (xdr_in, &args)) {
1000 reply_with_error ("%s: daemon failed to decode procedure arguments", "mkfs");
1003 fstype = args.fstype;
1004 device = args.device;
1006 r = do_mkfs (fstype, device);
1008 /* do_mkfs has already called reply_with_error */
1013 xdr_free ((xdrproc_t) xdr_guestfs_mkfs_args, (char *) &args);
1016 static void sfdisk_stub (XDR *xdr_in)
1019 struct guestfs_sfdisk_args args;
1026 memset (&args, 0, sizeof args);
1028 if (!xdr_guestfs_sfdisk_args (xdr_in, &args)) {
1029 reply_with_error ("%s: daemon failed to decode procedure arguments", "sfdisk");
1032 device = args.device;
1035 sectors = args.sectors;
1036 lines = realloc (args.lines.lines_val,
1037 sizeof (char *) * (args.lines.lines_len+1));
1038 if (lines == NULL) {
1039 reply_with_perror ("realloc");
1042 lines[args.lines.lines_len] = NULL;
1043 args.lines.lines_val = lines;
1045 r = do_sfdisk (device, cyls, heads, sectors, lines);
1047 /* do_sfdisk has already called reply_with_error */
1052 xdr_free ((xdrproc_t) xdr_guestfs_sfdisk_args, (char *) &args);
1055 static void write_file_stub (XDR *xdr_in)
1058 struct guestfs_write_file_args args;
1060 const char *content;
1063 memset (&args, 0, sizeof args);
1065 if (!xdr_guestfs_write_file_args (xdr_in, &args)) {
1066 reply_with_error ("%s: daemon failed to decode procedure arguments", "write_file");
1070 content = args.content;
1073 r = do_write_file (path, content, size);
1075 /* do_write_file has already called reply_with_error */
1080 xdr_free ((xdrproc_t) xdr_guestfs_write_file_args, (char *) &args);
1083 static void umount_stub (XDR *xdr_in)
1086 struct guestfs_umount_args args;
1087 const char *pathordevice;
1089 memset (&args, 0, sizeof args);
1091 if (!xdr_guestfs_umount_args (xdr_in, &args)) {
1092 reply_with_error ("%s: daemon failed to decode procedure arguments", "umount");
1095 pathordevice = args.pathordevice;
1097 r = do_umount (pathordevice);
1099 /* do_umount has already called reply_with_error */
1104 xdr_free ((xdrproc_t) xdr_guestfs_umount_args, (char *) &args);
1107 static void mounts_stub (XDR *xdr_in)
1113 /* do_mounts has already called reply_with_error */
1116 struct guestfs_mounts_ret ret;
1117 ret.devices.devices_len = count_strings (r);
1118 ret.devices.devices_val = r;
1119 reply ((xdrproc_t) &xdr_guestfs_mounts_ret, (char *) &ret);
1124 static void umount_all_stub (XDR *xdr_in)
1128 r = do_umount_all ();
1130 /* do_umount_all has already called reply_with_error */
1137 static void lvm_remove_all_stub (XDR *xdr_in)
1141 r = do_lvm_remove_all ();
1143 /* do_lvm_remove_all has already called reply_with_error */
1150 static void file_stub (XDR *xdr_in)
1153 struct guestfs_file_args args;
1156 memset (&args, 0, sizeof args);
1158 if (!xdr_guestfs_file_args (xdr_in, &args)) {
1159 reply_with_error ("%s: daemon failed to decode procedure arguments", "file");
1166 /* do_file has already called reply_with_error */
1169 struct guestfs_file_ret ret;
1170 ret.description = r;
1171 reply ((xdrproc_t) &xdr_guestfs_file_ret, (char *) &ret);
1174 xdr_free ((xdrproc_t) xdr_guestfs_file_args, (char *) &args);
1177 static void command_stub (XDR *xdr_in)
1180 struct guestfs_command_args args;
1183 memset (&args, 0, sizeof args);
1185 if (!xdr_guestfs_command_args (xdr_in, &args)) {
1186 reply_with_error ("%s: daemon failed to decode procedure arguments", "command");
1189 arguments = realloc (args.arguments.arguments_val,
1190 sizeof (char *) * (args.arguments.arguments_len+1));
1191 if (arguments == NULL) {
1192 reply_with_perror ("realloc");
1195 arguments[args.arguments.arguments_len] = NULL;
1196 args.arguments.arguments_val = arguments;
1198 r = do_command (arguments);
1200 /* do_command has already called reply_with_error */
1203 struct guestfs_command_ret ret;
1205 reply ((xdrproc_t) &xdr_guestfs_command_ret, (char *) &ret);
1208 xdr_free ((xdrproc_t) xdr_guestfs_command_args, (char *) &args);
1211 static void command_lines_stub (XDR *xdr_in)
1214 struct guestfs_command_lines_args args;
1217 memset (&args, 0, sizeof args);
1219 if (!xdr_guestfs_command_lines_args (xdr_in, &args)) {
1220 reply_with_error ("%s: daemon failed to decode procedure arguments", "command_lines");
1223 arguments = realloc (args.arguments.arguments_val,
1224 sizeof (char *) * (args.arguments.arguments_len+1));
1225 if (arguments == NULL) {
1226 reply_with_perror ("realloc");
1229 arguments[args.arguments.arguments_len] = NULL;
1230 args.arguments.arguments_val = arguments;
1232 r = do_command_lines (arguments);
1234 /* do_command_lines has already called reply_with_error */
1237 struct guestfs_command_lines_ret ret;
1238 ret.lines.lines_len = count_strings (r);
1239 ret.lines.lines_val = r;
1240 reply ((xdrproc_t) &xdr_guestfs_command_lines_ret, (char *) &ret);
1243 xdr_free ((xdrproc_t) xdr_guestfs_command_lines_args, (char *) &args);
1246 static void stat_stub (XDR *xdr_in)
1248 guestfs_int_stat *r;
1249 struct guestfs_stat_args args;
1252 memset (&args, 0, sizeof args);
1254 if (!xdr_guestfs_stat_args (xdr_in, &args)) {
1255 reply_with_error ("%s: daemon failed to decode procedure arguments", "stat");
1262 /* do_stat has already called reply_with_error */
1265 struct guestfs_stat_ret ret;
1267 reply ((xdrproc_t) xdr_guestfs_stat_ret, (char *) &ret);
1268 xdr_free ((xdrproc_t) xdr_guestfs_stat_ret, (char *) &ret);
1270 xdr_free ((xdrproc_t) xdr_guestfs_stat_args, (char *) &args);
1273 static void lstat_stub (XDR *xdr_in)
1275 guestfs_int_stat *r;
1276 struct guestfs_lstat_args args;
1279 memset (&args, 0, sizeof args);
1281 if (!xdr_guestfs_lstat_args (xdr_in, &args)) {
1282 reply_with_error ("%s: daemon failed to decode procedure arguments", "lstat");
1287 r = do_lstat (path);
1289 /* do_lstat has already called reply_with_error */
1292 struct guestfs_lstat_ret ret;
1294 reply ((xdrproc_t) xdr_guestfs_lstat_ret, (char *) &ret);
1295 xdr_free ((xdrproc_t) xdr_guestfs_lstat_ret, (char *) &ret);
1297 xdr_free ((xdrproc_t) xdr_guestfs_lstat_args, (char *) &args);
1300 static void statvfs_stub (XDR *xdr_in)
1302 guestfs_int_statvfs *r;
1303 struct guestfs_statvfs_args args;
1306 memset (&args, 0, sizeof args);
1308 if (!xdr_guestfs_statvfs_args (xdr_in, &args)) {
1309 reply_with_error ("%s: daemon failed to decode procedure arguments", "statvfs");
1314 r = do_statvfs (path);
1316 /* do_statvfs has already called reply_with_error */
1319 struct guestfs_statvfs_ret ret;
1321 reply ((xdrproc_t) xdr_guestfs_statvfs_ret, (char *) &ret);
1322 xdr_free ((xdrproc_t) xdr_guestfs_statvfs_ret, (char *) &ret);
1324 xdr_free ((xdrproc_t) xdr_guestfs_statvfs_args, (char *) &args);
1327 static void tune2fs_l_stub (XDR *xdr_in)
1330 struct guestfs_tune2fs_l_args args;
1333 memset (&args, 0, sizeof args);
1335 if (!xdr_guestfs_tune2fs_l_args (xdr_in, &args)) {
1336 reply_with_error ("%s: daemon failed to decode procedure arguments", "tune2fs_l");
1339 device = args.device;
1341 r = do_tune2fs_l (device);
1343 /* do_tune2fs_l has already called reply_with_error */
1346 struct guestfs_tune2fs_l_ret ret;
1347 ret.superblock.superblock_len = count_strings (r);
1348 ret.superblock.superblock_val = r;
1349 reply ((xdrproc_t) &xdr_guestfs_tune2fs_l_ret, (char *) &ret);
1352 xdr_free ((xdrproc_t) xdr_guestfs_tune2fs_l_args, (char *) &args);
1355 static void blockdev_setro_stub (XDR *xdr_in)
1358 struct guestfs_blockdev_setro_args args;
1361 memset (&args, 0, sizeof args);
1363 if (!xdr_guestfs_blockdev_setro_args (xdr_in, &args)) {
1364 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setro");
1367 device = args.device;
1369 r = do_blockdev_setro (device);
1371 /* do_blockdev_setro has already called reply_with_error */
1376 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setro_args, (char *) &args);
1379 static void blockdev_setrw_stub (XDR *xdr_in)
1382 struct guestfs_blockdev_setrw_args args;
1385 memset (&args, 0, sizeof args);
1387 if (!xdr_guestfs_blockdev_setrw_args (xdr_in, &args)) {
1388 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setrw");
1391 device = args.device;
1393 r = do_blockdev_setrw (device);
1395 /* do_blockdev_setrw has already called reply_with_error */
1400 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setrw_args, (char *) &args);
1403 static void blockdev_getro_stub (XDR *xdr_in)
1406 struct guestfs_blockdev_getro_args args;
1409 memset (&args, 0, sizeof args);
1411 if (!xdr_guestfs_blockdev_getro_args (xdr_in, &args)) {
1412 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getro");
1415 device = args.device;
1417 r = do_blockdev_getro (device);
1419 /* do_blockdev_getro has already called reply_with_error */
1422 struct guestfs_blockdev_getro_ret ret;
1424 reply ((xdrproc_t) &xdr_guestfs_blockdev_getro_ret, (char *) &ret);
1426 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getro_args, (char *) &args);
1429 static void blockdev_getss_stub (XDR *xdr_in)
1432 struct guestfs_blockdev_getss_args args;
1435 memset (&args, 0, sizeof args);
1437 if (!xdr_guestfs_blockdev_getss_args (xdr_in, &args)) {
1438 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getss");
1441 device = args.device;
1443 r = do_blockdev_getss (device);
1445 /* do_blockdev_getss has already called reply_with_error */
1448 struct guestfs_blockdev_getss_ret ret;
1450 reply ((xdrproc_t) &xdr_guestfs_blockdev_getss_ret, (char *) &ret);
1452 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getss_args, (char *) &args);
1455 static void blockdev_getbsz_stub (XDR *xdr_in)
1458 struct guestfs_blockdev_getbsz_args args;
1461 memset (&args, 0, sizeof args);
1463 if (!xdr_guestfs_blockdev_getbsz_args (xdr_in, &args)) {
1464 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getbsz");
1467 device = args.device;
1469 r = do_blockdev_getbsz (device);
1471 /* do_blockdev_getbsz has already called reply_with_error */
1474 struct guestfs_blockdev_getbsz_ret ret;
1476 reply ((xdrproc_t) &xdr_guestfs_blockdev_getbsz_ret, (char *) &ret);
1478 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getbsz_args, (char *) &args);
1481 static void blockdev_setbsz_stub (XDR *xdr_in)
1484 struct guestfs_blockdev_setbsz_args args;
1488 memset (&args, 0, sizeof args);
1490 if (!xdr_guestfs_blockdev_setbsz_args (xdr_in, &args)) {
1491 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_setbsz");
1494 device = args.device;
1495 blocksize = args.blocksize;
1497 r = do_blockdev_setbsz (device, blocksize);
1499 /* do_blockdev_setbsz has already called reply_with_error */
1504 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_setbsz_args, (char *) &args);
1507 static void blockdev_getsz_stub (XDR *xdr_in)
1510 struct guestfs_blockdev_getsz_args args;
1513 memset (&args, 0, sizeof args);
1515 if (!xdr_guestfs_blockdev_getsz_args (xdr_in, &args)) {
1516 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getsz");
1519 device = args.device;
1521 r = do_blockdev_getsz (device);
1523 /* do_blockdev_getsz has already called reply_with_error */
1526 struct guestfs_blockdev_getsz_ret ret;
1527 ret.sizeinsectors = r;
1528 reply ((xdrproc_t) &xdr_guestfs_blockdev_getsz_ret, (char *) &ret);
1530 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getsz_args, (char *) &args);
1533 static void blockdev_getsize64_stub (XDR *xdr_in)
1536 struct guestfs_blockdev_getsize64_args args;
1539 memset (&args, 0, sizeof args);
1541 if (!xdr_guestfs_blockdev_getsize64_args (xdr_in, &args)) {
1542 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_getsize64");
1545 device = args.device;
1547 r = do_blockdev_getsize64 (device);
1549 /* do_blockdev_getsize64 has already called reply_with_error */
1552 struct guestfs_blockdev_getsize64_ret ret;
1553 ret.sizeinbytes = r;
1554 reply ((xdrproc_t) &xdr_guestfs_blockdev_getsize64_ret, (char *) &ret);
1556 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_getsize64_args, (char *) &args);
1559 static void blockdev_flushbufs_stub (XDR *xdr_in)
1562 struct guestfs_blockdev_flushbufs_args args;
1565 memset (&args, 0, sizeof args);
1567 if (!xdr_guestfs_blockdev_flushbufs_args (xdr_in, &args)) {
1568 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_flushbufs");
1571 device = args.device;
1573 r = do_blockdev_flushbufs (device);
1575 /* do_blockdev_flushbufs has already called reply_with_error */
1580 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_flushbufs_args, (char *) &args);
1583 static void blockdev_rereadpt_stub (XDR *xdr_in)
1586 struct guestfs_blockdev_rereadpt_args args;
1589 memset (&args, 0, sizeof args);
1591 if (!xdr_guestfs_blockdev_rereadpt_args (xdr_in, &args)) {
1592 reply_with_error ("%s: daemon failed to decode procedure arguments", "blockdev_rereadpt");
1595 device = args.device;
1597 r = do_blockdev_rereadpt (device);
1599 /* do_blockdev_rereadpt has already called reply_with_error */
1604 xdr_free ((xdrproc_t) xdr_guestfs_blockdev_rereadpt_args, (char *) &args);
1607 static void upload_stub (XDR *xdr_in)
1610 struct guestfs_upload_args args;
1611 const char *remotefilename;
1613 memset (&args, 0, sizeof args);
1615 if (!xdr_guestfs_upload_args (xdr_in, &args)) {
1616 reply_with_error ("%s: daemon failed to decode procedure arguments", "upload");
1619 remotefilename = args.remotefilename;
1621 r = do_upload (remotefilename);
1623 /* do_upload has already called reply_with_error */
1628 xdr_free ((xdrproc_t) xdr_guestfs_upload_args, (char *) &args);
1631 static void download_stub (XDR *xdr_in)
1634 struct guestfs_download_args args;
1635 const char *remotefilename;
1637 memset (&args, 0, sizeof args);
1639 if (!xdr_guestfs_download_args (xdr_in, &args)) {
1640 reply_with_error ("%s: daemon failed to decode procedure arguments", "download");
1643 remotefilename = args.remotefilename;
1645 r = do_download (remotefilename);
1647 /* do_download has already called reply_with_error */
1650 /* do_download has already sent a reply */
1652 xdr_free ((xdrproc_t) xdr_guestfs_download_args, (char *) &args);
1655 static void checksum_stub (XDR *xdr_in)
1658 struct guestfs_checksum_args args;
1659 const char *csumtype;
1662 memset (&args, 0, sizeof args);
1664 if (!xdr_guestfs_checksum_args (xdr_in, &args)) {
1665 reply_with_error ("%s: daemon failed to decode procedure arguments", "checksum");
1668 csumtype = args.csumtype;
1671 r = do_checksum (csumtype, path);
1673 /* do_checksum has already called reply_with_error */
1676 struct guestfs_checksum_ret ret;
1678 reply ((xdrproc_t) &xdr_guestfs_checksum_ret, (char *) &ret);
1681 xdr_free ((xdrproc_t) xdr_guestfs_checksum_args, (char *) &args);
1684 static void tar_in_stub (XDR *xdr_in)
1687 struct guestfs_tar_in_args args;
1688 const char *directory;
1690 memset (&args, 0, sizeof args);
1692 if (!xdr_guestfs_tar_in_args (xdr_in, &args)) {
1693 reply_with_error ("%s: daemon failed to decode procedure arguments", "tar_in");
1696 directory = args.directory;
1698 r = do_tar_in (directory);
1700 /* do_tar_in has already called reply_with_error */
1705 xdr_free ((xdrproc_t) xdr_guestfs_tar_in_args, (char *) &args);
1708 static void tar_out_stub (XDR *xdr_in)
1711 struct guestfs_tar_out_args args;
1712 const char *directory;
1714 memset (&args, 0, sizeof args);
1716 if (!xdr_guestfs_tar_out_args (xdr_in, &args)) {
1717 reply_with_error ("%s: daemon failed to decode procedure arguments", "tar_out");
1720 directory = args.directory;
1722 r = do_tar_out (directory);
1724 /* do_tar_out has already called reply_with_error */
1727 /* do_tar_out has already sent a reply */
1729 xdr_free ((xdrproc_t) xdr_guestfs_tar_out_args, (char *) &args);
1732 static void tgz_in_stub (XDR *xdr_in)
1735 struct guestfs_tgz_in_args args;
1736 const char *directory;
1738 memset (&args, 0, sizeof args);
1740 if (!xdr_guestfs_tgz_in_args (xdr_in, &args)) {
1741 reply_with_error ("%s: daemon failed to decode procedure arguments", "tgz_in");
1744 directory = args.directory;
1746 r = do_tgz_in (directory);
1748 /* do_tgz_in has already called reply_with_error */
1753 xdr_free ((xdrproc_t) xdr_guestfs_tgz_in_args, (char *) &args);
1756 static void tgz_out_stub (XDR *xdr_in)
1759 struct guestfs_tgz_out_args args;
1760 const char *directory;
1762 memset (&args, 0, sizeof args);
1764 if (!xdr_guestfs_tgz_out_args (xdr_in, &args)) {
1765 reply_with_error ("%s: daemon failed to decode procedure arguments", "tgz_out");
1768 directory = args.directory;
1770 r = do_tgz_out (directory);
1772 /* do_tgz_out has already called reply_with_error */
1775 /* do_tgz_out has already sent a reply */
1777 xdr_free ((xdrproc_t) xdr_guestfs_tgz_out_args, (char *) &args);
1780 static void mount_ro_stub (XDR *xdr_in)
1783 struct guestfs_mount_ro_args args;
1785 const char *mountpoint;
1787 memset (&args, 0, sizeof args);
1789 if (!xdr_guestfs_mount_ro_args (xdr_in, &args)) {
1790 reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_ro");
1793 device = args.device;
1794 mountpoint = args.mountpoint;
1796 r = do_mount_ro (device, mountpoint);
1798 /* do_mount_ro has already called reply_with_error */
1803 xdr_free ((xdrproc_t) xdr_guestfs_mount_ro_args, (char *) &args);
1806 static void mount_options_stub (XDR *xdr_in)
1809 struct guestfs_mount_options_args args;
1810 const char *options;
1812 const char *mountpoint;
1814 memset (&args, 0, sizeof args);
1816 if (!xdr_guestfs_mount_options_args (xdr_in, &args)) {
1817 reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_options");
1820 options = args.options;
1821 device = args.device;
1822 mountpoint = args.mountpoint;
1824 r = do_mount_options (options, device, mountpoint);
1826 /* do_mount_options has already called reply_with_error */
1831 xdr_free ((xdrproc_t) xdr_guestfs_mount_options_args, (char *) &args);
1834 static void mount_vfs_stub (XDR *xdr_in)
1837 struct guestfs_mount_vfs_args args;
1838 const char *options;
1839 const char *vfstype;
1841 const char *mountpoint;
1843 memset (&args, 0, sizeof args);
1845 if (!xdr_guestfs_mount_vfs_args (xdr_in, &args)) {
1846 reply_with_error ("%s: daemon failed to decode procedure arguments", "mount_vfs");
1849 options = args.options;
1850 vfstype = args.vfstype;
1851 device = args.device;
1852 mountpoint = args.mountpoint;
1854 r = do_mount_vfs (options, vfstype, device, mountpoint);
1856 /* do_mount_vfs has already called reply_with_error */
1861 xdr_free ((xdrproc_t) xdr_guestfs_mount_vfs_args, (char *) &args);
1864 static void debug_stub (XDR *xdr_in)
1867 struct guestfs_debug_args args;
1871 memset (&args, 0, sizeof args);
1873 if (!xdr_guestfs_debug_args (xdr_in, &args)) {
1874 reply_with_error ("%s: daemon failed to decode procedure arguments", "debug");
1877 subcmd = args.subcmd;
1878 extraargs = realloc (args.extraargs.extraargs_val,
1879 sizeof (char *) * (args.extraargs.extraargs_len+1));
1880 if (extraargs == NULL) {
1881 reply_with_perror ("realloc");
1884 extraargs[args.extraargs.extraargs_len] = NULL;
1885 args.extraargs.extraargs_val = extraargs;
1887 r = do_debug (subcmd, extraargs);
1889 /* do_debug has already called reply_with_error */
1892 struct guestfs_debug_ret ret;
1894 reply ((xdrproc_t) &xdr_guestfs_debug_ret, (char *) &ret);
1897 xdr_free ((xdrproc_t) xdr_guestfs_debug_args, (char *) &args);
1900 static void lvremove_stub (XDR *xdr_in)
1903 struct guestfs_lvremove_args args;
1906 memset (&args, 0, sizeof args);
1908 if (!xdr_guestfs_lvremove_args (xdr_in, &args)) {
1909 reply_with_error ("%s: daemon failed to decode procedure arguments", "lvremove");
1912 device = args.device;
1914 r = do_lvremove (device);
1916 /* do_lvremove has already called reply_with_error */
1921 xdr_free ((xdrproc_t) xdr_guestfs_lvremove_args, (char *) &args);
1924 static void vgremove_stub (XDR *xdr_in)
1927 struct guestfs_vgremove_args args;
1930 memset (&args, 0, sizeof args);
1932 if (!xdr_guestfs_vgremove_args (xdr_in, &args)) {
1933 reply_with_error ("%s: daemon failed to decode procedure arguments", "vgremove");
1936 vgname = args.vgname;
1938 r = do_vgremove (vgname);
1940 /* do_vgremove has already called reply_with_error */
1945 xdr_free ((xdrproc_t) xdr_guestfs_vgremove_args, (char *) &args);
1948 static void pvremove_stub (XDR *xdr_in)
1951 struct guestfs_pvremove_args args;
1954 memset (&args, 0, sizeof args);
1956 if (!xdr_guestfs_pvremove_args (xdr_in, &args)) {
1957 reply_with_error ("%s: daemon failed to decode procedure arguments", "pvremove");
1960 device = args.device;
1962 r = do_pvremove (device);
1964 /* do_pvremove has already called reply_with_error */
1969 xdr_free ((xdrproc_t) xdr_guestfs_pvremove_args, (char *) &args);
1972 static void set_e2label_stub (XDR *xdr_in)
1975 struct guestfs_set_e2label_args args;
1979 memset (&args, 0, sizeof args);
1981 if (!xdr_guestfs_set_e2label_args (xdr_in, &args)) {
1982 reply_with_error ("%s: daemon failed to decode procedure arguments", "set_e2label");
1985 device = args.device;
1988 r = do_set_e2label (device, label);
1990 /* do_set_e2label has already called reply_with_error */
1995 xdr_free ((xdrproc_t) xdr_guestfs_set_e2label_args, (char *) &args);
1998 static void get_e2label_stub (XDR *xdr_in)
2001 struct guestfs_get_e2label_args args;
2004 memset (&args, 0, sizeof args);
2006 if (!xdr_guestfs_get_e2label_args (xdr_in, &args)) {
2007 reply_with_error ("%s: daemon failed to decode procedure arguments", "get_e2label");
2010 device = args.device;
2012 r = do_get_e2label (device);
2014 /* do_get_e2label has already called reply_with_error */
2017 struct guestfs_get_e2label_ret ret;
2019 reply ((xdrproc_t) &xdr_guestfs_get_e2label_ret, (char *) &ret);
2022 xdr_free ((xdrproc_t) xdr_guestfs_get_e2label_args, (char *) &args);
2025 static void set_e2uuid_stub (XDR *xdr_in)
2028 struct guestfs_set_e2uuid_args args;
2032 memset (&args, 0, sizeof args);
2034 if (!xdr_guestfs_set_e2uuid_args (xdr_in, &args)) {
2035 reply_with_error ("%s: daemon failed to decode procedure arguments", "set_e2uuid");
2038 device = args.device;
2041 r = do_set_e2uuid (device, uuid);
2043 /* do_set_e2uuid has already called reply_with_error */
2048 xdr_free ((xdrproc_t) xdr_guestfs_set_e2uuid_args, (char *) &args);
2051 static void get_e2uuid_stub (XDR *xdr_in)
2054 struct guestfs_get_e2uuid_args args;
2057 memset (&args, 0, sizeof args);
2059 if (!xdr_guestfs_get_e2uuid_args (xdr_in, &args)) {
2060 reply_with_error ("%s: daemon failed to decode procedure arguments", "get_e2uuid");
2063 device = args.device;
2065 r = do_get_e2uuid (device);
2067 /* do_get_e2uuid has already called reply_with_error */
2070 struct guestfs_get_e2uuid_ret ret;
2072 reply ((xdrproc_t) &xdr_guestfs_get_e2uuid_ret, (char *) &ret);
2075 xdr_free ((xdrproc_t) xdr_guestfs_get_e2uuid_args, (char *) &args);
2078 static void fsck_stub (XDR *xdr_in)
2081 struct guestfs_fsck_args args;
2085 memset (&args, 0, sizeof args);
2087 if (!xdr_guestfs_fsck_args (xdr_in, &args)) {
2088 reply_with_error ("%s: daemon failed to decode procedure arguments", "fsck");
2091 fstype = args.fstype;
2092 device = args.device;
2094 r = do_fsck (fstype, device);
2096 /* do_fsck has already called reply_with_error */
2099 struct guestfs_fsck_ret ret;
2101 reply ((xdrproc_t) &xdr_guestfs_fsck_ret, (char *) &ret);
2103 xdr_free ((xdrproc_t) xdr_guestfs_fsck_args, (char *) &args);
2106 static void zero_stub (XDR *xdr_in)
2109 struct guestfs_zero_args args;
2112 memset (&args, 0, sizeof args);
2114 if (!xdr_guestfs_zero_args (xdr_in, &args)) {
2115 reply_with_error ("%s: daemon failed to decode procedure arguments", "zero");
2118 device = args.device;
2120 r = do_zero (device);
2122 /* do_zero has already called reply_with_error */
2127 xdr_free ((xdrproc_t) xdr_guestfs_zero_args, (char *) &args);
2130 void dispatch_incoming_message (XDR *xdr_in)
2133 case GUESTFS_PROC_MOUNT:
2134 mount_stub (xdr_in);
2136 case GUESTFS_PROC_SYNC:
2139 case GUESTFS_PROC_TOUCH:
2140 touch_stub (xdr_in);
2142 case GUESTFS_PROC_CAT:
2145 case GUESTFS_PROC_LL:
2148 case GUESTFS_PROC_LS:
2151 case GUESTFS_PROC_LIST_DEVICES:
2152 list_devices_stub (xdr_in);
2154 case GUESTFS_PROC_LIST_PARTITIONS:
2155 list_partitions_stub (xdr_in);
2157 case GUESTFS_PROC_PVS:
2160 case GUESTFS_PROC_VGS:
2163 case GUESTFS_PROC_LVS:
2166 case GUESTFS_PROC_PVS_FULL:
2167 pvs_full_stub (xdr_in);
2169 case GUESTFS_PROC_VGS_FULL:
2170 vgs_full_stub (xdr_in);
2172 case GUESTFS_PROC_LVS_FULL:
2173 lvs_full_stub (xdr_in);
2175 case GUESTFS_PROC_READ_LINES:
2176 read_lines_stub (xdr_in);
2178 case GUESTFS_PROC_AUG_INIT:
2179 aug_init_stub (xdr_in);
2181 case GUESTFS_PROC_AUG_CLOSE:
2182 aug_close_stub (xdr_in);
2184 case GUESTFS_PROC_AUG_DEFVAR:
2185 aug_defvar_stub (xdr_in);
2187 case GUESTFS_PROC_AUG_DEFNODE:
2188 aug_defnode_stub (xdr_in);
2190 case GUESTFS_PROC_AUG_GET:
2191 aug_get_stub (xdr_in);
2193 case GUESTFS_PROC_AUG_SET:
2194 aug_set_stub (xdr_in);
2196 case GUESTFS_PROC_AUG_INSERT:
2197 aug_insert_stub (xdr_in);
2199 case GUESTFS_PROC_AUG_RM:
2200 aug_rm_stub (xdr_in);
2202 case GUESTFS_PROC_AUG_MV:
2203 aug_mv_stub (xdr_in);
2205 case GUESTFS_PROC_AUG_MATCH:
2206 aug_match_stub (xdr_in);
2208 case GUESTFS_PROC_AUG_SAVE:
2209 aug_save_stub (xdr_in);
2211 case GUESTFS_PROC_AUG_LOAD:
2212 aug_load_stub (xdr_in);
2214 case GUESTFS_PROC_AUG_LS:
2215 aug_ls_stub (xdr_in);
2217 case GUESTFS_PROC_RM:
2220 case GUESTFS_PROC_RMDIR:
2221 rmdir_stub (xdr_in);
2223 case GUESTFS_PROC_RM_RF:
2224 rm_rf_stub (xdr_in);
2226 case GUESTFS_PROC_MKDIR:
2227 mkdir_stub (xdr_in);
2229 case GUESTFS_PROC_MKDIR_P:
2230 mkdir_p_stub (xdr_in);
2232 case GUESTFS_PROC_CHMOD:
2233 chmod_stub (xdr_in);
2235 case GUESTFS_PROC_CHOWN:
2236 chown_stub (xdr_in);
2238 case GUESTFS_PROC_EXISTS:
2239 exists_stub (xdr_in);
2241 case GUESTFS_PROC_IS_FILE:
2242 is_file_stub (xdr_in);
2244 case GUESTFS_PROC_IS_DIR:
2245 is_dir_stub (xdr_in);
2247 case GUESTFS_PROC_PVCREATE:
2248 pvcreate_stub (xdr_in);
2250 case GUESTFS_PROC_VGCREATE:
2251 vgcreate_stub (xdr_in);
2253 case GUESTFS_PROC_LVCREATE:
2254 lvcreate_stub (xdr_in);
2256 case GUESTFS_PROC_MKFS:
2259 case GUESTFS_PROC_SFDISK:
2260 sfdisk_stub (xdr_in);
2262 case GUESTFS_PROC_WRITE_FILE:
2263 write_file_stub (xdr_in);
2265 case GUESTFS_PROC_UMOUNT:
2266 umount_stub (xdr_in);
2268 case GUESTFS_PROC_MOUNTS:
2269 mounts_stub (xdr_in);
2271 case GUESTFS_PROC_UMOUNT_ALL:
2272 umount_all_stub (xdr_in);
2274 case GUESTFS_PROC_LVM_REMOVE_ALL:
2275 lvm_remove_all_stub (xdr_in);
2277 case GUESTFS_PROC_FILE:
2280 case GUESTFS_PROC_COMMAND:
2281 command_stub (xdr_in);
2283 case GUESTFS_PROC_COMMAND_LINES:
2284 command_lines_stub (xdr_in);
2286 case GUESTFS_PROC_STAT:
2289 case GUESTFS_PROC_LSTAT:
2290 lstat_stub (xdr_in);
2292 case GUESTFS_PROC_STATVFS:
2293 statvfs_stub (xdr_in);
2295 case GUESTFS_PROC_TUNE2FS_L:
2296 tune2fs_l_stub (xdr_in);
2298 case GUESTFS_PROC_BLOCKDEV_SETRO:
2299 blockdev_setro_stub (xdr_in);
2301 case GUESTFS_PROC_BLOCKDEV_SETRW:
2302 blockdev_setrw_stub (xdr_in);
2304 case GUESTFS_PROC_BLOCKDEV_GETRO:
2305 blockdev_getro_stub (xdr_in);
2307 case GUESTFS_PROC_BLOCKDEV_GETSS:
2308 blockdev_getss_stub (xdr_in);
2310 case GUESTFS_PROC_BLOCKDEV_GETBSZ:
2311 blockdev_getbsz_stub (xdr_in);
2313 case GUESTFS_PROC_BLOCKDEV_SETBSZ:
2314 blockdev_setbsz_stub (xdr_in);
2316 case GUESTFS_PROC_BLOCKDEV_GETSZ:
2317 blockdev_getsz_stub (xdr_in);
2319 case GUESTFS_PROC_BLOCKDEV_GETSIZE64:
2320 blockdev_getsize64_stub (xdr_in);
2322 case GUESTFS_PROC_BLOCKDEV_FLUSHBUFS:
2323 blockdev_flushbufs_stub (xdr_in);
2325 case GUESTFS_PROC_BLOCKDEV_REREADPT:
2326 blockdev_rereadpt_stub (xdr_in);
2328 case GUESTFS_PROC_UPLOAD:
2329 upload_stub (xdr_in);
2331 case GUESTFS_PROC_DOWNLOAD:
2332 download_stub (xdr_in);
2334 case GUESTFS_PROC_CHECKSUM:
2335 checksum_stub (xdr_in);
2337 case GUESTFS_PROC_TAR_IN:
2338 tar_in_stub (xdr_in);
2340 case GUESTFS_PROC_TAR_OUT:
2341 tar_out_stub (xdr_in);
2343 case GUESTFS_PROC_TGZ_IN:
2344 tgz_in_stub (xdr_in);
2346 case GUESTFS_PROC_TGZ_OUT:
2347 tgz_out_stub (xdr_in);
2349 case GUESTFS_PROC_MOUNT_RO:
2350 mount_ro_stub (xdr_in);
2352 case GUESTFS_PROC_MOUNT_OPTIONS:
2353 mount_options_stub (xdr_in);
2355 case GUESTFS_PROC_MOUNT_VFS:
2356 mount_vfs_stub (xdr_in);
2358 case GUESTFS_PROC_DEBUG:
2359 debug_stub (xdr_in);
2361 case GUESTFS_PROC_LVREMOVE:
2362 lvremove_stub (xdr_in);
2364 case GUESTFS_PROC_VGREMOVE:
2365 vgremove_stub (xdr_in);
2367 case GUESTFS_PROC_PVREMOVE:
2368 pvremove_stub (xdr_in);
2370 case GUESTFS_PROC_SET_E2LABEL:
2371 set_e2label_stub (xdr_in);
2373 case GUESTFS_PROC_GET_E2LABEL:
2374 get_e2label_stub (xdr_in);
2376 case GUESTFS_PROC_SET_E2UUID:
2377 set_e2uuid_stub (xdr_in);
2379 case GUESTFS_PROC_GET_E2UUID:
2380 get_e2uuid_stub (xdr_in);
2382 case GUESTFS_PROC_FSCK:
2385 case GUESTFS_PROC_ZERO:
2389 reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr);
2393 static const char *lvm_pv_cols = "pv_name,pv_uuid,pv_fmt,pv_size,dev_size,pv_free,pv_used,pv_attr,pv_pe_count,pv_pe_alloc_count,pv_tags,pe_start,pv_mda_count,pv_mda_free";
2395 static int lvm_tokenize_pv (char *str, struct guestfs_lvm_int_pv *r)
2397 char *tok, *p, *next;
2401 fprintf (stderr, "%s: failed: passed a NULL string\n", __func__);
2404 if (!*str || isspace (*str)) {
2405 fprintf (stderr, "%s: failed: passed a empty string or one beginning with whitespace\n", __func__);
2410 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_name");
2413 p = strchrnul (tok, ',');
2414 if (*p) next = p+1; else next = NULL;
2416 r->pv_name = strdup (tok);
2417 if (r->pv_name == NULL) {
2423 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_uuid");
2426 p = strchrnul (tok, ',');
2427 if (*p) next = p+1; else next = NULL;
2429 for (i = j = 0; i < 32; ++j) {
2430 if (tok[j] == '\0') {
2431 fprintf (stderr, "%s: failed to parse UUID from '%s'\n", __func__, tok);
2433 } else if (tok[j] != '-')
2434 r->pv_uuid[i++] = tok[j];
2438 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_fmt");
2441 p = strchrnul (tok, ',');
2442 if (*p) next = p+1; else next = NULL;
2444 r->pv_fmt = strdup (tok);
2445 if (r->pv_fmt == NULL) {
2451 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_size");
2454 p = strchrnul (tok, ',');
2455 if (*p) next = p+1; else next = NULL;
2457 if (sscanf (tok, "%"SCNu64, &r->pv_size) != 1) {
2458 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "pv_size");
2463 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "dev_size");
2466 p = strchrnul (tok, ',');
2467 if (*p) next = p+1; else next = NULL;
2469 if (sscanf (tok, "%"SCNu64, &r->dev_size) != 1) {
2470 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "dev_size");
2475 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_free");
2478 p = strchrnul (tok, ',');
2479 if (*p) next = p+1; else next = NULL;
2481 if (sscanf (tok, "%"SCNu64, &r->pv_free) != 1) {
2482 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "pv_free");
2487 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_used");
2490 p = strchrnul (tok, ',');
2491 if (*p) next = p+1; else next = NULL;
2493 if (sscanf (tok, "%"SCNu64, &r->pv_used) != 1) {
2494 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "pv_used");
2499 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_attr");
2502 p = strchrnul (tok, ',');
2503 if (*p) next = p+1; else next = NULL;
2505 r->pv_attr = strdup (tok);
2506 if (r->pv_attr == NULL) {
2512 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_pe_count");
2515 p = strchrnul (tok, ',');
2516 if (*p) next = p+1; else next = NULL;
2518 if (sscanf (tok, "%"SCNi64, &r->pv_pe_count) != 1) {
2519 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "pv_pe_count");
2524 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_pe_alloc_count");
2527 p = strchrnul (tok, ',');
2528 if (*p) next = p+1; else next = NULL;
2530 if (sscanf (tok, "%"SCNi64, &r->pv_pe_alloc_count) != 1) {
2531 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "pv_pe_alloc_count");
2536 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_tags");
2539 p = strchrnul (tok, ',');
2540 if (*p) next = p+1; else next = NULL;
2542 r->pv_tags = strdup (tok);
2543 if (r->pv_tags == NULL) {
2549 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pe_start");
2552 p = strchrnul (tok, ',');
2553 if (*p) next = p+1; else next = NULL;
2555 if (sscanf (tok, "%"SCNu64, &r->pe_start) != 1) {
2556 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "pe_start");
2561 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_mda_count");
2564 p = strchrnul (tok, ',');
2565 if (*p) next = p+1; else next = NULL;
2567 if (sscanf (tok, "%"SCNi64, &r->pv_mda_count) != 1) {
2568 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "pv_mda_count");
2573 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_mda_free");
2576 p = strchrnul (tok, ',');
2577 if (*p) next = p+1; else next = NULL;
2579 if (sscanf (tok, "%"SCNu64, &r->pv_mda_free) != 1) {
2580 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "pv_mda_free");
2585 fprintf (stderr, "%s: failed: extra tokens at end of string\n", __func__);
2591 guestfs_lvm_int_pv_list *
2592 parse_command_line_pvs (void)
2597 guestfs_lvm_int_pv_list *ret;
2600 ret = malloc (sizeof *ret);
2602 reply_with_perror ("malloc");
2606 ret->guestfs_lvm_int_pv_list_len = 0;
2607 ret->guestfs_lvm_int_pv_list_val = NULL;
2609 r = command (&out, &err,
2611 "-o", lvm_pv_cols, "--unbuffered", "--noheadings",
2612 "--nosuffix", "--separator", ",", "--units", "b", NULL);
2614 reply_with_error ("%s", err);
2623 /* Tokenize each line of the output. */
2627 pend = strchr (p, '\n'); /* Get the next line of output. */
2633 while (*p && isspace (*p)) /* Skip any leading whitespace. */
2636 if (!*p) { /* Empty line? Skip it. */
2641 /* Allocate some space to store this next entry. */
2642 newp = realloc (ret->guestfs_lvm_int_pv_list_val,
2643 sizeof (guestfs_lvm_int_pv) * (i+1));
2645 reply_with_perror ("realloc");
2646 free (ret->guestfs_lvm_int_pv_list_val);
2651 ret->guestfs_lvm_int_pv_list_val = newp;
2653 /* Tokenize the next entry. */
2654 r = lvm_tokenize_pv (p, &ret->guestfs_lvm_int_pv_list_val[i]);
2656 reply_with_error ("failed to parse output of 'pvs' command");
2657 free (ret->guestfs_lvm_int_pv_list_val);
2667 ret->guestfs_lvm_int_pv_list_len = i;
2672 static const char *lvm_vg_cols = "vg_name,vg_uuid,vg_fmt,vg_attr,vg_size,vg_free,vg_sysid,vg_extent_size,vg_extent_count,vg_free_count,max_lv,max_pv,pv_count,lv_count,snap_count,vg_seqno,vg_tags,vg_mda_count,vg_mda_free";
2674 static int lvm_tokenize_vg (char *str, struct guestfs_lvm_int_vg *r)
2676 char *tok, *p, *next;
2680 fprintf (stderr, "%s: failed: passed a NULL string\n", __func__);
2683 if (!*str || isspace (*str)) {
2684 fprintf (stderr, "%s: failed: passed a empty string or one beginning with whitespace\n", __func__);
2689 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_name");
2692 p = strchrnul (tok, ',');
2693 if (*p) next = p+1; else next = NULL;
2695 r->vg_name = strdup (tok);
2696 if (r->vg_name == NULL) {
2702 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_uuid");
2705 p = strchrnul (tok, ',');
2706 if (*p) next = p+1; else next = NULL;
2708 for (i = j = 0; i < 32; ++j) {
2709 if (tok[j] == '\0') {
2710 fprintf (stderr, "%s: failed to parse UUID from '%s'\n", __func__, tok);
2712 } else if (tok[j] != '-')
2713 r->vg_uuid[i++] = tok[j];
2717 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_fmt");
2720 p = strchrnul (tok, ',');
2721 if (*p) next = p+1; else next = NULL;
2723 r->vg_fmt = strdup (tok);
2724 if (r->vg_fmt == NULL) {
2730 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_attr");
2733 p = strchrnul (tok, ',');
2734 if (*p) next = p+1; else next = NULL;
2736 r->vg_attr = strdup (tok);
2737 if (r->vg_attr == NULL) {
2743 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_size");
2746 p = strchrnul (tok, ',');
2747 if (*p) next = p+1; else next = NULL;
2749 if (sscanf (tok, "%"SCNu64, &r->vg_size) != 1) {
2750 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "vg_size");
2755 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_free");
2758 p = strchrnul (tok, ',');
2759 if (*p) next = p+1; else next = NULL;
2761 if (sscanf (tok, "%"SCNu64, &r->vg_free) != 1) {
2762 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "vg_free");
2767 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_sysid");
2770 p = strchrnul (tok, ',');
2771 if (*p) next = p+1; else next = NULL;
2773 r->vg_sysid = strdup (tok);
2774 if (r->vg_sysid == NULL) {
2780 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_extent_size");
2783 p = strchrnul (tok, ',');
2784 if (*p) next = p+1; else next = NULL;
2786 if (sscanf (tok, "%"SCNu64, &r->vg_extent_size) != 1) {
2787 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "vg_extent_size");
2792 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_extent_count");
2795 p = strchrnul (tok, ',');
2796 if (*p) next = p+1; else next = NULL;
2798 if (sscanf (tok, "%"SCNi64, &r->vg_extent_count) != 1) {
2799 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "vg_extent_count");
2804 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_free_count");
2807 p = strchrnul (tok, ',');
2808 if (*p) next = p+1; else next = NULL;
2810 if (sscanf (tok, "%"SCNi64, &r->vg_free_count) != 1) {
2811 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "vg_free_count");
2816 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "max_lv");
2819 p = strchrnul (tok, ',');
2820 if (*p) next = p+1; else next = NULL;
2822 if (sscanf (tok, "%"SCNi64, &r->max_lv) != 1) {
2823 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "max_lv");
2828 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "max_pv");
2831 p = strchrnul (tok, ',');
2832 if (*p) next = p+1; else next = NULL;
2834 if (sscanf (tok, "%"SCNi64, &r->max_pv) != 1) {
2835 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "max_pv");
2840 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "pv_count");
2843 p = strchrnul (tok, ',');
2844 if (*p) next = p+1; else next = NULL;
2846 if (sscanf (tok, "%"SCNi64, &r->pv_count) != 1) {
2847 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "pv_count");
2852 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_count");
2855 p = strchrnul (tok, ',');
2856 if (*p) next = p+1; else next = NULL;
2858 if (sscanf (tok, "%"SCNi64, &r->lv_count) != 1) {
2859 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "lv_count");
2864 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "snap_count");
2867 p = strchrnul (tok, ',');
2868 if (*p) next = p+1; else next = NULL;
2870 if (sscanf (tok, "%"SCNi64, &r->snap_count) != 1) {
2871 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "snap_count");
2876 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_seqno");
2879 p = strchrnul (tok, ',');
2880 if (*p) next = p+1; else next = NULL;
2882 if (sscanf (tok, "%"SCNi64, &r->vg_seqno) != 1) {
2883 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "vg_seqno");
2888 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_tags");
2891 p = strchrnul (tok, ',');
2892 if (*p) next = p+1; else next = NULL;
2894 r->vg_tags = strdup (tok);
2895 if (r->vg_tags == NULL) {
2901 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_mda_count");
2904 p = strchrnul (tok, ',');
2905 if (*p) next = p+1; else next = NULL;
2907 if (sscanf (tok, "%"SCNi64, &r->vg_mda_count) != 1) {
2908 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "vg_mda_count");
2913 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "vg_mda_free");
2916 p = strchrnul (tok, ',');
2917 if (*p) next = p+1; else next = NULL;
2919 if (sscanf (tok, "%"SCNu64, &r->vg_mda_free) != 1) {
2920 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "vg_mda_free");
2925 fprintf (stderr, "%s: failed: extra tokens at end of string\n", __func__);
2931 guestfs_lvm_int_vg_list *
2932 parse_command_line_vgs (void)
2937 guestfs_lvm_int_vg_list *ret;
2940 ret = malloc (sizeof *ret);
2942 reply_with_perror ("malloc");
2946 ret->guestfs_lvm_int_vg_list_len = 0;
2947 ret->guestfs_lvm_int_vg_list_val = NULL;
2949 r = command (&out, &err,
2951 "-o", lvm_vg_cols, "--unbuffered", "--noheadings",
2952 "--nosuffix", "--separator", ",", "--units", "b", NULL);
2954 reply_with_error ("%s", err);
2963 /* Tokenize each line of the output. */
2967 pend = strchr (p, '\n'); /* Get the next line of output. */
2973 while (*p && isspace (*p)) /* Skip any leading whitespace. */
2976 if (!*p) { /* Empty line? Skip it. */
2981 /* Allocate some space to store this next entry. */
2982 newp = realloc (ret->guestfs_lvm_int_vg_list_val,
2983 sizeof (guestfs_lvm_int_vg) * (i+1));
2985 reply_with_perror ("realloc");
2986 free (ret->guestfs_lvm_int_vg_list_val);
2991 ret->guestfs_lvm_int_vg_list_val = newp;
2993 /* Tokenize the next entry. */
2994 r = lvm_tokenize_vg (p, &ret->guestfs_lvm_int_vg_list_val[i]);
2996 reply_with_error ("failed to parse output of 'vgs' command");
2997 free (ret->guestfs_lvm_int_vg_list_val);
3007 ret->guestfs_lvm_int_vg_list_len = i;
3012 static const char *lvm_lv_cols = "lv_name,lv_uuid,lv_attr,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,lv_size,seg_count,origin,snap_percent,copy_percent,move_pv,lv_tags,mirror_log,modules";
3014 static int lvm_tokenize_lv (char *str, struct guestfs_lvm_int_lv *r)
3016 char *tok, *p, *next;
3020 fprintf (stderr, "%s: failed: passed a NULL string\n", __func__);
3023 if (!*str || isspace (*str)) {
3024 fprintf (stderr, "%s: failed: passed a empty string or one beginning with whitespace\n", __func__);
3029 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_name");
3032 p = strchrnul (tok, ',');
3033 if (*p) next = p+1; else next = NULL;
3035 r->lv_name = strdup (tok);
3036 if (r->lv_name == NULL) {
3042 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_uuid");
3045 p = strchrnul (tok, ',');
3046 if (*p) next = p+1; else next = NULL;
3048 for (i = j = 0; i < 32; ++j) {
3049 if (tok[j] == '\0') {
3050 fprintf (stderr, "%s: failed to parse UUID from '%s'\n", __func__, tok);
3052 } else if (tok[j] != '-')
3053 r->lv_uuid[i++] = tok[j];
3057 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_attr");
3060 p = strchrnul (tok, ',');
3061 if (*p) next = p+1; else next = NULL;
3063 r->lv_attr = strdup (tok);
3064 if (r->lv_attr == NULL) {
3070 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_major");
3073 p = strchrnul (tok, ',');
3074 if (*p) next = p+1; else next = NULL;
3076 if (sscanf (tok, "%"SCNi64, &r->lv_major) != 1) {
3077 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "lv_major");
3082 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_minor");
3085 p = strchrnul (tok, ',');
3086 if (*p) next = p+1; else next = NULL;
3088 if (sscanf (tok, "%"SCNi64, &r->lv_minor) != 1) {
3089 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "lv_minor");
3094 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_kernel_major");
3097 p = strchrnul (tok, ',');
3098 if (*p) next = p+1; else next = NULL;
3100 if (sscanf (tok, "%"SCNi64, &r->lv_kernel_major) != 1) {
3101 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "lv_kernel_major");
3106 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_kernel_minor");
3109 p = strchrnul (tok, ',');
3110 if (*p) next = p+1; else next = NULL;
3112 if (sscanf (tok, "%"SCNi64, &r->lv_kernel_minor) != 1) {
3113 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "lv_kernel_minor");
3118 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_size");
3121 p = strchrnul (tok, ',');
3122 if (*p) next = p+1; else next = NULL;
3124 if (sscanf (tok, "%"SCNu64, &r->lv_size) != 1) {
3125 fprintf (stderr, "%s: failed to parse size '%s' from token %s\n", __func__, tok, "lv_size");
3130 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "seg_count");
3133 p = strchrnul (tok, ',');
3134 if (*p) next = p+1; else next = NULL;
3136 if (sscanf (tok, "%"SCNi64, &r->seg_count) != 1) {
3137 fprintf (stderr, "%s: failed to parse int '%s' from token %s\n", __func__, tok, "seg_count");
3142 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "origin");
3145 p = strchrnul (tok, ',');
3146 if (*p) next = p+1; else next = NULL;
3148 r->origin = strdup (tok);
3149 if (r->origin == NULL) {
3155 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "snap_percent");
3158 p = strchrnul (tok, ',');
3159 if (*p) next = p+1; else next = NULL;
3162 r->snap_percent = -1;
3163 else if (sscanf (tok, "%f", &r->snap_percent) != 1) {
3164 fprintf (stderr, "%s: failed to parse float '%s' from token %s\n", __func__, tok, "snap_percent");
3169 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "copy_percent");
3172 p = strchrnul (tok, ',');
3173 if (*p) next = p+1; else next = NULL;
3176 r->copy_percent = -1;
3177 else if (sscanf (tok, "%f", &r->copy_percent) != 1) {
3178 fprintf (stderr, "%s: failed to parse float '%s' from token %s\n", __func__, tok, "copy_percent");
3183 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "move_pv");
3186 p = strchrnul (tok, ',');
3187 if (*p) next = p+1; else next = NULL;
3189 r->move_pv = strdup (tok);
3190 if (r->move_pv == NULL) {
3196 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "lv_tags");
3199 p = strchrnul (tok, ',');
3200 if (*p) next = p+1; else next = NULL;
3202 r->lv_tags = strdup (tok);
3203 if (r->lv_tags == NULL) {
3209 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "mirror_log");
3212 p = strchrnul (tok, ',');
3213 if (*p) next = p+1; else next = NULL;
3215 r->mirror_log = strdup (tok);
3216 if (r->mirror_log == NULL) {
3222 fprintf (stderr, "%s: failed: string finished early, around token %s\n", __func__, "modules");
3225 p = strchrnul (tok, ',');
3226 if (*p) next = p+1; else next = NULL;
3228 r->modules = strdup (tok);
3229 if (r->modules == NULL) {
3235 fprintf (stderr, "%s: failed: extra tokens at end of string\n", __func__);
3241 guestfs_lvm_int_lv_list *
3242 parse_command_line_lvs (void)
3247 guestfs_lvm_int_lv_list *ret;
3250 ret = malloc (sizeof *ret);
3252 reply_with_perror ("malloc");
3256 ret->guestfs_lvm_int_lv_list_len = 0;
3257 ret->guestfs_lvm_int_lv_list_val = NULL;
3259 r = command (&out, &err,
3261 "-o", lvm_lv_cols, "--unbuffered", "--noheadings",
3262 "--nosuffix", "--separator", ",", "--units", "b", NULL);
3264 reply_with_error ("%s", err);
3273 /* Tokenize each line of the output. */
3277 pend = strchr (p, '\n'); /* Get the next line of output. */
3283 while (*p && isspace (*p)) /* Skip any leading whitespace. */
3286 if (!*p) { /* Empty line? Skip it. */
3291 /* Allocate some space to store this next entry. */
3292 newp = realloc (ret->guestfs_lvm_int_lv_list_val,
3293 sizeof (guestfs_lvm_int_lv) * (i+1));
3295 reply_with_perror ("realloc");
3296 free (ret->guestfs_lvm_int_lv_list_val);
3301 ret->guestfs_lvm_int_lv_list_val = newp;
3303 /* Tokenize the next entry. */
3304 r = lvm_tokenize_lv (p, &ret->guestfs_lvm_int_lv_list_val[i]);
3306 reply_with_error ("failed to parse output of 'lvs' command");
3307 free (ret->guestfs_lvm_int_lv_list_val);
3317 ret->guestfs_lvm_int_lv_list_len = i;