All of lore.kernel.org
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/6] libqblock public type defines
Date: Mon, 3 Sep 2012 19:31:20 +0000	[thread overview]
Message-ID: <CAAu8pHt98X8=WcjPvxguY4R3jaa9MT+o2nS7cHbAPvdgrNMxgg@mail.gmail.com> (raw)
In-Reply-To: <1346663926-20188-3-git-send-email-xiawenc@linux.vnet.ibm.com>

On Mon, Sep 3, 2012 at 9:18 AM, Wenchao Xia <xiawenc@linux.vnet.ibm.com> wrote:
>   This patch contains public type and defines used in APIs.
>
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  libqblock/libqblock-types.h |  228 +++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 228 insertions(+), 0 deletions(-)
>  create mode 100644 libqblock/libqblock-types.h
>
> diff --git a/libqblock/libqblock-types.h b/libqblock/libqblock-types.h
> new file mode 100644
> index 0000000..3389bda
> --- /dev/null
> +++ b/libqblock/libqblock-types.h
> @@ -0,0 +1,228 @@
> +#ifndef LIBQBLOCK_TYPES_H
> +#define LIBQBLOCK_TYPES_H
> +
> +#include <stdio.h>
> +#include <stdint.h>
> +#include <stdlib.h>
> +#include <stdbool.h>
> +
> +/* this library is designed around this core struct. */
> +struct QBlockState;
> +
> +/* every thread would have a broker. */
> +struct QBroker;
> +
> +/* flag used in open and create */
> +#define LIBQBLOCK_O_RDWR        0x0002
> +/* do not use the host page cache */
> +#define LIBQBLOCK_O_NOCACHE     0x0020
> +/* use write-back caching */
> +#define LIBQBLOCK_O_CACHE_WB    0x0040
> +/* don't open the backing file */
> +#define LIBQBLOCK_O_NO_BACKING  0x0100
> +/* disable flushing on this disk */
> +#define LIBQBLOCK_O_NO_FLUSH    0x0200
> +
> +#define LIBQBLOCK_O_CACHE_MASK \
> +   (LIBQBLOCK_O_NOCACHE | LIBQBLOCK_O_CACHE_WB | LIBQBLOCK_O_NO_FLUSH)
> +
> +#define LIBQBLOCK_O_VALID_MASK \
> +   (LIBQBLOCK_O_RDWR | LIBQBLOCK_O_NOCACHE | LIBQBLOCK_O_CACHE_WB | \
> +    LIBQBLOCK_O_NO_BACKING | LIBQBLOCK_O_NO_FLUSH)
> +
> +enum QBlockProtocol {
> +    QB_PROTO_NONE = 0,
> +    QB_PROTO_FILE,
> +    QB_PROTO_MAX
> +};
> +
> +enum QBlockFormat {
> +    QB_FMT_NONE = 0,
> +    QB_FMT_COW,
> +    QB_FMT_QED,
> +    QB_FMT_QCOW,
> +    QB_FMT_QCOW2,
> +    QB_FMT_RAW,
> +    QB_FMT_RBD,
> +    QB_FMT_SHEEPDOG,
> +    QB_FMT_VDI,
> +    QB_FMT_VMDK,
> +    QB_FMT_VPC,
> +    QB_FMT_MAX
> +};
> +
> +struct QBlockOption_prot_file {

QBlockOptionProtFile

> +    char *filename;

'const'

> +};
> +
> +union QBlockOption_prot {

QBlockOptionProt

> +    struct QBlockOption_prot_file o_file;
> +};
> +
> +/**
> + * struct QBlockOptionLoc: contains information about how to find the image
> + *
> + * @prot_type: protocol type, now only support FILE.
> + * @prot_op: protocol related options.
> + */
> +struct QBlockOptionLoc {
> +    enum QBlockProtocol prot_type;
> +    union QBlockOption_prot prot_op;
> +    uint8_t reserved[512];
> +};
> +
> +/* format related options */
> +struct QBlockOption_fmt_cow {

QBlockOptionFmtCOW

> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +};
> +
> +struct QBlockOption_fmt_qed {

QBlockOptionFmtQED

etc. for the rest. Don't mix CamelCase with underscore style, struct
names must use CamelCase.

> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +    enum QBlockFormat backing_fmt;
> +    size_t cluster_size; /* unit is bytes */
> +    size_t table_size; /* unit is clusters */
> +};
> +
> +struct QBlockOption_fmt_qcow {
> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +    bool encrypt;
> +};
> +
> +/* "Compatibility level (0.10 or 1.1)" */
> +enum QBlockOption_fmt_qcow2_cpt {
> +    QBO_FMT_QCOW2_CPT_NONE = 0,
> +    QBO_FMT_QCOW2_CPT_V010,
> +    QBO_FMT_QCOW2_CPT_V110,
> +};
> +
> +/* off or metadata */
> +enum QBlockOption_fmt_qcow2_prealloc {
> +    QBO_FMT_QCOW2_PREALLOC_NONE = 0,
> +    QBO_FMT_QCOW2_PREALLOC_OFF,
> +    QBO_FMT_QCOW2_PREALLOC_METADATA,
> +};
> +
> +struct QBlockOption_fmt_qcow2 {
> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +    enum QBlockFormat backing_fmt;
> +    bool encrypt;
> +    size_t cluster_size; /* unit is bytes */
> +    enum QBlockOption_fmt_qcow2_cpt cpt_lv;
> +    enum QBlockOption_fmt_qcow2_prealloc pre_mode;
> +};
> +
> +struct QBlockOption_fmt_raw {
> +    size_t virt_size;
> +};
> +
> +struct QBlockOption_fmt_rbd {
> +    size_t virt_size;
> +    size_t cluster_size;
> +};
> +
> +/* off or full */
> +enum QBlockOption_fmt_sheepdog_prealloc {
> +    QBO_FMT_SD_PREALLOC_NONE = 0,
> +    QBO_FMT_SD_PREALLOC_OFF,
> +    QBO_FMT_SD_PREALLOC_FULL,
> +};
> +
> +struct QBlockOption_fmt_sheepdog {
> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +    enum QBlockOption_fmt_sheepdog_prealloc pre_mode;
> +};
> +
> +enum QBlockOption_fmt_vdi_prealloc {
> +    QBO_FMT_VDI_PREALLOC_NONE = 0,
> +    QBO_FMT_VDI_PREALLOC_FALSE,
> +    QBO_FMT_VDI_PREALLOC_TRUE,
> +};
> +
> +struct QBlockOption_fmt_vdi {
> +    size_t virt_size;
> +    size_t cluster_size;
> +    enum QBlockOption_fmt_vdi_prealloc pre_mode;
> +};
> +
> +/* whether compact to vmdk verion 6 */
> +enum QBlockOption_fmt_vmdk_cpt {
> +    QBO_FMT_VMDK_CPT_NONE = 0,
> +    QBO_FMT_VMDK_CPT_VMDKV6_FALSE,
> +    QBO_FMT_VMDK_CPT_VMDKV6_TRUE,
> +};
> +
> +/* vmdk flat extent format, values:
> +"{monolithicSparse (default) | monolithicFlat | twoGbMaxExtentSparse |
> +twoGbMaxExtentFlat | streamOptimized} */
> +enum QBlockOption_fmt_vmdk_subfmt {
> +    QBO_FMT_VMDK_SUBFMT_MONOLITHIC_NONE = 0,
> +    QBO_FMT_VMDK_SUBFMT_MONOLITHIC_SPARSE,
> +    QBO_FMT_VMDK_SUBFMT_MONOLITHIC_FLAT,
> +    QBO_FMT_VMDK_SUBFMT_TWOGBMAX_EXTENT_SPARSE,
> +    QBO_FMT_VMDK_SUBFMT_TWOGBMAX_EXTENT_FLAT,
> +    QBO_FMT_VMDK_SUBFMT_STREAM_OPTIMIZED,
> +};
> +
> +struct QBlockOption_fmt_vmdk {
> +    size_t virt_size;
> +    struct QBlockOptionLoc backing_loc;
> +    enum QBlockOption_fmt_vmdk_cpt cpt_lv;
> +    enum QBlockOption_fmt_vmdk_subfmt subfmt;
> +};
> +
> +/* "{dynamic (default) | fixed} " */
> +enum QBlockOption_fmt_vpc_subfmt {
> +    QBO_FMT_VPC_SUBFMT_NONE = 0,
> +    QBO_FMT_VPC_SUBFMT_DYNAMIC,
> +    QBO_FMT_VPC_SUBFMT_FIXED,
> +};
> +
> +struct QBlockOption_fmt_vpc {
> +    size_t virt_size;
> +    enum QBlockOption_fmt_vpc_subfmt subfmt;
> +};
> +
> +union QBlockOption_fmt {
> +    struct QBlockOption_fmt_cow       o_cow;
> +    struct QBlockOption_fmt_qed       o_qed;
> +    struct QBlockOption_fmt_qcow      o_qcow;
> +    struct QBlockOption_fmt_qcow2     o_qcow2;
> +    struct QBlockOption_fmt_raw       o_raw;
> +    struct QBlockOption_fmt_rbd       o_rbd;
> +    struct QBlockOption_fmt_sheepdog  o_sheepdog;
> +    struct QBlockOption_fmt_vdi       o_vdi;
> +    struct QBlockOption_fmt_vmdk      o_vmdk;
> +    struct QBlockOption_fmt_vpc       o_vpc;
> +};
> +
> +struct QBlockOptionFormat {
> +    enum QBlockFormat fmt_type;
> +    union QBlockOption_fmt fmt_op;
> +    uint8_t reserved[512];
> +};
> +
> +/**
> + * QBlockInfoImageStatic: information about the block image.
> + *
> + * @loc: location info.
> + * @fmt_type: format type.
> + * @virt_size: virtual size in bytes.
> + * @backing_loc: backing file location, its type is QB_PROT_NONE if not exist.
> + * @allocated_size: allocated size in bytes, negative if not available.
> + * @encrypt: encrypt flag.
> + */
> +struct QBlockInfoImageStatic {
> +    struct QBlockOptionLoc loc;
> +    enum QBlockFormat fmt_type;
> +    size_t virt_size;
> +    /* advance info */
> +    struct QBlockOptionLoc backing_loc;
> +    size_t allocated_size;
> +    bool encrypt;
> +};
> +#endif
> --
> 1.7.1
>
>
>

  parent reply	other threads:[~2012-09-03 19:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03  9:18 [Qemu-devel] [PATCH 0/6] libqblock, qemu block layer library Wenchao Xia
2012-09-03  9:18 ` [Qemu-devel] [PATCH 1/6] libqblock APIs Wenchao Xia
2012-09-03 13:18   ` Paolo Bonzini
2012-09-04  3:15     ` Wenchao Xia
2012-09-04  6:50       ` Paolo Bonzini
2012-09-04  9:05         ` Wenchao Xia
2012-09-10  8:10         ` Wenchao Xia
2012-09-03 13:56   ` Eric Blake
2012-09-03 14:05     ` Paolo Bonzini
2012-09-04  7:05       ` Wenchao Xia
2012-09-04  7:29         ` Paolo Bonzini
2012-09-04  6:42     ` Wenchao Xia
2012-09-04 11:35       ` Eric Blake
2012-09-04 13:47         ` Paolo Bonzini
2012-09-03 19:22   ` Blue Swirl
2012-09-03  9:18 ` [Qemu-devel] [PATCH 2/6] libqblock public type defines Wenchao Xia
2012-09-03 13:13   ` Paolo Bonzini
2012-09-04  2:00     ` Wenchao Xia
2012-09-03 14:20   ` Eric Blake
2012-09-04  7:10     ` Wenchao Xia
2012-09-04  7:37       ` Paolo Bonzini
2012-09-03 19:31   ` Blue Swirl [this message]
2012-09-04  7:19     ` Wenchao Xia
2012-09-04  7:38       ` Paolo Bonzini
2012-09-04 19:22         ` Blue Swirl
2012-09-10  8:22           ` Wenchao Xia
2012-09-03  9:18 ` [Qemu-devel] [PATCH 3/6] libqblock error handling Wenchao Xia
2012-09-03 14:22   ` Eric Blake
2012-09-04  7:12     ` Wenchao Xia
2012-09-10  8:20     ` Wenchao Xia
2012-09-03  9:18 ` [Qemu-devel] [PATCH 4/6] libqblock internal used functions Wenchao Xia
2012-09-03 13:18   ` Paolo Bonzini
2012-09-04  3:19     ` Wenchao Xia
2012-09-03 14:28   ` Eric Blake
2012-09-03 15:18     ` Paolo Bonzini
2012-09-04  7:15       ` Wenchao Xia
2012-09-04  7:38         ` Paolo Bonzini
2012-09-04 11:38         ` Eric Blake
2012-09-04 13:49           ` Paolo Bonzini
2012-09-04 13:51             ` Kevin Wolf
2012-09-10  8:23               ` Wenchao Xia
2012-09-03  9:18 ` [Qemu-devel] [PATCH 5/6] libqblock test example Wenchao Xia
2012-09-03 19:27   ` Blue Swirl
2012-09-03  9:18 ` [Qemu-devel] [PATCH 6/6] libqblock building system Wenchao Xia
2012-09-03 13:10   ` [Qemu-devel] xbzrle migration cache size advise for high memory changes workload ? Alexandre DERUMIER
2012-09-04 14:05     ` Orit Wasserman

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='CAAu8pHt98X8=WcjPvxguY4R3jaa9MT+o2nS7cHbAPvdgrNMxgg@mail.gmail.com' \
    --to=blauwirbel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=xiawenc@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.