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 library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 int cb_done; /* flag to indicate callback was called */
24 struct guestfs_message_header hdr;
25 struct guestfs_message_error err;
28 static void mount_cb (guestfs_h *g, void *data, XDR *xdr)
30 struct mount_rv *rv = (struct mount_rv *) data;
32 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
33 error (g, "guestfs_mount: failed to parse reply header");
36 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
37 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
38 error (g, "guestfs_mount: failed to parse reply error");
45 main_loop.main_loop_quit (g);
48 int guestfs_mount (guestfs_h *g,
50 const char *mountpoint)
52 struct guestfs_mount_args args;
56 if (g->state != READY) {
57 error (g, "guestfs_mount called from the wrong state, %d != READY",
62 memset (&rv, 0, sizeof rv);
64 args.device = (char *) device;
65 args.mountpoint = (char *) mountpoint;
66 serial = dispatch (g, GUESTFS_PROC_MOUNT,
67 (xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
72 g->reply_cb_internal = mount_cb;
73 g->reply_cb_internal_data = &rv;
74 main_loop.main_loop_run (g);
75 g->reply_cb_internal = NULL;
76 g->reply_cb_internal_data = NULL;
78 error (g, "guestfs_mount failed, see earlier error messages");
82 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MOUNT, serial) == -1)
85 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
86 error (g, "%s", rv.err.error);
94 int cb_done; /* flag to indicate callback was called */
95 struct guestfs_message_header hdr;
96 struct guestfs_message_error err;
99 static void sync_cb (guestfs_h *g, void *data, XDR *xdr)
101 struct sync_rv *rv = (struct sync_rv *) data;
103 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
104 error (g, "guestfs_sync: failed to parse reply header");
107 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
108 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
109 error (g, "guestfs_sync: failed to parse reply error");
116 main_loop.main_loop_quit (g);
119 int guestfs_sync (guestfs_h *g)
124 if (g->state != READY) {
125 error (g, "guestfs_sync called from the wrong state, %d != READY",
130 memset (&rv, 0, sizeof rv);
132 serial = dispatch (g, GUESTFS_PROC_SYNC, NULL, NULL);
137 g->reply_cb_internal = sync_cb;
138 g->reply_cb_internal_data = &rv;
139 main_loop.main_loop_run (g);
140 g->reply_cb_internal = NULL;
141 g->reply_cb_internal_data = NULL;
143 error (g, "guestfs_sync failed, see earlier error messages");
147 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_SYNC, serial) == -1)
150 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
151 error (g, "%s", rv.err.error);
159 int cb_done; /* flag to indicate callback was called */
160 struct guestfs_message_header hdr;
161 struct guestfs_message_error err;
164 static void touch_cb (guestfs_h *g, void *data, XDR *xdr)
166 struct touch_rv *rv = (struct touch_rv *) data;
168 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
169 error (g, "guestfs_touch: failed to parse reply header");
172 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
173 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
174 error (g, "guestfs_touch: failed to parse reply error");
181 main_loop.main_loop_quit (g);
184 int guestfs_touch (guestfs_h *g,
187 struct guestfs_touch_args args;
191 if (g->state != READY) {
192 error (g, "guestfs_touch called from the wrong state, %d != READY",
197 memset (&rv, 0, sizeof rv);
199 args.path = (char *) path;
200 serial = dispatch (g, GUESTFS_PROC_TOUCH,
201 (xdrproc_t) xdr_guestfs_touch_args, (char *) &args);
206 g->reply_cb_internal = touch_cb;
207 g->reply_cb_internal_data = &rv;
208 main_loop.main_loop_run (g);
209 g->reply_cb_internal = NULL;
210 g->reply_cb_internal_data = NULL;
212 error (g, "guestfs_touch failed, see earlier error messages");
216 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_TOUCH, serial) == -1)
219 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
220 error (g, "%s", rv.err.error);
228 int cb_done; /* flag to indicate callback was called */
229 struct guestfs_message_header hdr;
230 struct guestfs_message_error err;
231 struct guestfs_cat_ret ret;
234 static void cat_cb (guestfs_h *g, void *data, XDR *xdr)
236 struct cat_rv *rv = (struct cat_rv *) data;
238 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
239 error (g, "guestfs_cat: failed to parse reply header");
242 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
243 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
244 error (g, "guestfs_cat: failed to parse reply error");
249 if (!xdr_guestfs_cat_ret (xdr, &rv->ret)) {
250 error (g, "guestfs_cat: failed to parse reply");
255 main_loop.main_loop_quit (g);
258 char *guestfs_cat (guestfs_h *g,
261 struct guestfs_cat_args args;
265 if (g->state != READY) {
266 error (g, "guestfs_cat called from the wrong state, %d != READY",
271 memset (&rv, 0, sizeof rv);
273 args.path = (char *) path;
274 serial = dispatch (g, GUESTFS_PROC_CAT,
275 (xdrproc_t) xdr_guestfs_cat_args, (char *) &args);
280 g->reply_cb_internal = cat_cb;
281 g->reply_cb_internal_data = &rv;
282 main_loop.main_loop_run (g);
283 g->reply_cb_internal = NULL;
284 g->reply_cb_internal_data = NULL;
286 error (g, "guestfs_cat failed, see earlier error messages");
290 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_CAT, serial) == -1)
293 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
294 error (g, "%s", rv.err.error);
298 return rv.ret.content; /* caller will free */
302 int cb_done; /* flag to indicate callback was called */
303 struct guestfs_message_header hdr;
304 struct guestfs_message_error err;
305 struct guestfs_ll_ret ret;
308 static void ll_cb (guestfs_h *g, void *data, XDR *xdr)
310 struct ll_rv *rv = (struct ll_rv *) data;
312 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
313 error (g, "guestfs_ll: failed to parse reply header");
316 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
317 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
318 error (g, "guestfs_ll: failed to parse reply error");
323 if (!xdr_guestfs_ll_ret (xdr, &rv->ret)) {
324 error (g, "guestfs_ll: failed to parse reply");
329 main_loop.main_loop_quit (g);
332 char *guestfs_ll (guestfs_h *g,
333 const char *directory)
335 struct guestfs_ll_args args;
339 if (g->state != READY) {
340 error (g, "guestfs_ll called from the wrong state, %d != READY",
345 memset (&rv, 0, sizeof rv);
347 args.directory = (char *) directory;
348 serial = dispatch (g, GUESTFS_PROC_LL,
349 (xdrproc_t) xdr_guestfs_ll_args, (char *) &args);
354 g->reply_cb_internal = ll_cb;
355 g->reply_cb_internal_data = &rv;
356 main_loop.main_loop_run (g);
357 g->reply_cb_internal = NULL;
358 g->reply_cb_internal_data = NULL;
360 error (g, "guestfs_ll failed, see earlier error messages");
364 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LL, serial) == -1)
367 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
368 error (g, "%s", rv.err.error);
372 return rv.ret.listing; /* caller will free */
376 int cb_done; /* flag to indicate callback was called */
377 struct guestfs_message_header hdr;
378 struct guestfs_message_error err;
379 struct guestfs_ls_ret ret;
382 static void ls_cb (guestfs_h *g, void *data, XDR *xdr)
384 struct ls_rv *rv = (struct ls_rv *) data;
386 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
387 error (g, "guestfs_ls: failed to parse reply header");
390 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
391 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
392 error (g, "guestfs_ls: failed to parse reply error");
397 if (!xdr_guestfs_ls_ret (xdr, &rv->ret)) {
398 error (g, "guestfs_ls: failed to parse reply");
403 main_loop.main_loop_quit (g);
406 char **guestfs_ls (guestfs_h *g,
407 const char *directory)
409 struct guestfs_ls_args args;
413 if (g->state != READY) {
414 error (g, "guestfs_ls called from the wrong state, %d != READY",
419 memset (&rv, 0, sizeof rv);
421 args.directory = (char *) directory;
422 serial = dispatch (g, GUESTFS_PROC_LS,
423 (xdrproc_t) xdr_guestfs_ls_args, (char *) &args);
428 g->reply_cb_internal = ls_cb;
429 g->reply_cb_internal_data = &rv;
430 main_loop.main_loop_run (g);
431 g->reply_cb_internal = NULL;
432 g->reply_cb_internal_data = NULL;
434 error (g, "guestfs_ls failed, see earlier error messages");
438 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LS, serial) == -1)
441 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
442 error (g, "%s", rv.err.error);
446 /* caller will free this, but we need to add a NULL entry */
447 rv.ret.listing.listing_val = safe_realloc (g, rv.ret.listing.listing_val,
448 sizeof (char *) * (rv.ret.listing.listing_len + 1));
449 rv.ret.listing.listing_val[rv.ret.listing.listing_len] = NULL;
450 return rv.ret.listing.listing_val;
453 struct list_devices_rv {
454 int cb_done; /* flag to indicate callback was called */
455 struct guestfs_message_header hdr;
456 struct guestfs_message_error err;
457 struct guestfs_list_devices_ret ret;
460 static void list_devices_cb (guestfs_h *g, void *data, XDR *xdr)
462 struct list_devices_rv *rv = (struct list_devices_rv *) data;
464 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
465 error (g, "guestfs_list_devices: failed to parse reply header");
468 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
469 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
470 error (g, "guestfs_list_devices: failed to parse reply error");
475 if (!xdr_guestfs_list_devices_ret (xdr, &rv->ret)) {
476 error (g, "guestfs_list_devices: failed to parse reply");
481 main_loop.main_loop_quit (g);
484 char **guestfs_list_devices (guestfs_h *g)
486 struct list_devices_rv rv;
489 if (g->state != READY) {
490 error (g, "guestfs_list_devices called from the wrong state, %d != READY",
495 memset (&rv, 0, sizeof rv);
497 serial = dispatch (g, GUESTFS_PROC_LIST_DEVICES, NULL, NULL);
502 g->reply_cb_internal = list_devices_cb;
503 g->reply_cb_internal_data = &rv;
504 main_loop.main_loop_run (g);
505 g->reply_cb_internal = NULL;
506 g->reply_cb_internal_data = NULL;
508 error (g, "guestfs_list_devices failed, see earlier error messages");
512 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LIST_DEVICES, serial) == -1)
515 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
516 error (g, "%s", rv.err.error);
520 /* caller will free this, but we need to add a NULL entry */
521 rv.ret.devices.devices_val = safe_realloc (g, rv.ret.devices.devices_val,
522 sizeof (char *) * (rv.ret.devices.devices_len + 1));
523 rv.ret.devices.devices_val[rv.ret.devices.devices_len] = NULL;
524 return rv.ret.devices.devices_val;
527 struct list_partitions_rv {
528 int cb_done; /* flag to indicate callback was called */
529 struct guestfs_message_header hdr;
530 struct guestfs_message_error err;
531 struct guestfs_list_partitions_ret ret;
534 static void list_partitions_cb (guestfs_h *g, void *data, XDR *xdr)
536 struct list_partitions_rv *rv = (struct list_partitions_rv *) data;
538 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
539 error (g, "guestfs_list_partitions: failed to parse reply header");
542 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
543 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
544 error (g, "guestfs_list_partitions: failed to parse reply error");
549 if (!xdr_guestfs_list_partitions_ret (xdr, &rv->ret)) {
550 error (g, "guestfs_list_partitions: failed to parse reply");
555 main_loop.main_loop_quit (g);
558 char **guestfs_list_partitions (guestfs_h *g)
560 struct list_partitions_rv rv;
563 if (g->state != READY) {
564 error (g, "guestfs_list_partitions called from the wrong state, %d != READY",
569 memset (&rv, 0, sizeof rv);
571 serial = dispatch (g, GUESTFS_PROC_LIST_PARTITIONS, NULL, NULL);
576 g->reply_cb_internal = list_partitions_cb;
577 g->reply_cb_internal_data = &rv;
578 main_loop.main_loop_run (g);
579 g->reply_cb_internal = NULL;
580 g->reply_cb_internal_data = NULL;
582 error (g, "guestfs_list_partitions failed, see earlier error messages");
586 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LIST_PARTITIONS, serial) == -1)
589 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
590 error (g, "%s", rv.err.error);
594 /* caller will free this, but we need to add a NULL entry */
595 rv.ret.partitions.partitions_val = safe_realloc (g, rv.ret.partitions.partitions_val,
596 sizeof (char *) * (rv.ret.partitions.partitions_len + 1));
597 rv.ret.partitions.partitions_val[rv.ret.partitions.partitions_len] = NULL;
598 return rv.ret.partitions.partitions_val;
602 int cb_done; /* flag to indicate callback was called */
603 struct guestfs_message_header hdr;
604 struct guestfs_message_error err;
605 struct guestfs_pvs_ret ret;
608 static void pvs_cb (guestfs_h *g, void *data, XDR *xdr)
610 struct pvs_rv *rv = (struct pvs_rv *) data;
612 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
613 error (g, "guestfs_pvs: failed to parse reply header");
616 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
617 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
618 error (g, "guestfs_pvs: failed to parse reply error");
623 if (!xdr_guestfs_pvs_ret (xdr, &rv->ret)) {
624 error (g, "guestfs_pvs: failed to parse reply");
629 main_loop.main_loop_quit (g);
632 char **guestfs_pvs (guestfs_h *g)
637 if (g->state != READY) {
638 error (g, "guestfs_pvs called from the wrong state, %d != READY",
643 memset (&rv, 0, sizeof rv);
645 serial = dispatch (g, GUESTFS_PROC_PVS, NULL, NULL);
650 g->reply_cb_internal = pvs_cb;
651 g->reply_cb_internal_data = &rv;
652 main_loop.main_loop_run (g);
653 g->reply_cb_internal = NULL;
654 g->reply_cb_internal_data = NULL;
656 error (g, "guestfs_pvs failed, see earlier error messages");
660 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_PVS, serial) == -1)
663 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
664 error (g, "%s", rv.err.error);
668 /* caller will free this, but we need to add a NULL entry */
669 rv.ret.physvols.physvols_val = safe_realloc (g, rv.ret.physvols.physvols_val,
670 sizeof (char *) * (rv.ret.physvols.physvols_len + 1));
671 rv.ret.physvols.physvols_val[rv.ret.physvols.physvols_len] = NULL;
672 return rv.ret.physvols.physvols_val;
676 int cb_done; /* flag to indicate callback was called */
677 struct guestfs_message_header hdr;
678 struct guestfs_message_error err;
679 struct guestfs_vgs_ret ret;
682 static void vgs_cb (guestfs_h *g, void *data, XDR *xdr)
684 struct vgs_rv *rv = (struct vgs_rv *) data;
686 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
687 error (g, "guestfs_vgs: failed to parse reply header");
690 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
691 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
692 error (g, "guestfs_vgs: failed to parse reply error");
697 if (!xdr_guestfs_vgs_ret (xdr, &rv->ret)) {
698 error (g, "guestfs_vgs: failed to parse reply");
703 main_loop.main_loop_quit (g);
706 char **guestfs_vgs (guestfs_h *g)
711 if (g->state != READY) {
712 error (g, "guestfs_vgs called from the wrong state, %d != READY",
717 memset (&rv, 0, sizeof rv);
719 serial = dispatch (g, GUESTFS_PROC_VGS, NULL, NULL);
724 g->reply_cb_internal = vgs_cb;
725 g->reply_cb_internal_data = &rv;
726 main_loop.main_loop_run (g);
727 g->reply_cb_internal = NULL;
728 g->reply_cb_internal_data = NULL;
730 error (g, "guestfs_vgs failed, see earlier error messages");
734 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_VGS, serial) == -1)
737 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
738 error (g, "%s", rv.err.error);
742 /* caller will free this, but we need to add a NULL entry */
743 rv.ret.volgroups.volgroups_val = safe_realloc (g, rv.ret.volgroups.volgroups_val,
744 sizeof (char *) * (rv.ret.volgroups.volgroups_len + 1));
745 rv.ret.volgroups.volgroups_val[rv.ret.volgroups.volgroups_len] = NULL;
746 return rv.ret.volgroups.volgroups_val;
750 int cb_done; /* flag to indicate callback was called */
751 struct guestfs_message_header hdr;
752 struct guestfs_message_error err;
753 struct guestfs_lvs_ret ret;
756 static void lvs_cb (guestfs_h *g, void *data, XDR *xdr)
758 struct lvs_rv *rv = (struct lvs_rv *) data;
760 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
761 error (g, "guestfs_lvs: failed to parse reply header");
764 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
765 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
766 error (g, "guestfs_lvs: failed to parse reply error");
771 if (!xdr_guestfs_lvs_ret (xdr, &rv->ret)) {
772 error (g, "guestfs_lvs: failed to parse reply");
777 main_loop.main_loop_quit (g);
780 char **guestfs_lvs (guestfs_h *g)
785 if (g->state != READY) {
786 error (g, "guestfs_lvs called from the wrong state, %d != READY",
791 memset (&rv, 0, sizeof rv);
793 serial = dispatch (g, GUESTFS_PROC_LVS, NULL, NULL);
798 g->reply_cb_internal = lvs_cb;
799 g->reply_cb_internal_data = &rv;
800 main_loop.main_loop_run (g);
801 g->reply_cb_internal = NULL;
802 g->reply_cb_internal_data = NULL;
804 error (g, "guestfs_lvs failed, see earlier error messages");
808 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVS, serial) == -1)
811 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
812 error (g, "%s", rv.err.error);
816 /* caller will free this, but we need to add a NULL entry */
817 rv.ret.logvols.logvols_val = safe_realloc (g, rv.ret.logvols.logvols_val,
818 sizeof (char *) * (rv.ret.logvols.logvols_len + 1));
819 rv.ret.logvols.logvols_val[rv.ret.logvols.logvols_len] = NULL;
820 return rv.ret.logvols.logvols_val;
824 int cb_done; /* flag to indicate callback was called */
825 struct guestfs_message_header hdr;
826 struct guestfs_message_error err;
827 struct guestfs_pvs_full_ret ret;
830 static void pvs_full_cb (guestfs_h *g, void *data, XDR *xdr)
832 struct pvs_full_rv *rv = (struct pvs_full_rv *) data;
834 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
835 error (g, "guestfs_pvs_full: failed to parse reply header");
838 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
839 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
840 error (g, "guestfs_pvs_full: failed to parse reply error");
845 if (!xdr_guestfs_pvs_full_ret (xdr, &rv->ret)) {
846 error (g, "guestfs_pvs_full: failed to parse reply");
851 main_loop.main_loop_quit (g);
854 struct guestfs_lvm_pv_list *guestfs_pvs_full (guestfs_h *g)
856 struct pvs_full_rv rv;
859 if (g->state != READY) {
860 error (g, "guestfs_pvs_full called from the wrong state, %d != READY",
865 memset (&rv, 0, sizeof rv);
867 serial = dispatch (g, GUESTFS_PROC_PVS_FULL, NULL, NULL);
872 g->reply_cb_internal = pvs_full_cb;
873 g->reply_cb_internal_data = &rv;
874 main_loop.main_loop_run (g);
875 g->reply_cb_internal = NULL;
876 g->reply_cb_internal_data = NULL;
878 error (g, "guestfs_pvs_full failed, see earlier error messages");
882 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_PVS_FULL, serial) == -1)
885 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
886 error (g, "%s", rv.err.error);
890 /* caller will free this */
891 return safe_memdup (g, &rv.ret.physvols, sizeof (rv.ret.physvols));
895 int cb_done; /* flag to indicate callback was called */
896 struct guestfs_message_header hdr;
897 struct guestfs_message_error err;
898 struct guestfs_vgs_full_ret ret;
901 static void vgs_full_cb (guestfs_h *g, void *data, XDR *xdr)
903 struct vgs_full_rv *rv = (struct vgs_full_rv *) data;
905 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
906 error (g, "guestfs_vgs_full: failed to parse reply header");
909 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
910 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
911 error (g, "guestfs_vgs_full: failed to parse reply error");
916 if (!xdr_guestfs_vgs_full_ret (xdr, &rv->ret)) {
917 error (g, "guestfs_vgs_full: failed to parse reply");
922 main_loop.main_loop_quit (g);
925 struct guestfs_lvm_vg_list *guestfs_vgs_full (guestfs_h *g)
927 struct vgs_full_rv rv;
930 if (g->state != READY) {
931 error (g, "guestfs_vgs_full called from the wrong state, %d != READY",
936 memset (&rv, 0, sizeof rv);
938 serial = dispatch (g, GUESTFS_PROC_VGS_FULL, NULL, NULL);
943 g->reply_cb_internal = vgs_full_cb;
944 g->reply_cb_internal_data = &rv;
945 main_loop.main_loop_run (g);
946 g->reply_cb_internal = NULL;
947 g->reply_cb_internal_data = NULL;
949 error (g, "guestfs_vgs_full failed, see earlier error messages");
953 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_VGS_FULL, serial) == -1)
956 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
957 error (g, "%s", rv.err.error);
961 /* caller will free this */
962 return safe_memdup (g, &rv.ret.volgroups, sizeof (rv.ret.volgroups));
966 int cb_done; /* flag to indicate callback was called */
967 struct guestfs_message_header hdr;
968 struct guestfs_message_error err;
969 struct guestfs_lvs_full_ret ret;
972 static void lvs_full_cb (guestfs_h *g, void *data, XDR *xdr)
974 struct lvs_full_rv *rv = (struct lvs_full_rv *) data;
976 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
977 error (g, "guestfs_lvs_full: failed to parse reply header");
980 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
981 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
982 error (g, "guestfs_lvs_full: failed to parse reply error");
987 if (!xdr_guestfs_lvs_full_ret (xdr, &rv->ret)) {
988 error (g, "guestfs_lvs_full: failed to parse reply");
993 main_loop.main_loop_quit (g);
996 struct guestfs_lvm_lv_list *guestfs_lvs_full (guestfs_h *g)
998 struct lvs_full_rv rv;
1001 if (g->state != READY) {
1002 error (g, "guestfs_lvs_full called from the wrong state, %d != READY",
1007 memset (&rv, 0, sizeof rv);
1009 serial = dispatch (g, GUESTFS_PROC_LVS_FULL, NULL, NULL);
1014 g->reply_cb_internal = lvs_full_cb;
1015 g->reply_cb_internal_data = &rv;
1016 main_loop.main_loop_run (g);
1017 g->reply_cb_internal = NULL;
1018 g->reply_cb_internal_data = NULL;
1020 error (g, "guestfs_lvs_full failed, see earlier error messages");
1024 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVS_FULL, serial) == -1)
1027 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1028 error (g, "%s", rv.err.error);
1032 /* caller will free this */
1033 return safe_memdup (g, &rv.ret.logvols, sizeof (rv.ret.logvols));
1036 struct read_lines_rv {
1037 int cb_done; /* flag to indicate callback was called */
1038 struct guestfs_message_header hdr;
1039 struct guestfs_message_error err;
1040 struct guestfs_read_lines_ret ret;
1043 static void read_lines_cb (guestfs_h *g, void *data, XDR *xdr)
1045 struct read_lines_rv *rv = (struct read_lines_rv *) data;
1047 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1048 error (g, "guestfs_read_lines: failed to parse reply header");
1051 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1052 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1053 error (g, "guestfs_read_lines: failed to parse reply error");
1058 if (!xdr_guestfs_read_lines_ret (xdr, &rv->ret)) {
1059 error (g, "guestfs_read_lines: failed to parse reply");
1064 main_loop.main_loop_quit (g);
1067 char **guestfs_read_lines (guestfs_h *g,
1070 struct guestfs_read_lines_args args;
1071 struct read_lines_rv rv;
1074 if (g->state != READY) {
1075 error (g, "guestfs_read_lines called from the wrong state, %d != READY",
1080 memset (&rv, 0, sizeof rv);
1082 args.path = (char *) path;
1083 serial = dispatch (g, GUESTFS_PROC_READ_LINES,
1084 (xdrproc_t) xdr_guestfs_read_lines_args, (char *) &args);
1089 g->reply_cb_internal = read_lines_cb;
1090 g->reply_cb_internal_data = &rv;
1091 main_loop.main_loop_run (g);
1092 g->reply_cb_internal = NULL;
1093 g->reply_cb_internal_data = NULL;
1095 error (g, "guestfs_read_lines failed, see earlier error messages");
1099 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_READ_LINES, serial) == -1)
1102 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1103 error (g, "%s", rv.err.error);
1107 /* caller will free this, but we need to add a NULL entry */
1108 rv.ret.lines.lines_val = safe_realloc (g, rv.ret.lines.lines_val,
1109 sizeof (char *) * (rv.ret.lines.lines_len + 1));
1110 rv.ret.lines.lines_val[rv.ret.lines.lines_len] = NULL;
1111 return rv.ret.lines.lines_val;
1114 struct aug_init_rv {
1115 int cb_done; /* flag to indicate callback was called */
1116 struct guestfs_message_header hdr;
1117 struct guestfs_message_error err;
1120 static void aug_init_cb (guestfs_h *g, void *data, XDR *xdr)
1122 struct aug_init_rv *rv = (struct aug_init_rv *) data;
1124 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1125 error (g, "guestfs_aug_init: failed to parse reply header");
1128 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1129 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1130 error (g, "guestfs_aug_init: failed to parse reply error");
1137 main_loop.main_loop_quit (g);
1140 int guestfs_aug_init (guestfs_h *g,
1144 struct guestfs_aug_init_args args;
1145 struct aug_init_rv rv;
1148 if (g->state != READY) {
1149 error (g, "guestfs_aug_init called from the wrong state, %d != READY",
1154 memset (&rv, 0, sizeof rv);
1156 args.root = (char *) root;
1158 serial = dispatch (g, GUESTFS_PROC_AUG_INIT,
1159 (xdrproc_t) xdr_guestfs_aug_init_args, (char *) &args);
1164 g->reply_cb_internal = aug_init_cb;
1165 g->reply_cb_internal_data = &rv;
1166 main_loop.main_loop_run (g);
1167 g->reply_cb_internal = NULL;
1168 g->reply_cb_internal_data = NULL;
1170 error (g, "guestfs_aug_init failed, see earlier error messages");
1174 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_INIT, serial) == -1)
1177 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1178 error (g, "%s", rv.err.error);
1185 struct aug_close_rv {
1186 int cb_done; /* flag to indicate callback was called */
1187 struct guestfs_message_header hdr;
1188 struct guestfs_message_error err;
1191 static void aug_close_cb (guestfs_h *g, void *data, XDR *xdr)
1193 struct aug_close_rv *rv = (struct aug_close_rv *) data;
1195 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1196 error (g, "guestfs_aug_close: failed to parse reply header");
1199 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1200 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1201 error (g, "guestfs_aug_close: failed to parse reply error");
1208 main_loop.main_loop_quit (g);
1211 int guestfs_aug_close (guestfs_h *g)
1213 struct aug_close_rv rv;
1216 if (g->state != READY) {
1217 error (g, "guestfs_aug_close called from the wrong state, %d != READY",
1222 memset (&rv, 0, sizeof rv);
1224 serial = dispatch (g, GUESTFS_PROC_AUG_CLOSE, NULL, NULL);
1229 g->reply_cb_internal = aug_close_cb;
1230 g->reply_cb_internal_data = &rv;
1231 main_loop.main_loop_run (g);
1232 g->reply_cb_internal = NULL;
1233 g->reply_cb_internal_data = NULL;
1235 error (g, "guestfs_aug_close failed, see earlier error messages");
1239 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_CLOSE, serial) == -1)
1242 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1243 error (g, "%s", rv.err.error);
1250 struct aug_defvar_rv {
1251 int cb_done; /* flag to indicate callback was called */
1252 struct guestfs_message_header hdr;
1253 struct guestfs_message_error err;
1254 struct guestfs_aug_defvar_ret ret;
1257 static void aug_defvar_cb (guestfs_h *g, void *data, XDR *xdr)
1259 struct aug_defvar_rv *rv = (struct aug_defvar_rv *) data;
1261 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1262 error (g, "guestfs_aug_defvar: failed to parse reply header");
1265 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1266 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1267 error (g, "guestfs_aug_defvar: failed to parse reply error");
1272 if (!xdr_guestfs_aug_defvar_ret (xdr, &rv->ret)) {
1273 error (g, "guestfs_aug_defvar: failed to parse reply");
1278 main_loop.main_loop_quit (g);
1281 int guestfs_aug_defvar (guestfs_h *g,
1285 struct guestfs_aug_defvar_args args;
1286 struct aug_defvar_rv rv;
1289 if (g->state != READY) {
1290 error (g, "guestfs_aug_defvar called from the wrong state, %d != READY",
1295 memset (&rv, 0, sizeof rv);
1297 args.name = (char *) name;
1298 args.expr = expr ? (char **) &expr : NULL;
1299 serial = dispatch (g, GUESTFS_PROC_AUG_DEFVAR,
1300 (xdrproc_t) xdr_guestfs_aug_defvar_args, (char *) &args);
1305 g->reply_cb_internal = aug_defvar_cb;
1306 g->reply_cb_internal_data = &rv;
1307 main_loop.main_loop_run (g);
1308 g->reply_cb_internal = NULL;
1309 g->reply_cb_internal_data = NULL;
1311 error (g, "guestfs_aug_defvar failed, see earlier error messages");
1315 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_DEFVAR, serial) == -1)
1318 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1319 error (g, "%s", rv.err.error);
1323 return rv.ret.nrnodes;
1326 struct aug_defnode_rv {
1327 int cb_done; /* flag to indicate callback was called */
1328 struct guestfs_message_header hdr;
1329 struct guestfs_message_error err;
1330 struct guestfs_aug_defnode_ret ret;
1333 static void aug_defnode_cb (guestfs_h *g, void *data, XDR *xdr)
1335 struct aug_defnode_rv *rv = (struct aug_defnode_rv *) data;
1337 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1338 error (g, "guestfs_aug_defnode: failed to parse reply header");
1341 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1342 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1343 error (g, "guestfs_aug_defnode: failed to parse reply error");
1348 if (!xdr_guestfs_aug_defnode_ret (xdr, &rv->ret)) {
1349 error (g, "guestfs_aug_defnode: failed to parse reply");
1354 main_loop.main_loop_quit (g);
1357 struct guestfs_int_bool *guestfs_aug_defnode (guestfs_h *g,
1362 struct guestfs_aug_defnode_args args;
1363 struct aug_defnode_rv rv;
1366 if (g->state != READY) {
1367 error (g, "guestfs_aug_defnode called from the wrong state, %d != READY",
1372 memset (&rv, 0, sizeof rv);
1374 args.name = (char *) name;
1375 args.expr = (char *) expr;
1376 args.val = (char *) val;
1377 serial = dispatch (g, GUESTFS_PROC_AUG_DEFNODE,
1378 (xdrproc_t) xdr_guestfs_aug_defnode_args, (char *) &args);
1383 g->reply_cb_internal = aug_defnode_cb;
1384 g->reply_cb_internal_data = &rv;
1385 main_loop.main_loop_run (g);
1386 g->reply_cb_internal = NULL;
1387 g->reply_cb_internal_data = NULL;
1389 error (g, "guestfs_aug_defnode failed, see earlier error messages");
1393 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_DEFNODE, serial) == -1)
1396 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1397 error (g, "%s", rv.err.error);
1401 /* caller with free this */
1402 return safe_memdup (g, &rv.ret, sizeof (rv.ret));
1406 int cb_done; /* flag to indicate callback was called */
1407 struct guestfs_message_header hdr;
1408 struct guestfs_message_error err;
1409 struct guestfs_aug_get_ret ret;
1412 static void aug_get_cb (guestfs_h *g, void *data, XDR *xdr)
1414 struct aug_get_rv *rv = (struct aug_get_rv *) data;
1416 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1417 error (g, "guestfs_aug_get: failed to parse reply header");
1420 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1421 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1422 error (g, "guestfs_aug_get: failed to parse reply error");
1427 if (!xdr_guestfs_aug_get_ret (xdr, &rv->ret)) {
1428 error (g, "guestfs_aug_get: failed to parse reply");
1433 main_loop.main_loop_quit (g);
1436 char *guestfs_aug_get (guestfs_h *g,
1439 struct guestfs_aug_get_args args;
1440 struct aug_get_rv rv;
1443 if (g->state != READY) {
1444 error (g, "guestfs_aug_get called from the wrong state, %d != READY",
1449 memset (&rv, 0, sizeof rv);
1451 args.path = (char *) path;
1452 serial = dispatch (g, GUESTFS_PROC_AUG_GET,
1453 (xdrproc_t) xdr_guestfs_aug_get_args, (char *) &args);
1458 g->reply_cb_internal = aug_get_cb;
1459 g->reply_cb_internal_data = &rv;
1460 main_loop.main_loop_run (g);
1461 g->reply_cb_internal = NULL;
1462 g->reply_cb_internal_data = NULL;
1464 error (g, "guestfs_aug_get failed, see earlier error messages");
1468 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_GET, serial) == -1)
1471 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1472 error (g, "%s", rv.err.error);
1476 return rv.ret.val; /* caller will free */
1480 int cb_done; /* flag to indicate callback was called */
1481 struct guestfs_message_header hdr;
1482 struct guestfs_message_error err;
1485 static void aug_set_cb (guestfs_h *g, void *data, XDR *xdr)
1487 struct aug_set_rv *rv = (struct aug_set_rv *) data;
1489 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1490 error (g, "guestfs_aug_set: failed to parse reply header");
1493 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1494 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1495 error (g, "guestfs_aug_set: failed to parse reply error");
1502 main_loop.main_loop_quit (g);
1505 int guestfs_aug_set (guestfs_h *g,
1509 struct guestfs_aug_set_args args;
1510 struct aug_set_rv rv;
1513 if (g->state != READY) {
1514 error (g, "guestfs_aug_set called from the wrong state, %d != READY",
1519 memset (&rv, 0, sizeof rv);
1521 args.path = (char *) path;
1522 args.val = (char *) val;
1523 serial = dispatch (g, GUESTFS_PROC_AUG_SET,
1524 (xdrproc_t) xdr_guestfs_aug_set_args, (char *) &args);
1529 g->reply_cb_internal = aug_set_cb;
1530 g->reply_cb_internal_data = &rv;
1531 main_loop.main_loop_run (g);
1532 g->reply_cb_internal = NULL;
1533 g->reply_cb_internal_data = NULL;
1535 error (g, "guestfs_aug_set failed, see earlier error messages");
1539 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_SET, serial) == -1)
1542 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1543 error (g, "%s", rv.err.error);
1550 struct aug_insert_rv {
1551 int cb_done; /* flag to indicate callback was called */
1552 struct guestfs_message_header hdr;
1553 struct guestfs_message_error err;
1556 static void aug_insert_cb (guestfs_h *g, void *data, XDR *xdr)
1558 struct aug_insert_rv *rv = (struct aug_insert_rv *) data;
1560 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1561 error (g, "guestfs_aug_insert: failed to parse reply header");
1564 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1565 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1566 error (g, "guestfs_aug_insert: failed to parse reply error");
1573 main_loop.main_loop_quit (g);
1576 int guestfs_aug_insert (guestfs_h *g,
1581 struct guestfs_aug_insert_args args;
1582 struct aug_insert_rv rv;
1585 if (g->state != READY) {
1586 error (g, "guestfs_aug_insert called from the wrong state, %d != READY",
1591 memset (&rv, 0, sizeof rv);
1593 args.path = (char *) path;
1594 args.label = (char *) label;
1595 args.before = before;
1596 serial = dispatch (g, GUESTFS_PROC_AUG_INSERT,
1597 (xdrproc_t) xdr_guestfs_aug_insert_args, (char *) &args);
1602 g->reply_cb_internal = aug_insert_cb;
1603 g->reply_cb_internal_data = &rv;
1604 main_loop.main_loop_run (g);
1605 g->reply_cb_internal = NULL;
1606 g->reply_cb_internal_data = NULL;
1608 error (g, "guestfs_aug_insert failed, see earlier error messages");
1612 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_INSERT, serial) == -1)
1615 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1616 error (g, "%s", rv.err.error);
1624 int cb_done; /* flag to indicate callback was called */
1625 struct guestfs_message_header hdr;
1626 struct guestfs_message_error err;
1627 struct guestfs_aug_rm_ret ret;
1630 static void aug_rm_cb (guestfs_h *g, void *data, XDR *xdr)
1632 struct aug_rm_rv *rv = (struct aug_rm_rv *) data;
1634 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1635 error (g, "guestfs_aug_rm: failed to parse reply header");
1638 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1639 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1640 error (g, "guestfs_aug_rm: failed to parse reply error");
1645 if (!xdr_guestfs_aug_rm_ret (xdr, &rv->ret)) {
1646 error (g, "guestfs_aug_rm: failed to parse reply");
1651 main_loop.main_loop_quit (g);
1654 int guestfs_aug_rm (guestfs_h *g,
1657 struct guestfs_aug_rm_args args;
1658 struct aug_rm_rv rv;
1661 if (g->state != READY) {
1662 error (g, "guestfs_aug_rm called from the wrong state, %d != READY",
1667 memset (&rv, 0, sizeof rv);
1669 args.path = (char *) path;
1670 serial = dispatch (g, GUESTFS_PROC_AUG_RM,
1671 (xdrproc_t) xdr_guestfs_aug_rm_args, (char *) &args);
1676 g->reply_cb_internal = aug_rm_cb;
1677 g->reply_cb_internal_data = &rv;
1678 main_loop.main_loop_run (g);
1679 g->reply_cb_internal = NULL;
1680 g->reply_cb_internal_data = NULL;
1682 error (g, "guestfs_aug_rm failed, see earlier error messages");
1686 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_RM, serial) == -1)
1689 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1690 error (g, "%s", rv.err.error);
1694 return rv.ret.nrnodes;
1698 int cb_done; /* flag to indicate callback was called */
1699 struct guestfs_message_header hdr;
1700 struct guestfs_message_error err;
1703 static void aug_mv_cb (guestfs_h *g, void *data, XDR *xdr)
1705 struct aug_mv_rv *rv = (struct aug_mv_rv *) data;
1707 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1708 error (g, "guestfs_aug_mv: failed to parse reply header");
1711 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1712 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1713 error (g, "guestfs_aug_mv: failed to parse reply error");
1720 main_loop.main_loop_quit (g);
1723 int guestfs_aug_mv (guestfs_h *g,
1727 struct guestfs_aug_mv_args args;
1728 struct aug_mv_rv rv;
1731 if (g->state != READY) {
1732 error (g, "guestfs_aug_mv called from the wrong state, %d != READY",
1737 memset (&rv, 0, sizeof rv);
1739 args.src = (char *) src;
1740 args.dest = (char *) dest;
1741 serial = dispatch (g, GUESTFS_PROC_AUG_MV,
1742 (xdrproc_t) xdr_guestfs_aug_mv_args, (char *) &args);
1747 g->reply_cb_internal = aug_mv_cb;
1748 g->reply_cb_internal_data = &rv;
1749 main_loop.main_loop_run (g);
1750 g->reply_cb_internal = NULL;
1751 g->reply_cb_internal_data = NULL;
1753 error (g, "guestfs_aug_mv failed, see earlier error messages");
1757 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_MV, serial) == -1)
1760 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1761 error (g, "%s", rv.err.error);
1768 struct aug_match_rv {
1769 int cb_done; /* flag to indicate callback was called */
1770 struct guestfs_message_header hdr;
1771 struct guestfs_message_error err;
1772 struct guestfs_aug_match_ret ret;
1775 static void aug_match_cb (guestfs_h *g, void *data, XDR *xdr)
1777 struct aug_match_rv *rv = (struct aug_match_rv *) data;
1779 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1780 error (g, "guestfs_aug_match: failed to parse reply header");
1783 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1784 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1785 error (g, "guestfs_aug_match: failed to parse reply error");
1790 if (!xdr_guestfs_aug_match_ret (xdr, &rv->ret)) {
1791 error (g, "guestfs_aug_match: failed to parse reply");
1796 main_loop.main_loop_quit (g);
1799 char **guestfs_aug_match (guestfs_h *g,
1802 struct guestfs_aug_match_args args;
1803 struct aug_match_rv rv;
1806 if (g->state != READY) {
1807 error (g, "guestfs_aug_match called from the wrong state, %d != READY",
1812 memset (&rv, 0, sizeof rv);
1814 args.path = (char *) path;
1815 serial = dispatch (g, GUESTFS_PROC_AUG_MATCH,
1816 (xdrproc_t) xdr_guestfs_aug_match_args, (char *) &args);
1821 g->reply_cb_internal = aug_match_cb;
1822 g->reply_cb_internal_data = &rv;
1823 main_loop.main_loop_run (g);
1824 g->reply_cb_internal = NULL;
1825 g->reply_cb_internal_data = NULL;
1827 error (g, "guestfs_aug_match failed, see earlier error messages");
1831 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_MATCH, serial) == -1)
1834 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1835 error (g, "%s", rv.err.error);
1839 /* caller will free this, but we need to add a NULL entry */
1840 rv.ret.matches.matches_val = safe_realloc (g, rv.ret.matches.matches_val,
1841 sizeof (char *) * (rv.ret.matches.matches_len + 1));
1842 rv.ret.matches.matches_val[rv.ret.matches.matches_len] = NULL;
1843 return rv.ret.matches.matches_val;
1846 struct aug_save_rv {
1847 int cb_done; /* flag to indicate callback was called */
1848 struct guestfs_message_header hdr;
1849 struct guestfs_message_error err;
1852 static void aug_save_cb (guestfs_h *g, void *data, XDR *xdr)
1854 struct aug_save_rv *rv = (struct aug_save_rv *) data;
1856 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1857 error (g, "guestfs_aug_save: failed to parse reply header");
1860 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1861 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1862 error (g, "guestfs_aug_save: failed to parse reply error");
1869 main_loop.main_loop_quit (g);
1872 int guestfs_aug_save (guestfs_h *g)
1874 struct aug_save_rv rv;
1877 if (g->state != READY) {
1878 error (g, "guestfs_aug_save called from the wrong state, %d != READY",
1883 memset (&rv, 0, sizeof rv);
1885 serial = dispatch (g, GUESTFS_PROC_AUG_SAVE, NULL, NULL);
1890 g->reply_cb_internal = aug_save_cb;
1891 g->reply_cb_internal_data = &rv;
1892 main_loop.main_loop_run (g);
1893 g->reply_cb_internal = NULL;
1894 g->reply_cb_internal_data = NULL;
1896 error (g, "guestfs_aug_save failed, see earlier error messages");
1900 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_SAVE, serial) == -1)
1903 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1904 error (g, "%s", rv.err.error);
1911 struct aug_load_rv {
1912 int cb_done; /* flag to indicate callback was called */
1913 struct guestfs_message_header hdr;
1914 struct guestfs_message_error err;
1917 static void aug_load_cb (guestfs_h *g, void *data, XDR *xdr)
1919 struct aug_load_rv *rv = (struct aug_load_rv *) data;
1921 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1922 error (g, "guestfs_aug_load: failed to parse reply header");
1925 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1926 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1927 error (g, "guestfs_aug_load: failed to parse reply error");
1934 main_loop.main_loop_quit (g);
1937 int guestfs_aug_load (guestfs_h *g)
1939 struct aug_load_rv rv;
1942 if (g->state != READY) {
1943 error (g, "guestfs_aug_load called from the wrong state, %d != READY",
1948 memset (&rv, 0, sizeof rv);
1950 serial = dispatch (g, GUESTFS_PROC_AUG_LOAD, NULL, NULL);
1955 g->reply_cb_internal = aug_load_cb;
1956 g->reply_cb_internal_data = &rv;
1957 main_loop.main_loop_run (g);
1958 g->reply_cb_internal = NULL;
1959 g->reply_cb_internal_data = NULL;
1961 error (g, "guestfs_aug_load failed, see earlier error messages");
1965 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_LOAD, serial) == -1)
1968 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
1969 error (g, "%s", rv.err.error);
1977 int cb_done; /* flag to indicate callback was called */
1978 struct guestfs_message_header hdr;
1979 struct guestfs_message_error err;
1980 struct guestfs_aug_ls_ret ret;
1983 static void aug_ls_cb (guestfs_h *g, void *data, XDR *xdr)
1985 struct aug_ls_rv *rv = (struct aug_ls_rv *) data;
1987 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
1988 error (g, "guestfs_aug_ls: failed to parse reply header");
1991 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
1992 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
1993 error (g, "guestfs_aug_ls: failed to parse reply error");
1998 if (!xdr_guestfs_aug_ls_ret (xdr, &rv->ret)) {
1999 error (g, "guestfs_aug_ls: failed to parse reply");
2004 main_loop.main_loop_quit (g);
2007 char **guestfs_aug_ls (guestfs_h *g,
2010 struct guestfs_aug_ls_args args;
2011 struct aug_ls_rv rv;
2014 if (g->state != READY) {
2015 error (g, "guestfs_aug_ls called from the wrong state, %d != READY",
2020 memset (&rv, 0, sizeof rv);
2022 args.path = (char *) path;
2023 serial = dispatch (g, GUESTFS_PROC_AUG_LS,
2024 (xdrproc_t) xdr_guestfs_aug_ls_args, (char *) &args);
2029 g->reply_cb_internal = aug_ls_cb;
2030 g->reply_cb_internal_data = &rv;
2031 main_loop.main_loop_run (g);
2032 g->reply_cb_internal = NULL;
2033 g->reply_cb_internal_data = NULL;
2035 error (g, "guestfs_aug_ls failed, see earlier error messages");
2039 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_AUG_LS, serial) == -1)
2042 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2043 error (g, "%s", rv.err.error);
2047 /* caller will free this, but we need to add a NULL entry */
2048 rv.ret.matches.matches_val = safe_realloc (g, rv.ret.matches.matches_val,
2049 sizeof (char *) * (rv.ret.matches.matches_len + 1));
2050 rv.ret.matches.matches_val[rv.ret.matches.matches_len] = NULL;
2051 return rv.ret.matches.matches_val;
2055 int cb_done; /* flag to indicate callback was called */
2056 struct guestfs_message_header hdr;
2057 struct guestfs_message_error err;
2060 static void rm_cb (guestfs_h *g, void *data, XDR *xdr)
2062 struct rm_rv *rv = (struct rm_rv *) data;
2064 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2065 error (g, "guestfs_rm: failed to parse reply header");
2068 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2069 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2070 error (g, "guestfs_rm: failed to parse reply error");
2077 main_loop.main_loop_quit (g);
2080 int guestfs_rm (guestfs_h *g,
2083 struct guestfs_rm_args args;
2087 if (g->state != READY) {
2088 error (g, "guestfs_rm called from the wrong state, %d != READY",
2093 memset (&rv, 0, sizeof rv);
2095 args.path = (char *) path;
2096 serial = dispatch (g, GUESTFS_PROC_RM,
2097 (xdrproc_t) xdr_guestfs_rm_args, (char *) &args);
2102 g->reply_cb_internal = rm_cb;
2103 g->reply_cb_internal_data = &rv;
2104 main_loop.main_loop_run (g);
2105 g->reply_cb_internal = NULL;
2106 g->reply_cb_internal_data = NULL;
2108 error (g, "guestfs_rm failed, see earlier error messages");
2112 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_RM, serial) == -1)
2115 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2116 error (g, "%s", rv.err.error);
2124 int cb_done; /* flag to indicate callback was called */
2125 struct guestfs_message_header hdr;
2126 struct guestfs_message_error err;
2129 static void rmdir_cb (guestfs_h *g, void *data, XDR *xdr)
2131 struct rmdir_rv *rv = (struct rmdir_rv *) data;
2133 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2134 error (g, "guestfs_rmdir: failed to parse reply header");
2137 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2138 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2139 error (g, "guestfs_rmdir: failed to parse reply error");
2146 main_loop.main_loop_quit (g);
2149 int guestfs_rmdir (guestfs_h *g,
2152 struct guestfs_rmdir_args args;
2156 if (g->state != READY) {
2157 error (g, "guestfs_rmdir called from the wrong state, %d != READY",
2162 memset (&rv, 0, sizeof rv);
2164 args.path = (char *) path;
2165 serial = dispatch (g, GUESTFS_PROC_RMDIR,
2166 (xdrproc_t) xdr_guestfs_rmdir_args, (char *) &args);
2171 g->reply_cb_internal = rmdir_cb;
2172 g->reply_cb_internal_data = &rv;
2173 main_loop.main_loop_run (g);
2174 g->reply_cb_internal = NULL;
2175 g->reply_cb_internal_data = NULL;
2177 error (g, "guestfs_rmdir failed, see earlier error messages");
2181 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_RMDIR, serial) == -1)
2184 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2185 error (g, "%s", rv.err.error);
2193 int cb_done; /* flag to indicate callback was called */
2194 struct guestfs_message_header hdr;
2195 struct guestfs_message_error err;
2198 static void rm_rf_cb (guestfs_h *g, void *data, XDR *xdr)
2200 struct rm_rf_rv *rv = (struct rm_rf_rv *) data;
2202 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2203 error (g, "guestfs_rm_rf: failed to parse reply header");
2206 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2207 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2208 error (g, "guestfs_rm_rf: failed to parse reply error");
2215 main_loop.main_loop_quit (g);
2218 int guestfs_rm_rf (guestfs_h *g,
2221 struct guestfs_rm_rf_args args;
2225 if (g->state != READY) {
2226 error (g, "guestfs_rm_rf called from the wrong state, %d != READY",
2231 memset (&rv, 0, sizeof rv);
2233 args.path = (char *) path;
2234 serial = dispatch (g, GUESTFS_PROC_RM_RF,
2235 (xdrproc_t) xdr_guestfs_rm_rf_args, (char *) &args);
2240 g->reply_cb_internal = rm_rf_cb;
2241 g->reply_cb_internal_data = &rv;
2242 main_loop.main_loop_run (g);
2243 g->reply_cb_internal = NULL;
2244 g->reply_cb_internal_data = NULL;
2246 error (g, "guestfs_rm_rf failed, see earlier error messages");
2250 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_RM_RF, serial) == -1)
2253 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2254 error (g, "%s", rv.err.error);
2262 int cb_done; /* flag to indicate callback was called */
2263 struct guestfs_message_header hdr;
2264 struct guestfs_message_error err;
2267 static void mkdir_cb (guestfs_h *g, void *data, XDR *xdr)
2269 struct mkdir_rv *rv = (struct mkdir_rv *) data;
2271 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2272 error (g, "guestfs_mkdir: failed to parse reply header");
2275 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2276 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2277 error (g, "guestfs_mkdir: failed to parse reply error");
2284 main_loop.main_loop_quit (g);
2287 int guestfs_mkdir (guestfs_h *g,
2290 struct guestfs_mkdir_args args;
2294 if (g->state != READY) {
2295 error (g, "guestfs_mkdir called from the wrong state, %d != READY",
2300 memset (&rv, 0, sizeof rv);
2302 args.path = (char *) path;
2303 serial = dispatch (g, GUESTFS_PROC_MKDIR,
2304 (xdrproc_t) xdr_guestfs_mkdir_args, (char *) &args);
2309 g->reply_cb_internal = mkdir_cb;
2310 g->reply_cb_internal_data = &rv;
2311 main_loop.main_loop_run (g);
2312 g->reply_cb_internal = NULL;
2313 g->reply_cb_internal_data = NULL;
2315 error (g, "guestfs_mkdir failed, see earlier error messages");
2319 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MKDIR, serial) == -1)
2322 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2323 error (g, "%s", rv.err.error);
2331 int cb_done; /* flag to indicate callback was called */
2332 struct guestfs_message_header hdr;
2333 struct guestfs_message_error err;
2336 static void mkdir_p_cb (guestfs_h *g, void *data, XDR *xdr)
2338 struct mkdir_p_rv *rv = (struct mkdir_p_rv *) data;
2340 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2341 error (g, "guestfs_mkdir_p: failed to parse reply header");
2344 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2345 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2346 error (g, "guestfs_mkdir_p: failed to parse reply error");
2353 main_loop.main_loop_quit (g);
2356 int guestfs_mkdir_p (guestfs_h *g,
2359 struct guestfs_mkdir_p_args args;
2360 struct mkdir_p_rv rv;
2363 if (g->state != READY) {
2364 error (g, "guestfs_mkdir_p called from the wrong state, %d != READY",
2369 memset (&rv, 0, sizeof rv);
2371 args.path = (char *) path;
2372 serial = dispatch (g, GUESTFS_PROC_MKDIR_P,
2373 (xdrproc_t) xdr_guestfs_mkdir_p_args, (char *) &args);
2378 g->reply_cb_internal = mkdir_p_cb;
2379 g->reply_cb_internal_data = &rv;
2380 main_loop.main_loop_run (g);
2381 g->reply_cb_internal = NULL;
2382 g->reply_cb_internal_data = NULL;
2384 error (g, "guestfs_mkdir_p failed, see earlier error messages");
2388 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MKDIR_P, serial) == -1)
2391 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2392 error (g, "%s", rv.err.error);
2400 int cb_done; /* flag to indicate callback was called */
2401 struct guestfs_message_header hdr;
2402 struct guestfs_message_error err;
2405 static void chmod_cb (guestfs_h *g, void *data, XDR *xdr)
2407 struct chmod_rv *rv = (struct chmod_rv *) data;
2409 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2410 error (g, "guestfs_chmod: failed to parse reply header");
2413 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2414 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2415 error (g, "guestfs_chmod: failed to parse reply error");
2422 main_loop.main_loop_quit (g);
2425 int guestfs_chmod (guestfs_h *g,
2429 struct guestfs_chmod_args args;
2433 if (g->state != READY) {
2434 error (g, "guestfs_chmod called from the wrong state, %d != READY",
2439 memset (&rv, 0, sizeof rv);
2442 args.path = (char *) path;
2443 serial = dispatch (g, GUESTFS_PROC_CHMOD,
2444 (xdrproc_t) xdr_guestfs_chmod_args, (char *) &args);
2449 g->reply_cb_internal = chmod_cb;
2450 g->reply_cb_internal_data = &rv;
2451 main_loop.main_loop_run (g);
2452 g->reply_cb_internal = NULL;
2453 g->reply_cb_internal_data = NULL;
2455 error (g, "guestfs_chmod failed, see earlier error messages");
2459 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_CHMOD, serial) == -1)
2462 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2463 error (g, "%s", rv.err.error);
2471 int cb_done; /* flag to indicate callback was called */
2472 struct guestfs_message_header hdr;
2473 struct guestfs_message_error err;
2476 static void chown_cb (guestfs_h *g, void *data, XDR *xdr)
2478 struct chown_rv *rv = (struct chown_rv *) data;
2480 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2481 error (g, "guestfs_chown: failed to parse reply header");
2484 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2485 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2486 error (g, "guestfs_chown: failed to parse reply error");
2493 main_loop.main_loop_quit (g);
2496 int guestfs_chown (guestfs_h *g,
2501 struct guestfs_chown_args args;
2505 if (g->state != READY) {
2506 error (g, "guestfs_chown called from the wrong state, %d != READY",
2511 memset (&rv, 0, sizeof rv);
2515 args.path = (char *) path;
2516 serial = dispatch (g, GUESTFS_PROC_CHOWN,
2517 (xdrproc_t) xdr_guestfs_chown_args, (char *) &args);
2522 g->reply_cb_internal = chown_cb;
2523 g->reply_cb_internal_data = &rv;
2524 main_loop.main_loop_run (g);
2525 g->reply_cb_internal = NULL;
2526 g->reply_cb_internal_data = NULL;
2528 error (g, "guestfs_chown failed, see earlier error messages");
2532 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_CHOWN, serial) == -1)
2535 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2536 error (g, "%s", rv.err.error);
2544 int cb_done; /* flag to indicate callback was called */
2545 struct guestfs_message_header hdr;
2546 struct guestfs_message_error err;
2547 struct guestfs_exists_ret ret;
2550 static void exists_cb (guestfs_h *g, void *data, XDR *xdr)
2552 struct exists_rv *rv = (struct exists_rv *) data;
2554 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2555 error (g, "guestfs_exists: failed to parse reply header");
2558 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2559 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2560 error (g, "guestfs_exists: failed to parse reply error");
2565 if (!xdr_guestfs_exists_ret (xdr, &rv->ret)) {
2566 error (g, "guestfs_exists: failed to parse reply");
2571 main_loop.main_loop_quit (g);
2574 int guestfs_exists (guestfs_h *g,
2577 struct guestfs_exists_args args;
2578 struct exists_rv rv;
2581 if (g->state != READY) {
2582 error (g, "guestfs_exists called from the wrong state, %d != READY",
2587 memset (&rv, 0, sizeof rv);
2589 args.path = (char *) path;
2590 serial = dispatch (g, GUESTFS_PROC_EXISTS,
2591 (xdrproc_t) xdr_guestfs_exists_args, (char *) &args);
2596 g->reply_cb_internal = exists_cb;
2597 g->reply_cb_internal_data = &rv;
2598 main_loop.main_loop_run (g);
2599 g->reply_cb_internal = NULL;
2600 g->reply_cb_internal_data = NULL;
2602 error (g, "guestfs_exists failed, see earlier error messages");
2606 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_EXISTS, serial) == -1)
2609 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2610 error (g, "%s", rv.err.error);
2614 return rv.ret.existsflag;
2618 int cb_done; /* flag to indicate callback was called */
2619 struct guestfs_message_header hdr;
2620 struct guestfs_message_error err;
2621 struct guestfs_is_file_ret ret;
2624 static void is_file_cb (guestfs_h *g, void *data, XDR *xdr)
2626 struct is_file_rv *rv = (struct is_file_rv *) data;
2628 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2629 error (g, "guestfs_is_file: failed to parse reply header");
2632 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2633 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2634 error (g, "guestfs_is_file: failed to parse reply error");
2639 if (!xdr_guestfs_is_file_ret (xdr, &rv->ret)) {
2640 error (g, "guestfs_is_file: failed to parse reply");
2645 main_loop.main_loop_quit (g);
2648 int guestfs_is_file (guestfs_h *g,
2651 struct guestfs_is_file_args args;
2652 struct is_file_rv rv;
2655 if (g->state != READY) {
2656 error (g, "guestfs_is_file called from the wrong state, %d != READY",
2661 memset (&rv, 0, sizeof rv);
2663 args.path = (char *) path;
2664 serial = dispatch (g, GUESTFS_PROC_IS_FILE,
2665 (xdrproc_t) xdr_guestfs_is_file_args, (char *) &args);
2670 g->reply_cb_internal = is_file_cb;
2671 g->reply_cb_internal_data = &rv;
2672 main_loop.main_loop_run (g);
2673 g->reply_cb_internal = NULL;
2674 g->reply_cb_internal_data = NULL;
2676 error (g, "guestfs_is_file failed, see earlier error messages");
2680 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_IS_FILE, serial) == -1)
2683 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2684 error (g, "%s", rv.err.error);
2688 return rv.ret.fileflag;
2692 int cb_done; /* flag to indicate callback was called */
2693 struct guestfs_message_header hdr;
2694 struct guestfs_message_error err;
2695 struct guestfs_is_dir_ret ret;
2698 static void is_dir_cb (guestfs_h *g, void *data, XDR *xdr)
2700 struct is_dir_rv *rv = (struct is_dir_rv *) data;
2702 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2703 error (g, "guestfs_is_dir: failed to parse reply header");
2706 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2707 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2708 error (g, "guestfs_is_dir: failed to parse reply error");
2713 if (!xdr_guestfs_is_dir_ret (xdr, &rv->ret)) {
2714 error (g, "guestfs_is_dir: failed to parse reply");
2719 main_loop.main_loop_quit (g);
2722 int guestfs_is_dir (guestfs_h *g,
2725 struct guestfs_is_dir_args args;
2726 struct is_dir_rv rv;
2729 if (g->state != READY) {
2730 error (g, "guestfs_is_dir called from the wrong state, %d != READY",
2735 memset (&rv, 0, sizeof rv);
2737 args.path = (char *) path;
2738 serial = dispatch (g, GUESTFS_PROC_IS_DIR,
2739 (xdrproc_t) xdr_guestfs_is_dir_args, (char *) &args);
2744 g->reply_cb_internal = is_dir_cb;
2745 g->reply_cb_internal_data = &rv;
2746 main_loop.main_loop_run (g);
2747 g->reply_cb_internal = NULL;
2748 g->reply_cb_internal_data = NULL;
2750 error (g, "guestfs_is_dir failed, see earlier error messages");
2754 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_IS_DIR, serial) == -1)
2757 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2758 error (g, "%s", rv.err.error);
2762 return rv.ret.dirflag;
2765 struct pvcreate_rv {
2766 int cb_done; /* flag to indicate callback was called */
2767 struct guestfs_message_header hdr;
2768 struct guestfs_message_error err;
2771 static void pvcreate_cb (guestfs_h *g, void *data, XDR *xdr)
2773 struct pvcreate_rv *rv = (struct pvcreate_rv *) data;
2775 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2776 error (g, "guestfs_pvcreate: failed to parse reply header");
2779 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2780 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2781 error (g, "guestfs_pvcreate: failed to parse reply error");
2788 main_loop.main_loop_quit (g);
2791 int guestfs_pvcreate (guestfs_h *g,
2794 struct guestfs_pvcreate_args args;
2795 struct pvcreate_rv rv;
2798 if (g->state != READY) {
2799 error (g, "guestfs_pvcreate called from the wrong state, %d != READY",
2804 memset (&rv, 0, sizeof rv);
2806 args.device = (char *) device;
2807 serial = dispatch (g, GUESTFS_PROC_PVCREATE,
2808 (xdrproc_t) xdr_guestfs_pvcreate_args, (char *) &args);
2813 g->reply_cb_internal = pvcreate_cb;
2814 g->reply_cb_internal_data = &rv;
2815 main_loop.main_loop_run (g);
2816 g->reply_cb_internal = NULL;
2817 g->reply_cb_internal_data = NULL;
2819 error (g, "guestfs_pvcreate failed, see earlier error messages");
2823 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_PVCREATE, serial) == -1)
2826 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2827 error (g, "%s", rv.err.error);
2834 struct vgcreate_rv {
2835 int cb_done; /* flag to indicate callback was called */
2836 struct guestfs_message_header hdr;
2837 struct guestfs_message_error err;
2840 static void vgcreate_cb (guestfs_h *g, void *data, XDR *xdr)
2842 struct vgcreate_rv *rv = (struct vgcreate_rv *) data;
2844 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2845 error (g, "guestfs_vgcreate: failed to parse reply header");
2848 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2849 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2850 error (g, "guestfs_vgcreate: failed to parse reply error");
2857 main_loop.main_loop_quit (g);
2860 int guestfs_vgcreate (guestfs_h *g,
2861 const char *volgroup,
2862 char * const* const physvols)
2864 struct guestfs_vgcreate_args args;
2865 struct vgcreate_rv rv;
2868 if (g->state != READY) {
2869 error (g, "guestfs_vgcreate called from the wrong state, %d != READY",
2874 memset (&rv, 0, sizeof rv);
2876 args.volgroup = (char *) volgroup;
2877 args.physvols.physvols_val = (char **) physvols;
2878 for (args.physvols.physvols_len = 0; physvols[args.physvols.physvols_len]; args.physvols.physvols_len++) ;
2879 serial = dispatch (g, GUESTFS_PROC_VGCREATE,
2880 (xdrproc_t) xdr_guestfs_vgcreate_args, (char *) &args);
2885 g->reply_cb_internal = vgcreate_cb;
2886 g->reply_cb_internal_data = &rv;
2887 main_loop.main_loop_run (g);
2888 g->reply_cb_internal = NULL;
2889 g->reply_cb_internal_data = NULL;
2891 error (g, "guestfs_vgcreate failed, see earlier error messages");
2895 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_VGCREATE, serial) == -1)
2898 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2899 error (g, "%s", rv.err.error);
2906 struct lvcreate_rv {
2907 int cb_done; /* flag to indicate callback was called */
2908 struct guestfs_message_header hdr;
2909 struct guestfs_message_error err;
2912 static void lvcreate_cb (guestfs_h *g, void *data, XDR *xdr)
2914 struct lvcreate_rv *rv = (struct lvcreate_rv *) data;
2916 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2917 error (g, "guestfs_lvcreate: failed to parse reply header");
2920 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2921 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2922 error (g, "guestfs_lvcreate: failed to parse reply error");
2929 main_loop.main_loop_quit (g);
2932 int guestfs_lvcreate (guestfs_h *g,
2934 const char *volgroup,
2937 struct guestfs_lvcreate_args args;
2938 struct lvcreate_rv rv;
2941 if (g->state != READY) {
2942 error (g, "guestfs_lvcreate called from the wrong state, %d != READY",
2947 memset (&rv, 0, sizeof rv);
2949 args.logvol = (char *) logvol;
2950 args.volgroup = (char *) volgroup;
2951 args.mbytes = mbytes;
2952 serial = dispatch (g, GUESTFS_PROC_LVCREATE,
2953 (xdrproc_t) xdr_guestfs_lvcreate_args, (char *) &args);
2958 g->reply_cb_internal = lvcreate_cb;
2959 g->reply_cb_internal_data = &rv;
2960 main_loop.main_loop_run (g);
2961 g->reply_cb_internal = NULL;
2962 g->reply_cb_internal_data = NULL;
2964 error (g, "guestfs_lvcreate failed, see earlier error messages");
2968 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVCREATE, serial) == -1)
2971 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
2972 error (g, "%s", rv.err.error);
2980 int cb_done; /* flag to indicate callback was called */
2981 struct guestfs_message_header hdr;
2982 struct guestfs_message_error err;
2985 static void mkfs_cb (guestfs_h *g, void *data, XDR *xdr)
2987 struct mkfs_rv *rv = (struct mkfs_rv *) data;
2989 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
2990 error (g, "guestfs_mkfs: failed to parse reply header");
2993 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
2994 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
2995 error (g, "guestfs_mkfs: failed to parse reply error");
3002 main_loop.main_loop_quit (g);
3005 int guestfs_mkfs (guestfs_h *g,
3009 struct guestfs_mkfs_args args;
3013 if (g->state != READY) {
3014 error (g, "guestfs_mkfs called from the wrong state, %d != READY",
3019 memset (&rv, 0, sizeof rv);
3021 args.fstype = (char *) fstype;
3022 args.device = (char *) device;
3023 serial = dispatch (g, GUESTFS_PROC_MKFS,
3024 (xdrproc_t) xdr_guestfs_mkfs_args, (char *) &args);
3029 g->reply_cb_internal = mkfs_cb;
3030 g->reply_cb_internal_data = &rv;
3031 main_loop.main_loop_run (g);
3032 g->reply_cb_internal = NULL;
3033 g->reply_cb_internal_data = NULL;
3035 error (g, "guestfs_mkfs failed, see earlier error messages");
3039 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MKFS, serial) == -1)
3042 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3043 error (g, "%s", rv.err.error);
3051 int cb_done; /* flag to indicate callback was called */
3052 struct guestfs_message_header hdr;
3053 struct guestfs_message_error err;
3056 static void sfdisk_cb (guestfs_h *g, void *data, XDR *xdr)
3058 struct sfdisk_rv *rv = (struct sfdisk_rv *) data;
3060 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3061 error (g, "guestfs_sfdisk: failed to parse reply header");
3064 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3065 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3066 error (g, "guestfs_sfdisk: failed to parse reply error");
3073 main_loop.main_loop_quit (g);
3076 int guestfs_sfdisk (guestfs_h *g,
3081 char * const* const lines)
3083 struct guestfs_sfdisk_args args;
3084 struct sfdisk_rv rv;
3087 if (g->state != READY) {
3088 error (g, "guestfs_sfdisk called from the wrong state, %d != READY",
3093 memset (&rv, 0, sizeof rv);
3095 args.device = (char *) device;
3098 args.sectors = sectors;
3099 args.lines.lines_val = (char **) lines;
3100 for (args.lines.lines_len = 0; lines[args.lines.lines_len]; args.lines.lines_len++) ;
3101 serial = dispatch (g, GUESTFS_PROC_SFDISK,
3102 (xdrproc_t) xdr_guestfs_sfdisk_args, (char *) &args);
3107 g->reply_cb_internal = sfdisk_cb;
3108 g->reply_cb_internal_data = &rv;
3109 main_loop.main_loop_run (g);
3110 g->reply_cb_internal = NULL;
3111 g->reply_cb_internal_data = NULL;
3113 error (g, "guestfs_sfdisk failed, see earlier error messages");
3117 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_SFDISK, serial) == -1)
3120 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3121 error (g, "%s", rv.err.error);
3128 struct write_file_rv {
3129 int cb_done; /* flag to indicate callback was called */
3130 struct guestfs_message_header hdr;
3131 struct guestfs_message_error err;
3134 static void write_file_cb (guestfs_h *g, void *data, XDR *xdr)
3136 struct write_file_rv *rv = (struct write_file_rv *) data;
3138 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3139 error (g, "guestfs_write_file: failed to parse reply header");
3142 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3143 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3144 error (g, "guestfs_write_file: failed to parse reply error");
3151 main_loop.main_loop_quit (g);
3154 int guestfs_write_file (guestfs_h *g,
3156 const char *content,
3159 struct guestfs_write_file_args args;
3160 struct write_file_rv rv;
3163 if (g->state != READY) {
3164 error (g, "guestfs_write_file called from the wrong state, %d != READY",
3169 memset (&rv, 0, sizeof rv);
3171 args.path = (char *) path;
3172 args.content = (char *) content;
3174 serial = dispatch (g, GUESTFS_PROC_WRITE_FILE,
3175 (xdrproc_t) xdr_guestfs_write_file_args, (char *) &args);
3180 g->reply_cb_internal = write_file_cb;
3181 g->reply_cb_internal_data = &rv;
3182 main_loop.main_loop_run (g);
3183 g->reply_cb_internal = NULL;
3184 g->reply_cb_internal_data = NULL;
3186 error (g, "guestfs_write_file failed, see earlier error messages");
3190 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_WRITE_FILE, serial) == -1)
3193 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3194 error (g, "%s", rv.err.error);
3202 int cb_done; /* flag to indicate callback was called */
3203 struct guestfs_message_header hdr;
3204 struct guestfs_message_error err;
3207 static void umount_cb (guestfs_h *g, void *data, XDR *xdr)
3209 struct umount_rv *rv = (struct umount_rv *) data;
3211 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3212 error (g, "guestfs_umount: failed to parse reply header");
3215 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3216 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3217 error (g, "guestfs_umount: failed to parse reply error");
3224 main_loop.main_loop_quit (g);
3227 int guestfs_umount (guestfs_h *g,
3228 const char *pathordevice)
3230 struct guestfs_umount_args args;
3231 struct umount_rv rv;
3234 if (g->state != READY) {
3235 error (g, "guestfs_umount called from the wrong state, %d != READY",
3240 memset (&rv, 0, sizeof rv);
3242 args.pathordevice = (char *) pathordevice;
3243 serial = dispatch (g, GUESTFS_PROC_UMOUNT,
3244 (xdrproc_t) xdr_guestfs_umount_args, (char *) &args);
3249 g->reply_cb_internal = umount_cb;
3250 g->reply_cb_internal_data = &rv;
3251 main_loop.main_loop_run (g);
3252 g->reply_cb_internal = NULL;
3253 g->reply_cb_internal_data = NULL;
3255 error (g, "guestfs_umount failed, see earlier error messages");
3259 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_UMOUNT, serial) == -1)
3262 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3263 error (g, "%s", rv.err.error);
3271 int cb_done; /* flag to indicate callback was called */
3272 struct guestfs_message_header hdr;
3273 struct guestfs_message_error err;
3274 struct guestfs_mounts_ret ret;
3277 static void mounts_cb (guestfs_h *g, void *data, XDR *xdr)
3279 struct mounts_rv *rv = (struct mounts_rv *) data;
3281 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3282 error (g, "guestfs_mounts: failed to parse reply header");
3285 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3286 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3287 error (g, "guestfs_mounts: failed to parse reply error");
3292 if (!xdr_guestfs_mounts_ret (xdr, &rv->ret)) {
3293 error (g, "guestfs_mounts: failed to parse reply");
3298 main_loop.main_loop_quit (g);
3301 char **guestfs_mounts (guestfs_h *g)
3303 struct mounts_rv rv;
3306 if (g->state != READY) {
3307 error (g, "guestfs_mounts called from the wrong state, %d != READY",
3312 memset (&rv, 0, sizeof rv);
3314 serial = dispatch (g, GUESTFS_PROC_MOUNTS, NULL, NULL);
3319 g->reply_cb_internal = mounts_cb;
3320 g->reply_cb_internal_data = &rv;
3321 main_loop.main_loop_run (g);
3322 g->reply_cb_internal = NULL;
3323 g->reply_cb_internal_data = NULL;
3325 error (g, "guestfs_mounts failed, see earlier error messages");
3329 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MOUNTS, serial) == -1)
3332 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3333 error (g, "%s", rv.err.error);
3337 /* caller will free this, but we need to add a NULL entry */
3338 rv.ret.devices.devices_val = safe_realloc (g, rv.ret.devices.devices_val,
3339 sizeof (char *) * (rv.ret.devices.devices_len + 1));
3340 rv.ret.devices.devices_val[rv.ret.devices.devices_len] = NULL;
3341 return rv.ret.devices.devices_val;
3344 struct umount_all_rv {
3345 int cb_done; /* flag to indicate callback was called */
3346 struct guestfs_message_header hdr;
3347 struct guestfs_message_error err;
3350 static void umount_all_cb (guestfs_h *g, void *data, XDR *xdr)
3352 struct umount_all_rv *rv = (struct umount_all_rv *) data;
3354 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3355 error (g, "guestfs_umount_all: failed to parse reply header");
3358 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3359 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3360 error (g, "guestfs_umount_all: failed to parse reply error");
3367 main_loop.main_loop_quit (g);
3370 int guestfs_umount_all (guestfs_h *g)
3372 struct umount_all_rv rv;
3375 if (g->state != READY) {
3376 error (g, "guestfs_umount_all called from the wrong state, %d != READY",
3381 memset (&rv, 0, sizeof rv);
3383 serial = dispatch (g, GUESTFS_PROC_UMOUNT_ALL, NULL, NULL);
3388 g->reply_cb_internal = umount_all_cb;
3389 g->reply_cb_internal_data = &rv;
3390 main_loop.main_loop_run (g);
3391 g->reply_cb_internal = NULL;
3392 g->reply_cb_internal_data = NULL;
3394 error (g, "guestfs_umount_all failed, see earlier error messages");
3398 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_UMOUNT_ALL, serial) == -1)
3401 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3402 error (g, "%s", rv.err.error);
3409 struct lvm_remove_all_rv {
3410 int cb_done; /* flag to indicate callback was called */
3411 struct guestfs_message_header hdr;
3412 struct guestfs_message_error err;
3415 static void lvm_remove_all_cb (guestfs_h *g, void *data, XDR *xdr)
3417 struct lvm_remove_all_rv *rv = (struct lvm_remove_all_rv *) data;
3419 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3420 error (g, "guestfs_lvm_remove_all: failed to parse reply header");
3423 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3424 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3425 error (g, "guestfs_lvm_remove_all: failed to parse reply error");
3432 main_loop.main_loop_quit (g);
3435 int guestfs_lvm_remove_all (guestfs_h *g)
3437 struct lvm_remove_all_rv rv;
3440 if (g->state != READY) {
3441 error (g, "guestfs_lvm_remove_all called from the wrong state, %d != READY",
3446 memset (&rv, 0, sizeof rv);
3448 serial = dispatch (g, GUESTFS_PROC_LVM_REMOVE_ALL, NULL, NULL);
3453 g->reply_cb_internal = lvm_remove_all_cb;
3454 g->reply_cb_internal_data = &rv;
3455 main_loop.main_loop_run (g);
3456 g->reply_cb_internal = NULL;
3457 g->reply_cb_internal_data = NULL;
3459 error (g, "guestfs_lvm_remove_all failed, see earlier error messages");
3463 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LVM_REMOVE_ALL, serial) == -1)
3466 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3467 error (g, "%s", rv.err.error);
3475 int cb_done; /* flag to indicate callback was called */
3476 struct guestfs_message_header hdr;
3477 struct guestfs_message_error err;
3478 struct guestfs_file_ret ret;
3481 static void file_cb (guestfs_h *g, void *data, XDR *xdr)
3483 struct file_rv *rv = (struct file_rv *) data;
3485 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3486 error (g, "guestfs_file: failed to parse reply header");
3489 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3490 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3491 error (g, "guestfs_file: failed to parse reply error");
3496 if (!xdr_guestfs_file_ret (xdr, &rv->ret)) {
3497 error (g, "guestfs_file: failed to parse reply");
3502 main_loop.main_loop_quit (g);
3505 char *guestfs_file (guestfs_h *g,
3508 struct guestfs_file_args args;
3512 if (g->state != READY) {
3513 error (g, "guestfs_file called from the wrong state, %d != READY",
3518 memset (&rv, 0, sizeof rv);
3520 args.path = (char *) path;
3521 serial = dispatch (g, GUESTFS_PROC_FILE,
3522 (xdrproc_t) xdr_guestfs_file_args, (char *) &args);
3527 g->reply_cb_internal = file_cb;
3528 g->reply_cb_internal_data = &rv;
3529 main_loop.main_loop_run (g);
3530 g->reply_cb_internal = NULL;
3531 g->reply_cb_internal_data = NULL;
3533 error (g, "guestfs_file failed, see earlier error messages");
3537 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_FILE, serial) == -1)
3540 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3541 error (g, "%s", rv.err.error);
3545 return rv.ret.description; /* caller will free */
3549 int cb_done; /* flag to indicate callback was called */
3550 struct guestfs_message_header hdr;
3551 struct guestfs_message_error err;
3552 struct guestfs_command_ret ret;
3555 static void command_cb (guestfs_h *g, void *data, XDR *xdr)
3557 struct command_rv *rv = (struct command_rv *) data;
3559 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3560 error (g, "guestfs_command: failed to parse reply header");
3563 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3564 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3565 error (g, "guestfs_command: failed to parse reply error");
3570 if (!xdr_guestfs_command_ret (xdr, &rv->ret)) {
3571 error (g, "guestfs_command: failed to parse reply");
3576 main_loop.main_loop_quit (g);
3579 char *guestfs_command (guestfs_h *g,
3580 char * const* const arguments)
3582 struct guestfs_command_args args;
3583 struct command_rv rv;
3586 if (g->state != READY) {
3587 error (g, "guestfs_command called from the wrong state, %d != READY",
3592 memset (&rv, 0, sizeof rv);
3594 args.arguments.arguments_val = (char **) arguments;
3595 for (args.arguments.arguments_len = 0; arguments[args.arguments.arguments_len]; args.arguments.arguments_len++) ;
3596 serial = dispatch (g, GUESTFS_PROC_COMMAND,
3597 (xdrproc_t) xdr_guestfs_command_args, (char *) &args);
3602 g->reply_cb_internal = command_cb;
3603 g->reply_cb_internal_data = &rv;
3604 main_loop.main_loop_run (g);
3605 g->reply_cb_internal = NULL;
3606 g->reply_cb_internal_data = NULL;
3608 error (g, "guestfs_command failed, see earlier error messages");
3612 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_COMMAND, serial) == -1)
3615 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3616 error (g, "%s", rv.err.error);
3620 return rv.ret.output; /* caller will free */
3623 struct command_lines_rv {
3624 int cb_done; /* flag to indicate callback was called */
3625 struct guestfs_message_header hdr;
3626 struct guestfs_message_error err;
3627 struct guestfs_command_lines_ret ret;
3630 static void command_lines_cb (guestfs_h *g, void *data, XDR *xdr)
3632 struct command_lines_rv *rv = (struct command_lines_rv *) data;
3634 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
3635 error (g, "guestfs_command_lines: failed to parse reply header");
3638 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
3639 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
3640 error (g, "guestfs_command_lines: failed to parse reply error");
3645 if (!xdr_guestfs_command_lines_ret (xdr, &rv->ret)) {
3646 error (g, "guestfs_command_lines: failed to parse reply");
3651 main_loop.main_loop_quit (g);
3654 char **guestfs_command_lines (guestfs_h *g,
3655 char * const* const arguments)
3657 struct guestfs_command_lines_args args;
3658 struct command_lines_rv rv;
3661 if (g->state != READY) {
3662 error (g, "guestfs_command_lines called from the wrong state, %d != READY",
3667 memset (&rv, 0, sizeof rv);
3669 args.arguments.arguments_val = (char **) arguments;
3670 for (args.arguments.arguments_len = 0; arguments[args.arguments.arguments_len]; args.arguments.arguments_len++) ;
3671 serial = dispatch (g, GUESTFS_PROC_COMMAND_LINES,
3672 (xdrproc_t) xdr_guestfs_command_lines_args, (char *) &args);
3677 g->reply_cb_internal = command_lines_cb;
3678 g->reply_cb_internal_data = &rv;
3679 main_loop.main_loop_run (g);
3680 g->reply_cb_internal = NULL;
3681 g->reply_cb_internal_data = NULL;
3683 error (g, "guestfs_command_lines failed, see earlier error messages");
3687 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_COMMAND_LINES, serial) == -1)
3690 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
3691 error (g, "%s", rv.err.error);
3695 /* caller will free this, but we need to add a NULL entry */
3696 rv.ret.lines.lines_val = safe_realloc (g, rv.ret.lines.lines_val,
3697 sizeof (char *) * (rv.ret.lines.lines_len + 1));
3698 rv.ret.lines.lines_val[rv.ret.lines.lines_len] = NULL;
3699 return rv.ret.lines.lines_val;