block_int.h (d67066d8bc01a14f7c9d9b9aeeffb30a10f0e900) | block_int.h (bd86fb990cfedc50d9705b8ed31d183f01942035) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 542 unchanged lines hidden (view full) --- 551 void (*bdrv_abort_perm_update)(BlockDriverState *bs); 552 553 /** 554 * Returns in @nperm and @nshared the permissions that the driver for @bs 555 * needs on its child @c, based on the cumulative permissions requested by 556 * the parents in @parent_perm and @parent_shared. 557 * 558 * If @c is NULL, return the permissions for attaching a new child for the | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 542 unchanged lines hidden (view full) --- 551 void (*bdrv_abort_perm_update)(BlockDriverState *bs); 552 553 /** 554 * Returns in @nperm and @nshared the permissions that the driver for @bs 555 * needs on its child @c, based on the cumulative permissions requested by 556 * the parents in @parent_perm and @parent_shared. 557 * 558 * If @c is NULL, return the permissions for attaching a new child for the |
559 * given @role. | 559 * given @child_class. |
560 * 561 * If @reopen_queue is non-NULL, don't return the currently needed 562 * permissions, but those that will be needed after applying the 563 * @reopen_queue. 564 */ 565 void (*bdrv_child_perm)(BlockDriverState *bs, BdrvChild *c, | 560 * 561 * If @reopen_queue is non-NULL, don't return the currently needed 562 * permissions, but those that will be needed after applying the 563 * @reopen_queue. 564 */ 565 void (*bdrv_child_perm)(BlockDriverState *bs, BdrvChild *c, |
566 const BdrvChildRole *role, | 566 const BdrvChildClass *child_class, |
567 BlockReopenQueue *reopen_queue, 568 uint64_t parent_perm, uint64_t parent_shared, 569 uint64_t *nperm, uint64_t *nshared); 570 571 bool (*bdrv_co_can_store_new_dirty_bitmap)(BlockDriverState *bs, 572 const char *name, 573 uint32_t granularity, 574 Error **errp); --- 85 unchanged lines hidden (view full) --- 660 void (*detach_aio_context)(void *opaque); 661 662 void *opaque; 663 bool deleted; 664 665 QLIST_ENTRY(BdrvAioNotifier) list; 666} BdrvAioNotifier; 667 | 567 BlockReopenQueue *reopen_queue, 568 uint64_t parent_perm, uint64_t parent_shared, 569 uint64_t *nperm, uint64_t *nshared); 570 571 bool (*bdrv_co_can_store_new_dirty_bitmap)(BlockDriverState *bs, 572 const char *name, 573 uint32_t granularity, 574 Error **errp); --- 85 unchanged lines hidden (view full) --- 660 void (*detach_aio_context)(void *opaque); 661 662 void *opaque; 663 bool deleted; 664 665 QLIST_ENTRY(BdrvAioNotifier) list; 666} BdrvAioNotifier; 667 |
668struct BdrvChildRole { | 668struct BdrvChildClass { |
669 /* If true, bdrv_replace_node() doesn't change the node this BdrvChild 670 * points to. */ 671 bool stay_at_node; 672 673 /* If true, the parent is a BlockDriverState and bdrv_next_all_states() 674 * will return it. This information is used for drain_all, where every node 675 * will be drained separately, so the drain only needs to be propagated to 676 * non-BDS parents. */ --- 56 unchanged lines hidden (view full) --- 733 int (*update_filename)(BdrvChild *child, BlockDriverState *new_base, 734 const char *filename, Error **errp); 735 736 bool (*can_set_aio_ctx)(BdrvChild *child, AioContext *ctx, 737 GSList **ignore, Error **errp); 738 void (*set_aio_ctx)(BdrvChild *child, AioContext *ctx, GSList **ignore); 739}; 740 | 669 /* If true, bdrv_replace_node() doesn't change the node this BdrvChild 670 * points to. */ 671 bool stay_at_node; 672 673 /* If true, the parent is a BlockDriverState and bdrv_next_all_states() 674 * will return it. This information is used for drain_all, where every node 675 * will be drained separately, so the drain only needs to be propagated to 676 * non-BDS parents. */ --- 56 unchanged lines hidden (view full) --- 733 int (*update_filename)(BdrvChild *child, BlockDriverState *new_base, 734 const char *filename, Error **errp); 735 736 bool (*can_set_aio_ctx)(BdrvChild *child, AioContext *ctx, 737 GSList **ignore, Error **errp); 738 void (*set_aio_ctx)(BdrvChild *child, AioContext *ctx, GSList **ignore); 739}; 740 |
741extern const BdrvChildRole child_file; 742extern const BdrvChildRole child_format; 743extern const BdrvChildRole child_backing; | 741extern const BdrvChildClass child_file; 742extern const BdrvChildClass child_format; 743extern const BdrvChildClass child_backing; |
744 745struct BdrvChild { 746 BlockDriverState *bs; 747 char *name; | 744 745struct BdrvChild { 746 BlockDriverState *bs; 747 char *name; |
748 const BdrvChildRole *role; | 748 const BdrvChildClass *klass; |
749 void *opaque; 750 751 /** 752 * Granted permissions for operating on this BdrvChild (BLK_PERM_* bitmask) 753 */ 754 uint64_t perm; 755 756 /** --- 10 unchanged lines hidden (view full) --- 767 /* 768 * This link is frozen: the child can neither be replaced nor 769 * detached from the parent. 770 */ 771 bool frozen; 772 773 /* 774 * How many times the parent of this child has been drained | 749 void *opaque; 750 751 /** 752 * Granted permissions for operating on this BdrvChild (BLK_PERM_* bitmask) 753 */ 754 uint64_t perm; 755 756 /** --- 10 unchanged lines hidden (view full) --- 767 /* 768 * This link is frozen: the child can neither be replaced nor 769 * detached from the parent. 770 */ 771 bool frozen; 772 773 /* 774 * How many times the parent of this child has been drained |
775 * (through role->drained_*). | 775 * (through klass->drained_*). |
776 * Usually, this is equal to bs->quiesce_counter (potentially 777 * reduced by bdrv_drain_all_count). It may differ while the 778 * child is entering or leaving a drained section. 779 */ 780 int parent_quiesce_counter; 781 782 QLIST_ENTRY(BdrvChild) next; 783 QLIST_ENTRY(BdrvChild) next_parent; --- 443 unchanged lines hidden (view full) --- 1227 BlockdevOnError on_source_error, 1228 BlockdevOnError on_target_error, 1229 int creation_flags, 1230 BlockCompletionFunc *cb, void *opaque, 1231 JobTxn *txn, Error **errp); 1232 1233BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, 1234 const char *child_name, | 776 * Usually, this is equal to bs->quiesce_counter (potentially 777 * reduced by bdrv_drain_all_count). It may differ while the 778 * child is entering or leaving a drained section. 779 */ 780 int parent_quiesce_counter; 781 782 QLIST_ENTRY(BdrvChild) next; 783 QLIST_ENTRY(BdrvChild) next_parent; --- 443 unchanged lines hidden (view full) --- 1227 BlockdevOnError on_source_error, 1228 BlockdevOnError on_target_error, 1229 int creation_flags, 1230 BlockCompletionFunc *cb, void *opaque, 1231 JobTxn *txn, Error **errp); 1232 1233BdrvChild *bdrv_root_attach_child(BlockDriverState *child_bs, 1234 const char *child_name, |
1235 const BdrvChildRole *child_role, | 1235 const BdrvChildClass *child_class, |
1236 AioContext *ctx, 1237 uint64_t perm, uint64_t shared_perm, 1238 void *opaque, Error **errp); 1239void bdrv_root_unref_child(BdrvChild *child); 1240 1241void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm, 1242 uint64_t *shared_perm); 1243 --- 14 unchanged lines hidden (view full) --- 1258 * automatically refreshing the permissions. 1259 */ 1260int bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp); 1261 1262/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by 1263 * block filters: Forward CONSISTENT_READ, WRITE, WRITE_UNCHANGED and RESIZE to 1264 * all children */ 1265void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c, | 1236 AioContext *ctx, 1237 uint64_t perm, uint64_t shared_perm, 1238 void *opaque, Error **errp); 1239void bdrv_root_unref_child(BdrvChild *child); 1240 1241void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm, 1242 uint64_t *shared_perm); 1243 --- 14 unchanged lines hidden (view full) --- 1258 * automatically refreshing the permissions. 1259 */ 1260int bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp); 1261 1262/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by 1263 * block filters: Forward CONSISTENT_READ, WRITE, WRITE_UNCHANGED and RESIZE to 1264 * all children */ 1265void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c, |
1266 const BdrvChildRole *role, | 1266 const BdrvChildClass *child_class, |
1267 BlockReopenQueue *reopen_queue, 1268 uint64_t perm, uint64_t shared, 1269 uint64_t *nperm, uint64_t *nshared); 1270 1271/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by 1272 * (non-raw) image formats: Like above for bs->backing, but for bs->file it 1273 * requires WRITE | RESIZE for read-write images, always requires 1274 * CONSISTENT_READ and doesn't share WRITE. */ 1275void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c, | 1267 BlockReopenQueue *reopen_queue, 1268 uint64_t perm, uint64_t shared, 1269 uint64_t *nperm, uint64_t *nshared); 1270 1271/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by 1272 * (non-raw) image formats: Like above for bs->backing, but for bs->file it 1273 * requires WRITE | RESIZE for read-write images, always requires 1274 * CONSISTENT_READ and doesn't share WRITE. */ 1275void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c, |
1276 const BdrvChildRole *role, | 1276 const BdrvChildClass *child_class, |
1277 BlockReopenQueue *reopen_queue, 1278 uint64_t perm, uint64_t shared, 1279 uint64_t *nperm, uint64_t *nshared); 1280 1281bool bdrv_recurse_can_replace(BlockDriverState *bs, 1282 BlockDriverState *to_replace); 1283 1284/* --- 70 unchanged lines hidden --- | 1277 BlockReopenQueue *reopen_queue, 1278 uint64_t perm, uint64_t shared, 1279 uint64_t *nperm, uint64_t *nshared); 1280 1281bool bdrv_recurse_can_replace(BlockDriverState *bs, 1282 BlockDriverState *to_replace); 1283 1284/* --- 70 unchanged lines hidden --- |