ctdb-deamon: Rename vnn_has_interface_with_name() to vnn_has_interface()
authorMartin Schwenke <martin@meltin.net>
Wed, 24 Aug 2016 10:41:49 +0000 (20:41 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 8 Sep 2016 04:57:21 +0000 (06:57 +0200)
Now takes a pointer to an interface structure and does direct pointer
comparisons.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_takeover.c

index 28daf4d61cc7f7e6a634bc47648111c6a17ad68b..6843f9b103170643ca03d63bf34a245aedd0a389 100644 (file)
@@ -140,13 +140,13 @@ ctdb_add_local_iface(struct ctdb_context *ctdb, const char *iface)
        return i;
 }
 
-static bool vnn_has_interface_with_name(struct ctdb_vnn *vnn,
-                                       const char *name)
+static bool vnn_has_interface(struct ctdb_vnn *vnn,
+                             const struct ctdb_interface *iface)
 {
        struct vnn_interface *i;
 
        for (i = vnn->ifaces; i != NULL; i = i->next) {
-               if (strcmp(name, i->iface->name) == 0) {
+               if (iface == i->iface) {
                        return true;
                }
        }
@@ -177,14 +177,14 @@ static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
                next = i->next;
 
                /* Only consider interfaces named in the given VNN. */
-               if (!vnn_has_interface_with_name(vnn, i->name)) {
+               if (!vnn_has_interface(vnn, i)) {
                        continue;
                }
 
                /* Search for a vnn with this interface. */
                found = false;
                for (tv=ctdb->vnn; tv; tv=tv->next) {
-                       if (vnn_has_interface_with_name(tv, i->name)) {
+                       if (vnn_has_interface(tv, i)) {
                                found = true;
                                break;
                        }