[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/34] block: Constify data passed by pointer to blk_
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 01/34] block: Constify data passed by pointer to blk_name |
Date: |
Fri, 28 Apr 2017 22:33:09 +0200 |
From: Krzysztof Kozlowski <address@hidden>
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>
Signed-off-by: Kevin Wolf <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 7405024..ae3d771 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -420,7 +420,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 7462228..133e542 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -99,7 +99,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);
--
1.8.3.1
- [Qemu-devel] [PULL 00/34] Block layer patches, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 02/34] file-posix: Remove unnecessary includes, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 01/34] block: Constify data passed by pointer to blk_name,
Kevin Wolf <=
- [Qemu-devel] [PULL 03/34] file-win32: Remove unnecessary include, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 04/34] Revert "block/io: Comment out permission assertions", Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 06/34] migration: Call blk_resume_after_migration() for postcopy, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 05/34] qemu-img: simplify img_convert, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 08/34] qemu-iotests: Test postcopy migration, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 10/34] iotests/051: Add test for empty filename, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 09/34] block: An empty filename counts as no filename, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 11/34] qemu-iotests: Remove PERL_PROG and BC_PROG, Kevin Wolf, 2017/04/28
- [Qemu-devel] [PULL 12/34] qemu_iotests: Remove _readlink(), Kevin Wolf, 2017/04/28