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

RE: [PATCH v9 3/8] tools/misc: add xen-domctx to present domain context



> -----Original Message-----
> From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Sent: 02 October 2020 23:40
> To: Paul Durrant <paul@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Durrant, Paul <pdurrant@xxxxxxxxxxxx>; Ian Jackson 
> <ian.jackson@xxxxxxxxxxxxx>; Wei Liu
> <wl@xxxxxxx>
> 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 <pdurrant@xxxxxxxxxx>
> > Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > ---
> > Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > Cc: Wei Liu <wl@xxxxxxx>
> >
> > 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

 


Rackspace

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