2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 08:15:25 +00:00

db-ctl-base: do not expose get_table() API

Both get_table() and set_cloum() APIs are mostly used within db-ctl-base
library. This patch makes both private to the library.

Add a new ctl_set_colum() API for library client.

The changes are cleanups. No functional changes.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
This commit is contained in:
Andy Zhou
2015-07-07 19:34:28 -07:00
parent 07d2723a27
commit 15ffc20282
3 changed files with 18 additions and 8 deletions

View File

@@ -47,6 +47,10 @@ struct ovsdb_idl *the_idl;
struct ovsdb_idl_txn *the_idl_txn; struct ovsdb_idl_txn *the_idl_txn;
static struct shash all_commands = SHASH_INITIALIZER(&all_commands); static struct shash all_commands = SHASH_INITIALIZER(&all_commands);
static const struct ctl_table_class *get_table(const char *table_name);
static void set_column(const struct ctl_table_class *,
const struct ovsdb_idl_row *, const char *,
struct ovsdb_symbol_table *);
static struct option * static struct option *
@@ -1990,7 +1994,7 @@ ctl_context_done(struct ctl_context *ctx,
/* Finds and returns the "struct ctl_table_class *" with 'table_name' by /* Finds and returns the "struct ctl_table_class *" with 'table_name' by
* searching the 'tables'. */ * searching the 'tables'. */
const struct ctl_table_class * static const struct ctl_table_class *
get_table(const char *table_name) get_table(const char *table_name)
{ {
const struct ctl_table_class *table; const struct ctl_table_class *table;
@@ -2018,7 +2022,7 @@ get_table(const char *table_name)
} }
/* Sets the column of 'row' in 'table'. */ /* Sets the column of 'row' in 'table'. */
void static void
set_column(const struct ctl_table_class *table, set_column(const struct ctl_table_class *table,
const struct ovsdb_idl_row *row, const char *arg, const struct ovsdb_idl_row *row, const char *arg,
struct ovsdb_symbol_table *symtab) struct ovsdb_symbol_table *symtab)
@@ -2070,3 +2074,10 @@ set_column(const struct ctl_table_class *table,
free(key_string); free(key_string);
free(value_string); free(value_string);
} }
void ctl_set_column(const char *table_name,
const struct ovsdb_idl_row *row, const char *arg,
struct ovsdb_symbol_table *symtab)
{
set_column(get_table(table_name), row, arg, symtab);
}

View File

@@ -250,9 +250,8 @@ struct ctl_table_class {
* entry. */ * entry. */
extern const struct ctl_table_class tables[]; extern const struct ctl_table_class tables[];
const struct ctl_table_class *get_table(const char *table_name); void ctl_set_column(const char *table_name,
void set_column(const struct ctl_table_class *, const struct ovsdb_idl_row *, const char *arg,
const struct ovsdb_idl_row *, const char *arg, struct ovsdb_symbol_table *);
struct ovsdb_symbol_table *);
#endif /* db-ctl-base.h */ #endif /* db-ctl-base.h */

View File

@@ -1556,8 +1556,8 @@ add_port(struct ctl_context *ctx,
} }
for (i = 0; i < n_settings; i++) { for (i = 0; i < n_settings; i++) {
set_column(get_table("Port"), &port->header_, settings[i], ctl_set_column("Port", &port->header_, settings[i],
ctx->symtab); ctx->symtab);
} }
bridge_insert_port((bridge->parent ? bridge->parent->br_cfg bridge_insert_port((bridge->parent ? bridge->parent->br_cfg