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);