aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2023-02-03 16:21:58 +0100
committerKevin Wolf <kwolf@redhat.com>2023-02-23 19:49:26 +0100
commit79a292e5ec767eea27a0cc456570ee028f4e3972 (patch)
tree22f03a4c1f1cdc65a8cbde01222126ae8f3de82e /include
parentc73ff92c9d00f9aa535044e7348d0330aa94f467 (diff)
block: Mark bdrv_co_eject/lock_medium() and callers GRAPH_RDLOCK
This adds GRAPH_RDLOCK annotations to declare that callers of bdrv_co_eject() and bdrv_co_lock_medium() need to hold a reader lock for the graph. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230203152202.49054-20-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block-io.h7
-rw-r--r--include/block/block_int-common.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/include/block/block-io.h b/include/block/block-io.h
index 88db63492a..bf2748011e 100644
--- a/include/block/block-io.h
+++ b/include/block/block-io.h
@@ -148,8 +148,11 @@ int bdrv_get_flags(BlockDriverState *bs);
bool coroutine_fn GRAPH_RDLOCK bdrv_co_is_inserted(BlockDriverState *bs);
bool co_wrapper_bdrv_rdlock bdrv_is_inserted(BlockDriverState *bs);
-void coroutine_fn bdrv_co_lock_medium(BlockDriverState *bs, bool locked);
-void coroutine_fn bdrv_co_eject(BlockDriverState *bs, bool eject_flag);
+void coroutine_fn GRAPH_RDLOCK
+bdrv_co_lock_medium(BlockDriverState *bs, bool locked);
+
+void coroutine_fn GRAPH_RDLOCK
+bdrv_co_eject(BlockDriverState *bs, bool eject_flag);
const char *bdrv_get_format_name(BlockDriverState *bs);
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index b4a82269e5..30e6bd4909 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -714,8 +714,10 @@ struct BlockDriver {
/* removable device specific */
bool coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_is_inserted)(
BlockDriverState *bs);
- void coroutine_fn (*bdrv_co_eject)(BlockDriverState *bs, bool eject_flag);
- void coroutine_fn (*bdrv_co_lock_medium)(BlockDriverState *bs, bool locked);
+ void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_eject)(
+ BlockDriverState *bs, bool eject_flag);
+ void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_lock_medium)(
+ BlockDriverState *bs, bool locked);
/* to control generic scsi devices */
BlockAIOCB *coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_aio_ioctl)(