X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fexecution.c;h=514a278481f6ee8873ebe681e1e512176d1f490e;hb=1f06575b3d34bd8a9ac8be841b9249e92a75382f;hp=67f6b8d0611ab213b86980217d55ff30ef16f437;hpb=e9f8f9367e9e654b9582279608af86ea3744a2a0;p=openvswitch diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 67f6b8d0..514a2784 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009 Nicira Networks +/* Copyright (c) 2009, 2010 Nicira Networks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,6 +57,7 @@ static ovsdb_operation_executor ovsdb_execute_wait; static ovsdb_operation_executor ovsdb_execute_commit; static ovsdb_operation_executor ovsdb_execute_abort; static ovsdb_operation_executor ovsdb_execute_declare; +static ovsdb_operation_executor ovsdb_execute_comment; static ovsdb_operation_executor * lookup_executor(const char *name) @@ -76,6 +77,7 @@ lookup_executor(const char *name) { "commit", ovsdb_execute_commit }, { "abort", ovsdb_execute_abort }, { "declare", ovsdb_execute_declare }, + { "comment", ovsdb_execute_comment }, }; size_t i; @@ -159,9 +161,11 @@ ovsdb_execute(struct ovsdb *db, const struct json *params, && timeout_msec) { ovsdb_txn_abort(x.txn); *timeout_msec = x.timeout_msec; - ovsdb_error_destroy(error); + + json_destroy(result); json_destroy(results); - return NULL; + results = NULL; + goto exit; } /* Add result to array. */ @@ -184,6 +188,7 @@ ovsdb_execute(struct ovsdb *db, const struct json *params, json_array_add(results, json_null_create()); } +exit: ovsdb_error_destroy(error); ovsdb_symbol_table_destroy(x.symtab); @@ -685,3 +690,18 @@ ovsdb_execute_declare(struct ovsdb_execution *x, struct ovsdb_parser *parser, xasprintf(UUID_FMT, UUID_ARGS(&uuid)))); return NULL; } + +static struct ovsdb_error * +ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser, + struct json *result UNUSED) +{ + const struct json *comment; + + comment = ovsdb_parser_member(parser, "comment", OP_STRING); + if (!comment) { + return NULL; + } + ovsdb_txn_add_comment(x->txn, json_string(comment)); + + return NULL; +}