aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-05-10 18:06:20 +0300
committerKevin Wolf <kwolf@redhat.com>2023-05-19 19:12:12 +0200
commit240396965fc653756aed90edc2985f05783c5ad6 (patch)
tree6e603b0e6bac1df760df66b640a83d15647adf4a
parent8187f63c9c64c2f2322fc6730c478a57bc0ce9eb (diff)
blockdev: transactions: rename some things
Look at qmp_transaction(): dev_list is not obvious name for list of actions. Let's look at qapi spec, this argument is "actions". Let's follow the common practice of using same argument names in qapi scheme and code. To be honest, rename props to properties for same reason. Next, we have to rename global map of actions, to not conflict with new name for function argument. Rename also dev_entry loop variable accordingly to new name of the list. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20230510150624.310640-3-vsementsov@yandex-team.ru> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--blockdev.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/blockdev.c b/blockdev.c
index 3c72d40f51..75e313f403 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2291,7 +2291,7 @@ static void abort_commit(void *opaque)
g_assert_not_reached(); /* this action never succeeds */
}
-static const BlkActionOps actions[] = {
+static const BlkActionOps actions_map[] = {
[TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT] = {
.instance_size = sizeof(ExternalSnapshotState),
.action = external_snapshot_action,
@@ -2373,12 +2373,12 @@ static TransactionProperties *get_transaction_properties(
*
* Always run under BQL.
*/
-void qmp_transaction(TransactionActionList *dev_list,
- struct TransactionProperties *props,
+void qmp_transaction(TransactionActionList *actions,
+ struct TransactionProperties *properties,
Error **errp)
{
- TransactionActionList *dev_entry = dev_list;
- bool has_props = !!props;
+ TransactionActionList *act = actions;
+ bool has_properties = !!properties;
JobTxn *block_job_txn = NULL;
Error *local_err = NULL;
Transaction *tran = tran_new();
@@ -2388,8 +2388,8 @@ void qmp_transaction(TransactionActionList *dev_list,
/* Does this transaction get canceled as a group on failure?
* If not, we don't really need to make a JobTxn.
*/
- props = get_transaction_properties(props);
- if (props->completion_mode != ACTION_COMPLETION_MODE_INDIVIDUAL) {
+ properties = get_transaction_properties(properties);
+ if (properties->completion_mode != ACTION_COMPLETION_MODE_INDIVIDUAL) {
block_job_txn = job_txn_new();
}
@@ -2397,24 +2397,24 @@ void qmp_transaction(TransactionActionList *dev_list,
bdrv_drain_all();
/* We don't do anything in this loop that commits us to the operations */
- while (NULL != dev_entry) {
+ while (NULL != act) {
TransactionAction *dev_info = NULL;
const BlkActionOps *ops;
BlkActionState *state;
- dev_info = dev_entry->value;
- dev_entry = dev_entry->next;
+ dev_info = act->value;
+ act = act->next;
- assert(dev_info->type < ARRAY_SIZE(actions));
+ assert(dev_info->type < ARRAY_SIZE(actions_map));
- ops = &actions[dev_info->type];
+ ops = &actions_map[dev_info->type];
assert(ops->instance_size > 0);
state = g_malloc0(ops->instance_size);
state->ops = ops;
state->action = dev_info;
state->block_job_txn = block_job_txn;
- state->txn_props = props;
+ state->txn_props = properties;
state->ops->action(state, tran, &local_err);
if (local_err) {
@@ -2432,8 +2432,8 @@ delete_and_fail:
/* failure, and it is all-or-none; roll back all operations */
tran_abort(tran);
exit:
- if (!has_props) {
- qapi_free_TransactionProperties(props);
+ if (!has_properties) {
+ qapi_free_TransactionProperties(properties);
}
job_txn_unref(block_job_txn);
}