2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ovsdb: Allow comparison on optional scalar types

This allows things like initiating a wait request on an interface
ofport being set.

When the optional field is empty and operation is != or excludes
then the result is true; otherwise it is false. If the field is
set then the field is compared normally for its type.

Signed-off-by: Terry Wilson <twilson@redhat.com>
[blp@nicira.com updated ovsdb-server(1) and NEWS.]
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Terry Wilson
2014-08-19 17:28:55 -06:00
committed by Ben Pfaff
parent 886dd35a03
commit 09e256031a
6 changed files with 121 additions and 5 deletions

View File

@@ -152,6 +152,8 @@ bool ovsdb_type_is_valid(const struct ovsdb_type *);
static inline bool ovsdb_type_is_scalar(const struct ovsdb_type *);
static inline bool ovsdb_type_is_optional(const struct ovsdb_type *);
static inline bool ovsdb_type_is_optional_scalar(
const struct ovsdb_type *);
static inline bool ovsdb_type_is_composite(const struct ovsdb_type *);
static inline bool ovsdb_type_is_set(const struct ovsdb_type *);
static inline bool ovsdb_type_is_map(const struct ovsdb_type *);
@@ -202,6 +204,13 @@ static inline bool ovsdb_type_is_optional(const struct ovsdb_type *type)
return type->n_min == 0;
}
static inline bool ovsdb_type_is_optional_scalar(
const struct ovsdb_type *type)
{
return (type->value.type == OVSDB_TYPE_VOID
&& type->n_min == 0 && type->n_max == 1);
}
static inline bool ovsdb_type_is_composite(const struct ovsdb_type *type)
{
return type->n_max > 1;