From 15ffc2028265d073d526ea08010ba3365cb16d5d Mon Sep 17 00:00:00 2001 From: Andy Zhou Date: Tue, 7 Jul 2015 19:34:28 -0700 Subject: [PATCH] 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 Acked-by: Alex Wang --- lib/db-ctl-base.c | 15 +++++++++++++-- lib/db-ctl-base.h | 7 +++---- utilities/ovs-vsctl.c | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c index 10884b426..64c01e624 100644 --- a/lib/db-ctl-base.c +++ b/lib/db-ctl-base.c @@ -47,6 +47,10 @@ struct ovsdb_idl *the_idl; struct ovsdb_idl_txn *the_idl_txn; 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 * @@ -1990,7 +1994,7 @@ ctl_context_done(struct ctl_context *ctx, /* Finds and returns the "struct ctl_table_class *" with 'table_name' by * searching the 'tables'. */ -const struct ctl_table_class * +static const struct ctl_table_class * get_table(const char *table_name) { const struct ctl_table_class *table; @@ -2018,7 +2022,7 @@ get_table(const char *table_name) } /* Sets the column of 'row' in 'table'. */ -void +static void set_column(const struct ctl_table_class *table, const struct ovsdb_idl_row *row, const char *arg, struct ovsdb_symbol_table *symtab) @@ -2070,3 +2074,10 @@ set_column(const struct ctl_table_class *table, free(key_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); +} diff --git a/lib/db-ctl-base.h b/lib/db-ctl-base.h index f14d27f6b..ecb3e80bc 100644 --- a/lib/db-ctl-base.h +++ b/lib/db-ctl-base.h @@ -250,9 +250,8 @@ struct ctl_table_class { * entry. */ extern const struct ctl_table_class tables[]; -const struct ctl_table_class *get_table(const char *table_name); -void set_column(const struct ctl_table_class *, - const struct ovsdb_idl_row *, const char *arg, - struct ovsdb_symbol_table *); +void ctl_set_column(const char *table_name, + const struct ovsdb_idl_row *, const char *arg, + struct ovsdb_symbol_table *); #endif /* db-ctl-base.h */ diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index c9af35598..863bc73cd 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -1556,8 +1556,8 @@ add_port(struct ctl_context *ctx, } for (i = 0; i < n_settings; i++) { - set_column(get_table("Port"), &port->header_, settings[i], - ctx->symtab); + ctl_set_column("Port", &port->header_, settings[i], + ctx->symtab); } bridge_insert_port((bridge->parent ? bridge->parent->br_cfg -- 2.20.1