summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml58
-rw-r--r--src/guestfs-actions.c460
-rw-r--r--src/guestfs-actions.h5
-rw-r--r--src/guestfs_protocol.c139
-rw-r--r--src/guestfs_protocol.h68
-rw-r--r--src/guestfs_protocol.x42
6 files changed, 768 insertions, 4 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 652564d8..19dc20d5 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -1076,7 +1076,9 @@ information refer to the L<sfdisk(8)> manpage.
To create a single partition occupying the whole disk, you would
pass C<lines> as a single element list, when the single element being
-the string C<,> (comma).");
+the string C<,> (comma).
+
+See also: C<guestfs_sfdisk_l>, C<guestfs_sfdisk_N>");
("write_file", (RErr, [String "path"; String "content"; Int "size"]), 44, [ProtocolLimitWarning],
[InitBasicFS, Always, TestOutput (
@@ -2019,6 +2021,54 @@ mounted.
It is possible that using this program can damage the filesystem
or data on the filesystem.");
+ ("pvresize", (RErr, [String "device"]), 98, [],
+ [],
+ "resize an LVM physical volume",
+ "\
+This resizes (expands or shrinks) an existing LVM physical
+volume to match the new size of the underlying device.");
+
+ ("sfdisk_N", (RErr, [String "device"; Int "n";
+ Int "cyls"; Int "heads"; Int "sectors";
+ String "line"]), 99, [DangerWillRobinson],
+ [],
+ "modify a single partition on a block device",
+ "\
+This runs L<sfdisk(8)> option to modify just the single
+partition C<n> (note: C<n> counts from 1).
+
+For other parameters, see C<guestfs_sfdisk>. You should usually
+pass C<0> for the cyls/heads/sectors parameters.");
+
+ ("sfdisk_l", (RString "partitions", [String "device"]), 100, [],
+ [],
+ "display the partition table",
+ "\
+This displays the partition table on C<device>, in the
+human-readable output of the L<sfdisk(8)> command. It is
+not intended to be parsed.");
+
+ ("sfdisk_kernel_geometry", (RString "partitions", [String "device"]), 101, [],
+ [],
+ "display the kernel geometry",
+ "\
+This displays the kernel's idea of the geometry of C<device>.
+
+The result is in human-readable format, and not designed to
+be parsed.");
+
+ ("sfdisk_disk_geometry", (RString "partitions", [String "device"]), 102, [],
+ [],
+ "display the disk geometry from the partition table",
+ "\
+This displays the disk geometry of C<device> read from the
+partition table. Especially in the case where the underlying
+block device has been resized, this can be different from the
+kernel's idea of the geometry (see C<guestfs_sfdisk_kernel_geometry>).
+
+The result is in human-readable format, and not designed to
+be parsed.");
+
]
let all_functions = non_daemon_functions @ daemon_functions
@@ -2267,8 +2317,10 @@ let check_functions () =
fun (name, _, _, _, _, _, _) ->
if String.length name >= 7 && String.sub name 0 7 = "guestfs" then
failwithf "function name %s does not need 'guestfs' prefix" name;
- if contains_uppercase name then
- failwithf "function name %s should not contain uppercase chars" name;
+ if name = "" then
+ failwithf "function name is empty";
+ if name.[0] < 'a' || name.[0] > 'z' then
+ failwithf "function name %s must start with lowercase a-z" name;
if String.contains name '-' then
failwithf "function name %s should not contain '-', use '_' instead."
name
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index d27ef012..49e8961d 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -8896,3 +8896,463 @@ int guestfs_zerofree (guestfs_h *g,
return 0;
}
+struct pvresize_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;
+};
+
+static void pvresize_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct pvresize_ctx *ctx = (struct pvresize_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_pvresize");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_pvresize");
+ 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_pvresize");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+int guestfs_pvresize (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_pvresize_args args;
+ struct pvresize_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_pvresize") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_PVRESIZE,
+ (xdrproc_t) xdr_guestfs_pvresize_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, pvresize_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_pvresize");
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_PVRESIZE, 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 0;
+}
+
+struct sfdisk_N_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;
+};
+
+static void sfdisk_N_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct sfdisk_N_ctx *ctx = (struct sfdisk_N_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_sfdisk_N");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_sfdisk_N");
+ 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_sfdisk_N");
+ return;
+ }
+ goto done;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+int guestfs_sfdisk_N (guestfs_h *g,
+ const char *device,
+ int n,
+ int cyls,
+ int heads,
+ int sectors,
+ const char *line)
+{
+ struct guestfs_sfdisk_N_args args;
+ struct sfdisk_N_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_sfdisk_N") == -1) return -1;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ args.n = n;
+ args.cyls = cyls;
+ args.heads = heads;
+ args.sectors = sectors;
+ args.line = (char *) line;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_SFDISK_N,
+ (xdrproc_t) xdr_guestfs_sfdisk_N_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, sfdisk_N_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_sfdisk_N");
+ guestfs_end_busy (g);
+ return -1;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_SFDISK_N, 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 0;
+}
+
+struct sfdisk_l_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_sfdisk_l_ret ret;
+};
+
+static void sfdisk_l_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct sfdisk_l_ctx *ctx = (struct sfdisk_l_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_sfdisk_l");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_sfdisk_l");
+ 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_sfdisk_l");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_sfdisk_l_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_sfdisk_l");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char *guestfs_sfdisk_l (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_sfdisk_l_args args;
+ struct sfdisk_l_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_sfdisk_l") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_SFDISK_L,
+ (xdrproc_t) xdr_guestfs_sfdisk_l_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, sfdisk_l_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_sfdisk_l");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_SFDISK_L, serial) == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ free (ctx.err.error_message);
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs_end_busy (g);
+ return ctx.ret.partitions; /* caller will free */
+}
+
+struct sfdisk_kernel_geometry_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_sfdisk_kernel_geometry_ret ret;
+};
+
+static void sfdisk_kernel_geometry_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct sfdisk_kernel_geometry_ctx *ctx = (struct sfdisk_kernel_geometry_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_sfdisk_kernel_geometry");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_sfdisk_kernel_geometry");
+ 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_sfdisk_kernel_geometry");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_sfdisk_kernel_geometry_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_sfdisk_kernel_geometry");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char *guestfs_sfdisk_kernel_geometry (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_sfdisk_kernel_geometry_args args;
+ struct sfdisk_kernel_geometry_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_sfdisk_kernel_geometry") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_SFDISK_KERNEL_GEOMETRY,
+ (xdrproc_t) xdr_guestfs_sfdisk_kernel_geometry_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, sfdisk_kernel_geometry_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_sfdisk_kernel_geometry");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_SFDISK_KERNEL_GEOMETRY, serial) == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ free (ctx.err.error_message);
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs_end_busy (g);
+ return ctx.ret.partitions; /* caller will free */
+}
+
+struct sfdisk_disk_geometry_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_sfdisk_disk_geometry_ret ret;
+};
+
+static void sfdisk_disk_geometry_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct sfdisk_disk_geometry_ctx *ctx = (struct sfdisk_disk_geometry_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_sfdisk_disk_geometry");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_sfdisk_disk_geometry");
+ 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_sfdisk_disk_geometry");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_sfdisk_disk_geometry_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_sfdisk_disk_geometry");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char *guestfs_sfdisk_disk_geometry (guestfs_h *g,
+ const char *device)
+{
+ struct guestfs_sfdisk_disk_geometry_args args;
+ struct sfdisk_disk_geometry_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_sfdisk_disk_geometry") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.device = (char *) device;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_SFDISK_DISK_GEOMETRY,
+ (xdrproc_t) xdr_guestfs_sfdisk_disk_geometry_args, (char *) &args);
+ if (serial == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs__switch_to_receiving (g);
+ ctx.cb_sequence = 0;
+ guestfs_set_reply_callback (g, sfdisk_disk_geometry_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_sfdisk_disk_geometry");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_SFDISK_DISK_GEOMETRY, serial) == -1) {
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (ctx.hdr.status == GUESTFS_STATUS_ERROR) {
+ error (g, "%s", ctx.err.error_message);
+ free (ctx.err.error_message);
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ guestfs_end_busy (g);
+ return ctx.ret.partitions; /* caller will free */
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index 9a4e9232..b07e3dd5 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -140,3 +140,8 @@ extern char **guestfs_strings (guestfs_h *handle, const char *path);
extern char **guestfs_strings_e (guestfs_h *handle, const char *encoding, const char *path);
extern char *guestfs_hexdump (guestfs_h *handle, const char *path);
extern int guestfs_zerofree (guestfs_h *handle, const char *device);
+extern int guestfs_pvresize (guestfs_h *handle, const char *device);
+extern int guestfs_sfdisk_N (guestfs_h *handle, const char *device, int n, int cyls, int heads, int sectors, const char *line);
+extern char *guestfs_sfdisk_l (guestfs_h *handle, const char *device);
+extern char *guestfs_sfdisk_kernel_geometry (guestfs_h *handle, const char *device);
+extern char *guestfs_sfdisk_disk_geometry (guestfs_h *handle, const char *device);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index c505b251..e6e865e6 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1624,6 +1624,145 @@ xdr_guestfs_zerofree_args (XDR *xdrs, guestfs_zerofree_args *objp)
}
bool_t
+xdr_guestfs_pvresize_args (XDR *xdrs, guestfs_pvresize_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
+{
+ register int32_t *buf;
+
+
+ if (xdrs->x_op == XDR_ENCODE) {
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->n))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->cyls))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->heads))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->sectors))
+ return FALSE;
+
+ } else {
+ IXDR_PUT_LONG(buf, objp->n);
+ IXDR_PUT_LONG(buf, objp->cyls);
+ IXDR_PUT_LONG(buf, objp->heads);
+ IXDR_PUT_LONG(buf, objp->sectors);
+ }
+ if (!xdr_string (xdrs, &objp->line, ~0))
+ return FALSE;
+ return TRUE;
+ } else if (xdrs->x_op == XDR_DECODE) {
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->n))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->cyls))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->heads))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->sectors))
+ return FALSE;
+
+ } else {
+ objp->n = IXDR_GET_LONG(buf);
+ objp->cyls = IXDR_GET_LONG(buf);
+ objp->heads = IXDR_GET_LONG(buf);
+ objp->sectors = IXDR_GET_LONG(buf);
+ }
+ if (!xdr_string (xdrs, &objp->line, ~0))
+ return FALSE;
+ return TRUE;
+ }
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->n))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->cyls))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->heads))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->sectors))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->line, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_l_args (XDR *xdrs, guestfs_sfdisk_l_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_l_ret (XDR *xdrs, guestfs_sfdisk_l_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->partitions, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_kernel_geometry_args (XDR *xdrs, guestfs_sfdisk_kernel_geometry_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_kernel_geometry_ret (XDR *xdrs, guestfs_sfdisk_kernel_geometry_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->partitions, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_disk_geometry_args (XDR *xdrs, guestfs_sfdisk_disk_geometry_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->device, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_sfdisk_disk_geometry_ret (XDR *xdrs, guestfs_sfdisk_disk_geometry_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->partitions, ~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 a855307c..62355774 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -842,6 +842,51 @@ struct guestfs_zerofree_args {
};
typedef struct guestfs_zerofree_args guestfs_zerofree_args;
+struct guestfs_pvresize_args {
+ char *device;
+};
+typedef struct guestfs_pvresize_args guestfs_pvresize_args;
+
+struct guestfs_sfdisk_N_args {
+ char *device;
+ int n;
+ int cyls;
+ int heads;
+ int sectors;
+ char *line;
+};
+typedef struct guestfs_sfdisk_N_args guestfs_sfdisk_N_args;
+
+struct guestfs_sfdisk_l_args {
+ char *device;
+};
+typedef struct guestfs_sfdisk_l_args guestfs_sfdisk_l_args;
+
+struct guestfs_sfdisk_l_ret {
+ char *partitions;
+};
+typedef struct guestfs_sfdisk_l_ret guestfs_sfdisk_l_ret;
+
+struct guestfs_sfdisk_kernel_geometry_args {
+ char *device;
+};
+typedef struct guestfs_sfdisk_kernel_geometry_args guestfs_sfdisk_kernel_geometry_args;
+
+struct guestfs_sfdisk_kernel_geometry_ret {
+ char *partitions;
+};
+typedef struct guestfs_sfdisk_kernel_geometry_ret guestfs_sfdisk_kernel_geometry_ret;
+
+struct guestfs_sfdisk_disk_geometry_args {
+ char *device;
+};
+typedef struct guestfs_sfdisk_disk_geometry_args guestfs_sfdisk_disk_geometry_args;
+
+struct guestfs_sfdisk_disk_geometry_ret {
+ char *partitions;
+};
+typedef struct guestfs_sfdisk_disk_geometry_ret guestfs_sfdisk_disk_geometry_ret;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -940,7 +985,12 @@ enum guestfs_procedure {
GUESTFS_PROC_STRINGS_E = 95,
GUESTFS_PROC_HEXDUMP = 96,
GUESTFS_PROC_ZEROFREE = 97,
- GUESTFS_PROC_NR_PROCS = 97 + 1,
+ GUESTFS_PROC_PVRESIZE = 98,
+ GUESTFS_PROC_SFDISK_N = 99,
+ GUESTFS_PROC_SFDISK_L = 100,
+ GUESTFS_PROC_SFDISK_KERNEL_GEOMETRY = 101,
+ GUESTFS_PROC_SFDISK_DISK_GEOMETRY = 102,
+ GUESTFS_PROC_NR_PROCS = 102 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -1123,6 +1173,14 @@ extern bool_t xdr_guestfs_strings_e_ret (XDR *, guestfs_strings_e_ret*);
extern bool_t xdr_guestfs_hexdump_args (XDR *, guestfs_hexdump_args*);
extern bool_t xdr_guestfs_hexdump_ret (XDR *, guestfs_hexdump_ret*);
extern bool_t xdr_guestfs_zerofree_args (XDR *, guestfs_zerofree_args*);
+extern bool_t xdr_guestfs_pvresize_args (XDR *, guestfs_pvresize_args*);
+extern bool_t xdr_guestfs_sfdisk_N_args (XDR *, guestfs_sfdisk_N_args*);
+extern bool_t xdr_guestfs_sfdisk_l_args (XDR *, guestfs_sfdisk_l_args*);
+extern bool_t xdr_guestfs_sfdisk_l_ret (XDR *, guestfs_sfdisk_l_ret*);
+extern bool_t xdr_guestfs_sfdisk_kernel_geometry_args (XDR *, guestfs_sfdisk_kernel_geometry_args*);
+extern bool_t xdr_guestfs_sfdisk_kernel_geometry_ret (XDR *, guestfs_sfdisk_kernel_geometry_ret*);
+extern bool_t xdr_guestfs_sfdisk_disk_geometry_args (XDR *, guestfs_sfdisk_disk_geometry_args*);
+extern bool_t xdr_guestfs_sfdisk_disk_geometry_ret (XDR *, guestfs_sfdisk_disk_geometry_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*);
@@ -1264,6 +1322,14 @@ extern bool_t xdr_guestfs_strings_e_ret ();
extern bool_t xdr_guestfs_hexdump_args ();
extern bool_t xdr_guestfs_hexdump_ret ();
extern bool_t xdr_guestfs_zerofree_args ();
+extern bool_t xdr_guestfs_pvresize_args ();
+extern bool_t xdr_guestfs_sfdisk_N_args ();
+extern bool_t xdr_guestfs_sfdisk_l_args ();
+extern bool_t xdr_guestfs_sfdisk_l_ret ();
+extern bool_t xdr_guestfs_sfdisk_kernel_geometry_args ();
+extern bool_t xdr_guestfs_sfdisk_kernel_geometry_ret ();
+extern bool_t xdr_guestfs_sfdisk_disk_geometry_args ();
+extern bool_t xdr_guestfs_sfdisk_disk_geometry_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 f09e5b5b..0df5cb07 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -652,6 +652,43 @@ struct guestfs_zerofree_args {
string device<>;
};
+struct guestfs_pvresize_args {
+ string device<>;
+};
+
+struct guestfs_sfdisk_N_args {
+ string device<>;
+ int n;
+ int cyls;
+ int heads;
+ int sectors;
+ string line<>;
+};
+
+struct guestfs_sfdisk_l_args {
+ string device<>;
+};
+
+struct guestfs_sfdisk_l_ret {
+ string partitions<>;
+};
+
+struct guestfs_sfdisk_kernel_geometry_args {
+ string device<>;
+};
+
+struct guestfs_sfdisk_kernel_geometry_ret {
+ string partitions<>;
+};
+
+struct guestfs_sfdisk_disk_geometry_args {
+ string device<>;
+};
+
+struct guestfs_sfdisk_disk_geometry_ret {
+ string partitions<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -750,6 +787,11 @@ enum guestfs_procedure {
GUESTFS_PROC_STRINGS_E = 95,
GUESTFS_PROC_HEXDUMP = 96,
GUESTFS_PROC_ZEROFREE = 97,
+ GUESTFS_PROC_PVRESIZE = 98,
+ GUESTFS_PROC_SFDISK_N = 99,
+ GUESTFS_PROC_SFDISK_L = 100,
+ GUESTFS_PROC_SFDISK_KERNEL_GEOMETRY = 101,
+ GUESTFS_PROC_SFDISK_DISK_GEOMETRY = 102,
GUESTFS_PROC_NR_PROCS
};