block.c (497a30dbb065937d67f6c43af6dd78492e1d6f6d) | block.c (ab5b522879e2a7880418cbd29340675e5427572f) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 4081 unchanged lines hidden (view full) --- 4090BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, 4091 BlockDriverState *bs, 4092 QDict *options, bool keep_old_opts) 4093{ 4094 return bdrv_reopen_queue_child(bs_queue, bs, options, NULL, 0, false, 4095 NULL, 0, keep_old_opts); 4096} 4097 | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 4081 unchanged lines hidden (view full) --- 4090BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, 4091 BlockDriverState *bs, 4092 QDict *options, bool keep_old_opts) 4093{ 4094 return bdrv_reopen_queue_child(bs_queue, bs, options, NULL, 0, false, 4095 NULL, 0, keep_old_opts); 4096} 4097 |
4098void bdrv_reopen_queue_free(BlockReopenQueue *bs_queue) 4099{ 4100 if (bs_queue) { 4101 BlockReopenQueueEntry *bs_entry, *next; 4102 QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { 4103 qobject_unref(bs_entry->state.explicit_options); 4104 qobject_unref(bs_entry->state.options); 4105 g_free(bs_entry); 4106 } 4107 g_free(bs_queue); 4108 } 4109} 4110 |
|
4098/* 4099 * Reopen multiple BlockDriverStates atomically & transactionally. 4100 * 4101 * The queue passed in (bs_queue) must have been built up previous 4102 * via bdrv_reopen_queue(). 4103 * 4104 * Reopens all BDS specified in the queue, with the appropriate 4105 * flags. All devices are prepared for reopen, and failure of any --- 86 unchanged lines hidden (view full) --- 4192 goto cleanup; 4193 4194abort: 4195 tran_abort(tran); 4196 QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { 4197 if (bs_entry->prepared) { 4198 bdrv_reopen_abort(&bs_entry->state); 4199 } | 4111/* 4112 * Reopen multiple BlockDriverStates atomically & transactionally. 4113 * 4114 * The queue passed in (bs_queue) must have been built up previous 4115 * via bdrv_reopen_queue(). 4116 * 4117 * Reopens all BDS specified in the queue, with the appropriate 4118 * flags. All devices are prepared for reopen, and failure of any --- 86 unchanged lines hidden (view full) --- 4205 goto cleanup; 4206 4207abort: 4208 tran_abort(tran); 4209 QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { 4210 if (bs_entry->prepared) { 4211 bdrv_reopen_abort(&bs_entry->state); 4212 } |
4200 qobject_unref(bs_entry->state.explicit_options); 4201 qobject_unref(bs_entry->state.options); | |
4202 } 4203 4204cleanup: | 4213 } 4214 4215cleanup: |
4205 QTAILQ_FOREACH_SAFE(bs_entry, bs_queue, entry, next) { 4206 g_free(bs_entry); 4207 } 4208 g_free(bs_queue); | 4216 bdrv_reopen_queue_free(bs_queue); |
4209 4210 return ret; 4211} 4212 4213int bdrv_reopen_set_read_only(BlockDriverState *bs, bool read_only, 4214 Error **errp) 4215{ 4216 int ret; --- 351 unchanged lines hidden (view full) --- 4568 /* If there are any driver level actions to take */ 4569 if (drv->bdrv_reopen_commit) { 4570 drv->bdrv_reopen_commit(reopen_state); 4571 } 4572 4573 /* set BDS specific flags now */ 4574 qobject_unref(bs->explicit_options); 4575 qobject_unref(bs->options); | 4217 4218 return ret; 4219} 4220 4221int bdrv_reopen_set_read_only(BlockDriverState *bs, bool read_only, 4222 Error **errp) 4223{ 4224 int ret; --- 351 unchanged lines hidden (view full) --- 4576 /* If there are any driver level actions to take */ 4577 if (drv->bdrv_reopen_commit) { 4578 drv->bdrv_reopen_commit(reopen_state); 4579 } 4580 4581 /* set BDS specific flags now */ 4582 qobject_unref(bs->explicit_options); 4583 qobject_unref(bs->options); |
4584 qobject_ref(reopen_state->explicit_options); 4585 qobject_ref(reopen_state->options); |
|
4576 4577 bs->explicit_options = reopen_state->explicit_options; 4578 bs->options = reopen_state->options; 4579 bs->open_flags = reopen_state->flags; 4580 bs->detect_zeroes = reopen_state->detect_zeroes; 4581 4582 /* Remove child references from bs->options and bs->explicit_options. 4583 * Child options were already removed in bdrv_reopen_queue_child() */ --- 3024 unchanged lines hidden --- | 4586 4587 bs->explicit_options = reopen_state->explicit_options; 4588 bs->options = reopen_state->options; 4589 bs->open_flags = reopen_state->flags; 4590 bs->detect_zeroes = reopen_state->detect_zeroes; 4591 4592 /* Remove child references from bs->options and bs->explicit_options. 4593 * Child options were already removed in bdrv_reopen_queue_child() */ --- 3024 unchanged lines hidden --- |