* [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao
@ 2012-04-16 16:00 Roger Pau Monne
2012-05-09 8:46 ` Roger Pau Monne
0 siblings, 1 reply; 2+ messages in thread
From: Roger Pau Monne @ 2012-04-16 16:00 UTC (permalink / raw)
To: xen-devel; +Cc: Roger Pau Monne
Add a dummy ao parameter to both functions, since they may become slow in the
future.
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
Requires Ian Jackson's "libxl: Allow AO_GC and EGC_GC even if not used"
tools/libxl/libxl.c | 20 ++++++++++++--------
tools/libxl/libxl.h | 6 ++++--
tools/libxl/libxl_create.c | 6 +++---
tools/libxl/libxl_dm.c | 4 ++--
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 44a54cb..3fd8d5b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -2208,9 +2208,10 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
return 0;
}
-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+ const libxl_asyncop_how *ao_how)
{
- GC_INIT(ctx);
+ AO_CREATE(ctx, domid, ao_how);
flexarray_t *front;
flexarray_t *back;
libxl__device device;
@@ -2255,8 +2256,9 @@ out_free:
flexarray_free(back);
flexarray_free(front);
out:
- GC_FREE;
- return rc;
+ /* Dummy ao */
+ libxl__ao_complete(egc, ao, rc);
+ return AO_INPROGRESS;
}
int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
@@ -2339,9 +2341,10 @@ static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
return 0;
}
-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+ const libxl_asyncop_how *ao_how)
{
- GC_INIT(ctx);
+ AO_CREATE(ctx, domid, ao_how);
flexarray_t *front;
flexarray_t *back;
libxl__device device;
@@ -2399,8 +2402,9 @@ out_free:
flexarray_free(front);
flexarray_free(back);
out:
- GC_FREE;
- return rc;
+ /* Dummy ao */
+ libxl__ao_complete(egc, ao, rc);
+ return AO_INPROGRESS;
}
int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 6da6107..ce89b31 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -563,14 +563,16 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
libxl_device_nic *nic, libxl_nicinfo *nicinfo);
/* Keyboard */
-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+ const libxl_asyncop_how *ao_how);
int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
libxl_device_vkb *vkb,
const libxl_asyncop_how *ao_how);
int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
/* Framebuffer */
-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+ const libxl_asyncop_how *ao_how);
int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
libxl_device_vfb *vfb,
const libxl_asyncop_how *ao_how);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index a1f5731..39e9257 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -628,7 +628,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
libxl__device_console_dispose(&console);
libxl_device_vkb_init(&vkb);
- libxl_device_vkb_add(ctx, domid, &vkb);
+ libxl_device_vkb_add(ctx, domid, &vkb, 0);
libxl_device_vkb_dispose(&vkb);
ret = libxl__create_device_model(gc, domid, d_config,
@@ -646,8 +646,8 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
libxl__device_console console;
for (i = 0; i < d_config->num_vfbs; i++) {
- libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
- libxl_device_vkb_add(ctx, domid, &d_config->vkbs[i]);
+ libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i], 0);
+ libxl_device_vkb_add(ctx, domid, &d_config->vkbs[i], 0);
}
ret = init_console_info(&console, 0);
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 8dc588d..4a2b5c1 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -804,10 +804,10 @@ retry_transaction:
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], 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], 0);
if (ret)
goto out_free;
--
1.7.7.5 (Apple Git-26)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao
2012-04-16 16:00 [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao Roger Pau Monne
@ 2012-05-09 8:46 ` Roger Pau Monne
0 siblings, 0 replies; 2+ messages in thread
From: Roger Pau Monne @ 2012-05-09 8:46 UTC (permalink / raw)
To: xen-devel@lists.xen.org
Roger Pau Monne escribió:
> Add a dummy ao parameter to both functions, since they may become slow in the
> future.
>
> Signed-off-by: Roger Pau Monne<roger.pau@citrix.com>
This is completely wrong, please don't even review it.
> ---
>
> Requires Ian Jackson's "libxl: Allow AO_GC and EGC_GC even if not used"
>
> tools/libxl/libxl.c | 20 ++++++++++++--------
> tools/libxl/libxl.h | 6 ++++--
> tools/libxl/libxl_create.c | 6 +++---
> tools/libxl/libxl_dm.c | 4 ++--
> 4 files changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 44a54cb..3fd8d5b 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -2208,9 +2208,10 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
> return 0;
> }
>
> -int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
> +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
> + const libxl_asyncop_how *ao_how)
> {
> - GC_INIT(ctx);
> + AO_CREATE(ctx, domid, ao_how);
> flexarray_t *front;
> flexarray_t *back;
> libxl__device device;
> @@ -2255,8 +2256,9 @@ out_free:
> flexarray_free(back);
> flexarray_free(front);
> out:
> - GC_FREE;
> - return rc;
> + /* Dummy ao */
> + libxl__ao_complete(egc, ao, rc);
> + return AO_INPROGRESS;
> }
>
> int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
> @@ -2339,9 +2341,10 @@ static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
> return 0;
> }
>
> -int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
> +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
> + const libxl_asyncop_how *ao_how)
> {
> - GC_INIT(ctx);
> + AO_CREATE(ctx, domid, ao_how);
> flexarray_t *front;
> flexarray_t *back;
> libxl__device device;
> @@ -2399,8 +2402,9 @@ out_free:
> flexarray_free(front);
> flexarray_free(back);
> out:
> - GC_FREE;
> - return rc;
> + /* Dummy ao */
> + libxl__ao_complete(egc, ao, rc);
> + return AO_INPROGRESS;
> }
>
> int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index 6da6107..ce89b31 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -563,14 +563,16 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
> libxl_device_nic *nic, libxl_nicinfo *nicinfo);
>
> /* Keyboard */
> -int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
> +int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
> + const libxl_asyncop_how *ao_how);
> int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
> libxl_device_vkb *vkb,
> const libxl_asyncop_how *ao_how);
> int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
>
> /* Framebuffer */
> -int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
> +int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
> + const libxl_asyncop_how *ao_how);
> int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
> libxl_device_vfb *vfb,
> const libxl_asyncop_how *ao_how);
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index a1f5731..39e9257 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -628,7 +628,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> libxl__device_console_dispose(&console);
>
> libxl_device_vkb_init(&vkb);
> - libxl_device_vkb_add(ctx, domid,&vkb);
> + libxl_device_vkb_add(ctx, domid,&vkb, 0);
> libxl_device_vkb_dispose(&vkb);
>
> ret = libxl__create_device_model(gc, domid, d_config,
> @@ -646,8 +646,8 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
> libxl__device_console console;
>
> for (i = 0; i< d_config->num_vfbs; i++) {
> - libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i]);
> - libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i]);
> + libxl_device_vfb_add(ctx, domid,&d_config->vfbs[i], 0);
> + libxl_device_vkb_add(ctx, domid,&d_config->vkbs[i], 0);
> }
>
> ret = init_console_info(&console, 0);
> diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
> index 8dc588d..4a2b5c1 100644
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -804,10 +804,10 @@ retry_transaction:
> 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], 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], 0);
> if (ret)
> goto out_free;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-09 8:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-16 16:00 [PATCH] libxl: make libxl_device_{vkb, vfb}_add take a dummy ao Roger Pau Monne
2012-05-09 8:46 ` Roger Pau Monne
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).