block: iostatus: Drop BDRV_IOS_INVAL
authorLuiz Capitulino <lcapitulino@redhat.com>
Fri, 14 Oct 2011 20:11:23 +0000 (17:11 -0300)
committerLuiz Capitulino <lcapitulino@redhat.com>
Thu, 27 Oct 2011 13:48:47 +0000 (11:48 -0200)
A future commit will convert bdrv_info() to the QAPI and it won't
provide IOS_INVAL.

Luckily all we have to do is to add a new 'iostatus_enabled'
member to BlockDriverState and use it instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
block.c
block.h
block_int.h

diff --git a/block.c b/block.c
index 70aab63e4b8edcde7661c31c92d0b811bf2bb70e..4dc2b85b86f6f5e4378668be48ff3b6697a8355e 100644 (file)
--- a/block.c
+++ b/block.c
@@ -3139,6 +3139,7 @@ int bdrv_in_use(BlockDriverState *bs)
 
 void bdrv_iostatus_enable(BlockDriverState *bs)
 {
+    bs->iostatus_enabled = true;
     bs->iostatus = BDRV_IOS_OK;
 }
 
@@ -3146,7 +3147,7 @@ void bdrv_iostatus_enable(BlockDriverState *bs)
  * enables it _and_ the VM is configured to stop on errors */
 bool bdrv_iostatus_is_enabled(const BlockDriverState *bs)
 {
-    return (bs->iostatus != BDRV_IOS_INVAL &&
+    return (bs->iostatus_enabled &&
            (bs->on_write_error == BLOCK_ERR_STOP_ENOSPC ||
             bs->on_write_error == BLOCK_ERR_STOP_ANY    ||
             bs->on_read_error == BLOCK_ERR_STOP_ANY));
@@ -3154,7 +3155,7 @@ bool bdrv_iostatus_is_enabled(const BlockDriverState *bs)
 
 void bdrv_iostatus_disable(BlockDriverState *bs)
 {
-    bs->iostatus = BDRV_IOS_INVAL;
+    bs->iostatus_enabled = false;
 }
 
 void bdrv_iostatus_reset(BlockDriverState *bs)
diff --git a/block.h b/block.h
index 5a042c96e783e3d49fa11ebde655f8e792bcc594..1823e93801b622bdf03d8ea7a3447b93e17a88ee 100644 (file)
--- a/block.h
+++ b/block.h
@@ -78,8 +78,7 @@ typedef enum {
 } BlockMonEventAction;
 
 typedef enum {
-    BDRV_IOS_INVAL, BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC,
-    BDRV_IOS_MAX
+    BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, BDRV_IOS_MAX
 } BlockIOStatus;
 
 void bdrv_iostatus_enable(BlockDriverState *bs);
index dac00f504fcea45bff7eef09341f6d6b2b33ce93..3929ec90a55a02a1f9e0c4187f44c602fe513dbe 100644 (file)
@@ -202,6 +202,7 @@ struct BlockDriverState {
        drivers. They are not used by the block driver */
     int cyls, heads, secs, translation;
     BlockErrorAction on_read_error, on_write_error;
+    bool iostatus_enabled;
     BlockIOStatus iostatus;
     char device_name[32];
     unsigned long *dirty_bitmap;