Patchwork [RFC,V6,05/33] qcow2: Make update_refcount public.

login
register
mail settings
Submitter Benoît Canet
Date Feb. 6, 2013, 12:31 p.m.
Message ID <1360153926-9492-6-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/218605/
State New
Headers show

Comments

Benoît Canet - Feb. 6, 2013, 12:31 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block/qcow2-refcount.c |    6 +-----
 block/qcow2.h          |    2 ++
 2 files changed, 3 insertions(+), 5 deletions(-)
Stefan Hajnoczi - Feb. 6, 2013, 4:50 p.m.
On Wed, Feb 06, 2013 at 01:31:38PM +0100, Benoît Canet wrote:
>  /* XXX: cache several refcount block clusters ? */
> -static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
> +int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,

Public functions are prefixed with qcow2_.

At this point in the series it's also hard to know whether the code
which will call into update_refcount() would better be located in
block/qcow2-refcount.c, keeping update_refcount() static.
Eric Blake - Feb. 6, 2013, 5:49 p.m.
On 02/06/2013 05:31 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block/qcow2-refcount.c |    6 +-----
>  block/qcow2.h          |    2 ++
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> @@ -413,7 +409,7 @@ fail_block:
>  }
>  
>  /* XXX: cache several refcount block clusters ? */
> -static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
> +int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
>      int64_t offset, int64_t length, int addend)

Fix the indentation while touching this.

>  {
>      BDRVQcowState *s = bs->opaque;
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 0197a2b..8867091 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -396,6 +396,8 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
>  
>  int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
>                            BdrvCheckMode fix);
> +int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
> +    int64_t offset, int64_t length, int addend);

Indentation is off (second line should start after the '(' of the first
line; wrap to more than two lines if needed).

Patch

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index bc1784c..296c440 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -27,10 +27,6 @@ 
 #include "block/qcow2.h"
 
 static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size);
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
-                            int64_t offset, int64_t length,
-                            int addend);
-
 
 /*********************************************************/
 /* refcount handling */
@@ -413,7 +409,7 @@  fail_block:
 }
 
 /* XXX: cache several refcount block clusters ? */
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
+int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
     int64_t offset, int64_t length, int addend)
 {
     BDRVQcowState *s = bs->opaque;
diff --git a/block/qcow2.h b/block/qcow2.h
index 0197a2b..8867091 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -396,6 +396,8 @@  int qcow2_update_snapshot_refcount(BlockDriverState *bs,
 
 int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
                           BdrvCheckMode fix);
+int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
+    int64_t offset, int64_t length, int addend);
 
 /* qcow2-cluster.c functions */
 int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size);