Patchwork [V8,17/20] block: return bool for bdrv_can_snapshot()

login
register
mail settings
Submitter Wayne Xia
Date March 7, 2013, 6:07 a.m.
Message ID <1362636445-7188-18-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/225739/
State New
Headers show

Comments

Wayne Xia - March 7, 2013, 6:07 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 124a9eb..77e21f5 100644
--- a/block.c
+++ b/block.c
@@ -3123,21 +3123,21 @@  bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag)
 /**************************************************************/
 /* handling of snapshots */
 
-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 0f750d7..c883857 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -327,7 +327,7 @@  void bdrv_get_full_backing_filename(BlockDriverState *bs,
                                     char *dest, size_t sz);
 BlockInfo *bdrv_query_info(BlockDriverState *s);
 BlockStats *bdrv_query_stats(const 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,