All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2 of 9] libxl: add shutdown reason to libxl_dominfo
Date: Tue, 27 Jul 2010 11:13:44 +0100	[thread overview]
Message-ID: <74371f414f2012adebba.1280225624@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1280225622@localhost.localdomain>

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1280225493 -3600
# Node ID 74371f414f2012adebba8a8617ddef957f5e3ae0
# Parent  7a0c37f2a9b51ac012a32bcf6ab222580e7cac94
libxl: add shutdown reason to libxl_dominfo

Removes the need for explicit libxl_dominfo.crashed so remove it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r 7a0c37f2a9b5 -r 74371f414f20 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Jul 26 11:36:02 2010 +0100
+++ b/tools/libxl/libxl.c	Tue Jul 27 11:11:33 2010 +0100
@@ -405,8 +405,6 @@ static void xcinfo2xlinfo(const xc_domai
 static void xcinfo2xlinfo(const xc_domaininfo_t *xcinfo,
                           struct libxl_dominfo *xlinfo)
 {
-    unsigned int shutdown_reason;
-
     memcpy(&(xlinfo->uuid), xcinfo->handle, sizeof(xen_domain_handle_t));
     xlinfo->domid = xcinfo->domain;
 
@@ -415,14 +413,11 @@ static void xcinfo2xlinfo(const xc_domai
     xlinfo->paused   = !!(xcinfo->flags&XEN_DOMINF_paused);
     xlinfo->blocked  = !!(xcinfo->flags&XEN_DOMINF_blocked);
     xlinfo->running  = !!(xcinfo->flags&XEN_DOMINF_running);
-    xlinfo->crashed  = 0;
 
-    shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
-
-    if ( xlinfo->shutdown && (shutdown_reason == SHUTDOWN_crash) ) {
-        xlinfo->shutdown = 0;
-        xlinfo->crashed  = 1;
-    }
+    if (xlinfo->shutdown || xlinfo->dying)
+        xlinfo->shutdown_reason = (xcinfo->flags>>XEN_DOMINF_shutdownshift) & XEN_DOMINF_shutdownmask;
+    else
+        xlinfo->shutdown_reason  = ~0;
 
     xlinfo->max_memkb = PAGE_TO_MEMKB(xcinfo->tot_pages);
     xlinfo->cpu_time = xcinfo->cpu_time;
diff -r 7a0c37f2a9b5 -r 74371f414f20 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Mon Jul 26 11:36:02 2010 +0100
+++ b/tools/libxl/libxl.h	Tue Jul 27 11:11:33 2010 +0100
@@ -29,8 +29,16 @@ struct libxl_dominfo {
     uint8_t blocked:1;
     uint8_t paused:1;
     uint8_t shutdown:1;
-    uint8_t crashed:1;
     uint8_t dying:1;
+
+    /*
+     * Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+     *
+     * Otherwise set to a value guaranteed not to clash with any valid
+     * SHUTDOWN_* constant.
+     */
+    unsigned int shutdown_reason;
+
     uint64_t max_memkb;
     uint64_t cpu_time;
     uint32_t vcpu_max_id;
diff -r 7a0c37f2a9b5 -r 74371f414f20 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon Jul 26 11:36:02 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Jul 27 11:11:33 2010 +0100
@@ -1935,7 +1935,7 @@ void list_domains(int verbose)
                 info[i].blocked ? 'b' : '-',
                 info[i].paused ? 'p' : '-',
                 info[i].shutdown ? 's' : '-',
-                info[i].crashed ? 'c' : '-',
+                info[i].shutdown_reason == SHUTDOWN_crash ? 'c' : '-',
                 info[i].dying ? 'd' : '-',
                 ((float)info[i].cpu_time / 1e9));
         if (verbose) {

  parent reply	other threads:[~2010-07-27 10:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 10:13 [PATCH 0 of 9] xl: handle domain shutdown/reboot/crash in a user configurable way Ian Campbell
2010-07-27 10:13 ` [PATCH 1 of 9] libxl: Add LIBXL_EVENT namespace to enum libxl_event_type Ian Campbell
2010-07-27 10:13 ` Ian Campbell [this message]
2010-07-27 10:13 ` [PATCH 3 of 9] libxl: return libxl_dominfo from libxl_event_get_domain_death_info Ian Campbell
2010-07-27 10:13 ` [PATCH 4 of 9] libxl: signal caller if domain already destroyed on domain death event Ian Campbell
2010-07-27 10:13 ` [PATCH 5 of 9] xl: Add function to generate random uuid and use it Ian Campbell
2010-07-27 11:47   ` Gianni Tedesco
2010-07-27 16:02     ` Ian Jackson
2010-07-27 16:07       ` Ian Campbell
2010-07-27 10:13 ` [PATCH 6 of 9] xl: Factor out domain death handling into a separate function Ian Campbell
2010-07-27 10:13 ` [PATCH 7 of 9] xl: support on_{poweroff, reboot, crash} domain configuration options Ian Campbell
2010-07-27 10:13 ` [PATCH 8 of 9] libxl: add libxl_domain_preserve Ian Campbell
2010-07-27 10:13 ` [PATCH 9 of 9] xl: implement "rename-restart" action for shutdown Ian Campbell

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=74371f414f2012adebba.1280225624@localhost.localdomain \
    --to=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.