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>
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 *,
/* 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);
}
* - the *ctl command context by inheriting the 'struct ctl_context' for
* additional commands implemented by user. (See 'struct ctl_context' for
* more info)
- *
- * - the 'tables[]' for each table in the schema.
- *
*/
/* ctl_fatal() also logs the error, so it is preferred in this file. */
extern struct ovsdb_idl *the_idl;
extern struct ovsdb_idl_txn *the_idl_txn;
-void ctl_init(void);
+struct ctl_table_class;
+void ctl_init(const struct ctl_table_class *tables);
char *ctl_default_db(void);
OVS_NO_RETURN void ctl_exit(int status);
OVS_NO_RETURN void ctl_fatal(const char *, ...) OVS_PRINTF_FORMAT(1, 2);
struct ctl_row_id row_ids[2];
};
-/* Represents all tables in the schema. User must define 'tables'
- * in implementation. And the definition must end with an all-NULL
- * entry. */
-extern const struct ctl_table_class tables[];
-
void ctl_set_column(const char *table_name,
const struct ovsdb_idl_row *, const char *arg,
struct ovsdb_symbol_table *);
}
\f
-const struct ctl_table_class tables[] = {
+static const struct ctl_table_class tables[] = {
{&ovsrec_table_bridge,
{{&ovsrec_table_bridge, &ovsrec_bridge_col_name, NULL},
{&ovsrec_table_flow_sample_collector_set, NULL,
static void
vsctl_cmd_init(void)
{
- ctl_init();
+ ctl_init(tables);
ctl_register_commands(vsctl_commands);
}
}
/* Parameter commands. */
-const struct ctl_table_class tables[] = {
+static const struct ctl_table_class tables[] = {
{&vteprec_table_global,
{{&vteprec_table_global, NULL, NULL},
{NULL, NULL, NULL}}},
static void
vtep_ctl_cmd_init(void)
{
- ctl_init();
+ ctl_init(tables);
ctl_register_commands(vtep_commands);
}