ovsdb-idlc: Make schema version available.
authorJustin Pettit <jpettit@nicira.com>
Thu, 27 Feb 2014 00:18:33 +0000 (16:18 -0800)
committerJustin Pettit <jpettit@nicira.com>
Fri, 28 Feb 2014 21:18:29 +0000 (13:18 -0800)
Future patches will make use of the ability to retrieve the schema
version against which they were compiled.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ovsdb/ovsdb-idlc.in

index ec1c655..d680f7c 100755 (executable)
@@ -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):