common/vsprintf: special-case DOMID_IDLE handling for %pv
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 25 Jun 2015 12:56:26 +0000 (14:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Jun 2015 12:56:26 +0000 (14:56 +0200)
Prints IDLEv0 as opposed to d32767v0

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/vsprintf.c

index 065cc42525d85b2272fa982211a78218d33bcbeb..51b5e4e4d100f3d426718cff6ca741cd502cb4d5 100644 (file)
@@ -336,9 +336,14 @@ static char *pointer(char *str, char *end, const char **fmt_ptr,
         const struct vcpu *v = arg;
 
         ++*fmt_ptr;
-        if ( str < end )
-            *str = 'd';
-        str = number(str + 1, end, v->domain->domain_id, 10, -1, -1, 0);
+        if ( unlikely(v->domain->domain_id == DOMID_IDLE) )
+            str = string(str, end, "IDLE", -1, -1, 0);
+        else
+        {
+            if ( str < end )
+                *str = 'd';
+            str = number(str + 1, end, v->domain->domain_id, 10, -1, -1, 0);
+        }
         if ( str < end )
             *str = 'v';
         return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0);