summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-06-08 17:44:18 +0100
committerRichard Jones <rjones@redhat.com>2009-06-08 17:44:18 +0100
commit460d139e6a52da67a4f1947035b1978610349f78 (patch)
tree798177aa71bc9615074cd1a9a351ff4b38165c7c /src
parent3de234656bc61a2d35b0f1a9ccb1e6ef7535166b (diff)
downloadlibguestfs-460d139e6a52da67a4f1947035b1978610349f78.tar.gz
libguestfs-460d139e6a52da67a4f1947035b1978610349f78.tar.xz
libguestfs-460d139e6a52da67a4f1947035b1978610349f78.zip
Generated code for ntfs_3g_probe command.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs-actions.c94
-rw-r--r--src/guestfs-actions.h1
-rw-r--r--src/guestfs_protocol.c22
-rw-r--r--src/guestfs_protocol.h18
-rw-r--r--src/guestfs_protocol.x10
5 files changed, 144 insertions, 1 deletions
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index 955cfff8..ecaa5662 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -9980,3 +9980,97 @@ int guestfs_sleep (guestfs_h *g,
return 0;
}
+struct ntfs_3g_probe_ctx {
+ /* This flag is set by the callbacks, so we know we've done
+ * the callbacks as expected, and in the right sequence.
+ * 0 = not called, 1 = reply_cb called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+ struct guestfs_ntfs_3g_probe_ret ret;
+};
+
+static void ntfs_3g_probe_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct ntfs_3g_probe_ctx *ctx = (struct ntfs_3g_probe_ctx *) data;
+
+ /* This should definitely not happen. */
+ if (ctx->cb_sequence != 0) {
+ ctx->cb_sequence = 9999;
+ error (g, "%s: internal error: reply callback called twice", "guestfs_ntfs_3g_probe");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_ntfs_3g_probe");
+ return;
+ }
+ if (ctx->hdr.status == GUESTFS_STATUS_ERROR) {
+ if (!xdr_guestfs_message_error (xdr, &ctx->err)) {
+ error (g, "%s: failed to parse reply error", "guestfs_ntfs_3g_probe");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_ntfs_3g_probe_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_ntfs_3g_probe");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+int guestfs_ntfs_3g_probe (guestfs_h *g,
+ int rw,
+ const char *device)
+{
+ struct guestfs_ntfs_3g_probe_args args;
+ struct ntfs_3g_probe_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_ntfs_3g_probe") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.rw = rw;
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_NTFS_3G_PROBE,
+ (xdrproc_t) xdr_guestfs_ntfs_3g_probe_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, ntfs_3g_probe_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_ntfs_3g_probe");
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_NTFS_3G_PROBE, serial) == -1) {
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ free (ctx.err.error_message);
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ guestfs_end_busy (g);
+ return ctx.ret.status;
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index 1afb4f0b..7f8f0deb 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -180,3 +180,4 @@ extern int guestfs_resize2fs (guestfs_h *handle, const char *device);
extern char **guestfs_find (guestfs_h *handle, const char *directory);
extern int guestfs_e2fsck_f (guestfs_h *handle, const char *device);
extern int guestfs_sleep (guestfs_h *handle, int secs);
+extern int guestfs_ntfs_3g_probe (guestfs_h *handle, int rw, const char *device);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index df494203..fc88d05f 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1849,6 +1849,28 @@ xdr_guestfs_sleep_args (XDR *xdrs, guestfs_sleep_args *objp)
}
bool_t
+xdr_guestfs_ntfs_3g_probe_args (XDR *xdrs, guestfs_ntfs_3g_probe_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, &objp->rw))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_ntfs_3g_probe_ret (XDR *xdrs, guestfs_ntfs_3g_probe_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_int (xdrs, &objp->status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_guestfs_procedure (XDR *xdrs, guestfs_procedure *objp)
{
register int32_t *buf;
diff --git a/src/guestfs_protocol.h b/src/guestfs_protocol.h
index 68f4ec62..9f3bd8d0 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -935,6 +935,17 @@ struct guestfs_sleep_args {
};
typedef struct guestfs_sleep_args guestfs_sleep_args;
+struct guestfs_ntfs_3g_probe_args {
+ bool_t rw;
+ char *device;
+};
+typedef struct guestfs_ntfs_3g_probe_args guestfs_ntfs_3g_probe_args;
+
+struct guestfs_ntfs_3g_probe_ret {
+ int status;
+};
+typedef struct guestfs_ntfs_3g_probe_ret guestfs_ntfs_3g_probe_ret;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -1045,7 +1056,8 @@ enum guestfs_procedure {
GUESTFS_PROC_FIND = 107,
GUESTFS_PROC_E2FSCK_F = 108,
GUESTFS_PROC_SLEEP = 109,
- GUESTFS_PROC_NR_PROCS = 109 + 1,
+ GUESTFS_PROC_NTFS_3G_PROBE = 110,
+ GUESTFS_PROC_NR_PROCS = 110 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -1244,6 +1256,8 @@ extern bool_t xdr_guestfs_find_args (XDR *, guestfs_find_args*);
extern bool_t xdr_guestfs_find_ret (XDR *, guestfs_find_ret*);
extern bool_t xdr_guestfs_e2fsck_f_args (XDR *, guestfs_e2fsck_f_args*);
extern bool_t xdr_guestfs_sleep_args (XDR *, guestfs_sleep_args*);
+extern bool_t xdr_guestfs_ntfs_3g_probe_args (XDR *, guestfs_ntfs_3g_probe_args*);
+extern bool_t xdr_guestfs_ntfs_3g_probe_ret (XDR *, guestfs_ntfs_3g_probe_ret*);
extern bool_t xdr_guestfs_procedure (XDR *, guestfs_procedure*);
extern bool_t xdr_guestfs_message_direction (XDR *, guestfs_message_direction*);
extern bool_t xdr_guestfs_message_status (XDR *, guestfs_message_status*);
@@ -1401,6 +1415,8 @@ extern bool_t xdr_guestfs_find_args ();
extern bool_t xdr_guestfs_find_ret ();
extern bool_t xdr_guestfs_e2fsck_f_args ();
extern bool_t xdr_guestfs_sleep_args ();
+extern bool_t xdr_guestfs_ntfs_3g_probe_args ();
+extern bool_t xdr_guestfs_ntfs_3g_probe_ret ();
extern bool_t xdr_guestfs_procedure ();
extern bool_t xdr_guestfs_message_direction ();
extern bool_t xdr_guestfs_message_status ();
diff --git a/src/guestfs_protocol.x b/src/guestfs_protocol.x
index 556ed60e..cc514e74 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -723,6 +723,15 @@ struct guestfs_sleep_args {
int secs;
};
+struct guestfs_ntfs_3g_probe_args {
+ bool rw;
+ string device<>;
+};
+
+struct guestfs_ntfs_3g_probe_ret {
+ int status;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -833,6 +842,7 @@ enum guestfs_procedure {
GUESTFS_PROC_FIND = 107,
GUESTFS_PROC_E2FSCK_F = 108,
GUESTFS_PROC_SLEEP = 109,
+ GUESTFS_PROC_NTFS_3G_PROBE = 110,
GUESTFS_PROC_NR_PROCS
};