[ovs-dev] [PATCH monitor_cond V2 01/12] ovsdb: create column index mapping between ovsdb row to monitor row
Liran Schour
LIRANS at il.ibm.com
Thu Jan 21 12:05:44 UTC 2016
Andy Zhou <azhou at ovn.org> wrote on 21/01/2016 09:20:52 AM:
>
> Please also see my comments for the next patch.
>
> On Sat, Jan 16, 2016 at 12:16 AM, Liran Schour <lirans at il.ibm.com>
wrote:
> Indexing is different between ovsdb_row to ovsdb_monitor_row. To be
> able to evaluate conditions on ovsdb_monitor_row we need this mapping.
>
> signed-off-by: Liran Schour <lirans at il.ibm.com>
> ---
> ovsdb/monitor.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
> index 0dde54e..51f4e09 100644
> --- a/ovsdb/monitor.c
> +++ b/ovsdb/monitor.c
> @@ -116,6 +116,9 @@ struct ovsdb_monitor_table {
> struct ovsdb_monitor_column *columns;
> size_t n_columns;
>
> + /* map between column->index to columns */
> This comment seems too generic. It can be more helpful to be more
> precisely describe
> the map, and how what function it provides.
>
Agree. Will fix that.
> + unsigned int *columns_index_map;
> +
> /* Contains 'ovsdb_monitor_changes' indexed by 'transaction'. */
> struct hmap changes;
> };
> @@ -347,6 +350,8 @@ ovsdb_monitor_add_table(struct ovsdb_monitor *m,
> mt->table = table;
> shash_add(&m->tables, table->schema->name, mt);
> hmap_init(&mt->changes);
> + mt->columns_index_map =
> + xmalloc(sizeof(unsigned int) *
shash_count(&table->schema->columns));
>
> Should xzalloc() be used here instead?
> }
>
xzalloc() won't be enough since 0 is a valid index. I will initialize the
array to -1.
More information about the dev
mailing list