Define IQ macro for SSL man page fragment
[openvswitch] / tests / test-ovsdb.c
index 3025ce390510a076b91b9d60548c9ef4a654e5a0..b2ab4c6005638b24237aa1b84723dd8a009babf5 100644 (file)
@@ -257,34 +257,24 @@ static void
 do_log_io(int argc, char *argv[])
 {
     const char *name = argv[1];
-    char *mode = argv[2];
+    char *mode_string = argv[2];
 
     struct ovsdb_error *error;
+    enum ovsdb_log_open_mode mode;
     struct ovsdb_log *log;
-    char *save_ptr = NULL;
-    const char *token;
-    int flags;
     int i;
 
-    for (flags = 0, token = strtok_r(mode, " |", &save_ptr); token != NULL;
-         token = strtok_r(NULL, " |", &save_ptr))
-    {
-        if (!strcmp(token, "O_RDONLY")) {
-            flags |= O_RDONLY;
-        } else if (!strcmp(token, "O_RDWR")) {
-            flags |= O_RDWR;
-        } else if (!strcmp(token, "O_TRUNC")) {
-            flags |= O_TRUNC;
-        } else if (!strcmp(token, "O_CREAT")) {
-            flags |= O_CREAT;
-        } else if (!strcmp(token, "O_EXCL")) {
-            flags |= O_EXCL;
-        } else if (!strcmp(token, "O_TRUNC")) {
-            flags |= O_TRUNC;
-        }
+    if (!strcmp(mode_string, "read-only")) {
+        mode = OVSDB_LOG_READ_ONLY;
+    } else if (!strcmp(mode_string, "read/write")) {
+        mode = OVSDB_LOG_READ_WRITE;
+    } else if (!strcmp(mode_string, "create")) {
+        mode = OVSDB_LOG_CREATE;
+    } else {
+        ovs_fatal(0, "unknown log-io open mode \"%s\"", mode_string);
     }
 
-    check_ovsdb_error(ovsdb_log_open(name, flags, &log));
+    check_ovsdb_error(ovsdb_log_open(name, mode, -1, &log));
     printf("%s: open successful\n", name);
 
     for (i = 3; i < argc; i++) {
@@ -325,7 +315,7 @@ do_log_io(int argc, char *argv[])
 }
 
 static void
-do_parse_atomic_type(int argc UNUSED, char *argv[])
+do_parse_atomic_type(int argc OVS_UNUSED, char *argv[])
 {
     enum ovsdb_atomic_type type;
     struct json *json;
@@ -337,7 +327,7 @@ do_parse_atomic_type(int argc UNUSED, char *argv[])
 }
 
 static void
-do_parse_base_type(int argc UNUSED, char *argv[])
+do_parse_base_type(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_base_type base;
     struct json *json;
@@ -350,7 +340,7 @@ do_parse_base_type(int argc UNUSED, char *argv[])
 }
 
 static void
-do_parse_type(int argc UNUSED, char *argv[])
+do_parse_type(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_type type;
     struct json *json;
@@ -482,7 +472,7 @@ compare_atoms(const void *a_, const void *b_)
 }
 
 static void
-do_sort_atoms(int argc UNUSED, char *argv[])
+do_sort_atoms(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_base_type base;
     union ovsdb_atom *atoms;
@@ -524,7 +514,7 @@ do_sort_atoms(int argc UNUSED, char *argv[])
 }
 
 static void
-do_parse_column(int argc UNUSED, char *argv[])
+do_parse_column(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_column *column;
     struct json *json;
@@ -537,7 +527,7 @@ do_parse_column(int argc UNUSED, char *argv[])
 }
 
 static void
-do_parse_table(int argc UNUSED, char *argv[])
+do_parse_table(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_table_schema *ts;
     struct json *json;
@@ -705,7 +695,7 @@ do_parse_conditions(int argc, char *argv[])
 }
 
 static void
-do_evaluate_conditions(int argc UNUSED, char *argv[])
+do_evaluate_conditions(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_table_schema *ts;
     struct ovsdb_table *table;
@@ -810,7 +800,7 @@ do_parse_mutations(int argc, char *argv[])
 }
 
 static void
-do_execute_mutations(int argc UNUSED, char *argv[])
+do_execute_mutations(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_table_schema *ts;
     struct ovsdb_table *table;
@@ -926,7 +916,7 @@ do_query_cb(const struct ovsdb_row *row, void *cbdata_)
 }
 
 static void
-do_query(int argc UNUSED, char *argv[])
+do_query(int argc OVS_UNUSED, char *argv[])
 {
     struct do_query_cbdata cbdata;
     struct ovsdb_table_schema *ts;
@@ -1016,7 +1006,7 @@ struct do_query_distinct_row {
 };
 
 static void
-do_query_distinct(int argc UNUSED, char *argv[])
+do_query_distinct(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_column_set columns;
     struct ovsdb_table_schema *ts;
@@ -1141,7 +1131,7 @@ do_query_distinct(int argc UNUSED, char *argv[])
 }
 
 static void
-do_parse_schema(int argc UNUSED, char *argv[])
+do_parse_schema(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_schema *schema;
     struct json *json;
@@ -1154,7 +1144,7 @@ do_parse_schema(int argc UNUSED, char *argv[])
 }
 
 static void
-do_execute(int argc UNUSED, char *argv[])
+do_execute(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_schema *schema;
     struct json *json;
@@ -1204,7 +1194,7 @@ do_trigger_dump(struct test_trigger *t, long long int now, const char *title)
 }
 
 static void
-do_trigger(int argc UNUSED, char *argv[])
+do_trigger(int argc OVS_UNUSED, char *argv[])
 {
     struct ovsdb_schema *schema;
     struct list completions;
@@ -1259,7 +1249,7 @@ do_trigger(int argc UNUSED, char *argv[])
 }
 
 static void
-do_help(int argc UNUSED, char *argv[] UNUSED)
+do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     usage();
 }
@@ -1271,14 +1261,14 @@ static struct ovsdb_txn *do_transact_txn;
 static struct ovsdb_table *do_transact_table;
 
 static void
-do_transact_commit(int argc UNUSED, char *argv[] UNUSED)
+do_transact_commit(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     ovsdb_txn_commit(do_transact_txn, false);
     do_transact_txn = NULL;
 }
 
 static void
-do_transact_abort(int argc UNUSED, char *argv[] UNUSED)
+do_transact_abort(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     ovsdb_txn_abort(do_transact_txn);
     do_transact_txn = NULL;
@@ -1338,7 +1328,7 @@ do_transact_set_i_j(struct ovsdb_row *row,
 }
 
 static void
-do_transact_insert(int argc UNUSED, char *argv[] UNUSED)
+do_transact_insert(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     struct ovsdb_row *row;
     struct uuid *uuid;
@@ -1360,14 +1350,14 @@ do_transact_insert(int argc UNUSED, char *argv[] UNUSED)
 }
 
 static void
-do_transact_delete(int argc UNUSED, char *argv[] UNUSED)
+do_transact_delete(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     const struct ovsdb_row *row = do_transact_find_row(argv[1]);
     ovsdb_txn_row_delete(do_transact_txn, row);
 }
 
 static void
-do_transact_modify(int argc UNUSED, char *argv[] UNUSED)
+do_transact_modify(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     const struct ovsdb_row *row_ro;
     struct ovsdb_row *row_rw;
@@ -1387,7 +1377,7 @@ compare_rows_by_uuid(const void *a_, const void *b_)
 }
 
 static void
-do_transact_print(int argc UNUSED, char *argv[] UNUSED)
+do_transact_print(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
     const struct ovsdb_row **rows;
     const struct ovsdb_row *row;
@@ -1745,12 +1735,7 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step)
         }
     }
 
-    while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
-        ovsdb_idl_run(idl);
-        ovsdb_idl_wait(idl);
-        ovsdb_idl_txn_wait(txn);
-        poll_block();
-    }
+    status = ovsdb_idl_txn_commit_block(txn);
     printf("%03d: commit, status=%s",
            step, ovsdb_idl_txn_status_to_string(status));
     if (increment) {