qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDri


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v4 2/7] block: Introduce op_blockers to BlockDriverState
Date: Fri, 22 Nov 2013 17:20:52 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Nov 22, 2013 at 01:24:49PM +0800, Fam Zheng wrote:
> +bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp)
> +{
> +    BdrvOpBlocker *blocker;
> +    assert(op >=0 && op < BLOCK_OP_TYPE_MAX);
> +    if (!QLIST_EMPTY(&bs->op_blockers[op])) {
> +        blocker = QLIST_FIRST(&bs->op_blockers[op]);
> +        *errp = error_copy(blocker->reason);
> +        return true;
> +    }
> +    return false;
> +}

It's worth following the convention that Error **errp may be NULL:

if (errp) {
    *errp = error_copy(blocker->reason);
}

The bool return value might be enough for some callers who don't need
the full Error.



reply via email to

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