qemu_ram_foreach_block: pass up error value, and down the ramblock name

check the return value of the function it calls and error if it's non-0
Fixup qemu_rdma_init_one_block that is the only current caller,
  and rdma_add_block the only function it calls using it.

Pass the name of the ramblock to the function; helps in debugging.

Backports commit e3807054e20fb3b94d18cb751c437ee2f43b6fac from qemu
This commit is contained in:
Dr. David Alan Gilbert 2018-02-18 19:16:52 -05:00 committed by Lioncash
parent 71beea204c
commit 75701d03ee
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 14 additions and 4 deletions

View file

@ -2861,12 +2861,22 @@ bool cpu_physical_memory_is_io(AddressSpace *as, hwaddr phys_addr)
memory_region_is_romd(mr));
}
void qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque)
int qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque)
{
RAMBlock *block;
int ret = 0;
// Unicorn: commented out
//rcu_read_lock();
QLIST_FOREACH(block, &uc->ram_list.blocks, next) {
func(block->host, block->offset, block->used_length, opaque);
ret = func(block->idstr, block->host, block->offset,
block->used_length, opaque);
if (ret) {
break;
}
}
// Unicorn: commented out
//rcu_read_unlock();
return ret;
}
#endif

View file

@ -116,10 +116,10 @@ void cpu_flush_icache_range(AddressSpace *as, hwaddr start, int len);
extern struct MemoryRegion io_mem_rom;
extern struct MemoryRegion io_mem_notdirty;
typedef void (RAMBlockIterFunc)(void *host_addr,
typedef int (RAMBlockIterFunc)(const char *block_name, void *host_addr,
ram_addr_t offset, ram_addr_t length, void *opaque);
void qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque);
int qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque);
#endif