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. > +#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. > + sizeof(*(_x)), len - off); \ > + exit(1); \ Your error handling will be far more simple by using err() instead of opencoding it. ~Andrew