From b4cef64c83469653f40d0cbe50a88c7b42c1f46d Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Tue, 1 Jun 2021 23:01:22 +0200 Subject: ovsdb: row: Add support for xor-based row updates. This will be used to apply update3 type updates to ovsdb tables while processing updates for future ovsdb 'relay' service model. 'ovsdb_datum_apply_diff' is allowed to fail, so adding support to return this error. Acked-by: Mark D. Gray Acked-by: Dumitru Ceara Signed-off-by: Ilya Maximets --- ovsdb/table.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ovsdb/table.c') diff --git a/ovsdb/table.c b/ovsdb/table.c index 2935bd897..455a3663f 100644 --- a/ovsdb/table.c +++ b/ovsdb/table.c @@ -384,7 +384,8 @@ ovsdb_table_execute_delete(struct ovsdb_txn *txn, const struct uuid *row_uuid, struct ovsdb_error * ovsdb_table_execute_update(struct ovsdb_txn *txn, const struct uuid *row_uuid, - struct ovsdb_table *table, struct json *json_row) + struct ovsdb_table *table, struct json *json_row, + bool xor) { const struct ovsdb_row *row = ovsdb_table_get_row(table, row_uuid); if (!row) { @@ -399,9 +400,9 @@ ovsdb_table_execute_update(struct ovsdb_txn *txn, const struct uuid *row_uuid, struct ovsdb_error *error = ovsdb_row_from_json(update, json_row, NULL, &columns); - if (!error && !ovsdb_row_equal_columns(row, update, &columns)) { - ovsdb_row_update_columns(ovsdb_txn_row_modify(txn, row), - update, &columns); + if (!error && (xor || !ovsdb_row_equal_columns(row, update, &columns))) { + error = ovsdb_row_update_columns(ovsdb_txn_row_modify(txn, row), + update, &columns, xor); } ovsdb_column_set_destroy(&columns); -- cgit v1.2.1