[ovs-dev] [PATCH v4 1/2] ovsdb-idlc: Generate new *_get_for_uuid() functions.
Ben Pfaff
blp at nicira.com
Fri Mar 28 04:02:36 UTC 2014
This allows a client to obtain the IDL version of a row given its UUID.
It isn't normally useful, but there's a specialized use case for getting
the IDL version of a row given the UUID returned by
ovsdb_idl_txn_get_insert_uuid() following transaction commit.
An alternative would be to generate table-specific versions of
ovsdb_idl_txn_get_insert_uuid(). That seems reasonable to me too.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
v4: New patch.
ovsdb/ovsdb-idlc.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index d680f7c..6c8aa43 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -110,6 +110,7 @@ def printCIDLHeader(schemaFile):
print "\nextern struct ovsdb_idl_column %s_columns[%s_N_COLUMNS];" % (structName, structName.upper())
print '''
+const struct %(s)s *%(s)s_get_for_uuid(const struct ovsdb_idl *, const struct uuid *);
const struct %(s)s *%(s)s_first(const struct ovsdb_idl *);
const struct %(s)s *%(s)s_next(const struct %(s)s *);
#define %(S)s_FOR_EACH(ROW, IDL) \\
@@ -382,6 +383,12 @@ void
# First, next functions.
print '''
const struct %(s)s *
+%(s)s_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
+{
+ return %(s)s_cast(ovsdb_idl_get_row_for_uuid(idl, &%(p)stable_classes[%(P)sTABLE_%(T)s], uuid));
+}
+
+const struct %(s)s *
%(s)s_first(const struct ovsdb_idl *idl)
{
return %(s)s_cast(ovsdb_idl_first_row(idl, &%(p)stable_classes[%(P)sTABLE_%(T)s]));
--
1.8.5.3
More information about the dev
mailing list