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

Re: [Xen-devel] [PATCH v2] xen/vsprintf: Introduce %pd formatter for domains



>>> On 28.09.18 at 19:22, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/common/vsprintf.c
> +++ b/xen/common/vsprintf.c
> @@ -264,6 +264,47 @@ static char *string(char *str, char *end, const char *s,
>      return str;
>  }
>  
> +/* Print a domain id, using names for system domains.  (e.g. d0 or d[IDLE]) 
> */
> +static char *print_domain(char *str, char *end, const struct domain *d)
> +{
> +    const char *name = NULL;
> +
> +    /* Some debugging may have an optionally-NULL pointer. */
> +    if ( unlikely(!d) )
> +        return string(str, end, "NULL", -1, -1, 0);
> +
> +    if ( str < end )
> +        *str = 'd';
> +
> +    switch ( d->domain_id )
> +    {
> +    case DOMID_IO:   name = "[IO]";   break;
> +    case DOMID_XEN:  name = "[XEN]";  break;
> +    case DOMID_COW:  name = "[COW]";  break;
> +    case DOMID_IDLE: name = "[IDLE]"; break;

    default: ASSERT_UNREACHABLE();

?

> +    }

Perhaps the insertion of 'd' might better live here, to make a
better connection between the lack of a ++ there and the + 1
below?

> +    if ( name )
> +        return string(str + 1, end, name, -1, -1, 0);
> +    else
> +        return number(str + 1, end, d->domain_id, 10, -1, -1, 0);
> +}

Anyway, even without the adjustments
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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