[ovs-dev] [PATCH 3/6] ovsdb-idlc: Make schema version available.

Justin Pettit jpettit at nicira.com
Thu Feb 27 00:35:41 UTC 2014


Future patches will make use of the ability to retrieve the schema
version against which they were compiled.

Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ovsdb/ovsdb-idlc.in |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index ec1c655..d680f7c 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -166,6 +166,8 @@ struct %(s)s *%(s)s_insert(struct ovsdb_idl_txn *);
 
     print "\nextern struct ovsdb_idl_class %sidl_class;" % prefix
     print "\nvoid %sinit(void);" % prefix
+
+    print "\nconst char * %sget_db_version(void);" % prefix
     print "\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()}
 
 def printEnum(members):
@@ -652,6 +654,16 @@ void
         print "    %s_columns_init();" % structName
     print "}"
 
+    print """
+/* Return the schema version.  The caller must not free the returned value. */
+const char *
+%sget_db_version(void)
+{
+    return "%s";
+}
+""" % (prefix, schema.version)
+
+
 
 def ovsdb_escape(string):
     def escape(match):
-- 
1.7.5.4




More information about the dev mailing list