* Juan Quintela (quint...@redhat.com) wrote: > > @@ -662,6 +672,24 @@ static int save_zero_page(QEMUFile *f, RAMBlock > > *block, ram_addr_t offset, > > } > > > > /** > > + * ram_find_block_by_id: Find a ramblock by name. > > + * > > + * Returns: The RAMBlock with matching ID, or NULL. > > + */ > > +static RAMBlock *ram_find_block_by_id(const char *id) > > +{ > > + RAMBlock *block; > > + > > + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { > > + if (!strcmp(id, block->idstr)) { > > + return block; > > + } > > + } > > + > > + return NULL; > > +} > > We don't have this function already..... > > Once here, could we split it in its own patch and use it in ram_load? > > > QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { > if (!strncmp(id, block->idstr, sizeof(id))) { > if (length != block->used_length) { > Error *local_err = NULL; > > ret = qemu_ram_resize(block->offset, length, > &local_err); > if (local_err) { > error_report_err(local_err); > } > } > ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG, > block->idstr); > break; > } > } > > if (!block) { > error_report("Unknown ramblock \"%s\", cannot " > "accept migration", id); > ret = -EINVAL; > } > > > We could also use it in: > > host_from_stream_offset
Done; replaced both uses and it's now called 'qemu_ram_block_by_name' Dave -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK