[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 01/15] libxc: xc_domain_restore, make toolstack_restore const-correct



On Wed, 2012-05-30 at 17:16 +0100, Ian Jackson wrote:
> Also provide typedefs for the nontrivial function callback types.

Are there any other uses of these type other than the one of each
inlined in the structs?

If not then I'm not sure this makes things clearer -- you now have to
look at both the callback struct and then go find the corresponding
typedef.

> Update the one provider of this callback, in libxl.
> 
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> ---
>  tools/libxc/xenguest.h  |   14 ++++++++++----
>  tools/libxl/libxl_dom.c |    4 ++--
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h
> index 91d53f7..328a2a5 100644
> --- a/tools/libxc/xenguest.h
> +++ b/tools/libxc/xenguest.h
> @@ -31,6 +31,10 @@
>  #define X86_64_B_SIZE   64 
>  #define X86_32_B_SIZE   32
>  
> +typedef int xc_switch_qemu_logdirty_cb(int domid, unsigned enable, void 
> *data);
> +typedef int xc_toolstack_save_cb(uint32_t domid, uint8_t **buf,
> +                                 uint32_t *len, void *data);
> +
>  /* callbacks provided by xc_domain_save */
>  struct save_callbacks {
>      /* Called after expiration of checkpoint interval,
> @@ -61,7 +65,7 @@ struct save_callbacks {
>      int (*checkpoint)(void* data);
>  
>      /* Enable qemu-dm logging dirty pages to xen */
> -    int (*switch_qemu_logdirty)(int domid, unsigned enable, void *data); /* 
> HVM only */
> +    xc_switch_qemu_logdirty_cb *switch_qemu_logdirty; /* HVM only */
>  
>      /* Save toolstack specific data
>       * @param buf the buffer with the data to be saved
> @@ -69,7 +73,7 @@ struct save_callbacks {
>       * The callee allocates the buffer, the caller frees it (buffer must
>       * be free'able).
>       */
> -    int (*toolstack_save)(uint32_t domid, uint8_t **buf, uint32_t *len, void 
> *data);
> +    xc_toolstack_save_cb *toolstack_save;
>  
>      /* to be provided as the last argument to each callback function */
>      void* data;
> @@ -89,11 +93,13 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t 
> dom, uint32_t max_iter
>                     unsigned long vm_generationid_addr);
>  
> 
> +typedef int xc_toolstack_restore_cb(uint32_t domid, const uint8_t *buf,
> +                                    uint32_t size, void* data);
> +
>  /* callbacks provided by xc_domain_restore */
>  struct restore_callbacks {
>      /* callback to restore toolstack specific data */
> -    int (*toolstack_restore)(uint32_t domid, uint8_t *buf,
> -            uint32_t size, void* data);
> +    xc_toolstack_restore_cb *toolstack_restore;
>  
>      /* to be provided as the last argument to each callback function */
>      void* data;
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 06dbc92..929fbf2 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -465,13 +465,13 @@ static inline char *restore_helper(libxl__gc *gc, 
> uint32_t domid,
>              domid, phys_offset, node);
>  }
>  
> -static int libxl__toolstack_restore(uint32_t domid, uint8_t *buf,
> +static int libxl__toolstack_restore(uint32_t domid, const uint8_t *buf,
>          uint32_t size, void *data)
>  {
>      libxl__gc *gc = (libxl__gc *) data;
>      libxl_ctx *ctx = gc->owner;
>      int i, ret;
> -    uint8_t *ptr = buf;
> +    const uint8_t *ptr = buf;
>      uint32_t count = 0, version = 0;
>      struct libxl__physmap_info* pi;
>      char *xs_path;



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.