block: Add blk_is_available()
commitdb0284f86a31ec66d138f0f7794321c306af969e
authorMax Reitz <mreitz@redhat.com>
Mon, 19 Oct 2015 15:53:12 +0000 (19 17:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 23 Oct 2015 16:18:22 +0000 (23 18:18 +0200)
tree41bef170c6daa645b59b37f77334e77f9479ccdb
parente031f750483377a5e5de4c92af68dfa68e4d0aae
block: Add blk_is_available()

blk_is_available() returns true iff the BDS is inserted (which means
blk_bs() is not NULL and bdrv_is_inserted() returns true) and if the
tray of the guest device is closed.

blk_is_inserted() is changed to return true only if blk_bs() is not
NULL.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c
include/sysemu/block-backend.h