platform: add trace-logging to nm_platform_link_get_all()

This commit is contained in:
Thomas Haller
2015-07-02 14:42:08 +02:00
parent c9aeefb5a1
commit 987515ea73

View File

@@ -445,11 +445,14 @@ nm_platform_link_get_all (NMPlatform *self)
item = &g_array_index (links, NMPlatformLink, i); item = &g_array_index (links, NMPlatformLink, i);
if (item->ifindex <= 0 || g_hash_table_contains (unseen, GINT_TO_POINTER (item->ifindex))) { if (item->ifindex <= 0 || g_hash_table_contains (unseen, GINT_TO_POINTER (item->ifindex))) {
_LOGT ("link-get: SKIP: %3d: %s", i, nm_platform_link_to_string (item));
g_warn_if_reached (); g_warn_if_reached ();
item->ifindex = 0; item->ifindex = 0;
continue; continue;
} }
_LOGT ("link-get: %3d: %s", i, nm_platform_link_to_string (item));
g_hash_table_insert (unseen, GINT_TO_POINTER (item->ifindex), NULL); g_hash_table_insert (unseen, GINT_TO_POINTER (item->ifindex), NULL);
} }
@@ -499,6 +502,8 @@ nm_platform_link_get_all (NMPlatform *self)
if (item->parent > 0 && g_hash_table_contains (unseen, GINT_TO_POINTER (item->parent))) if (item->parent > 0 && g_hash_table_contains (unseen, GINT_TO_POINTER (item->parent)))
continue; continue;
_LOGT ("link-get: add %3d -> %3d: %s", i, j, nm_platform_link_to_string (item));
g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex)); g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex));
g_array_index (result, NMPlatformLink, j++) = *item; g_array_index (result, NMPlatformLink, j++) = *item;
item->ifindex = 0; item->ifindex = 0;
@@ -507,9 +512,11 @@ nm_platform_link_get_all (NMPlatform *self)
if (!found_something) { if (!found_something) {
/* there is a circle, pop the first (remaining) element from the list */ /* there is a circle, pop the first (remaining) element from the list */
g_warn_if_reached ();
item = &g_array_index (links, NMPlatformLink, first_idx); item = &g_array_index (links, NMPlatformLink, first_idx);
_LOGT ("link-get: add (circle) %3d -> %3d: %s", first_idx, j, nm_platform_link_to_string (item));
g_warn_if_reached ();
g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex)); g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex));
g_array_index (result, NMPlatformLink, j++) = *item; g_array_index (result, NMPlatformLink, j++) = *item;
item->ifindex = 0; item->ifindex = 0;