Remove usage of GStaticMutex since it causes compiler problems
[connman] / plugins / ethernet.c
index f171348..d6861f8 100644 (file)
 
 #include <connman/plugin.h>
 #include <connman/driver.h>
+#include <connman/rtnl.h>
 #include <connman/log.h>
 
 struct ethernet_data {
        int index;
-       short flags;
+       unsigned flags;
 };
 
-static GStaticMutex ethernet_mutex = G_STATIC_MUTEX_INIT;
 static GSList *ethernet_list = NULL;
 
-static void ethernet_link_flags(int index, short flags)
+static void ethernet_newlink(unsigned short type, int index,
+                                       unsigned flags, unsigned change)
 {
        GSList *list;
 
-       g_static_mutex_lock(&ethernet_mutex);
+       DBG("index %d flags %ld change %ld", index, flags, change);
 
        for (list = ethernet_list; list; list = list->next) {
                struct connman_element *element = list->data;
@@ -83,13 +84,11 @@ static void ethernet_link_flags(int index, short flags)
                        connman_element_unregister_children(element);
                }
        }
-
-       g_static_mutex_unlock(&ethernet_mutex);
 }
 
 static struct connman_rtnl ethernet_rtnl = {
        .name           = "ethernet",
-       .link_flags     = ethernet_link_flags,
+       .newlink        = ethernet_newlink,
 };
 
 static int iface_up(struct ethernet_data *ethernet)
@@ -188,9 +187,7 @@ static int ethernet_probe(struct connman_element *element)
        if (ethernet == NULL)
                return -ENOMEM;
 
-       g_static_mutex_lock(&ethernet_mutex);
        ethernet_list = g_slist_append(ethernet_list, element);
-       g_static_mutex_unlock(&ethernet_mutex);
 
        connman_element_set_data(element, ethernet);
 
@@ -213,9 +210,7 @@ static void ethernet_remove(struct connman_element *element)
 
        iface_down(ethernet);
 
-       g_static_mutex_lock(&ethernet_mutex);
        ethernet_list = g_slist_remove(ethernet_list, element);
-       g_static_mutex_unlock(&ethernet_mutex);
 
        g_free(ethernet);
 }
@@ -238,7 +233,7 @@ static int ethernet_init(void)
 
        err = connman_driver_register(&ethernet_driver);
        if (err < 0) {
-               connman_rtnl_unregister(&ethernet_rtnl):
+               connman_rtnl_unregister(&ethernet_rtnl);
                return err;
        }