[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/19] block: Get full backing filename from string
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 08/19] block: Get full backing filename from string |
Date: |
Fri, 19 Dec 2014 17:34:58 +0100 |
From: Max Reitz <address@hidden>
Introduce bdrv_get_full_backing_filename_from_filename(), a function
which takes the name of the backed file and a potentially relative
backing filename to produce the full (absolute) backing filename.
Use this function from bdrv_get_full_backing_filename().
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 16 ++++++++++++----
include/block/block.h | 3 +++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index 58f8042..86f2faa 100644
--- a/block.c
+++ b/block.c
@@ -303,15 +303,23 @@ void path_combine(char *dest, int dest_size,
}
}
-void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t
sz)
+void bdrv_get_full_backing_filename_from_filename(const char *backed,
+ const char *backing,
+ char *dest, size_t sz)
{
- if (bs->backing_file[0] == '\0' || path_has_protocol(bs->backing_file)) {
- pstrcpy(dest, sz, bs->backing_file);
+ if (backing[0] == '\0' || path_has_protocol(backing)) {
+ pstrcpy(dest, sz, backing);
} else {
- path_combine(dest, sz, bs->filename, bs->backing_file);
+ path_combine(dest, sz, backed, backing);
}
}
+void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t
sz)
+{
+ bdrv_get_full_backing_filename_from_filename(bs->filename,
bs->backing_file,
+ dest, sz);
+}
+
void bdrv_register(BlockDriver *bdrv)
{
/* Block drivers without coroutine functions need emulation */
diff --git a/include/block/block.h b/include/block/block.h
index 6e7275d..eac9bb0 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -397,6 +397,9 @@ void bdrv_get_backing_filename(BlockDriverState *bs,
char *filename, int filename_size);
void bdrv_get_full_backing_filename(BlockDriverState *bs,
char *dest, size_t sz);
+void bdrv_get_full_backing_filename_from_filename(const char *backed,
+ const char *backing,
+ char *dest, size_t sz);
int bdrv_is_snapshot(BlockDriverState *bs);
int path_has_protocol(const char *path);
--
1.8.3.1
- [Qemu-devel] [PULL 00/19] Block patches, (continued)
- [Qemu-devel] [PULL 00/19] Block patches, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 02/19] qemu-iotests: Speed up make check-block, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 05/19] block: do not allocate an iovec per read of a growable/zero_after_eof BDS, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 06/19] block: replace g_new0 with g_new for bottom half allocation., Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 01/19] qemu-iotests: Remove 091 from quick group, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 07/19] checkpatch: Brace handling on multi-line condition, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 04/19] block: mark AioContext as recursive, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 12/19] iotests: Add test for relative backing file names, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 03/19] tests/Makefile: Add check-block to make check, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 11/19] block/vmdk: Relative backing file for creation, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 08/19] block: Get full backing filename from string,
Kevin Wolf <=
- [Qemu-devel] [PULL 14/19] block: fix spoiling all dirty bitmaps by mirror and migration, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 10/19] block: Relative backing file for image creation, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 09/19] block: JSON filenames and relative backing files, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 13/19] qapi: Fix document for BlockStats.node-name, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 15/19] qapi: Comment version info in TransactionAction, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 18/19] qemu-iotests: Test blockdev-backup in 055, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 17/19] block: Add blockdev-backup to transaction, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 19/19] iotests: Filter out "I/O thread spun..." warning, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 16/19] qmp: Add command 'blockdev-backup', Kevin Wolf, 2014/12/19
- Re: [Qemu-devel] [PULL 00/19] Block patches, Peter Maydell, 2014/12/22