Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFuwM-0007wr-Tp for qemu-devel@nongnu.org; Wed, 02 Dec 2009 14:32:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFuwH-0007u1-UH for qemu-devel@nongnu.org; Wed, 02 Dec 2009 14:32:42 -0500 Received: from [199.232.76.173] (port=49644 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFuwH-0007tv-R7 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 14:32:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42697) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFuYs-00013H-Pt for qemu-devel@nongnu.org; Wed, 02 Dec 2009 14:08:27 -0500 From: Juan Quintela In-Reply-To: <20091202184001.GG3956@redhat.com> (Michael S. Tsirkin's message of "Wed, 2 Dec 2009 20:40:01 +0200") References: <20091202145853.GH18519@redhat.com> <20091202184001.GG3956@redhat.com> Date: Wed, 02 Dec 2009 20:07:44 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 33/41] virtio-net: port to vmstate List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org "Michael S. Tsirkin" wrote: > On Wed, Dec 02, 2009 at 07:38:03PM +0100, Juan Quintela wrote: >> "Michael S. Tsirkin" wrote: > I expect it fits in practice. > But you should range check the value and fail migration on error. > >> That is only >> needed for old versions that we are reading (get_* function has real >> code). But we are supposed to never write old versions (*). >> Thet that shouldn't happen ever. > > vmstate guarantees this won't be called? No, I express it badly. That function should never be called. It is a compatibility type for old versions. Only get() part should be used. What should be guaranteed is that you protect that with a test or something to assure that only the get() part is ever used, not the put() one. > So just assert(1)? Let's not write a ton of > code that isn't called? options are: a- put a NULL value in the struct, and if there are ever an error get a segmentation fault. b- put a function that just writes "the impossible happened in " and exit. I don't know where do you want me to put one assert. Later, Juan. >> > when >> > is this called? Please supply a comment. >> > Maybe call assert? >> > >> >> assert or exit is ok for me, what does people preffer? >> >> Later, Juan. >> >> (*): My next series will propose to change that and allow to write old >> versions, but that didn't exist when this code was written, and >> there are still no agreement about how/if doing it.