From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org, anthony@codemonkey.ws
Cc: jschopp@linux.vnet.ibm.com, coreyb@linux.vnet.ibm.com,
mdroth@linux.vnet.ibm.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH v5 4/8] QAPI: add type_sized_buffer
Date: Thu, 28 Mar 2013 07:38:15 -0400 [thread overview]
Message-ID: <1364470699-16223-5-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1364470699-16223-1-git-send-email-stefanb@linux.vnet.ibm.com>
Add a sized buffer interface to qapi for serializing and
deserializing of u8[], u16[], u32[] and u64[] with proper
handling of endianess.
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: Michael Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
---
include/qapi/visitor-impl.h | 3 +++
include/qapi/visitor.h | 3 +++
qapi/qapi-visit-core.c | 8 ++++++++
3 files changed, 14 insertions(+)
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 5159964..be4e5ab 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -34,6 +34,9 @@ struct Visitor
void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp);
void (*type_number)(Visitor *v, double *obj, const char *name,
Error **errp);
+ void (*type_sized_buffer)(Visitor *v, void **obj, const char *name,
+ size_t elem_count, size_t elem_size,
+ 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 1fef18c..66ba4bf 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -51,5 +51,8 @@ void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp);
void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp);
+void visit_type_sized_buffer(Visitor *v, void **obj, const char *name,
+ size_t elem_counter, size_t elem_size,
+ Error **errp);
#endif
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index 401ee6e..374c0ff 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -313,3 +313,11 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[],
g_free(enum_str);
*obj = value;
}
+
+void visit_type_sized_buffer(Visitor *v, void **obj, const char *name,
+ size_t elem_count, size_t elem_size, Error **errp)
+{
+ if (!error_is_set(errp)) {
+ v->type_sized_buffer(v, obj, name, elem_count, elem_size, errp);
+ }
+}
--
1.7.11.7
next prev parent reply other threads:[~2013-03-28 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 11:38 [Qemu-devel] [PATCH v5 0/8] Implement and test ASN.1 BER visitors Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 1/8] Move some contents of savevm.c to qemu-file.c Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 2/8] 3 new file wrappers Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 3/8] QEMUSizedBuffer Stefan Berger
2013-03-28 11:38 ` Stefan Berger [this message]
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 5/8] ASN.1 output visitor Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 6/8] ASN.1 input visitor Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 7/8] Extend test-visitor-serialization with ASN.1 visitor(s) Stefan Berger
2013-03-28 11:38 ` [Qemu-devel] [PATCH v5 8/8] ASN.1 specific test cases Stefan Berger
2013-03-28 11:43 ` [Qemu-devel] [PATCH v5 0/8] Implement and test ASN.1 BER visitors Stefan Berger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364470699-16223-5-git-send-email-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=anthony@codemonkey.ws \
--cc=coreyb@linux.vnet.ibm.com \
--cc=jschopp@linux.vnet.ibm.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).