X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-idl.c;h=3f3ce555ac3f4ec413352107ef65e40730ade696;hb=3bcf3e33e9cfb7fd837086bfa8e627110d84dce8;hp=fd4607de81061820c589a3671277eab8697f8278;hpb=af96ccd24690553a0f8e2dbe9ee72530f18629c6;p=openvswitch diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index fd4607de..3f3ce555 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -25,6 +25,7 @@ #include "bitmap.h" #include "dynamic-string.h" +#include "fatal-signal.h" #include "json.h" #include "jsonrpc.h" #include "ovsdb-data.h" @@ -914,13 +915,22 @@ ovsdb_idl_txn_create(struct ovsdb_idl *idl) return txn; } +/* Appends 's', which is treated as a printf()-type format string, to the + * comments that will be passed to the OVSDB server when 'txn' is committed. + * (The comment will be committed to the OVSDB log, which "ovsdb-tool + * show-log" can print in a relatively human-readable form.) */ void -ovsdb_idl_txn_add_comment(struct ovsdb_idl_txn *txn, const char *s) +ovsdb_idl_txn_add_comment(struct ovsdb_idl_txn *txn, const char *s, ...) { + va_list args; + if (txn->comment.length) { ds_put_char(&txn->comment, '\n'); } - ds_put_cstr(&txn->comment, s); + + va_start(args, s); + ds_put_format_valist(&txn->comment, s, args); + va_end(args); } void @@ -1272,6 +1282,7 @@ ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *txn) { enum ovsdb_idl_txn_status status; + fatal_signal_run(); while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) { ovsdb_idl_run(txn->idl); ovsdb_idl_wait(txn->idl); @@ -1681,3 +1692,10 @@ ovsdb_idl_txn_get(const struct ovsdb_idl_row *row) assert(txn != NULL); return txn; } + +struct ovsdb_idl * +ovsdb_idl_txn_get_idl (struct ovsdb_idl_txn *txn) +{ + return txn->idl; +} +