[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] Question about bdrv_child_perm()

From: Alberto Garcia
Subject: [Qemu-block] Question about bdrv_child_perm()
Date: Tue, 19 Mar 2019 11:59:56 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

bdrv_child_perm(BlockDriverState *bs, BlockDriverState *child_bs, ...)
was introduced in commit ffd1a5a25c7199d3c9c6d84a5a84ae51f8824602 and
is only called when bs has children (hence the child_bs parameter).

It contains the following code:

    if (bs->drv && bs->drv->bdrv_child_perm) {
        bs->drv->bdrv_child_perm(bs, c, role,
                                 parent_perm, parent_shared,
                                 nperm, nshared);

but as far as I can see all block drivers with children implement
bdrv_child_perm, so that check is not needed.

On top of that, if the condition would fail then no one would set
nperm and all callers would use it uninitialized.

So that check seems unnecessary, maybe we should replace it with an
assertion? Some of the callers already have this:

    if (!drv->bdrv_child_perm) {
        return 0;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]