[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v6 5/9] block: Add bdrv_filename()
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [PATCH v6 5/9] block: Add bdrv_filename() |
Date: |
Mon, 16 Jan 2017 15:33:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 |
On 01/13/2017 02:52 PM, Max Reitz wrote:
> Split the part which actually refreshes the BlockDriverState.filename
> field off of bdrv_refresh_filename() into a more generic function
> bdrv_filename(), which first calls bdrv_refresh_filename() and then
> stores a qemu-usable filename in the given buffer instead of
> BlockDriverState.filename.
>
> Since bdrv_refresh_filename() therefore no longer refreshes that field,
> all of the existing calls to that function have to be replaced by calls
> to bdrv_filename() "manually" refreshing the BDS filename field (this is
> only temporary).
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> include/block/block.h | 1 +
> block.c | 50 +++++++++++++++++++++++++++++++++++++++++---------
> block/replication.c | 2 +-
> blockdev.c | 3 ++-
> 4 files changed, 45 insertions(+), 11 deletions(-)
>
> +
> +/* First refreshes exact_filename and full_open_options by calling
> + * bdrv_refresh_filename(). Then, if exact_filename is set, it is copied into
> + * the target buffer. Otherwise, full_open_options is converted to a JSON
> + * object, prefixed with "json:" (for use through the JSON pseudo protocol)
> and
> + * put there.
> + *
> + * If @dest is not NULL, the filename will be truncated to @sz - 1 bytes and
> + * placed there. If @sz > 0, it will always be null-terminated.
> + *
> + * If @dest is NULL, @sz is ignored and a new buffer will be allocated which
> is
> + * large enough to hold the filename and the trailing '\0'. This buffer is
> then
> + * returned and has to be freed by the caller when it is no longer needed.
> + *
> + * Returns @dest if it is not NULL, and the newly allocated buffer otherwise.
> + */
> +char *bdrv_filename(BlockDriverState *bs, char *dest, size_t sz)
Seems like a reasonable interface.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v6 0/9] block: Drop BDS.filename, Max Reitz, 2017/01/13
- [Qemu-block] [PATCH v6 1/9] block: Always set *file in get_block_status, Max Reitz, 2017/01/13
- [Qemu-block] [PATCH v6 2/9] block: Change bdrv_get_encrypted_filename(), Max Reitz, 2017/01/13
- [Qemu-block] [PATCH v6 3/9] block: Avoid BlockDriverState.filename, Max Reitz, 2017/01/13
- [Qemu-block] [PATCH v6 4/9] block: Do not blindly copy filename from file, Max Reitz, 2017/01/13
- [Qemu-block] [PATCH v6 5/9] block: Add bdrv_filename(), Max Reitz, 2017/01/13
- Re: [Qemu-block] [PATCH v6 5/9] block: Add bdrv_filename(),
Eric Blake <=
- [Qemu-block] [PATCH v6 9/9] iotests: Test changed Quorum filename, Max Reitz, 2017/01/16
- [Qemu-block] [PATCH v6 8/9] block: Complete move to pull filename updates, Max Reitz, 2017/01/16
- [Qemu-block] [PATCH v6 7/9] block: Drop BlockDriverState.filename, Max Reitz, 2017/01/16
- [Qemu-block] [PATCH v6 6/9] qemu-img: Use bdrv_filename() for map, Max Reitz, 2017/01/16
- Re: [Qemu-block] [PATCH v6 0/9] block: Drop BDS.filename, Max Reitz, 2017/01/16