From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtWhA-0005KR-CU for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtWh4-00022R-J0 for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:52 -0500 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:49219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtWh4-00022A-CV for qemu-devel@nongnu.org; Thu, 19 Dec 2013 01:02:46 -0500 Received: by mail-pd0-f175.google.com with SMTP id w10so671360pde.6 for ; Wed, 18 Dec 2013 22:02:45 -0800 (PST) From: edgar.iglesias@gmail.com Date: Thu, 19 Dec 2013 15:51:29 +1000 Message-Id: <1387432293-17711-19-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1387432293-17711-1-git-send-email-edgar.iglesias@gmail.com> References: <1387432293-17711-1-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH v2 18/22] memory: Add address_space_find_by_name() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, blauwirbel@gmail.com, aliguori@amazon.com, pcrost@xilinx.com, pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias --- include/exec/memory.h | 8 ++++++++ memory.c | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 2d0b614..02f4012 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -941,6 +941,14 @@ void mtree_info(fprintf_function mon_printf, void *f); */ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name); +/** + * address_space_find_by_name: Find an AddressSpace * by name + * + * Returns an AddressSpace * if found. + * + * @name: name of an address space too look for. + */ +AddressSpace *address_space_find_by_name(const char *name); /** * address_space_destroy: destroy an address space diff --git a/memory.c b/memory.c index 7764314..4695879 100644 --- a/memory.c +++ b/memory.c @@ -1725,6 +1725,18 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name) memory_region_transaction_commit(); } +AddressSpace *address_space_find_by_name(const char *name) +{ + AddressSpace *as; + + QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { + if (strcmp(as->name, name) == 0) { + return as; + } + } + return NULL; +} + void address_space_destroy(AddressSpace *as) { /* Flush out anything from MemoryListeners listening in on this */ -- 1.7.10.4