From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 16/24] libxl: change some structures to unit arrays
Date: Mon, 16 Apr 2012 18:17:58 +0100 [thread overview]
Message-ID: <1334596686-8479-17-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1334596686-8479-1-git-send-email-ian.jackson@eu.citrix.com>
In the next patch these variables will turn into actual pointers.
To clarify that patch, prepare the ground by changing these variables
from "struct foo var" to "struct foo var[1]". This enables accesses
to them and their members to be made as if they were pointers.
No functional change.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxl/libxl_create.c | 18 +++++-----
tools/libxl/libxl_dm.c | 84 ++++++++++++++++++++++----------------------
2 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index dbc3cf0..8408c26 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -543,7 +543,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
{
libxl_ctx *ctx = libxl__gc_owner(gc);
libxl__spawner_starting *dm_starting = 0;
- libxl__domain_build_state state;
+ libxl__domain_build_state state[1];
uint32_t domid;
int i, ret;
@@ -585,12 +585,12 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
}
}
- memset(&state, 0, sizeof(state));
+ memset(state, 0, sizeof(*state));
if ( restore_fd >= 0 ) {
- ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, &state);
+ ret = domain_restore(gc, &d_config->b_info, domid, restore_fd, state);
} else {
- ret = libxl__domain_build(gc, &d_config->b_info, domid, &state);
+ ret = libxl__domain_build(gc, &d_config->b_info, domid, state);
}
if (ret) {
@@ -628,7 +628,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
ret = init_console_info(&console, 0);
if ( ret )
goto error_out;
- libxl__device_console_add(gc, domid, &console, &state);
+ libxl__device_console_add(gc, domid, &console, state);
libxl__device_console_dispose(&console);
libxl_device_vkb_init(&vkb);
@@ -636,7 +636,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
libxl_device_vkb_dispose(&vkb);
ret = libxl__create_device_model(gc, domid, d_config,
- &state, &dm_starting);
+ state, &dm_starting);
if (ret < 0) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"failed to create device model: %d", ret);
@@ -665,11 +665,11 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
if (need_qemu)
console.consback = LIBXL__CONSOLE_BACKEND_IOEMU;
- libxl__device_console_add(gc, domid, &console, &state);
+ libxl__device_console_add(gc, domid, &console, state);
libxl__device_console_dispose(&console);
if (need_qemu) {
- libxl__create_xenpv_qemu(gc, domid, d_config, &state, &dm_starting);
+ libxl__create_xenpv_qemu(gc, domid, d_config, state, &dm_starting);
}
break;
}
@@ -683,7 +683,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
== LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
libxl__qmp_initializations(gc, domid, d_config);
}
- ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
+ ret = libxl__confirm_device_model_startup(gc, state, dm_starting);
if (ret < 0) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
"device model did not start: %d", ret);
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 7bf653a..3921e2a 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -676,10 +676,10 @@ static int libxl__create_stubdom(libxl__gc *gc,
libxl_ctx *ctx = libxl__gc_owner(gc);
int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
libxl__device_console *console;
- libxl_domain_config dm_config;
+ libxl_domain_config dm_config[1];
libxl_device_vfb vfb;
libxl_device_vkb vkb;
- libxl__domain_build_state stubdom_state;
+ libxl__domain_build_state stubdom_state[1];
uint32_t dm_domid;
char **args;
struct xs_permissions perm[2];
@@ -692,58 +692,58 @@ static int libxl__create_stubdom(libxl__gc *gc,
goto out;
}
- libxl_domain_create_info_init(&dm_config.c_info);
- dm_config.c_info.type = LIBXL_DOMAIN_TYPE_PV;
- dm_config.c_info.name = libxl__sprintf(gc, "%s-dm",
+ libxl_domain_create_info_init(&dm_config->c_info);
+ dm_config->c_info.type = LIBXL_DOMAIN_TYPE_PV;
+ dm_config->c_info.name = libxl__sprintf(gc, "%s-dm",
libxl__domid_to_name(gc, guest_domid));
- dm_config.c_info.ssidref = guest_config->b_info.device_model_ssidref;
+ dm_config->c_info.ssidref = guest_config->b_info.device_model_ssidref;
- libxl_uuid_generate(&dm_config.c_info.uuid);
+ libxl_uuid_generate(&dm_config->c_info.uuid);
- libxl_domain_build_info_init(&dm_config.b_info);
- libxl_domain_build_info_init_type(&dm_config.b_info, LIBXL_DOMAIN_TYPE_PV);
+ libxl_domain_build_info_init(&dm_config->b_info);
+ libxl_domain_build_info_init_type(&dm_config->b_info, LIBXL_DOMAIN_TYPE_PV);
- dm_config.b_info.max_vcpus = 1;
- dm_config.b_info.max_memkb = 32 * 1024;
- dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
+ dm_config->b_info.max_vcpus = 1;
+ dm_config->b_info.max_memkb = 32 * 1024;
+ dm_config->b_info.target_memkb = dm_config->b_info.max_memkb;
- dm_config.b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
+ dm_config->b_info.u.pv.kernel.path = libxl__abs_path(gc, "ioemu-stubdom.gz",
libxl_xenfirmwaredir_path());
- dm_config.b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
- dm_config.b_info.u.pv.ramdisk.path = "";
- dm_config.b_info.u.pv.features = "";
+ dm_config->b_info.u.pv.cmdline = libxl__sprintf(gc, " -d %d", guest_domid);
+ dm_config->b_info.u.pv.ramdisk.path = "";
+ dm_config->b_info.u.pv.features = "";
- dm_config.b_info.device_model_version =
+ dm_config->b_info.device_model_version =
guest_config->b_info.device_model_version;
- dm_config.b_info.device_model =
+ dm_config->b_info.device_model =
guest_config->b_info.device_model;
- dm_config.b_info.extra = guest_config->b_info.extra;
- dm_config.b_info.extra_pv = guest_config->b_info.extra_pv;
- dm_config.b_info.extra_hvm = guest_config->b_info.extra_hvm;
+ dm_config->b_info.extra = guest_config->b_info.extra;
+ dm_config->b_info.extra_pv = guest_config->b_info.extra_pv;
+ dm_config->b_info.extra_hvm = guest_config->b_info.extra_hvm;
- dm_config.disks = guest_config->disks;
- dm_config.num_disks = guest_config->num_disks;
+ dm_config->disks = guest_config->disks;
+ dm_config->num_disks = guest_config->num_disks;
- dm_config.vifs = guest_config->vifs;
- dm_config.num_vifs = guest_config->num_vifs;
+ dm_config->vifs = guest_config->vifs;
+ dm_config->num_vifs = guest_config->num_vifs;
- ret = libxl__domain_create_info_setdefault(gc, &dm_config.c_info);
+ ret = libxl__domain_create_info_setdefault(gc, &dm_config->c_info);
if (ret) goto out;
- ret = libxl__domain_build_info_setdefault(gc, &dm_config.b_info);
+ ret = libxl__domain_build_info_setdefault(gc, &dm_config->b_info);
if (ret) goto out;
libxl__vfb_and_vkb_from_hvm_guest_config(gc, guest_config, &vfb, &vkb);
- dm_config.vfbs = &vfb;
- dm_config.num_vfbs = 1;
- dm_config.vkbs = &vkb;
- dm_config.num_vkbs = 1;
+ dm_config->vfbs = &vfb;
+ dm_config->num_vfbs = 1;
+ dm_config->vkbs = &vkb;
+ dm_config->num_vkbs = 1;
/* fixme: this function can leak the stubdom if it fails */
dm_domid = 0;
- ret = libxl__domain_make(gc, &dm_config.c_info, &dm_domid);
+ ret = libxl__domain_make(gc, &dm_config->c_info, &dm_domid);
if (ret)
goto out;
- ret = libxl__domain_build(gc, &dm_config.b_info, dm_domid, &stubdom_state);
+ ret = libxl__domain_build(gc, &dm_config->b_info, dm_domid, stubdom_state);
if (ret)
goto out;
@@ -788,20 +788,20 @@ retry_transaction:
if (errno == EAGAIN)
goto retry_transaction;
- for (i = 0; i < dm_config.num_disks; i++) {
- ret = libxl_device_disk_add(ctx, dm_domid, &dm_config.disks[i]);
+ for (i = 0; i < dm_config->num_disks; i++) {
+ ret = libxl_device_disk_add(ctx, dm_domid, &dm_config->disks[i]);
if (ret)
goto out_free;
}
- for (i = 0; i < dm_config.num_vifs; i++) {
- ret = libxl_device_nic_add(ctx, dm_domid, &dm_config.vifs[i]);
+ for (i = 0; i < dm_config->num_vifs; i++) {
+ ret = libxl_device_nic_add(ctx, dm_domid, &dm_config->vifs[i]);
if (ret)
goto out_free;
}
- ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config.vfbs[0]);
+ ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config->vfbs[0]);
if (ret)
goto out_free;
- ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config.vkbs[0]);
+ ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config->vkbs[0]);
if (ret)
goto out_free;
@@ -845,14 +845,14 @@ retry_transaction:
break;
}
ret = libxl__device_console_add(gc, dm_domid, &console[i],
- i == STUBDOM_CONSOLE_LOGGING ? &stubdom_state : NULL);
+ i == STUBDOM_CONSOLE_LOGGING ? stubdom_state : NULL);
if (ret)
goto out_free;
}
if (libxl__create_xenpv_qemu(gc, dm_domid,
- &dm_config,
- &stubdom_state,
+ dm_config,
+ stubdom_state,
&dm_starting) < 0) {
ret = ERROR_FAIL;
goto out_free;
--
1.7.2.5
next prev parent reply other threads:[~2012-04-16 17:17 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 17:17 [PATCH v7 00/24] libxl: subprocess handling Ian Jackson
2012-04-16 17:17 ` [PATCH 01/24] libxl: handle POLLERR, POLLHUP, POLLNVAL properly Ian Jackson
2012-04-16 17:17 ` [PATCH 02/24] libxl: support multiple libxl__ev_fds for the same fd Ian Jackson
2012-04-16 17:17 ` [PATCH 03/24] libxl: event API: new facilities for waiting for subprocesses Ian Jackson
2012-04-16 17:17 ` [PATCH 04/24] autoconf: trim the configure script; use autoheader Ian Jackson
2012-04-17 9:18 ` Ian Campbell
2012-04-17 13:18 ` Ian Jackson
2012-04-17 13:22 ` Ian Campbell
2012-04-17 14:07 ` Roger Pau Monne
2012-04-16 17:17 ` [PATCH 05/24] autoconf: New test for openpty et al Ian Jackson
2012-04-17 9:20 ` Ian Campbell
2012-04-16 17:17 ` [PATCH 06/24] libxl: provide libxl__remove_file " Ian Jackson
2012-04-16 17:17 ` [PATCH 07/24] libxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds Ian Jackson
2012-04-16 17:17 ` [PATCH 08/24] libxl: Clean up setdefault in do_domain_create Ian Jackson
2012-04-16 17:17 ` [PATCH 09/24] libxl: provide libxl__datacopier_* Ian Jackson
2012-04-17 9:37 ` Ian Campbell
2012-04-16 17:17 ` [PATCH 10/24] libxl: provide libxl__openpty_* Ian Jackson
2012-04-16 17:17 ` [PATCH 11/24] libxl: ao: Convert libxl_run_bootloader Ian Jackson
2012-04-16 17:17 ` [PATCH 12/24] libxl: make libxl_create_logfile const-correct Ian Jackson
2012-04-16 17:17 ` [PATCH 13/24] libxl: log bootloader output Ian Jackson
2012-04-16 17:17 ` [PATCH 14/24] libxl: Allow AO_GC and EGC_GC even if not used Ian Jackson
2012-04-16 17:17 ` [PATCH 15/24] libxl: remove ctx->waitpid_instead Ian Jackson
2012-04-17 9:40 ` Ian Campbell
2012-04-17 13:24 ` Ian Jackson
2012-04-16 17:17 ` Ian Jackson [this message]
2012-04-17 9:41 ` [PATCH 16/24] libxl: change some structures to unit arrays Ian Campbell
2012-04-16 17:17 ` [PATCH 17/24] libxl: ao: convert libxl__spawn_* Ian Jackson
2012-04-17 15:17 ` Ian Campbell
2012-04-17 17:03 ` Ian Jackson
2012-04-18 10:12 ` Ian Campbell
2012-04-18 10:52 ` Ian Jackson
2012-04-18 11:07 ` Ian Campbell
2012-04-16 17:18 ` [PATCH 18/24] libxl: make libxl_create run bootloader via callback Ian Jackson
2012-04-24 13:46 ` Ian Campbell
2012-04-24 13:54 ` Ian Jackson
2012-04-16 17:18 ` [PATCH 19/24] libxl: provide progress reporting for long-running operations Ian Jackson
2012-04-24 13:59 ` Ian Campbell
2012-04-25 13:38 ` Ian Jackson
2012-04-16 17:18 ` [PATCH 20/24] libxl: remove malloc failure handling from NEW_EVENT Ian Jackson
2012-04-24 14:01 ` Ian Campbell
2012-04-16 17:18 ` [PATCH 21/24] libxl: convert console callback to libxl_asyncprogress_how Ian Jackson
2012-04-24 14:05 ` Ian Campbell
2012-04-16 17:18 ` [PATCH 22/24] libxl: clarify definition of "slow" operation Ian Jackson
2012-04-24 14:06 ` Ian Campbell
2012-04-16 17:18 ` [PATCH 23/24] libxl: child processes cleanups Ian Jackson
2012-04-24 14:12 ` Ian Campbell
2012-04-24 14:27 ` Ian Jackson
2012-04-24 15:05 ` Ian Campbell
2012-04-24 15:07 ` Ian Campbell
2012-04-24 15:22 ` Ian Jackson
2012-04-24 15:32 ` Ian Campbell
2012-04-16 17:18 ` [PATCH 24/24] libxl: aborting bootloader invocation when domain dioes Ian Jackson
2012-04-24 14:18 ` Ian Campbell
2012-04-24 14:38 ` Ian Jackson
2012-04-24 15:08 ` Ian Campbell
2012-04-24 15:26 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334596686-8479-17-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).