summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-25 21:41:09 +0100
committerRichard Jones <rjones@redhat.com>2009-04-25 21:41:09 +0100
commitaed0fa2c015e56a882fd6d4b759c82df08fc40d7 (patch)
treeacfb96c7b0adbc10ab73236d30c644b85807ffdc /src
parent58caa9e5f1dca3916178894876b938a6a45771b0 (diff)
downloadlibguestfs-aed0fa2c015e56a882fd6d4b759c82df08fc40d7.tar.gz
libguestfs-aed0fa2c015e56a882fd6d4b759c82df08fc40d7.tar.xz
libguestfs-aed0fa2c015e56a882fd6d4b759c82df08fc40d7.zip
Generated code for lvremove, vgremove, pvremove.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs-actions.c240
-rw-r--r--src/guestfs-actions.h3
-rw-r--r--src/guestfs_protocol.c30
-rw-r--r--src/guestfs_protocol.h26
-rw-r--r--src/guestfs_protocol.x15
5 files changed, 313 insertions, 1 deletions
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index e143c27b..68f122aa 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -6477,3 +6477,243 @@ char *guestfs_debug (guestfs_h *g,
return ctx.ret.result; /* caller will free */
}
+struct lvremove_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 = send called,
+ * 1001 = reply called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+};
+
+static void lvremove_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct lvremove_ctx *ctx = (struct lvremove_ctx *) data;
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_lvremove");
+ 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_lvremove");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1001;
+}
+
+int guestfs_lvremove (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_lvremove_args args;
+ struct lvremove_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_lvremove") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_LVREMOVE,
+ (xdrproc_t) xdr_guestfs_lvremove_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, lvremove_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1001) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_lvremove");
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_LVREMOVE, serial) == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs_set_ready (g);
+ return 0;
+}
+
+struct vgremove_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 = send called,
+ * 1001 = reply called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+};
+
+static void vgremove_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct vgremove_ctx *ctx = (struct vgremove_ctx *) data;
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_vgremove");
+ 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_vgremove");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1001;
+}
+
+int guestfs_vgremove (guestfs_h *g,
+ const char *vgname)
+{
+ struct guestfs_vgremove_args args;
+ struct vgremove_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_vgremove") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.vgname = (char *) vgname;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_VGREMOVE,
+ (xdrproc_t) xdr_guestfs_vgremove_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, vgremove_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1001) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_vgremove");
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_VGREMOVE, serial) == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs_set_ready (g);
+ return 0;
+}
+
+struct pvremove_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 = send called,
+ * 1001 = reply called.
+ */
+ int cb_sequence;
+ struct guestfs_message_header hdr;
+ struct guestfs_message_error err;
+};
+
+static void pvremove_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct pvremove_ctx *ctx = (struct pvremove_ctx *) data;
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_pvremove");
+ 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_pvremove");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1001;
+}
+
+int guestfs_pvremove (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_pvremove_args args;
+ struct pvremove_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_pvremove") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_PVREMOVE,
+ (xdrproc_t) xdr_guestfs_pvremove_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, pvremove_reply_cb, &ctx);
+ (void) ml->main_loop_run (ml, g);
+ guestfs_set_reply_callback (g, NULL, NULL);
+ if (ctx.cb_sequence != 1001) {
+ error (g, "%s reply failed, see earlier error messages", "guestfs_pvremove");
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_PVREMOVE, serial) == -1) {
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ guestfs_set_ready (g);
+ return -1;
+ }
+
+ guestfs_set_ready (g);
+ return 0;
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index 51905285..a11a6b27 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -116,3 +116,6 @@ extern int guestfs_mount_ro (guestfs_h *handle, const char *device, const char *
extern int guestfs_mount_options (guestfs_h *handle, const char *options, const char *device, const char *mountpoint);
extern int guestfs_mount_vfs (guestfs_h *handle, const char *options, const char *vfstype, const char *device, const char *mountpoint);
extern char *guestfs_debug (guestfs_h *handle, const char *subcmd, char * const* const extraargs);
+extern int guestfs_lvremove (guestfs_h *handle, const char *device);
+extern int guestfs_vgremove (guestfs_h *handle, const char *vgname);
+extern int guestfs_pvremove (guestfs_h *handle, const char *device);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index 5bde2b97..2a34a925 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1334,6 +1334,36 @@ xdr_guestfs_debug_ret (XDR *xdrs, guestfs_debug_ret *objp)
}
bool_t
+xdr_guestfs_lvremove_args (XDR *xdrs, guestfs_lvremove_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_vgremove_args (XDR *xdrs, guestfs_vgremove_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->vgname, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_pvremove_args (XDR *xdrs, guestfs_pvremove_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ 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 2a8d9194..826dc42e 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -692,6 +692,21 @@ struct guestfs_debug_ret {
};
typedef struct guestfs_debug_ret guestfs_debug_ret;
+struct guestfs_lvremove_args {
+ char *device;
+};
+typedef struct guestfs_lvremove_args guestfs_lvremove_args;
+
+struct guestfs_vgremove_args {
+ char *vgname;
+};
+typedef struct guestfs_vgremove_args guestfs_vgremove_args;
+
+struct guestfs_pvremove_args {
+ char *device;
+};
+typedef struct guestfs_pvremove_args guestfs_pvremove_args;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -769,7 +784,10 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNT_OPTIONS = 74,
GUESTFS_PROC_MOUNT_VFS = 75,
GUESTFS_PROC_DEBUG = 76,
- GUESTFS_PROC_NR_PROCS = 76 + 1,
+ GUESTFS_PROC_LVREMOVE = 77,
+ GUESTFS_PROC_VGREMOVE = 78,
+ GUESTFS_PROC_PVREMOVE = 79,
+ GUESTFS_PROC_NR_PROCS = 79 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -925,6 +943,9 @@ extern bool_t xdr_guestfs_mount_options_args (XDR *, guestfs_mount_options_args
extern bool_t xdr_guestfs_mount_vfs_args (XDR *, guestfs_mount_vfs_args*);
extern bool_t xdr_guestfs_debug_args (XDR *, guestfs_debug_args*);
extern bool_t xdr_guestfs_debug_ret (XDR *, guestfs_debug_ret*);
+extern bool_t xdr_guestfs_lvremove_args (XDR *, guestfs_lvremove_args*);
+extern bool_t xdr_guestfs_vgremove_args (XDR *, guestfs_vgremove_args*);
+extern bool_t xdr_guestfs_pvremove_args (XDR *, guestfs_pvremove_args*);
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*);
@@ -1039,6 +1060,9 @@ extern bool_t xdr_guestfs_mount_options_args ();
extern bool_t xdr_guestfs_mount_vfs_args ();
extern bool_t xdr_guestfs_debug_args ();
extern bool_t xdr_guestfs_debug_ret ();
+extern bool_t xdr_guestfs_lvremove_args ();
+extern bool_t xdr_guestfs_vgremove_args ();
+extern bool_t xdr_guestfs_pvremove_args ();
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 7f0793f4..348f3f9c 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -535,6 +535,18 @@ struct guestfs_debug_ret {
string result<>;
};
+struct guestfs_lvremove_args {
+ string device<>;
+};
+
+struct guestfs_vgremove_args {
+ string vgname<>;
+};
+
+struct guestfs_pvremove_args {
+ string device<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -612,6 +624,9 @@ enum guestfs_procedure {
GUESTFS_PROC_MOUNT_OPTIONS = 74,
GUESTFS_PROC_MOUNT_VFS = 75,
GUESTFS_PROC_DEBUG = 76,
+ GUESTFS_PROC_LVREMOVE = 77,
+ GUESTFS_PROC_VGREMOVE = 78,
+ GUESTFS_PROC_PVREMOVE = 79,
GUESTFS_PROC_NR_PROCS
};