X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Ftest-ovsdb.c;h=b2ab4c6005638b24237aa1b84723dd8a009babf5;hb=2da0385d1f57fe00977d2e58022b3f9a6604192e;hp=2e12d495bd885d366c19afb1d3023aca98ae0d1d;hpb=c69ee87c10818267f991236201150b1fa51ae519;p=openvswitch diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c index 2e12d495..b2ab4c60 100644 --- a/tests/test-ovsdb.c +++ b/tests/test-ovsdb.c @@ -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++) { @@ -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) {