diff mbox

[v19,02/16] block: Add BlockOpType enum

Message ID 1399858555-9672-3-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng May 12, 2014, 1:35 a.m. UTC
This adds the enum of all the operations that can be taken on a block
device.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Jeff Cody <jcody@redhat.com>
---
 include/block/block.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Markus Armbruster May 19, 2014, 1:55 p.m. UTC | #1
Fam Zheng <famz@redhat.com> writes:

> This adds the enum of all the operations that can be taken on a block
> device.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> Reviewed-by: Benoit Canet <benoit@irqsave.net>
> Reviewed-by: Jeff Cody <jcody@redhat.com>
> ---
>  include/block/block.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index 467fb2b..ac3a69b 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -155,6 +155,25 @@ typedef struct BDRVReopenState {
>      void *opaque;
>  } BDRVReopenState;
>  
> +/*
> + * Block operation types
> + */
> +typedef enum BlockOpType {
> +    BLOCK_OP_TYPE_BACKUP_SOURCE,
> +    BLOCK_OP_TYPE_BACKUP_TARGET,
> +    BLOCK_OP_TYPE_CHANGE,
> +    BLOCK_OP_TYPE_COMMIT,
> +    BLOCK_OP_TYPE_DATAPLANE,
> +    BLOCK_OP_TYPE_DRIVE_DEL,
> +    BLOCK_OP_TYPE_EJECT,
> +    BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
> +    BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
> +    BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
> +    BLOCK_OP_TYPE_MIRROR,
> +    BLOCK_OP_TYPE_RESIZE,
> +    BLOCK_OP_TYPE_STREAM,
> +    BLOCK_OP_TYPE_MAX,
> +} BlockOpType;
>  
>  void bdrv_iostatus_enable(BlockDriverState *bs);
>  void bdrv_iostatus_reset(BlockDriverState *bs);

Observation, not objection: BLOCK_OP_TYPE_COMMIT,
BLOCK_OP_TYPE_INTERNAL_SNAPSHOT and
BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE are not used in this series.
Eric Blake May 19, 2014, 3:53 p.m. UTC | #2
On 05/11/2014 07:35 PM, Fam Zheng wrote:
> This adds the enum of all the operations that can be taken on a block
> device.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> Reviewed-by: Benoit Canet <benoit@irqsave.net>
> Reviewed-by: Jeff Cody <jcody@redhat.com>
> ---
>  include/block/block.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Is it worth making this a formal QAPI enum, documented in the .json
file? If we ever add qapi introspection, it might be nice to know when
new block op types are added as part of the formal qapi definition.
Markus Armbruster May 19, 2014, 4:15 p.m. UTC | #3
Eric Blake <eblake@redhat.com> writes:

> On 05/11/2014 07:35 PM, Fam Zheng wrote:
>> This adds the enum of all the operations that can be taken on a block
>> device.
>> 
>> Signed-off-by: Fam Zheng <famz@redhat.com>
>> Reviewed-by: Benoit Canet <benoit@irqsave.net>
>> Reviewed-by: Jeff Cody <jcody@redhat.com>
>> ---
>>  include/block/block.h | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>
> Is it worth making this a formal QAPI enum, documented in the .json
> file? If we ever add qapi introspection, it might be nice to know when
> new block op types are added as part of the formal qapi definition.

Moving it into the schema when QAPI needs it shouldn't be hard.
Fam Zheng May 20, 2014, 3:09 a.m. UTC | #4
On Mon, 05/19 18:15, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
> > On 05/11/2014 07:35 PM, Fam Zheng wrote:
> >> This adds the enum of all the operations that can be taken on a block
> >> device.
> >> 
> >> Signed-off-by: Fam Zheng <famz@redhat.com>
> >> Reviewed-by: Benoit Canet <benoit@irqsave.net>
> >> Reviewed-by: Jeff Cody <jcody@redhat.com>
> >> ---
> >>  include/block/block.h | 19 +++++++++++++++++++
> >>  1 file changed, 19 insertions(+)
> >
> > Is it worth making this a formal QAPI enum, documented in the .json
> > file? If we ever add qapi introspection, it might be nice to know when
> > new block op types are added as part of the formal qapi definition.
> 
> Moving it into the schema when QAPI needs it shouldn't be hard.
> 

Yes. It was a QAPI enum before v9. The previous discussion about this was in v8
series, where I decided to keep this internal only:

http://patchwork.ozlabs.org/patch/300933/

Fam
diff mbox

Patch

diff --git a/include/block/block.h b/include/block/block.h
index 467fb2b..ac3a69b 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -155,6 +155,25 @@  typedef struct BDRVReopenState {
     void *opaque;
 } BDRVReopenState;
 
+/*
+ * Block operation types
+ */
+typedef enum BlockOpType {
+    BLOCK_OP_TYPE_BACKUP_SOURCE,
+    BLOCK_OP_TYPE_BACKUP_TARGET,
+    BLOCK_OP_TYPE_CHANGE,
+    BLOCK_OP_TYPE_COMMIT,
+    BLOCK_OP_TYPE_DATAPLANE,
+    BLOCK_OP_TYPE_DRIVE_DEL,
+    BLOCK_OP_TYPE_EJECT,
+    BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
+    BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
+    BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
+    BLOCK_OP_TYPE_MIRROR,
+    BLOCK_OP_TYPE_RESIZE,
+    BLOCK_OP_TYPE_STREAM,
+    BLOCK_OP_TYPE_MAX,
+} BlockOpType;
 
 void bdrv_iostatus_enable(BlockDriverState *bs);
 void bdrv_iostatus_reset(BlockDriverState *bs);