mirror of
https://github.com/openvswitch/ovs
synced 2025-09-03 15:55:19 +00:00
ovsdb-idl: Sort and unique-ify datum in ovsdb_idl_txn_write().
I noticed that there were lots of calls to ovsdb_datum_sort_unique() from "set" functions in generated IDL code. This moves that call into common code, reducing redundancy. There are more calls to the same function that are a little harder to remove. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
@@ -3159,9 +3159,10 @@ discard_datum:
|
||||
* itself and the structs derived from it (e.g. the "struct ovsrec_*", for
|
||||
* ovs-vswitchd).
|
||||
*
|
||||
* 'datum' must have the correct type for its column. The IDL does not check
|
||||
* that it meets schema constraints, but ovsdb-server will do so at commit time
|
||||
* so it had better be correct.
|
||||
* 'datum' must have the correct type for its column, but it needs not be
|
||||
* sorted or unique because this function will take care of that. The IDL does
|
||||
* not check that it meets schema constraints, but ovsdb-server will do so at
|
||||
* commit time so it had better be correct.
|
||||
*
|
||||
* A transaction must be in progress. Replication of 'column' must not have
|
||||
* been disabled (by calling ovsdb_idl_omit()).
|
||||
@@ -3177,11 +3178,17 @@ ovsdb_idl_txn_write(const struct ovsdb_idl_row *row,
|
||||
const struct ovsdb_idl_column *column,
|
||||
struct ovsdb_datum *datum)
|
||||
{
|
||||
ovsdb_datum_sort_unique(datum,
|
||||
column->type.key.type, column->type.value.type);
|
||||
ovsdb_idl_txn_write__(row, column, datum, true);
|
||||
}
|
||||
|
||||
/* Similar to ovsdb_idl_txn_write(), except that the caller retains ownership
|
||||
* of 'datum' and what it points to. */
|
||||
/* Similar to ovsdb_idl_txn_write(), except:
|
||||
*
|
||||
* - The caller retains ownership of 'datum' and what it points to.
|
||||
*
|
||||
* - The caller must ensure that 'datum' is sorted and unique (e.g. via
|
||||
* ovsdb_datum_sort_unique().) */
|
||||
void
|
||||
ovsdb_idl_txn_write_clone(const struct ovsdb_idl_row *row,
|
||||
const struct ovsdb_idl_column *column,
|
||||
|
@@ -763,8 +763,6 @@ void
|
||||
valueType = type.value.toAtomicType()
|
||||
else:
|
||||
valueType = "OVSDB_TYPE_VOID"
|
||||
print " ovsdb_datum_sort_unique(&datum, %s, %s);" % (
|
||||
type.key.toAtomicType(), valueType)
|
||||
txn_write_func = "ovsdb_idl_txn_write"
|
||||
print " %(f)s(&row->header_, &%(s)s_col_%(c)s, &datum);" \
|
||||
% {'f': txn_write_func,
|
||||
|
Reference in New Issue
Block a user