X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-idl.c;h=42c53b831c60e9044731af6dd4cdedb69ba46b38;hb=55aa00e0df2cacc67081d31b813328fb39ce3561;hp=fd4607de81061820c589a3671277eab8697f8278;hpb=af96ccd24690553a0f8e2dbe9ee72530f18629c6;p=openvswitch diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index fd4607de..42c53b83 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -914,13 +914,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 @@ -1681,3 +1690,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; +} +