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);
65 args.device = (char *) device;
66 args.mountpoint = (char *) mountpoint;
67 serial = dispatch (g, GUESTFS_PROC_MOUNT,
68 (xdrproc_t) xdr_guestfs_mount_args, (char *) &args);
73 g->reply_cb_internal = mount_cb;
74 g->reply_cb_internal_data = &rv;
75 main_loop.main_loop_run (g);
76 g->reply_cb_internal = NULL;
77 g->reply_cb_internal_data = NULL;
79 error (g, "guestfs_mount failed, see earlier error messages");
83 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_MOUNT, serial) == -1)
86 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
87 error (g, "%s", rv.err.error);
95 int cb_done; /* flag to indicate callback was called */
96 struct guestfs_message_header hdr;
97 struct guestfs_message_error err;
100 static void sync_cb (guestfs_h *g, void *data, XDR *xdr)
102 struct sync_rv *rv = (struct sync_rv *) data;
104 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
105 error (g, "guestfs_sync: failed to parse reply header");
108 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
109 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
110 error (g, "guestfs_sync: failed to parse reply error");
117 main_loop.main_loop_quit (g);
120 int guestfs_sync (guestfs_h *g)
125 if (g->state != READY) {
126 error (g, "guestfs_sync called from the wrong state, %d != READY",
131 memset (&rv, 0, sizeof rv);
133 serial = dispatch (g, GUESTFS_PROC_SYNC, NULL, NULL);
138 g->reply_cb_internal = sync_cb;
139 g->reply_cb_internal_data = &rv;
140 main_loop.main_loop_run (g);
141 g->reply_cb_internal = NULL;
142 g->reply_cb_internal_data = NULL;
144 error (g, "guestfs_sync failed, see earlier error messages");
148 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_SYNC, serial) == -1)
151 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
152 error (g, "%s", rv.err.error);
160 int cb_done; /* flag to indicate callback was called */
161 struct guestfs_message_header hdr;
162 struct guestfs_message_error err;
165 static void touch_cb (guestfs_h *g, void *data, XDR *xdr)
167 struct touch_rv *rv = (struct touch_rv *) data;
169 if (!xdr_guestfs_message_header (xdr, &rv->hdr)) {
170 error (g, "guestfs_touch: failed to parse reply header");
173 if (rv->hdr.status == GUESTFS_STATUS_ERROR) {
174 if (!xdr_guestfs_message_error (xdr, &rv->err)) {
175 error (g, "guestfs_touch: failed to parse reply error");
182 main_loop.main_loop_quit (g);
185 int guestfs_touch (guestfs_h *g,
188 struct guestfs_touch_args args;
192 if (g->state != READY) {
193 error (g, "guestfs_touch called from the wrong state, %d != READY",
198 memset (&rv, 0, sizeof rv);
201 args.path = (char *) path;
202 serial = dispatch (g, GUESTFS_PROC_TOUCH,
203 (xdrproc_t) xdr_guestfs_touch_args, (char *) &args);
208 g->reply_cb_internal = touch_cb;
209 g->reply_cb_internal_data = &rv;
210 main_loop.main_loop_run (g);
211 g->reply_cb_internal = NULL;
212 g->reply_cb_internal_data = NULL;
214 error (g, "guestfs_touch failed, see earlier error messages");
218 if (check_reply_header (g, &rv.hdr, GUESTFS_PROC_TOUCH, serial) == -1)
221 if (rv.hdr.status == GUESTFS_STATUS_ERROR) {
222 error (g, "%s", rv.err.error);