[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Gerd Hoffmann
On 11/09/10 14:05, Michael S. Tsirkin wrote: On Tue, Nov 09, 2010 at 12:50:11PM +0100, Gerd Hoffmann wrote: Hi, +static int get_bool(QEMUFile *f, void *pv, size_t size) +{ +bool *v = pv; +*v = qemu_get_byte(f); +return 0; I think we should verify that value is 0 or 1 and fail

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Michael S. Tsirkin
On Tue, Nov 09, 2010 at 12:50:11PM +0100, Gerd Hoffmann wrote: > Hi, > > +static int get_bool(QEMUFile *f, void *pv, size_t size) > +{ > +bool *v = pv; > +*v = qemu_get_byte(f); > +return 0; > > >I think we should verify that value is 0 or 1 and fail > >migration

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Gerd Hoffmann
Hi, +static int get_bool(QEMUFile *f, void *pv, size_t size) +{ +bool *v = pv; +*v = qemu_get_byte(f); +return 0; I think we should verify that value is 0 or 1 and fail migration otherwise, to make it more robust. I still think such a check doesn't belong into the migration co

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Michael S. Tsirkin
On Tue, Nov 09, 2010 at 10:37:37AM +0100, Gerd Hoffmann wrote: > Hi, > > >>+#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ > >>+VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0) > >>+ > > > >Why don't we pack the bits? > > Point being? As long as we don't save *big* arrays of boo

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Michael S. Tsirkin
On Tue, Nov 09, 2010 at 02:28:37PM +0100, Gerd Hoffmann wrote: > On 11/09/10 14:05, Michael S. Tsirkin wrote: > >On Tue, Nov 09, 2010 at 12:50:11PM +0100, Gerd Hoffmann wrote: > >> Hi, > >> > >>+static int get_bool(QEMUFile *f, void *pv, size_t size) > >>+{ > >>+bool *v = pv; > >>

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Gerd Hoffmann
Hi, +#define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ +VMSTATE_BOOL_ARRAY_V(_f, _s, _n, 0) + Why don't we pack the bits? Point being? As long as we don't save *big* arrays of bools it simply isn't worth the effort IMHO. And for big arrays we'll probably wouldn'

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Paolo Bonzini
On 11/09/2010 10:23 AM, Markus Armbruster wrote: +} + +static void put_bool(QEMUFile *f, void *pv, size_t size) +{ +bool *v = pv; +qemu_put_byte(f, *v); Is there a guarantee that bool is a single byte, BTW? Nope. Does it matter? No. In fact I think QEMU makes (or tries to make) th

Re: [Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-09 Thread Markus Armbruster
"Michael S. Tsirkin" writes: > On Mon, Nov 01, 2010 at 03:51:54PM +0100, Gerd Hoffmann wrote: [...] >> diff --git a/savevm.c b/savevm.c >> index 10057f3..14268ea 100644 >> --- a/savevm.c >> +++ b/savevm.c >> @@ -675,6 +675,27 @@ uint64_t qemu_get_be64(QEMUFile *f) >> return v; >> } >> >>

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-08 Thread Michael S. Tsirkin
On Mon, Nov 01, 2010 at 03:51:54PM +0100, Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > hw/hw.h | 14 ++ > savevm.c | 21 + > 2 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/hw/hw.h b/hw/hw.h > index e935364..234c713 100644

[Qemu-devel] Re: [PATCH] add VMSTATE_BOOL

2010-11-01 Thread malc
On Mon, 1 Nov 2010, Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > --- > hw/hw.h | 14 ++ > savevm.c | 21 + > 2 files changed, 35 insertions(+), 0 deletions(-) Applied, thanks. [..snip..] -- mailto:av1...@comtv.ru