> -----Original Message-----
> From: Andrew Cooper <andrew.coop...@citrix.com>
> Sent: 02 October 2020 23:40
> To: Paul Durrant <p...@xen.org>; xen-devel@lists.xenproject.org
> Cc: Durrant, Paul <pdurr...@amazon.co.uk>; Ian Jackson 
> <ian.jack...@eu.citrix.com>; Wei Liu
> <w...@xen.org>
> Subject: RE: [EXTERNAL] [PATCH v9 3/8] tools/misc: add xen-domctx to present 
> domain context
> 
> CAUTION: This email originated from outside of the organization. Do not click 
> links or open
> attachments unless you can confirm the sender and know the content is safe.
> 
> 
> 
> On 24/09/2020 14:10, Paul Durrant wrote:
> > This tool is analogous to 'xen-hvmctx' which presents HVM context.
> > Subsequent patches will add 'dump' functions when new records are
> > introduced.
> >
> > Signed-off-by: Paul Durrant <pdurr...@amazon.com>
> > Acked-by: Ian Jackson <ian.jack...@eu.citrix.com>
> > ---
> > Cc: Andrew Cooper <andrew.coop...@citrix.com>
> > Cc: Wei Liu <w...@xen.org>
> >
> > NOTE: Ian requested ack from Andrew
> 
> I mean - its a fairly throwaway piece of misc userspace, so ack.
> 
> However, it is largely superseded by the changes you need to make to
> verify-stream-v2 so you might want to bear that in mind.
> 
> Also, I wonder if it is wise in general that we're throwing so many misc
> debugging tools into sbin.
> 

The intention is to eventually replace hvm context so we'll need a parallel 
tool to replace xen-hvmctx, unless we want to retire it.

> > +#include <inttypes.h>
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <string.h>
> > +#include <errno.h>
> > +
> > +#include <xenctrl.h>
> > +#include <xen/xen.h>
> > +#include <xen/domctl.h>
> > +#include <xen/save.h>
> > +
> > +static void *buf = NULL;
> > +static size_t len, off;
> > +
> > +#define GET_PTR(_x)                                                        
> > \
> > +    do {                                                                   
> > \
> > +        if ( len - off < sizeof(*(_x)) )                                   
> > \
> > +        {                                                                  
> > \
> > +            fprintf(stderr,                                                
> > \
> > +                    "error: need another %lu bytes, only %lu available\n", 
> > \
> 
> %zu is the correct formatter for size_t.
> 

True, missed that.

> > +                    sizeof(*(_x)), len - off);                             
> > \
> > +            exit(1);                                                       
> > \
> 
> Your error handling will be far more simple by using err() instead of
> opencoding it.
> 

Ok.

  Paul

> ~Andrew

Reply via email to