From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mdfvf-00089j-QK for qemu-devel@nongnu.org; Wed, 19 Aug 2009 03:49:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mdfva-00089J-Dq for qemu-devel@nongnu.org; Wed, 19 Aug 2009 03:49:54 -0400 Received: from [199.232.76.173] (port=47988 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mdfva-00089G-9i for qemu-devel@nongnu.org; Wed, 19 Aug 2009 03:49:50 -0400 Received: from mx20.gnu.org ([199.232.41.8]:34831) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MdfvZ-0000uY-PT for qemu-devel@nongnu.org; Wed, 19 Aug 2009 03:49:49 -0400 Received: from [66.187.237.31] (helo=mx2.redhat.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdfvY-0005kO-Up for qemu-devel@nongnu.org; Wed, 19 Aug 2009 03:49:49 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7J7nl4m032244 for ; Wed, 19 Aug 2009 03:49:47 -0400 Message-ID: <4A8BAE97.8010500@redhat.com> Date: Wed, 19 Aug 2009 09:49:43 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4/5] New VMstate save/load infrastructure References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org > +enum VMStateType { > + VMSTATE_TYPE_UNSPEC = 0, > + VMSTATE_TYPE_INT8, > + VMSTATE_TYPE_INT16, > + VMSTATE_TYPE_INT32, > + VMSTATE_TYPE_INT64, > + VMSTATE_TYPE_UINT8, > + VMSTATE_TYPE_UINT16, > + VMSTATE_TYPE_UINT32, > + VMSTATE_TYPE_UINT64, > + VMSTATE_TYPE_TIMER, > +}; > + > +typedef struct VMStateInfo VMStateInfo; > + > +struct VMStateInfo { > + const char *name; > + size_t size; > + enum VMStateType type; > + void (*get)(QEMUFile *f, VMStateInfo *info, void *pv); > + void (*put)(QEMUFile *f, VMStateInfo *info, const void *pv); > +}; > + > +typedef struct { > + const char *name; > + size_t num; > + size_t offset; > + VMStateInfo *info; > + int version_id; > +} VMStateField; Hmm, I'm not sure VMStateInfo is that useful here. All the get/put callbacks are simple two-liners, and it is unlikely that the number of types ever grows. I think I would stick "enum VMStateType" directly into VMStateField and kill one level of indirection. > + > +typedef struct { > + const char *name; > + int version_id; > + int minimum_version_id; > + VMStateField *fields; > +} VMStateDescription; Add compat_load() callback for version_id < minimum_version_id here? cheers, Gerd