block: Add BdrvChildRole.get_parent_desc()

For meaningful error messages in the permission system, we need to get
some human-readable description of the parent of a BdrvChild.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
Kevin Wolf 2017-01-17 15:56:16 +01:00
parent c6cc12bfa7
commit b541155587
3 changed files with 36 additions and 0 deletions

View file

@ -452,6 +452,12 @@ struct BdrvChildRole {
* name), or NULL if the parent can't provide a better name. */
const char* (*get_name)(BdrvChild *child);
/* Returns a malloced string that describes the parent of the child for a
* human reader. This could be a node-name, BlockBackend name, qdev ID or
* QOM path of the device owning the BlockBackend, job type and ID etc. The
* caller is responsible for freeing the memory. */
char* (*get_parent_desc)(BdrvChild *child);
/*
* If this pair of functions is implemented, the parent doesn't issue new
* requests after returning from .drained_begin() until .drained_end() is