On Fri, Jun 24, 2016 at 04:44:04PM -0700, Ben Pfaff wrote: > From: Mario Cabrera <mario.cabr...@hpe.com> > > A blacklist of tables that will be excluded from replication can be > specified by the following option: > > --sync-exclude-tables=db:table[,db:table]… > > Where 'table' corresponds to a table name, and 'db' corresponds to the > database name where the table resides. > > Signed-off-by: Mario Cabrera <mario.cabr...@hpe.com>
Thanks for the patch. I noticed some indentations to fix. Also, there is some code that tries too hard to allocate a string with exactly the right length; I replaced it with a call to xasprintf(). I folded in the following and I plan to apply patches 1 to 3 to master in a minute. --8<--------------------------cut here-------------------------->8-- diff --git a/ovsdb/replication.c b/ovsdb/replication.c index 8cea620..1fa0f25 100644 --- a/ovsdb/replication.c +++ b/ovsdb/replication.c @@ -127,7 +127,7 @@ set_tables_blacklist(const char *blacklist) replication_init(); if (blacklist) { - char *t_blacklist = strdup(blacklist); + char *t_blacklist = xstrdup(blacklist); for (blacklist_item = strtok_r(t_blacklist, ",", &save_ptr); blacklist_item != NULL; blacklist_item = strtok_r(NULL, ",", &save_ptr)) { @@ -190,14 +190,9 @@ reset_database(struct ovsdb *db, struct ovsdb_txn *txn) struct ovsdb_table *table = table_node->data; struct ovsdb_row *row; - size_t blacklist_item_len = strlen(db->schema->name) + - strlen(table_node->name) + 2; - /* Do not reset if table is blacklisted. */ - char* blacklist_item = xmalloc(blacklist_item_len); - snprintf(blacklist_item, blacklist_item_len, "%s%s%s", - db->schema->name, ":", table_node->name); - + char *blacklist_item = xasprintf( + "%s%s%s", db->schema->name, ":", table_node->name); if (!sset_contains(&tables_blacklist, blacklist_item)) { HMAP_FOR_EACH (row, hmap_node, &table->rows) { ovsdb_txn_row_delete(txn, row); @@ -334,14 +329,10 @@ send_monitor_requests(struct shash *all_dbs) for (int j = 0; j < n; j++) { struct ovsdb_table_schema *table = nodes[j]->data; - size_t blacklist_item_len = strlen(db_name) + - strlen(table->name) + 2; - char* blacklist_item = xmalloc(blacklist_item_len); - - snprintf(blacklist_item, blacklist_item_len, "%s%s%s", - db_name, ":", table->name); /* Check if table is not blacklisted. */ + char *blacklist_item = xasprintf( + "%s%s%s", db_name, ":", table->name); if (!sset_contains(&tables_blacklist, blacklist_item)) { add_monitored_table(table, monitor_request); } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev