[ovs-dev] [PATCH 07/23] ovn-controller: Un-inline get_chassis_by_name().

Ben Pfaff blp at nicira.com
Sat Oct 10 04:15:28 UTC 2015


I don't know of any reason to inline this.

Also rename for consistency with get_bridge().

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 ovn/controller/binding.c        |  4 ++--
 ovn/controller/chassis.c        |  4 ++--
 ovn/controller/ovn-controller.c | 14 ++++++++++++++
 ovn/controller/ovn-controller.h | 15 ++-------------
 4 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index fca2430..b2f2a19 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -84,7 +84,7 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
         return;
     }
 
-    chassis_rec = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+    chassis_rec = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return;
     }
@@ -142,7 +142,7 @@ binding_cleanup(struct controller_ctx *ctx, const char *chassis_id)
         return true;
     }
     const struct sbrec_chassis *chassis_rec
-        = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return true;
     }
diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index 9d6a77a..abe2e4d 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -43,7 +43,7 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id)
     struct sbrec_encap *encap_rec;
     static bool inited = false;
 
-    chassis_rec = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+    chassis_rec = get_chassis(ctx->ovnsb_idl, chassis_id);
 
     /* xxx Need to support more than one encap.  Also need to support
      * xxx encap options. */
@@ -110,7 +110,7 @@ chassis_cleanup(struct controller_ctx *ctx, const char *chassis_id)
 
     /* Delete Chassis row. */
     const struct sbrec_chassis *chassis_rec
-        = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return true;
     }
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index f1bc524..0371c38 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -57,6 +57,20 @@ OVS_NO_RETURN static void usage(void);
 
 static char *ovs_remote;
 
+const struct sbrec_chassis *
+get_chassis(struct ovsdb_idl *ovnsb_idl, const char *chassis_id)
+{
+    const struct sbrec_chassis *chassis_rec;
+
+    SBREC_CHASSIS_FOR_EACH(chassis_rec, ovnsb_idl) {
+        if (!strcmp(chassis_rec->name, chassis_id)) {
+            break;
+        }
+    }
+
+    return chassis_rec;
+}
+
 static const struct ovsrec_bridge *
 get_bridge(struct ovsdb_idl *ovs_idl, const char *br_name)
 {
diff --git a/ovn/controller/ovn-controller.h b/ovn/controller/ovn-controller.h
index be89b5f..9766bc3 100644
--- a/ovn/controller/ovn-controller.h
+++ b/ovn/controller/ovn-controller.h
@@ -27,18 +27,7 @@ struct controller_ctx {
     struct ovsdb_idl_txn *ovs_idl_txn;
 };
 
-static inline const struct sbrec_chassis *
-get_chassis_by_name(struct ovsdb_idl *ovnsb_idl, const char *chassis_id)
-{
-    const struct sbrec_chassis *chassis_rec;
-
-    SBREC_CHASSIS_FOR_EACH(chassis_rec, ovnsb_idl) {
-        if (!strcmp(chassis_rec->name, chassis_id)) {
-            break;
-        }
-    }
-
-    return chassis_rec;
-}
+const struct sbrec_chassis *get_chassis(struct ovsdb_idl *,
+                                        const char *chassis_id);
 
 #endif /* ovn/ovn-controller.h */
-- 
2.1.3




More information about the dev mailing list