On 01/16/2017 02:49 PM, Max Reitz wrote:
> This function may be implemented by block drivers to derive a directory
> name from a BDS. Concatenating this g_free()-able string with a relative
> filename must result in a valid (not necessarily existing) filename, so
> this is a function that should generally be not implemented by format
> drivers, because this is protocol-specific.
> 
> If a BDS's driver does not implement this function, bdrv_dirname() will
> fall through to the BDS's file if it exists. If it does not, the
> exact_filename field will be used to generate a directory name.
> 
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  include/block/block.h     |  1 +
>  include/block/block_int.h |  1 +
>  block.c                   | 26 ++++++++++++++++++++++++++
>  3 files changed, 28 insertions(+)

> +++ b/include/block/block_int.h
> @@ -130,6 +130,7 @@ struct BlockDriver {
>      int (*bdrv_make_empty)(BlockDriverState *bs);
>  
>      void (*bdrv_refresh_filename)(BlockDriverState *bs, QDict *options);
> +    char *(*bdrv_dirname)(BlockDriverState *bs, Error **errp);

I know we've been lousy at documentation in the past, but should we
start doing a better job of documenting the contract as we add new
callbacks, rather than just the commit messages?

Based on existing practice, though, I'm okay with:
Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to