X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Ftable.c;h=7ba47eb012a4c8a194b29fb5c89d7c389780fdf0;hb=5c9a0b820c1ff5b20f572198cda241d5cd557320;hp=1901852452dfc02812baf5eb46177fe806f14823;hpb=bd76d25d8b3b7d11c5a326e91d784ad2cdeecd45;p=openvswitch diff --git a/ovsdb/table.c b/ovsdb/table.c index 19018524..7ba47eb0 100644 --- a/ovsdb/table.c +++ b/ovsdb/table.c @@ -61,6 +61,26 @@ ovsdb_table_schema_create(const char *name, const char *comment, bool mutable) return ts; } +struct ovsdb_table_schema * +ovsdb_table_schema_clone(const struct ovsdb_table_schema *old) +{ + struct ovsdb_table_schema *new; + struct shash_node *node; + + new = ovsdb_table_schema_create(old->name, old->comment, old->mutable); + SHASH_FOR_EACH (node, &old->columns) { + const struct ovsdb_column *column = node->data; + + if (column->name[0] == '_') { + /* Added automatically by ovsdb_table_schema_create(). */ + continue; + } + + add_column(new, ovsdb_column_clone(column)); + } + return new; +} + void ovsdb_table_schema_destroy(struct ovsdb_table_schema *ts) {