Patchwork [V7,03/14] block: return bool for bdrv_can_snapshot()

login
register
mail settings
Submitter Wayne Xia
Date Feb. 26, 2013, 10:40 a.m.
Message ID <1361875228-15769-4-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/223202/
State New
Headers show

Comments

Wayne Xia - Feb. 26, 2013, 10:40 a.m.
This function should return bool instead of int, just as
bdrv_can_read_snapshot().

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block.c               |    8 ++++----
 include/block/block.h |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

Patch

diff --git a/block.c b/block.c
index 19c2d7b..0ed8190 100644
--- a/block.c
+++ b/block.c
@@ -3077,21 +3077,21 @@  bool bdrv_can_read_snapshot(BlockDriverState *bs)
 }
 
 /* return whether internal snapshot can be write on @bs */
-int bdrv_can_snapshot(BlockDriverState *bs)
+bool bdrv_can_snapshot(BlockDriverState *bs)
 {
     BlockDriver *drv = bs->drv;
     if (!drv || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
-        return 0;
+        return false;
     }
 
     if (!drv->bdrv_snapshot_create) {
         if (bs->file != NULL) {
             return bdrv_can_snapshot(bs->file);
         }
-        return 0;
+        return false;
     }
 
-    return 1;
+    return true;
 }
 
 int bdrv_is_snapshot(BlockDriverState *bs)
diff --git a/include/block/block.h b/include/block/block.h
index 4c48052..2dabb87 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -322,7 +322,7 @@  void bdrv_get_full_backing_filename(BlockDriverState *bs,
 BlockInfo *bdrv_query_info(BlockDriverState *s);
 BlockStats *bdrv_query_stats(const BlockDriverState *bs);
 bool bdrv_can_read_snapshot(BlockDriverState *bs);
-int bdrv_can_snapshot(BlockDriverState *bs);
+bool bdrv_can_snapshot(BlockDriverState *bs);
 int bdrv_is_snapshot(BlockDriverState *bs);
 BlockDriverState *bdrv_snapshots(void);
 int bdrv_snapshot_create(BlockDriverState *bs,