On 04/20/2018 10:47 AM, Peter Maydell wrote: > On 20 April 2018 at 07:59, Cédric Le Goater <c...@kaod.org> wrote: >> Hello David, >> >> On 04/19/2018 06:58 PM, Dr. David Alan Gilbert wrote: >>> * Cédric Le Goater (c...@kaod.org) wrote: >>>> @@ -1823,6 +1831,7 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const >>>> char *name, DeviceState *dev) >>>> } >>>> } >>>> pstrcat(new_block->idstr, sizeof(new_block->idstr), name); >>>> + new_block->flags |= RAM_MIGRATABLE; >>>> >>>> rcu_read_lock(); >>>> RAMBLOCK_FOREACH(block) { >>>> @@ -1845,6 +1854,7 @@ void qemu_ram_unset_idstr(RAMBlock *block) >>>> */ >>>> if (block) { >>>> memset(block->idstr, 0, sizeof(block->idstr)); >>>> + block->flags &= ~RAM_MIGRATABLE; >>>> } >>>> } >>> >>> Why in qemu_ram_set_idstr and qemu_ram_(un)set_idstr ? It seems an >>> odd place to put them. >> >> The only place where this routines are called is from >> vmstate_un/register_ram() >> It seemed unnecessary to add an extra interface qemu_ram_un/set_migratable(). > > Why not set the flags in vmstate_{register,unregister}_ram() ?
because the RAM flags are not exposed outside exec.c so it would require some qemu_ram_un/set_migratable() helpers like this is done for RAM_UF_ZEROPAGE. That is possible of course. C.