"Michael S. Tsirkin" <m...@redhat.com> wrote: > On Wed, Dec 02, 2009 at 07:38:03PM +0100, Juan Quintela wrote: >> "Michael S. Tsirkin" <m...@redhat.com> 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 <foo>" 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.