[ovs-dev] [RFC 01/14] ovsdb-idlc.in: Support more interfaces for passing pointers of individual tables.

Han Zhou zhouhan at gmail.com
Wed Jul 25 00:59:27 UTC 2018


This is a follow-up patch for commit 0eb1e37c, to add more interfaces
that supports passing around pointers of individual tables, which will
be used in incremental processing.

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
---
 ovsdb/ovsdb-idlc.in | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index ee655f7..1c9483c 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -251,6 +251,7 @@ const struct %(s)s *%(s)s_table_first(const struct %(s)s_table *);
              (ROW) = (NEXT))
 
 const struct %(s)s *%(s)s_get_for_uuid(const struct ovsdb_idl *, const struct uuid *);
+const struct %(s)s *%(s)s_table_get_for_uuid(const struct %(s)s_table *, 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) \\
@@ -271,6 +272,13 @@ const struct %(s)s *%(s)s_track_get_next(const struct %(s)s *);
              (ROW); \\
              (ROW) = %(s)s_track_get_next(ROW))
 
+const struct %(s)s *%(s)s_table_track_get_first(const struct %(s)s_table *);
+#define %(S)s_TABLE_FOR_EACH_TRACKED(ROW, TABLE) \\
+        for ((ROW) = %(s)s_table_track_get_first(TABLE); \\
+             (ROW); \\
+             (ROW) = %(s)s_track_get_next(ROW))
+
+
 /* Returns true if 'row' was inserted since the last change tracking reset. */
 static inline bool %(s)s_is_new(const struct %(s)s *row)
 {
@@ -479,6 +487,14 @@ const struct %(s)s *
     const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
     return %(s)s_first(idl);
 }
+
+
+const struct %(s)s *
+%(s)s_table_track_get_first(const struct %(s)s_table *table)
+{
+    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
+    return %(s)s_track_get_first(idl);
+}
 ''' % {'s': structName})
 
         # Parse functions.
@@ -655,6 +671,15 @@ const struct %(s)s *
     return %(s)s_cast(ovsdb_idl_get_row_for_uuid(idl, &%(p)stable_%(tl)s, uuid));
 }
 
+/* Searches table "%(t)s" for a row with UUID 'uuid'.  Returns
+ * a pointer to the row if there is one, otherwise a null pointer.  */
+const struct %(s)s *
+%(s)s_table_get_for_uuid(const struct %(s)s_table *table, const struct uuid *uuid)
+{
+    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
+    return %(s)s_get_for_uuid(idl, uuid);
+}
+
 /* Returns a row in table "%(t)s" in 'idl', or a null pointer if that
  * table is empty.
  *
-- 
2.1.0



More information about the dev mailing list