qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V5 3/5] libqblock API
Date: Sat, 29 Sep 2012 10:37:17 +0200	[thread overview]
Message-ID: <k46bvs$c2p$1@ger.gmane.org> (raw)
In-Reply-To: <1348906418-16471-4-git-send-email-xiawenc@linux.vnet.ibm.com>

Il 29/09/2012 10:13, Wenchao Xia ha scritto:
> +static void qb_setup_info_addr(QBlockStaticInfo *info,
> +                               QBlockStaticInfoAddr *info_addr)
> +{
> +    uint64_t *virt_size = NULL;
> +    QBlockLocationInfo *backing_loc = NULL;
> +    bool *encrypt = NULL;
> +    QBlockFormatInfo *fmt = &(info->fmt);
> +
> +    switch (fmt->fmt_type) {
> +    case QB_FMT_COW:
> +        virt_size = &(fmt->o_cow.virt_size);
> +        backing_loc = &(fmt->o_cow.backing_loc);
> +        break;
> +    case QB_FMT_QED:
> +        virt_size = &(fmt->o_qed.virt_size);
> +        backing_loc = &(fmt->o_qed.backing_loc);
> +        break;
> +    case QB_FMT_QCOW:
> +        virt_size = &(fmt->o_qcow.virt_size);
> +        backing_loc = &(fmt->o_qcow.backing_loc);
> +        encrypt = &(fmt->o_qcow.encrypt);
> +        break;
> +    case QB_FMT_QCOW2:
> +        virt_size = &(fmt->o_qcow2.virt_size);
> +        backing_loc = &(fmt->o_qcow2.backing_loc);
> +        encrypt = &(fmt->o_qcow2.encrypt);
> +        break;
> +    case QB_FMT_RAW:
> +        virt_size = &(fmt->o_raw.virt_size);
> +        break;
> +    case QB_FMT_RBD:
> +        virt_size = &(fmt->o_rbd.virt_size);
> +        break;
> +    case QB_FMT_SHEEPDOG:
> +        virt_size = &(fmt->o_sd.virt_size);
> +        backing_loc = &(fmt->o_sd.backing_loc);
> +        break;
> +    case QB_FMT_VDI:
> +        virt_size = &(fmt->o_vdi.virt_size);
> +        break;
> +    case QB_FMT_VMDK:
> +        virt_size = &(fmt->o_vmdk.virt_size);
> +        backing_loc = &(fmt->o_vmdk.backing_loc);
> +        break;
> +    case QB_FMT_VPC:
> +        virt_size = &(fmt->o_vpc.virt_size);
> +        break;
> +    default:
> +        break;
> +    }
> +
> +    info_addr->virt_size = virt_size;
> +    info_addr->backing_loc = backing_loc;
> +    info_addr->encrypt = encrypt;
> +    return;
> +}
> +
> +const uint64_t *qb_get_virt_size(const QBlockStaticInfo *info)
> +{
> +    return info->member_addr->virt_size;

Please change this to:

     QBlockStaticInfoAddr addrs;
     qb_setup_info_addr(info, &addrs);
     return *addrs->virt_size;

and similarly for the others.

QBlockStaticInfoAddr should not be a public struct.  I'm sorry if this
wasn't clear.

I'll review the rest on Monday.

Paolo

> +}
> +
> +const QBlockLocationInfo *qb_get_backing_loc(const QBlockStaticInfo *info)
> +{
> +    return info->member_addr->backing_loc;
> +}
> +
> +const bool *qb_get_encrypt(const QBlockStaticInfo *info)
> +{
> +    return info->member_addr->encrypt;
> +}
> +

  reply	other threads:[~2012-09-29  8:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29  8:13 [Qemu-devel] [PATCH V5 0/5] libqblock qemu block layer library Wenchao Xia
2012-09-29  8:13 ` [Qemu-devel] [PATCH V5 1/5] libqblock build system Wenchao Xia
2012-09-29  8:13 ` [Qemu-devel] [PATCH V5 2/5] libqblock type defines Wenchao Xia
2012-09-29  8:13 ` [Qemu-devel] [PATCH V5 3/5] libqblock API Wenchao Xia
2012-09-29  8:37   ` Paolo Bonzini [this message]
2012-09-29  8:13 ` [Qemu-devel] [PATCH V5 4/5] libqblock test build system Wenchao Xia
2012-09-29  8:13 ` [Qemu-devel] [PATCH V5 5/5] libqblock test example Wenchao Xia
2012-10-03 11:31   ` wenchao xia
2012-10-03 12:21     ` Paolo Bonzini
2012-10-05 11:20       ` wenchao xia
2012-10-05 11:32         ` Paolo Bonzini

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='k46bvs$c2p$1@ger.gmane.org' \
    --to=pbonzini@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).