OSDN Git Service

block: Involve block drivers in permission granting
authorKevin Wolf <kwolf@redhat.com>
Thu, 15 Dec 2016 12:04:20 +0000 (13:04 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 28 Feb 2017 19:40:36 +0000 (20:40 +0100)
commit33a610c398603efafd954c706ba07850835a5098
treebe851b767225da6995faa95b824199a843b0305a
parentd5e6f437c5508614803d11e59ee16a758dde09ef
block: Involve block drivers in permission granting

In many cases, the required permissions of one node on its children
depend on what its parents require from it. For example, the raw format
or most filter drivers only need to request consistent reads if that's
something that one of their parents wants.

In order to achieve this, this patch introduces two new BlockDriver
callbacks. The first one lets drivers first check (recursively) whether
the requested permissions can be set; the second one actually sets the
new permission bitmask.

Also add helper functions that drivers can use in their implementation
of the callbacks to update their permissions on a specific child.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block.c
include/block/block_int.h