2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

db-ctl-base: do not require client to expose the "tables" variable

Instead, client now pass it via the modified ctl_init() API.

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:38:42 -07:00
parent 15ffc20282
commit 802cb46ebc
4 changed files with 13 additions and 14 deletions

View File

@@ -46,6 +46,11 @@ VLOG_DEFINE_THIS_MODULE(db_ctl_base);
struct ovsdb_idl *the_idl;
struct ovsdb_idl_txn *the_idl_txn;
/* Represents all tables in the schema. User must define 'tables'
* in implementation and supply via clt_init(). The definition must end
* with an all-NULL entry. */
static const struct ctl_table_class *tables;
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 *,
@@ -1908,8 +1913,9 @@ ctl_register_commands(const struct ctl_command_syntax *commands)
/* Registers the 'db_ctl_commands' to 'all_commands'. */
void
ctl_init(void)
ctl_init(const struct ctl_table_class tables_[])
{
tables = tables_;
ctl_register_commands(db_ctl_commands);
ctl_register_commands(db_ctl_show_command);
}