qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: mdroth <mdroth@linux.vnet.ibm.com>
Cc: Joel Schopp <jschopp@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, Michael Tsirkin <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 5/9] qapi_sized_buffer
Date: Wed, 13 Mar 2013 21:48:11 -0400	[thread overview]
Message-ID: <51412C5B.1000003@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130313231836.GA9093@vm>

On 03/13/2013 07:18 PM, mdroth wrote:
> On Wed, Mar 13, 2013 at 06:00:24PM -0400, Stefan Berger wrote:
>> On 03/13/2013 04:52 PM, mdroth wrote:
>>
> Visitors don't have any knowledge of the data structures they're visiting
> outside of what we tell them via the visit_*() API.
>
> [...]
>
> For example, a visitor for a 16-element array of:
>
> typedef struct ComplexType {
>      int32_t foo;
>      char *bar;
> } ComplexType;
>
> would look something like:
>
> visit_start_carray(v, ...); // instruct visitor how to calculate offsets
> for (i = 0; i < 16; i++) {
>      visit_type_ComplexType(v, ...) // instruct visitor how to handle elem
>      visit_next_carray(v, ...); // instruct visitor to move to next offset
> }
> visit_end_carray(v, ...); // instruct visitor to finalize array

Given this example above, I think we will need the sized buffer. The 
sized buffer targets  binary arrays and their encoding. If I was to 
encode an 'unsigned char[n]' (e.g., n=200) using n, or n/2 or n/4 loops 
like above breaking it apart in u8, u16 or u32 respectively I think this 
would 'not bed good' also considering the 2 bytes for tag and length 
being added by ASN.1 for every such datatype (u8,u16,u32). The sized 
buffer allows you to for example take a memory page and write it out in 
one chunk adding a few bytes of ASN.1 'decoration' around the actual data.

    Stefan

  reply	other threads:[~2013-03-14  1:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 18:56 [Qemu-devel] [PATCH 0/9 v3] Implement and test asn1 ber visitors Joel Schopp
2013-03-13 18:56 ` [Qemu-devel] [PATCH 1/9] qemu-file Joel Schopp
2013-03-13 18:56 ` [Qemu-devel] [PATCH 2/9] qapi_c_arrays.diff Joel Schopp
2013-03-13 19:11   ` Anthony Liguori
2013-03-13 22:54   ` Stefan Berger
2013-03-13 18:56 ` [Qemu-devel] [PATCH 3/9] two new file wrappers Joel Schopp
2013-03-13 21:04   ` Eric Blake
2013-03-14 10:49     ` Stefan Berger
2013-03-13 18:56 ` [Qemu-devel] [PATCH 4/9] qemu_qsb.diff Joel Schopp
2013-03-13 21:11   ` mdroth
2013-03-13 21:28     ` Stefan Berger
2013-03-13 22:41       ` mdroth
2013-03-13 22:47         ` mdroth
2013-03-13 23:11           ` Stefan Berger
2013-03-13 18:56 ` [Qemu-devel] [PATCH 5/9] qapi_sized_buffer Joel Schopp
2013-03-13 20:52   ` mdroth
2013-03-13 22:00     ` Stefan Berger
2013-03-13 23:18       ` mdroth
2013-03-14  1:48         ` Stefan Berger [this message]
2013-03-14 12:18           ` mdroth
2013-03-14 13:39             ` Stefan Berger
2013-03-14 14:28               ` mdroth
2013-03-14 14:51                 ` Stefan Berger
2013-03-14 15:11                   ` mdroth
2013-03-14 15:24                     ` Stefan Berger
2013-03-14 21:06                       ` mdroth
2013-03-15  2:05                         ` Stefan Berger
2013-03-13 18:56 ` [Qemu-devel] [PATCH 6/9] asn1_output-visitor.diff Joel Schopp
2013-03-13 18:56 ` [Qemu-devel] [PATCH 7/9] asn1_input-visitor.diff Joel Schopp
2013-03-13 18:56 ` [Qemu-devel] [PATCH 8/9] asn1_test_visitor_serialization.diff Joel Schopp
2013-03-13 18:56 ` [Qemu-devel] [PATCH 9/9] update_maintainers.diff Joel Schopp
  -- strict thread matches above, loose matches on Subject: below --
2013-03-13  3:09 [Qemu-devel] [PATCH 0/9 v2] Implement and test asn1 ber visitors Joel Schopp
2013-03-13  3:09 ` [Qemu-devel] [PATCH 5/9] qapi_sized_buffer Joel Schopp

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=51412C5B.1000003@linux.vnet.ibm.com \
    --to=stefanb@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).