From: Vincent Hanquez Subject: [PATCH 09/11] add a get_shutdown_reason Date: Tue, 29 Dec 2009 18:06:57 +0000 Message-ID: <1262110019-31072-10-git-send-email-vincent.hanquez@eu.citrix.com> References: <1262110019-31072-1-git-send-email-vincent.hanquez@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1.6.5.6" Return-path: In-Reply-To: <1262110019-31072-1-git-send-email-vincent.hanquez@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Vincent Hanquez List-Id: xen-devel@lists.xenproject.org --------------1.6.5.6 Content-Type: text/plain; charset="UTF-8"; format=fixed Content-Transfer-Encoding: quoted-printable Signed-off-by: Vincent Hanquez --- tools/libxl/libxl_dom.c | 15 +++++++++++++++ tools/libxl/libxl_internal.h | 3 +++ 2 files changed, 18 insertions(+), 0 deletions(-) --------------1.6.5.6 Content-Type: text/x-patch; name="0009-add-a-get_shutdown_reason.patch" Content-Disposition: attachment; filename="0009-add-a-get_shutdown_reason.patch" Content-Transfer-Encoding: quoted-printable diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index e876970..ae93bd1 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -42,6 +42,21 @@ int is_hvm(struct libxl_ctx *ctx, uint32_t domid) return !!(info.flags & XEN_DOMINF_hvm_guest); } =20 +int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid) +{ + xc_domaininfo_t info; + int ret; + + ret =3D xc_domain_getinfolist(ctx->xch, domid, 1, &info); + if (ret !=3D 1) + return -1; + if (info.domain !=3D domid) + return -1; + if (!(info.flags & XEN_DOMINF_shutdown)) + return -1; + return dominfo_get_shutdown_reason(&info); +} + int build_pre(struct libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *s= tate) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 3519eac..294d7a7 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -124,6 +124,9 @@ char **libxl_xs_directory(struct libxl_ctx *ctx, xs_t= ransaction_t t, char *path, =20 /* from xl_dom */ int is_hvm(struct libxl_ctx *ctx, uint32_t domid); +int get_shutdown_reason(struct libxl_ctx *ctx, uint32_t domid); +#define dominfo_get_shutdown_reason(info) (((info)->flags >> XEN_DOMINF_= shutdownshift) & XEN_DOMINF_shutdownmask) + int build_pre(struct libxl_ctx *ctx, uint32_t domid, libxl_domain_build_info *info, libxl_domain_build_state *s= tate); int build_post(struct libxl_ctx *ctx, uint32_t domid, --------------1.6.5.6 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 --------------1.6.5.6--