Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-27 Thread Markus Armbruster
Dietmar Maurer writes: > This is a very simple archive format, see docs/specs/vma_spec.txt > > Signed-off-by: Dietmar Maurer > --- > Makefile|3 +- > Makefile.objs |2 +- > blockdev.c |6 +- > docs/specs/vma_spec.txt | 24 ++ > vma-reader.c

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-27 Thread Kevin Wolf
Am 25.02.2013 um 16:12 hat Eric Blake geschrieben: > On 02/24/2013 11:37 PM, Dietmar Maurer wrote: > > I tried to do that, but it seems that gcc does not support sizeof in > > preprocessor conditionals, > > so I added a runtime check in vma_writer_create(). > > Then you've never written a compile

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-25 Thread Eric Blake
On 02/24/2013 11:18 PM, Dietmar Maurer wrote: >>> +if (full_read(vmar->fd, vmar->head_data, sizeof(VmaHeader)) != >>> +sizeof(VmaHeader)) { >>> +error_setg(errp, "can't read vma header - %s", >>> + errno ? strerror(errno) : "got EOF"); >> >> You're not the firs

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-25 Thread Eric Blake
On 02/24/2013 11:37 PM, Dietmar Maurer wrote: >> Do we care about EBCDIC, in which case you should be using raw hex values >> instead of relying on ASCII conversion of your magic number? >> That is, I'd much rather see: >> >> #define VMA_MAGIC 0x564D4100 /* ascii "VMA\0" */ > > The other code in

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-24 Thread Dietmar Maurer
> > +return -1; > > +} > > + > > +VmaHeader *h = (VmaHeader *)vmar->head_data; > > + > > +if (h->magic != VMA_MAGIC) { > > +error_setg(errp, "not a vma file - wrong magic number"); > > +return -1; > > +} > > Doesn't seem like this is endian-safe. h->magic i

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-24 Thread Dietmar Maurer
> > +if (full_read(vmar->fd, vmar->head_data, sizeof(VmaHeader)) != > > +sizeof(VmaHeader)) { > > +error_setg(errp, "can't read vma header - %s", > > + errno ? strerror(errno) : "got EOF"); > > You're not the first user, but strerror() isn't thread-safe. stre

Re: [Qemu-devel] [PATCH v5 4/6] introduce new vma archive format

2013-02-22 Thread Eric Blake
On 02/21/2013 04:27 AM, Dietmar Maurer wrote: > This is a very simple archive format, see docs/specs/vma_spec.txt > > Signed-off-by: Dietmar Maurer > --- > +++ b/docs/specs/vma_spec.txt > @@ -0,0 +1,24 @@ > +=Virtual Machine Archive format (VMA)= > + > +This format contains a header which includ