@@ -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;
}
@@ -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;
}
@@ -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)
{
@@ -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 */
I don't know of any reason to inline this. Also rename for consistency with get_bridge(). Signed-off-by: Ben Pfaff <blp@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(-)