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

Message ID 1532480380-97578-2-git-send-email-hzhou8@ebay.com
State RFC
Headers show
Series
  • ovn-controller incremental processing.
Related show

Commit Message

Han Zhou July 25, 2018, 12:59 a.m.
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@ebay.com>
---
 ovsdb/ovsdb-idlc.in | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Patch

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.
  *