[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] block: Constify data passed by pointer to blk_n

From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH] block: Constify data passed by pointer to blk_name
Date: Sun, 5 Mar 2017 18:58:25 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

On 03/05/2017 06:44 PM, Krzysztof Kozlowski wrote:
blk_name() is not modifying data passed to it through pointer and it
returns also a pointer to const so the argument can be made const for
code safeness.

Signed-off-by: Krzysztof Kozlowski <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

 block/block-backend.c          | 2 +-
 include/sysemu/block-backend.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index daa7908d0151..2d2169a5dfb0 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -409,7 +409,7 @@ void monitor_remove_blk(BlockBackend *blk)
  * Return @blk's name, a non-null string.
  * Returns an empty string iff @blk is not referenced by the monitor.
-const char *blk_name(BlockBackend *blk)
+const char *blk_name(const BlockBackend *blk)
     return blk->name ?: "";
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 096c17fce064..d16c85d67b5c 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -91,7 +91,7 @@ int blk_get_refcnt(BlockBackend *blk);
 void blk_ref(BlockBackend *blk);
 void blk_unref(BlockBackend *blk);
 void blk_remove_all_bs(void);
-const char *blk_name(BlockBackend *blk);
+const char *blk_name(const BlockBackend *blk);
 BlockBackend *blk_by_name(const char *name);
 BlockBackend *blk_next(BlockBackend *blk);
 bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]