From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH 7/7] libxenlight resend: get state for one domain Date: Wed, 02 Dec 2009 13:03:37 -0500 Message-ID: <4B16ABF9.9000408@lagarcavilla.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060306070103040404030808" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefano Stabellini , Vincent Hanquez , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060306070103040404030808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Simple function to get the dominfo state of a single domain. Signed-off-by: Andres Lagar-Cavilla --------------060306070103040404030808 Content-Type: text/plain; name="07_get_state_one_domain.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="07_get_state_one_domain.patch" # HG changeset patch # User Andres Lagar-Cavilla # Date 1259285614 18000 # Node ID 39484f864ecb79a6541aee97748c8887f4e6f0cd # Parent a5f6b5cd5472fe914b57ef8aa7a97887c2aa9aab Simple function to get the dominfo state of a single domain. Signed-off-by: Andres Lagar-Cavilla diff -r a5f6b5cd5472 -r 39484f864ecb libxl.c --- a/libxl.c +++ b/libxl.c @@ -362,6 +362,26 @@ static int libxl_save_device_model(struc return 0; } +xc_dominfo_t *libxl_domain_info(struct libxl_ctx *ctx, uint32_t domid) +{ + xc_dominfo_t *info; + int rc; + + info = (xc_dominfo_t *) calloc(1, sizeof(xc_dominfo_t)); + if (!info) { + return NULL; + } + + rc = xc_domain_getinfo(ctx->xch, domid, 1, info); + if (rc != 1) { + free(info); + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "Failed to get info for domain %u", + domid); + return NULL; + } + + return info; +} int libxl_domain_suspend(struct libxl_ctx *ctx, libxl_domain_suspend_info *info, uint32_t domid, int fd) { diff -r a5f6b5cd5472 -r 39484f864ecb libxl.h --- a/libxl.h +++ b/libxl.h @@ -283,6 +283,7 @@ int libxl_console_attach(struct libxl_ct struct libxl_dominfo * libxl_domain_list(struct libxl_ctx *ctx, int *nb_domain); xc_dominfo_t * libxl_domain_infolist(struct libxl_ctx *ctx, int *nb_domain); +xc_dominfo_t * libxl_domain_info(struct libxl_ctx *ctx, uint32_t domid); typedef struct libxl_device_model_starting libxl_device_model_starting; int libxl_create_device_model(struct libxl_ctx *ctx, --------------060306070103040404030808 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060306070103040404030808--