From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1kLU-00076G-IJ for qemu-devel@nongnu.org; Wed, 25 Nov 2015 19:23:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1kLT-0005t8-RE for qemu-devel@nongnu.org; Wed, 25 Nov 2015 19:23:32 -0500 From: Eric Blake Date: Wed, 25 Nov 2015 17:23:08 -0700 Message-Id: <1448497401-27784-12-git-send-email-eblake@redhat.com> In-Reply-To: <1448497401-27784-1-git-send-email-eblake@redhat.com> References: <1448497401-27784-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v6 11/23] ppc: Improve use of qapi visitors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexander Graf , "open list:sPAPR pseries" , armbru@redhat.com, David Gibson The implementation of prop_get_fdt() is taking some shortcuts with the qapi visitor functions. Document them, and use error_abort rather than NULL to ensure that any changes to the visitors do not break our use of shortcuts. Signed-off-by: Eric Blake --- v6: new patch, split from RFC on v5 7/46 --- hw/ppc/spapr_drc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 1846b4f..03a1879 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -276,21 +276,26 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, case FDT_BEGIN_NODE: fdt_depth++; name = fdt_get_name(fdt, fdt_offset, &name_len); - visit_start_struct(v, NULL, NULL, name, 0, NULL); + visit_start_struct(v, NULL, "fdt", name, 0, &error_abort); break; case FDT_END_NODE: /* shouldn't ever see an FDT_END_NODE before FDT_BEGIN_NODE */ g_assert(fdt_depth > 0); - visit_end_struct(v, NULL); + visit_end_struct(v, &error_abort); fdt_depth--; break; case FDT_PROP: { int i; prop = fdt_get_property_by_offset(fdt, fdt_offset, &prop_len); name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); - visit_start_list(v, name, NULL); + /* Note: since v is an output visitor, we can get away + * with just visiting a direct sequence of uint8 into the + * output array, instead of creating a uint8List and using + * visit_type_uint8List(). */ + visit_start_list(v, name, &error_abort); for (i = 0; i < prop_len; i++) { - visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, NULL); + visit_type_uint8(v, (uint8_t *)&prop->data[i], NULL, + &error_abort); } visit_end_list(v); -- 2.4.3