[ovs-dev] [mirror names 04/10] ovsdb-idlc: Check and restore ovsdb_datum invariants when setting data.
Justin Pettit
jpettit at nicira.com
Fri Jul 2 22:45:57 UTC 2010
Looks good.
--Justin
On Jun 17, 2010, at 3:57 PM, Ben Pfaff wrote:
> ovsdb_datum has an important invariant (documented in the large comment
> on the declaration of struct ovsdb_datum) that a lot of code relies upon:
> keys must be unique and in sorted order. Most code that creates or
> modifies ovsdb_datum structures maintains this invariant. However, the
> "set" functions generated by ovsdb-idlc.in do not check or restore it.
> This commit adds that checking.
>
> This might fix an actual bug or two--none have been reported--but mostly it
> is just to add some additional checking to avoid future subtle bugs.
> ---
> ovsdb/ovsdb-idlc.in | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
> index c010348..cd656a3 100755
> --- a/ovsdb/ovsdb-idlc.in
> +++ b/ovsdb/ovsdb-idlc.in
> @@ -456,6 +456,12 @@ void
> if type.value:
> print " " + type.value.copyCValue("datum.values[i].%s" % type.value.type, "%s[i]" % valueVar)
> print " }"
> + if type.value:
> + valueType = type.value.toAtomicType()
> + else:
> + valueType = "OVSDB_TYPE_VOID"
> + print " ovsdb_datum_sort_unique(&datum, %s, %s);" % (
> + type.key.toAtomicType(), valueType)
> print " ovsdb_idl_txn_write(&row->header_, &%(s)s_columns[%(S)s_COL_%(C)s], &datum);" \
> % {'s': structName,
> 'S': structName.upper(),
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
More information about the dev
mailing list