From e9387de4a2601ed2768baaa9bc92a3ef27f1145a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 28 Feb 2011 12:43:15 -0800 Subject: [PATCH] ovsdb-data: Rename 'used' to 'created' in struct ovsdb_symbol. The name 'created' better reflects the actual meaning of this member: in both ovsdb and ovs-vsctl, it is true if a row has been created with the symbol's UUID and false otherwise. --- lib/ovsdb-data.c | 8 ++++---- lib/ovsdb-data.h | 5 +++-- ovsdb/execution.c | 4 ++-- utilities/ovs-vsctl.c | 12 ++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c index 1a075244..c141e86e 100644 --- a/lib/ovsdb-data.c +++ b/lib/ovsdb-data.c @@ -1825,14 +1825,14 @@ ovsdb_symbol_table_get(const struct ovsdb_symbol_table *symtab, struct ovsdb_symbol * ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name, - const struct uuid *uuid, bool used) + const struct uuid *uuid, bool created) { struct ovsdb_symbol *symbol; assert(!ovsdb_symbol_table_get(symtab, name)); symbol = xmalloc(sizeof *symbol); symbol->uuid = *uuid; - symbol->used = used; + symbol->created = created; shash_add(&symtab->sh, name, symbol); return symbol; } @@ -1854,13 +1854,13 @@ ovsdb_symbol_table_insert(struct ovsdb_symbol_table *symtab, } const char * -ovsdb_symbol_table_find_unused(const struct ovsdb_symbol_table *symtab) +ovsdb_symbol_table_find_uncreated(const struct ovsdb_symbol_table *symtab) { struct shash_node *node; SHASH_FOR_EACH (node, &symtab->sh) { struct ovsdb_symbol *symbol = node->data; - if (!symbol->used) { + if (!symbol->created) { return node->name; } } diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h index ced30339..fe279bcf 100644 --- a/lib/ovsdb-data.h +++ b/lib/ovsdb-data.h @@ -231,7 +231,7 @@ ovsdb_datum_conforms_to_type(const struct ovsdb_datum *datum, struct ovsdb_symbol { struct uuid uuid; /* The UUID that the symbol represents. */ - bool used; /* Already used as row UUID? */ + bool created; /* Already used to create row? */ }; struct ovsdb_symbol_table *ovsdb_symbol_table_create(void); @@ -243,7 +243,8 @@ struct ovsdb_symbol *ovsdb_symbol_table_put(struct ovsdb_symbol_table *, const struct uuid *, bool used); struct ovsdb_symbol *ovsdb_symbol_table_insert(struct ovsdb_symbol_table *, const char *name); -const char *ovsdb_symbol_table_find_unused(const struct ovsdb_symbol_table *); +const char *ovsdb_symbol_table_find_uncreated( + const struct ovsdb_symbol_table *); /* Tokenization * diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 9b18ec94..708cc60d 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -292,13 +292,13 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct ovsdb_symbol *symbol; symbol = ovsdb_symbol_table_insert(x->symtab, json_string(uuid_name)); - if (symbol->used) { + if (symbol->created) { return ovsdb_syntax_error(uuid_name, "duplicate uuid-name", "This \"uuid-name\" appeared on an " "earlier \"insert\" operation."); } row_uuid = symbol->uuid; - symbol->used = true; + symbol->created = true; } else { uuid_generate(&row_uuid); } diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 5de5f926..2818a38f 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -2365,11 +2365,11 @@ create_symbol(struct ovsdb_symbol_table *symtab, const char *id, bool *newp) } symbol = ovsdb_symbol_table_insert(symtab, id); - if (symbol->used) { + if (symbol->created) { vsctl_fatal("row id \"%s\" may only be specified on one --id option", id); } - symbol->used = true; + symbol->created = true; return &symbol->uuid; } @@ -3354,7 +3354,7 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands, const struct ovsrec_open_vswitch *ovs; enum ovsdb_idl_txn_status status; struct ovsdb_symbol_table *symtab; - const char *unused; + const char *uncreated; struct vsctl_command *c; int64_t next_cfg = 0; char *error = NULL; @@ -3395,10 +3395,10 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands, } } - unused = ovsdb_symbol_table_find_unused(symtab); - if (unused) { + uncreated = ovsdb_symbol_table_find_uncreated(symtab); + if (uncreated) { vsctl_fatal("row id \"%s\" is referenced but never created (e.g. " - "with \"-- --id=%s create ...\")", unused, unused); + "with \"-- --id=%s create ...\")", uncreated, uncreated); } status = ovsdb_idl_txn_commit_block(txn); -- 2.30.2