On Wed, Mar 13, 2013 at 01:56:24PM -0500, Joel Schopp wrote: > Add a sized buffer interface to qapi.
Isn't this just a special case of the visit_*_carray() interfaces? We should avoid new interfaces if possible, since it adds to feature disparities between visitor implementations. > > Cc: Michael Tsirkin <m...@redhat.com> > Signed-off-by: Stefan Berger <stef...@linux.vnet.ibm.com> > Signed-off-by: Joel Schopp <jsch...@linux.vnet.ibm.com> > --- > include/qapi/visitor-impl.h | 2 ++ > include/qapi/visitor.h | 2 ++ > qapi/qapi-visit-core.c | 8 ++++++++ > 3 files changed, 12 insertions(+) > > diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h > index 9d87f2d..dc0e25c 100644 > --- a/include/qapi/visitor-impl.h > +++ b/include/qapi/visitor-impl.h > @@ -38,6 +38,8 @@ struct Visitor > size_t elem_count, size_t elem_size, Error **errp); > void (*next_carray)(Visitor *v, Error **errp); > void (*end_carray)(Visitor *v, Error **errp); > + void (*type_sized_buffer)(Visitor *v, uint8_t **obj, size_t size, > + const char *name, Error **errp); > > /* May be NULL */ > void (*start_optional)(Visitor *v, bool *present, const char *name, > diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h > index 74bddef..7c7bb98 100644 > --- a/include/qapi/visitor.h > +++ b/include/qapi/visitor.h > @@ -55,5 +55,7 @@ void visit_start_carray(Visitor *v, void **obj, const char > *name, > size_t elem_count, size_t elem_size, Error **errp); > void visit_next_carray(Visitor *v, Error **errp); > void visit_end_carray(Visitor *v, Error **errp); > +void visit_type_sized_buffer(Visitor *v, uint8_t **obj, size_t len, > + const char *name, Error **errp); > > #endif > diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c > index d9982f8..4b36a54 100644 > --- a/qapi/qapi-visit-core.c > +++ b/qapi/qapi-visit-core.c > @@ -338,3 +338,11 @@ void visit_end_carray(Visitor *v, Error **errp) > v->end_carray(v, errp); > } > } > + > +void visit_type_sized_buffer(Visitor *v, uint8_t **obj, size_t len, > + const char *name, Error **errp) > +{ > + if (!error_is_set(errp)) { > + v->type_sized_buffer(v, obj, len, name, errp); > + } > +} > -- > 1.7.10.4 > >