X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fovsdb-client.c;h=7177b2614c9893e77d852a1f419f60bf2f11ab30;hb=6c4bf0b0070d474ac6cf97b3fda2e262cd060703;hp=e6dee819e2bb08296d56f6a248ab6c1bd24f87d7;hpb=25c269efadb6a7f7f00d8a1ee66104041481299d;p=openvswitch diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index e6dee819..7177b261 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -224,11 +224,11 @@ open_jsonrpc(const char *server) struct stream *stream; int error; - error = stream_open_block(server, &stream); + error = stream_open_block(jsonrpc_stream_open(server, &stream), &stream); if (error == EAFNOSUPPORT) { struct pstream *pstream; - error = pstream_open(server, &pstream); + error = jsonrpc_pstream_open(server, &pstream); if (error) { ovs_fatal(error, "failed to connect or listen to \"%s\"", server); } @@ -434,9 +434,14 @@ table_print_table_line__(struct ds *line) static void table_print_table__(const struct table *table) { + static int n = 0; struct ds line = DS_EMPTY_INITIALIZER; size_t x, y; + if (n++ > 0) { + putchar('\n'); + } + if (output_headings) { for (x = 0; x < table->n_columns; x++) { const struct column *column = &table->columns[x]; @@ -590,8 +595,13 @@ table_print_csv_cell__(const char *content) static void table_print_csv__(const struct table *table) { + static int n = 0; size_t x, y; + if (n++ > 0) { + putchar('\n'); + } + if (table->caption) { puts(table->caption); } @@ -685,15 +695,11 @@ do_list_tables(int argc OVS_UNUSED, char *argv[]) schema = fetch_schema(argv[1], argv[2]); table_init(&t); table_add_column(&t, "Table"); - table_add_column(&t, "Comment"); SHASH_FOR_EACH (node, &schema->tables) { struct ovsdb_table_schema *ts = node->data; table_add_row(&t); table_add_cell(&t, ts->name); - if (ts->comment) { - table_add_cell(&t, ts->comment); - } } ovsdb_schema_destroy(schema); table_print(&t); @@ -714,7 +720,6 @@ do_list_columns(int argc OVS_UNUSED, char *argv[]) } table_add_column(&t, "Column"); table_add_column(&t, "Type"); - table_add_column(&t, "Comment"); SHASH_FOR_EACH (table_node, &schema->tables) { struct ovsdb_table_schema *ts = table_node->data; @@ -731,9 +736,6 @@ do_list_columns(int argc OVS_UNUSED, char *argv[]) } table_add_cell(&t, column->name); table_add_cell_nocopy(&t, json_to_string(type, JSSF_SORT)); - if (column->comment) { - table_add_cell(&t, column->comment); - } json_destroy(type); } @@ -915,14 +917,22 @@ do_monitor(int argc, char *argv[]) ovsdb_column_set_add(&columns, column); } } else { - struct shash_node *node; - - SHASH_FOR_EACH (node, &table->columns) { - const struct ovsdb_column *column = node->data; - if (column->index != OVSDB_COL_UUID) { + const struct shash_node **nodes; + size_t i, n; + + n = shash_count(&table->columns); + nodes = shash_sort(&table->columns); + for (i = 0; i < n; i++) { + const struct ovsdb_column *column = nodes[i]->data; + if (column->index != OVSDB_COL_UUID + && column->index != OVSDB_COL_VERSION) { ovsdb_column_set_add(&columns, column); } } + free(nodes); + + ovsdb_column_set_add(&columns, + ovsdb_table_schema_get_column(table, "_version")); } if (argc >= 6 && *argv[5] != '\0') {