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;
26 struct guestfs_cat_ret ret;
29 static void cat_cb (guestfs_h *g, void *data, XDR *xdr)
31 struct cat_rv *rv = (struct cat_rv *) data;
33 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
34 error (g, "guestfs_cat: failed to parse reply header");
37 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
38 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
39 error (g, "guestfs_cat: failed to parse reply error");
44 if (!xdr_guestfs_cat_ret (xdr, &rv->ret)) {
45 error (g, "guestfs_cat: failed to parse reply");
50 main_loop.main_loop_quit (g);
53 char *guestfs_cat (guestfs_h *g,
56 struct guestfs_cat_args args;
60 if (g->state != READY) {
61 error (g, "guestfs_cat called from the wrong state, %d != READY",
66 memset (&rv, 0, sizeof rv);
68 args.path = (char *) path;
69 serial = dispatch (g, GUESTFS_PROC_CAT,
70 (xdrproc_t) xdr_guestfs_cat_args, (char *) &args);
75 g->reply_cb_internal = cat_cb;
76 g->reply_cb_internal_data = &rv;
77 main_loop.main_loop_run (g);
78 g->reply_cb_internal = NULL;
79 g->reply_cb_internal_data = NULL;
81 error (g, "guestfs_cat failed, see earlier error messages");
85 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_CAT, serial) == -1)
88 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
89 error (g, "%s", rv.err.error);
93 return rv.ret.content; /* caller will free */
97 int cb_done; /* flag to indicate callback was called */
98 struct guestfs_message_header hdr;
99 struct guestfs_message_error err;
100 struct guestfs_ll_ret ret;
103 static void ll_cb (guestfs_h *g, void *data, XDR *xdr)
105 struct ll_rv *rv = (struct ll_rv *) data;
107 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
108 error (g, "guestfs_ll: failed to parse reply header");
111 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
112 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
113 error (g, "guestfs_ll: failed to parse reply error");
118 if (!xdr_guestfs_ll_ret (xdr, &rv->ret)) {
119 error (g, "guestfs_ll: failed to parse reply");
124 main_loop.main_loop_quit (g);
127 char *guestfs_ll (guestfs_h *g,
128 const char *directory)
130 struct guestfs_ll_args args;
134 if (g->state != READY) {
135 error (g, "guestfs_ll called from the wrong state, %d != READY",
140 memset (&rv, 0, sizeof rv);
142 args.directory = (char *) directory;
143 serial = dispatch (g, GUESTFS_PROC_LL,
144 (xdrproc_t) xdr_guestfs_ll_args, (char *) &args);
149 g->reply_cb_internal = ll_cb;
150 g->reply_cb_internal_data = &rv;
151 main_loop.main_loop_run (g);
152 g->reply_cb_internal = NULL;
153 g->reply_cb_internal_data = NULL;
155 error (g, "guestfs_ll failed, see earlier error messages");
159 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LL, serial) == -1)
162 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
163 error (g, "%s", rv.err.error);
167 return rv.ret.listing; /* caller will free */
171 int cb_done; /* flag to indicate callback was called */
172 struct guestfs_message_header hdr;
173 struct guestfs_message_error err;
174 struct guestfs_ls_ret ret;
177 static void ls_cb (guestfs_h *g, void *data, XDR *xdr)
179 struct ls_rv *rv = (struct ls_rv *) data;
181 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
182 error (g, "guestfs_ls: failed to parse reply header");
185 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
186 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
187 error (g, "guestfs_ls: failed to parse reply error");
192 if (!xdr_guestfs_ls_ret (xdr, &rv->ret)) {
193 error (g, "guestfs_ls: failed to parse reply");
198 main_loop.main_loop_quit (g);
201 char **guestfs_ls (guestfs_h *g,
202 const char *directory)
204 struct guestfs_ls_args args;
208 if (g->state != READY) {
209 error (g, "guestfs_ls called from the wrong state, %d != READY",
214 memset (&rv, 0, sizeof rv);
216 args.directory = (char *) directory;
217 serial = dispatch (g, GUESTFS_PROC_LS,
218 (xdrproc_t) xdr_guestfs_ls_args, (char *) &args);
223 g->reply_cb_internal = ls_cb;
224 g->reply_cb_internal_data = &rv;
225 main_loop.main_loop_run (g);
226 g->reply_cb_internal = NULL;
227 g->reply_cb_internal_data = NULL;
229 error (g, "guestfs_ls failed, see earlier error messages");
233 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_LS, serial) == -1)
236 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
237 error (g, "%s", rv.err.error);
241 /* caller will free this, but we need to add a NULL entry */
242 rv.ret.listing.listing_val = safe_realloc (g, rv.ret.listing.listing_val, rv.ret.listing.listing_len + 1);
243 rv.ret.listing.listing_val[rv.ret.listing.listing_len] = NULL;
244 return rv.ret.listing.listing_val;
248 int cb_done; /* flag to indicate callback was called */
249 struct guestfs_message_header hdr;
250 struct guestfs_message_error err;
253 static void mount_cb (guestfs_h *g, void *data, XDR *xdr)
255 struct mount_rv *rv = (struct mount_rv *) data;
257 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
258 error (g, "guestfs_mount: failed to parse reply header");
261 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
262 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
263 error (g, "guestfs_mount: failed to parse reply error");
270 main_loop.main_loop_quit (g);
273 int guestfs_mount (guestfs_h *g,
275 const char *mountpoint)
277 struct guestfs_mount_args args;
281 if (g->state != READY) {
282 error (g, "guestfs_mount called from the wrong state, %d != READY",
287 memset (&rv, 0, sizeof rv);
289 args.device = (char *) device;
290 args.mountpoint = (char *) mountpoint;
291 serial = dispatch (g, GUESTFS_PROC_MOUNT,
292 (xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
297 g->reply_cb_internal = mount_cb;
298 g->reply_cb_internal_data = &rv;
299 main_loop.main_loop_run (g);
300 g->reply_cb_internal = NULL;
301 g->reply_cb_internal_data = NULL;
303 error (g, "guestfs_mount failed, see earlier error messages");
307 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MOUNT, serial) == -1)
310 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
311 error (g, "%s", rv.err.error);
319 int cb_done; /* flag to indicate callback was called */
320 struct guestfs_message_header hdr;
321 struct guestfs_message_error err;
324 static void sync_cb (guestfs_h *g, void *data, XDR *xdr)
326 struct sync_rv *rv = (struct sync_rv *) data;
328 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
329 error (g, "guestfs_sync: failed to parse reply header");
332 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
333 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
334 error (g, "guestfs_sync: failed to parse reply error");
341 main_loop.main_loop_quit (g);
344 int guestfs_sync (guestfs_h *g)
349 if (g->state != READY) {
350 error (g, "guestfs_sync called from the wrong state, %d != READY",
355 memset (&rv, 0, sizeof rv);
357 serial = dispatch (g, GUESTFS_PROC_SYNC, NULL, NULL);
362 g->reply_cb_internal = sync_cb;
363 g->reply_cb_internal_data = &rv;
364 main_loop.main_loop_run (g);
365 g->reply_cb_internal = NULL;
366 g->reply_cb_internal_data = NULL;
368 error (g, "guestfs_sync failed, see earlier error messages");
372 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_SYNC, serial) == -1)
375 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
376 error (g, "%s", rv.err.error);
384 int cb_done; /* flag to indicate callback was called */
385 struct guestfs_message_header hdr;
386 struct guestfs_message_error err;
389 static void touch_cb (guestfs_h *g, void *data, XDR *xdr)
391 struct touch_rv *rv = (struct touch_rv *) data;
393 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
394 error (g, "guestfs_touch: failed to parse reply header");
397 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
398 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
399 error (g, "guestfs_touch: failed to parse reply error");
406 main_loop.main_loop_quit (g);
409 int guestfs_touch (guestfs_h *g,
412 struct guestfs_touch_args args;
416 if (g->state != READY) {
417 error (g, "guestfs_touch called from the wrong state, %d != READY",
422 memset (&rv, 0, sizeof rv);
424 args.path = (char *) path;
425 serial = dispatch (g, GUESTFS_PROC_TOUCH,
426 (xdrproc_t) xdr_guestfs_touch_args, (char *) &args);
431 g->reply_cb_internal = touch_cb;
432 g->reply_cb_internal_data = &rv;
433 main_loop.main_loop_run (g);
434 g->reply_cb_internal = NULL;
435 g->reply_cb_internal_data = NULL;
437 error (g, "guestfs_touch failed, see earlier error messages");
441 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_TOUCH, serial) == -1)
444 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
445 error (g, "%s", rv.err.error);