summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 11:47:07 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 11:47:07 +0100
commit826020fe18bf2eee43f8afea392874bb88c0650a (patch)
tree7c6c40758611605be29b3528da647a78a071ea1b /src
parent3854bbdecd1c089959fb812a739b84a96c05fbbf (diff)
downloadlibguestfs-826020fe18bf2eee43f8afea392874bb88c0650a.tar.gz
libguestfs-826020fe18bf2eee43f8afea392874bb88c0650a.tar.xz
libguestfs-826020fe18bf2eee43f8afea392874bb88c0650a.zip
Generated code for head/tail commands.
Diffstat (limited to 'src')
-rw-r--r--src/MAX_PROC_NR2
-rw-r--r--src/guestfs-actions.c396
-rw-r--r--src/guestfs-actions.h6
-rw-r--r--src/guestfs_protocol.c98
-rw-r--r--src/guestfs_protocol.h78
-rw-r--r--src/guestfs_protocol.x40
6 files changed, 608 insertions, 12 deletions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 52bd8e43..fc902f4f 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-120
+124
diff --git a/src/guestfs-actions.c b/src/guestfs-actions.c
index ce4cfe1e..4a38b453 100644
--- a/src/guestfs-actions.c
+++ b/src/guestfs-actions.c
@@ -9024,7 +9024,7 @@ static void sfdisk_N_reply_cb (guestfs_h *g, void *data, XDR *xdr)
int guestfs_sfdisk_N (guestfs_h *g,
const char *device,
- int n,
+ int partnum,
int cyls,
int heads,
int sectors,
@@ -9041,7 +9041,7 @@ int guestfs_sfdisk_N (guestfs_h *g,
memset (&ctx, 0, sizeof ctx);
args.device = (char *) device;
- args.n = n;
+ args.partnum = partnum;
args.cyls = cyls;
args.heads = heads;
args.sectors = sectors;
@@ -10989,3 +10989,395 @@ int guestfs_wc_c (guestfs_h *g,
return ctx.ret.chars;
}
+struct head_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_head_ret ret;
+};
+
+static void head_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct head_ctx *ctx = (struct head_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_head");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_head");
+ 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_head");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_head_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_head");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char **guestfs_head (guestfs_h *g,
+ const char *path)
+{
+ struct guestfs_head_args args;
+ struct head_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_head") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.path = (char *) path;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_HEAD,
+ (xdrproc_t) xdr_guestfs_head_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, head_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_head");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_HEAD, 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);
+ /* caller will free this, but we need to add a NULL entry */
+ ctx.ret.lines.lines_val =
+ safe_realloc (g, ctx.ret.lines.lines_val,
+ sizeof (char *) * (ctx.ret.lines.lines_len + 1));
+ ctx.ret.lines.lines_val[ctx.ret.lines.lines_len] = NULL;
+ return ctx.ret.lines.lines_val;
+}
+
+struct head_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;
+ struct guestfs_head_n_ret ret;
+};
+
+static void head_n_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct head_n_ctx *ctx = (struct head_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_head_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_head_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_head_n");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_head_n_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_head_n");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char **guestfs_head_n (guestfs_h *g,
+ int nrlines,
+ const char *path)
+{
+ struct guestfs_head_n_args args;
+ struct head_n_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_head_n") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.nrlines = nrlines;
+ args.path = (char *) path;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_HEAD_N,
+ (xdrproc_t) xdr_guestfs_head_n_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, head_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_head_n");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_HEAD_N, 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);
+ /* caller will free this, but we need to add a NULL entry */
+ ctx.ret.lines.lines_val =
+ safe_realloc (g, ctx.ret.lines.lines_val,
+ sizeof (char *) * (ctx.ret.lines.lines_len + 1));
+ ctx.ret.lines.lines_val[ctx.ret.lines.lines_len] = NULL;
+ return ctx.ret.lines.lines_val;
+}
+
+struct tail_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_tail_ret ret;
+};
+
+static void tail_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct tail_ctx *ctx = (struct tail_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_tail");
+ return;
+ }
+
+ ml->main_loop_quit (ml, g);
+
+ if (!xdr_guestfs_message_header (xdr, &ctx->hdr)) {
+ error (g, "%s: failed to parse reply header", "guestfs_tail");
+ 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_tail");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_tail_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_tail");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char **guestfs_tail (guestfs_h *g,
+ const char *path)
+{
+ struct guestfs_tail_args args;
+ struct tail_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_tail") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.path = (char *) path;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_TAIL,
+ (xdrproc_t) xdr_guestfs_tail_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, tail_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_tail");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_TAIL, 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);
+ /* caller will free this, but we need to add a NULL entry */
+ ctx.ret.lines.lines_val =
+ safe_realloc (g, ctx.ret.lines.lines_val,
+ sizeof (char *) * (ctx.ret.lines.lines_len + 1));
+ ctx.ret.lines.lines_val[ctx.ret.lines.lines_len] = NULL;
+ return ctx.ret.lines.lines_val;
+}
+
+struct tail_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;
+ struct guestfs_tail_n_ret ret;
+};
+
+static void tail_n_reply_cb (guestfs_h *g, void *data, XDR *xdr)
+{
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ struct tail_n_ctx *ctx = (struct tail_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_tail_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_tail_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_tail_n");
+ return;
+ }
+ goto done;
+ }
+ if (!xdr_guestfs_tail_n_ret (xdr, &ctx->ret)) {
+ error (g, "%s: failed to parse reply", "guestfs_tail_n");
+ return;
+ }
+ done:
+ ctx->cb_sequence = 1;
+}
+
+char **guestfs_tail_n (guestfs_h *g,
+ int nrlines,
+ const char *path)
+{
+ struct guestfs_tail_n_args args;
+ struct tail_n_ctx ctx;
+ guestfs_main_loop *ml = guestfs_get_main_loop (g);
+ int serial;
+
+ if (check_state (g, "guestfs_tail_n") == -1) return NULL;
+ guestfs_set_busy (g);
+
+ memset (&ctx, 0, sizeof ctx);
+
+ args.nrlines = nrlines;
+ args.path = (char *) path;
+ serial = guestfs__send_sync (g, GUESTFS_PROC_TAIL_N,
+ (xdrproc_t) xdr_guestfs_tail_n_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, tail_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_tail_n");
+ guestfs_end_busy (g);
+ return NULL;
+ }
+
+ if (check_reply_header (g, &ctx.hdr, GUESTFS_PROC_TAIL_N, 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);
+ /* caller will free this, but we need to add a NULL entry */
+ ctx.ret.lines.lines_val =
+ safe_realloc (g, ctx.ret.lines.lines_val,
+ sizeof (char *) * (ctx.ret.lines.lines_len + 1));
+ ctx.ret.lines.lines_val[ctx.ret.lines.lines_len] = NULL;
+ return ctx.ret.lines.lines_val;
+}
+
diff --git a/src/guestfs-actions.h b/src/guestfs-actions.h
index cbdf0fbf..42951cbc 100644
--- a/src/guestfs-actions.h
+++ b/src/guestfs-actions.h
@@ -169,7 +169,7 @@ extern char **guestfs_strings_e (guestfs_h *handle, const char *encoding, const
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 int guestfs_sfdisk_N (guestfs_h *handle, const char *device, int partnum, 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);
@@ -191,3 +191,7 @@ extern char *guestfs_mkdtemp (guestfs_h *handle, const char *template);
extern int guestfs_wc_l (guestfs_h *handle, const char *path);
extern int guestfs_wc_w (guestfs_h *handle, const char *path);
extern int guestfs_wc_c (guestfs_h *handle, const char *path);
+extern char **guestfs_head (guestfs_h *handle, const char *path);
+extern char **guestfs_head_n (guestfs_h *handle, int nrlines, const char *path);
+extern char **guestfs_tail (guestfs_h *handle, const char *path);
+extern char **guestfs_tail_n (guestfs_h *handle, int nrlines, const char *path);
diff --git a/src/guestfs_protocol.c b/src/guestfs_protocol.c
index bdcc2042..3f08084d 100644
--- a/src/guestfs_protocol.c
+++ b/src/guestfs_protocol.c
@@ -1644,7 +1644,7 @@ xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
return FALSE;
buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_int (xdrs, &objp->n))
+ if (!xdr_int (xdrs, &objp->partnum))
return FALSE;
if (!xdr_int (xdrs, &objp->cyls))
return FALSE;
@@ -1654,7 +1654,7 @@ xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
return FALSE;
} else {
- IXDR_PUT_LONG(buf, objp->n);
+ IXDR_PUT_LONG(buf, objp->partnum);
IXDR_PUT_LONG(buf, objp->cyls);
IXDR_PUT_LONG(buf, objp->heads);
IXDR_PUT_LONG(buf, objp->sectors);
@@ -1667,7 +1667,7 @@ xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
return FALSE;
buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_int (xdrs, &objp->n))
+ if (!xdr_int (xdrs, &objp->partnum))
return FALSE;
if (!xdr_int (xdrs, &objp->cyls))
return FALSE;
@@ -1677,7 +1677,7 @@ xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
return FALSE;
} else {
- objp->n = IXDR_GET_LONG(buf);
+ objp->partnum = IXDR_GET_LONG(buf);
objp->cyls = IXDR_GET_LONG(buf);
objp->heads = IXDR_GET_LONG(buf);
objp->sectors = IXDR_GET_LONG(buf);
@@ -1689,7 +1689,7 @@ xdr_guestfs_sfdisk_N_args (XDR *xdrs, guestfs_sfdisk_N_args *objp)
if (!xdr_string (xdrs, &objp->device, ~0))
return FALSE;
- if (!xdr_int (xdrs, &objp->n))
+ if (!xdr_int (xdrs, &objp->partnum))
return FALSE;
if (!xdr_int (xdrs, &objp->cyls))
return FALSE;
@@ -2043,6 +2043,94 @@ xdr_guestfs_wc_c_ret (XDR *xdrs, guestfs_wc_c_ret *objp)
}
bool_t
+xdr_guestfs_head_args (XDR *xdrs, guestfs_head_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_head_ret (XDR *xdrs, guestfs_head_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->lines.lines_val, (u_int *) &objp->lines.lines_len, ~0,
+ sizeof (str), (xdrproc_t) xdr_str))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_head_n_args (XDR *xdrs, guestfs_head_n_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_int (xdrs, &objp->nrlines))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_head_n_ret (XDR *xdrs, guestfs_head_n_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->lines.lines_val, (u_int *) &objp->lines.lines_len, ~0,
+ sizeof (str), (xdrproc_t) xdr_str))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_tail_args (XDR *xdrs, guestfs_tail_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_tail_ret (XDR *xdrs, guestfs_tail_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->lines.lines_val, (u_int *) &objp->lines.lines_len, ~0,
+ sizeof (str), (xdrproc_t) xdr_str))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_tail_n_args (XDR *xdrs, guestfs_tail_n_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_int (xdrs, &objp->nrlines))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->path, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_guestfs_tail_n_ret (XDR *xdrs, guestfs_tail_n_ret *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->lines.lines_val, (u_int *) &objp->lines.lines_len, ~0,
+ sizeof (str), (xdrproc_t) xdr_str))
+ 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 0c31e79e..7fe3a32a 100644
--- a/src/guestfs_protocol.h
+++ b/src/guestfs_protocol.h
@@ -849,7 +849,7 @@ typedef struct guestfs_pvresize_args guestfs_pvresize_args;
struct guestfs_sfdisk_N_args {
char *device;
- int n;
+ int partnum;
int cyls;
int heads;
int sectors;
@@ -1037,6 +1037,60 @@ struct guestfs_wc_c_ret {
};
typedef struct guestfs_wc_c_ret guestfs_wc_c_ret;
+struct guestfs_head_args {
+ char *path;
+};
+typedef struct guestfs_head_args guestfs_head_args;
+
+struct guestfs_head_ret {
+ struct {
+ u_int lines_len;
+ str *lines_val;
+ } lines;
+};
+typedef struct guestfs_head_ret guestfs_head_ret;
+
+struct guestfs_head_n_args {
+ int nrlines;
+ char *path;
+};
+typedef struct guestfs_head_n_args guestfs_head_n_args;
+
+struct guestfs_head_n_ret {
+ struct {
+ u_int lines_len;
+ str *lines_val;
+ } lines;
+};
+typedef struct guestfs_head_n_ret guestfs_head_n_ret;
+
+struct guestfs_tail_args {
+ char *path;
+};
+typedef struct guestfs_tail_args guestfs_tail_args;
+
+struct guestfs_tail_ret {
+ struct {
+ u_int lines_len;
+ str *lines_val;
+ } lines;
+};
+typedef struct guestfs_tail_ret guestfs_tail_ret;
+
+struct guestfs_tail_n_args {
+ int nrlines;
+ char *path;
+};
+typedef struct guestfs_tail_n_args guestfs_tail_n_args;
+
+struct guestfs_tail_n_ret {
+ struct {
+ u_int lines_len;
+ str *lines_val;
+ } lines;
+};
+typedef struct guestfs_tail_n_ret guestfs_tail_n_ret;
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -1158,7 +1212,11 @@ enum guestfs_procedure {
GUESTFS_PROC_WC_L = 118,
GUESTFS_PROC_WC_W = 119,
GUESTFS_PROC_WC_C = 120,
- GUESTFS_PROC_NR_PROCS = 120 + 1,
+ GUESTFS_PROC_HEAD = 121,
+ GUESTFS_PROC_HEAD_N = 122,
+ GUESTFS_PROC_TAIL = 123,
+ GUESTFS_PROC_TAIL_N = 124,
+ GUESTFS_PROC_NR_PROCS = 124 + 1,
};
typedef enum guestfs_procedure guestfs_procedure;
#define GUESTFS_MESSAGE_MAX 4194304
@@ -1376,6 +1434,14 @@ extern bool_t xdr_guestfs_wc_w_args (XDR *, guestfs_wc_w_args*);
extern bool_t xdr_guestfs_wc_w_ret (XDR *, guestfs_wc_w_ret*);
extern bool_t xdr_guestfs_wc_c_args (XDR *, guestfs_wc_c_args*);
extern bool_t xdr_guestfs_wc_c_ret (XDR *, guestfs_wc_c_ret*);
+extern bool_t xdr_guestfs_head_args (XDR *, guestfs_head_args*);
+extern bool_t xdr_guestfs_head_ret (XDR *, guestfs_head_ret*);
+extern bool_t xdr_guestfs_head_n_args (XDR *, guestfs_head_n_args*);
+extern bool_t xdr_guestfs_head_n_ret (XDR *, guestfs_head_n_ret*);
+extern bool_t xdr_guestfs_tail_args (XDR *, guestfs_tail_args*);
+extern bool_t xdr_guestfs_tail_ret (XDR *, guestfs_tail_ret*);
+extern bool_t xdr_guestfs_tail_n_args (XDR *, guestfs_tail_n_args*);
+extern bool_t xdr_guestfs_tail_n_ret (XDR *, guestfs_tail_n_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*);
@@ -1552,6 +1618,14 @@ extern bool_t xdr_guestfs_wc_w_args ();
extern bool_t xdr_guestfs_wc_w_ret ();
extern bool_t xdr_guestfs_wc_c_args ();
extern bool_t xdr_guestfs_wc_c_ret ();
+extern bool_t xdr_guestfs_head_args ();
+extern bool_t xdr_guestfs_head_ret ();
+extern bool_t xdr_guestfs_head_n_args ();
+extern bool_t xdr_guestfs_head_n_ret ();
+extern bool_t xdr_guestfs_tail_args ();
+extern bool_t xdr_guestfs_tail_ret ();
+extern bool_t xdr_guestfs_tail_n_args ();
+extern bool_t xdr_guestfs_tail_n_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 e0f106c0..fd8953f1 100644
--- a/src/guestfs_protocol.x
+++ b/src/guestfs_protocol.x
@@ -658,7 +658,7 @@ struct guestfs_pvresize_args {
struct guestfs_sfdisk_N_args {
string device<>;
- int n;
+ int partnum;
int cyls;
int heads;
int sectors;
@@ -800,6 +800,40 @@ struct guestfs_wc_c_ret {
int chars;
};
+struct guestfs_head_args {
+ string path<>;
+};
+
+struct guestfs_head_ret {
+ str lines<>;
+};
+
+struct guestfs_head_n_args {
+ int nrlines;
+ string path<>;
+};
+
+struct guestfs_head_n_ret {
+ str lines<>;
+};
+
+struct guestfs_tail_args {
+ string path<>;
+};
+
+struct guestfs_tail_ret {
+ str lines<>;
+};
+
+struct guestfs_tail_n_args {
+ int nrlines;
+ string path<>;
+};
+
+struct guestfs_tail_n_ret {
+ str lines<>;
+};
+
enum guestfs_procedure {
GUESTFS_PROC_MOUNT = 1,
GUESTFS_PROC_SYNC = 2,
@@ -921,6 +955,10 @@ enum guestfs_procedure {
GUESTFS_PROC_WC_L = 118,
GUESTFS_PROC_WC_W = 119,
GUESTFS_PROC_WC_C = 120,
+ GUESTFS_PROC_HEAD = 121,
+ GUESTFS_PROC_HEAD_N = 122,
+ GUESTFS_PROC_TAIL = 123,
+ GUESTFS_PROC_TAIL_N = 124,
GUESTFS_PROC_NR_PROCS
};