logging: swap names of logging macros _LOGT() and _LOGt()

Previsously, _LOGT() could be disabled at compile time. Thus it
was different then the other macros _LOGD(), _LOGI(), etc.

OTOH, _LOGt() was the macro that always was compiled in.

Swap the name of the macros. Now the upper-case macros are always
enabled, while the lower-case macro _LOGt() is enabled depending
on compile configuration.

(cherry picked from commit 9587867349)
This commit is contained in:
Thomas Haller 2015-11-06 12:58:55 +01:00
parent 8c8e88ae28
commit ca7d6feafd
5 changed files with 82 additions and 82 deletions

View file

@ -173,27 +173,27 @@ void nm_logging_syslog_closelog (void);
* might want to undef this and redefine it. */
#define _NMLOG_ENABLED(level) ( nm_logging_enabled ((level), (_NMLOG_DOMAIN)) )
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
#define _LOGT(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
#define _LOGD(...) _NMLOG (LOGL_DEBUG, __VA_ARGS__)
#define _LOGI(...) _NMLOG (LOGL_INFO , __VA_ARGS__)
#define _LOGW(...) _NMLOG (LOGL_WARN , __VA_ARGS__)
#define _LOGE(...) _NMLOG (LOGL_ERR , __VA_ARGS__)
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
#define _LOGT_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
#define _LOGD_ENABLED(...) _NMLOG_ENABLED (LOGL_DEBUG, ##__VA_ARGS__)
#define _LOGI_ENABLED(...) _NMLOG_ENABLED (LOGL_INFO , ##__VA_ARGS__)
#define _LOGW_ENABLED(...) _NMLOG_ENABLED (LOGL_WARN , ##__VA_ARGS__)
#define _LOGE_ENABLED(...) _NMLOG_ENABLED (LOGL_ERR , ##__VA_ARGS__)
/* _LOGt() and _LOGT() both log with level TRACE, but the latter is disabled by default,
/* _LOGT() and _LOGt() both log with level TRACE, but the latter is disabled by default,
* unless building with --with-more-logging. */
#ifdef NM_MORE_LOGGING
#define _LOGT_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
#define _LOGT(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
#define _LOGt_ENABLED(...) _NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)
#define _LOGt(...) _NMLOG (LOGL_TRACE, __VA_ARGS__)
#else
/* still call the logging macros to get compile time checks, but they will be optimize out. */
#define _LOGT_ENABLED(...) ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
#define _LOGT(...) G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
#define _LOGt_ENABLED(...) ( FALSE && (_NMLOG_ENABLED (LOGL_TRACE, ##__VA_ARGS__)) )
#define _LOGt(...) G_STMT_START { if (FALSE) { _NMLOG (LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
#endif
/*****************************************************************************/

View file

@ -465,13 +465,13 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
ASSERT_route_index_valid (vtable, known_routes, known_routes_idx, FALSE);
_LOGD (vtable->vt->addr_family, "%3d: sync %u IPv%c routes", ifindex, known_routes_idx->len, vtable->vt->is_ip4 ? '4' : '6');
if (_LOGT_ENABLED (vtable->vt->addr_family)) {
if (_LOGt_ENABLED (vtable->vt->addr_family)) {
for (i = 0; i < known_routes_idx->len; i++) {
_LOGT (vtable->vt->addr_family, "%3d: sync new route #%u: %s",
_LOGt (vtable->vt->addr_family, "%3d: sync new route #%u: %s",
ifindex, i, vtable->vt->route_to_string (VTABLE_ROUTE_INDEX (vtable, known_routes, i)));
}
for (i = 0; i < ipx_routes->index->len; i++)
_LOGT (vtable->vt->addr_family, "%3d: STATE: has #%u - %s (%lld)",
_LOGt (vtable->vt->addr_family, "%3d: STATE: has #%u - %s (%lld)",
ifindex, i,
vtable->vt->route_to_string (ipx_routes->index->entries[i]),
(long long) g_array_index (ipx_routes->effective_metrics, gint64, i));
@ -513,7 +513,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
cur_ipx_route->rx.ifindex = ifindex;
cur_ipx_route->rx.metric = vtable->vt->metric_normalize (cur_ipx_route->rx.metric);
ipx_routes_changed = TRUE;
_LOGT (vtable->vt->addr_family, "%3d: STATE: update #%u - %s", ifindex, i_ipx_routes, vtable->vt->route_to_string (cur_ipx_route));
_LOGt (vtable->vt->addr_family, "%3d: STATE: update #%u - %s", ifindex, i_ipx_routes, vtable->vt->route_to_string (cur_ipx_route));
}
} else if (cur_known_route) {
g_assert (!cur_ipx_route || route_id_cmp_result > 0);
@ -571,7 +571,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
&& cur_plat_route->rx.metric == *p_effective_metric) {
/* we are about to delete cur_ipx_route and we have a matching route
* in platform. Delete it. */
_LOGT (vtable->vt->addr_family, "%3d: platform rt-rm #%u - %s", ifindex, i_plat_routes, vtable->vt->route_to_string (cur_plat_route));
_LOGt (vtable->vt->addr_family, "%3d: platform rt-rm #%u - %s", ifindex, i_plat_routes, vtable->vt->route_to_string (cur_plat_route));
vtable->vt->route_delete (priv->platform, ifindex, cur_plat_route);
}
}
@ -583,7 +583,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
for (i = 0; i < to_delete_indexes->len; i++) {
guint idx = g_array_index (to_delete_indexes, guint, i);
_LOGT (vtable->vt->addr_family, "%3d: STATE: delete #%u - %s", ifindex, idx, vtable->vt->route_to_string (ipx_routes->index->entries[idx]));
_LOGt (vtable->vt->addr_family, "%3d: STATE: delete #%u - %s", ifindex, idx, vtable->vt->route_to_string (ipx_routes->index->entries[idx]));
g_array_index (to_delete_indexes, guint, i) = _route_index_reverse_idx (vtable, ipx_routes->index, idx, ipx_routes->entries);
}
g_array_sort (to_delete_indexes, (GCompareFunc) _sort_indexes_cmp);
@ -607,7 +607,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
g_array_index (ipx_routes->effective_metrics_reverse, gint64, j++) = -1;
_LOGT (vtable->vt->addr_family, "%3d: STATE: added #%u - %s", ifindex, ipx_routes->entries->len - 1, vtable->vt->route_to_string (ipx_route));
_LOGt (vtable->vt->addr_family, "%3d: STATE: added #%u - %s", ifindex, ipx_routes->entries->len - 1, vtable->vt->route_to_string (ipx_route));
}
g_ptr_array_unref (to_add_routes);
}
@ -692,7 +692,7 @@ _vx_route_sync (const VTableIP *vtable, NMRouteManager *self, int ifindex, const
break;
}
next:
_LOGT (vtable->vt->addr_family, "%3d: new metric #%u - %s (%lld)",
_LOGt (vtable->vt->addr_family, "%3d: new metric #%u - %s (%lld)",
ifindex, i_ipx_routes,
vtable->vt->route_to_string (cur_ipx_route),
(long long) *p_effective_metric);
@ -717,7 +717,7 @@ next:
g_assert (cur_plat_route->rx.ifindex == ifindex);
_LOGT (vtable->vt->addr_family, "%3d: platform rt #%u - %s", ifindex, i_plat_routes, vtable->vt->route_to_string (cur_plat_route));
_LOGt (vtable->vt->addr_family, "%3d: platform rt #%u - %s", ifindex, i_plat_routes, vtable->vt->route_to_string (cur_plat_route));
/* skip over @cur_ipx_route that are ordered before @cur_plat_route */
while ( cur_ipx_route
@ -987,7 +987,7 @@ _ip4_device_routes_idle_cb (IP4DeviceRoutePurgeEntry *entry)
return G_SOURCE_REMOVE;
}
_LOGT (vtable_v4.vt->addr_family, "device-route: delete %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
_LOGt (vtable_v4.vt->addr_family, "device-route: delete %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
nm_platform_ip4_route_delete (priv->platform,
entry->obj->ip4_route.ifindex,
@ -1030,14 +1030,14 @@ _ip4_device_routes_ip4_route_changed (NMPlatform *platform,
return;
if (_ip4_device_routes_entry_expired (entry, nm_utils_get_monotonic_timestamp_ns ())) {
_LOGT (vtable_v4.vt->addr_family, "device-route: cleanup-ch %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
_LOGt (vtable_v4.vt->addr_family, "device-route: cleanup-ch %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
g_hash_table_remove (priv->ip4_device_routes.entries, entry->obj);
_ip4_device_routes_cancel (self);
return;
}
if (entry->idle_id == 0) {
_LOGT (vtable_v4.vt->addr_family, "device-route: schedule %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
_LOGt (vtable_v4.vt->addr_family, "device-route: schedule %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
entry->idle_id = g_idle_add ((GSourceFunc) _ip4_device_routes_idle_cb, entry);
}
}
@ -1050,7 +1050,7 @@ _ip4_device_routes_cancel (NMRouteManager *self)
if (priv->ip4_device_routes.gc_id) {
if (g_hash_table_size (priv->ip4_device_routes.entries) > 0)
return G_SOURCE_CONTINUE;
_LOGT (vtable_v4.vt->addr_family, "device-route: cancel");
_LOGt (vtable_v4.vt->addr_family, "device-route: cancel");
if (priv->platform)
g_signal_handlers_disconnect_by_func (priv->platform, G_CALLBACK (_ip4_device_routes_ip4_route_changed), self);
nm_clear_g_source (&priv->ip4_device_routes.gc_id);
@ -1071,7 +1071,7 @@ _ip4_device_routes_gc (NMRouteManager *self)
g_hash_table_iter_init (&iter, priv->ip4_device_routes.entries);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &entry)) {
if (_ip4_device_routes_entry_expired (entry, now)) {
_LOGT (vtable_v4.vt->addr_family, "device-route: cleanup-gc %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
_LOGt (vtable_v4.vt->addr_family, "device-route: cleanup-gc %s", nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
g_hash_table_iter_remove (&iter);
}
}
@ -1104,7 +1104,7 @@ nm_route_manager_ip4_route_register_device_route_purge_list (NMRouteManager *sel
IP4DeviceRoutePurgeEntry *entry;
entry = _ip4_device_routes_purge_entry_create (self, &g_array_index (device_route_purge_list, NMPlatformIP4Route, i), now_ns);
_LOGT (vtable_v4.vt->addr_family, "device-route: watch (%s) %s",
_LOGt (vtable_v4.vt->addr_family, "device-route: watch (%s) %s",
g_hash_table_contains (priv->ip4_device_routes.entries, entry->obj)
? "update" : "new",
nmp_object_to_string (entry->obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));

View file

@ -466,7 +466,7 @@ _nl_sock_request_link (NMPlatform *platform, struct nl_sock *sk, int ifindex, co
g_return_val_if_fail (ifindex > 0 || name, -NLE_INVAL);
_LOGT ("sock: request-link %d%s%s%s", ifindex, name ? ", \"" : "", name ? name : "", name ? "\"" : "");
_LOGt ("sock: request-link %d%s%s%s", ifindex, name ? ", \"" : "", name ? name : "", name ? "\"" : "");
if ((err = rtnl_link_build_get_request (ifindex, name, &msg)) < 0)
return err;
@ -491,7 +491,7 @@ _nl_sock_request_all (NMPlatform *platform, struct nl_sock *sk, NMPObjectType ob
klass = nmp_class_from_type (obj_type);
_LOGT ("sock: request-all-%s", klass->obj_type_name);
_LOGt ("sock: request-all-%s", klass->obj_type_name);
/* reimplement
* nl_rtgen_request (sk, klass->rtm_gettype, klass->addr_family, NLM_F_DUMP);
@ -901,7 +901,7 @@ link_extract_type (NMPlatform *platform, struct rtnl_link *rtnllink, gboolean *c
obj = _lookup_link_cached (platform, rtnl_link_get_ifindex (rtnllink), completed_from_cache, link_cached);
if (obj && obj->link.kind) {
rtnl_type = obj->link.kind;
_LOGT ("link_extract_type(): complete kind from cache: ifindex=%d, kind=%s", rtnl_link_get_ifindex (rtnllink), rtnl_type);
_LOGt ("link_extract_type(): complete kind from cache: ifindex=%d, kind=%s", rtnl_link_get_ifindex (rtnllink), rtnl_type);
}
}
if (out_kind)
@ -1012,8 +1012,8 @@ _nmp_vt_cmd_plobj_init_from_nl_link (NMPlatform *platform, NMPlatformObject *_ob
nm_assert (memcmp (obj, ((char [sizeof (NMPObjectLink)]) { 0 }), sizeof (NMPObjectLink)) == 0);
if (_LOGT_ENABLED () && !NM_IN_SET (rtnl_link_get_family (nlo), AF_UNSPEC, AF_BRIDGE))
_LOGT ("netlink object for ifindex %d has unusual family %d", rtnl_link_get_ifindex (nlo), rtnl_link_get_family (nlo));
if (_LOGt_ENABLED () && !NM_IN_SET (rtnl_link_get_family (nlo), AF_UNSPEC, AF_BRIDGE))
_LOGt ("netlink object for ifindex %d has unusual family %d", rtnl_link_get_ifindex (nlo), rtnl_link_get_family (nlo));
obj->ifindex = rtnl_link_get_ifindex (nlo);
@ -1471,7 +1471,7 @@ do_emit_signal (NMPlatform *platform, const NMPObject *obj, NMPCacheOpsType cach
klass = NMP_OBJECT_GET_CLASS (obj);
_LOGT ("emit signal %s %s: %s (%ld)",
_LOGt ("emit signal %s %s: %s (%ld)",
klass->signal_type,
nm_platform_signal_change_type_to_string ((NMPlatformSignalChangeType) cache_op),
nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0),
@ -1528,8 +1528,8 @@ delayed_action_to_string (DelayedActionType action_type)
}
}
#define _LOGT_delayed_action(action_type, arg, operation) \
_LOGT ("delayed-action: %s %s (%d) [%p / %d]", ""operation, delayed_action_to_string (action_type), (int) action_type, arg, GPOINTER_TO_INT (arg))
#define _LOGt_delayed_action(action_type, arg, operation) \
_LOGt ("delayed-action: %s %s (%d) [%p / %d]", ""operation, delayed_action_to_string (action_type), (int) action_type, arg, GPOINTER_TO_INT (arg))
static void
delayed_action_handle_MASTER_CONNECTED (NMPlatform *platform, int master_ifindex)
@ -1584,7 +1584,7 @@ delayed_action_handle_one (NMPlatform *platform)
priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_MASTER_CONNECTED;
nm_assert (_nm_utils_ptrarray_find_first (priv->delayed_action.list_master_connected->pdata, priv->delayed_action.list_master_connected->len, user_data) < 0);
_LOGT_delayed_action (DELAYED_ACTION_TYPE_MASTER_CONNECTED, user_data, "handle");
_LOGt_delayed_action (DELAYED_ACTION_TYPE_MASTER_CONNECTED, user_data, "handle");
delayed_action_handle_MASTER_CONNECTED (platform, GPOINTER_TO_INT (user_data));
return TRUE;
}
@ -1593,7 +1593,7 @@ delayed_action_handle_one (NMPlatform *platform)
/* Next we prefer read-netlink, because the buffer size is limited and we want to process events
* from netlink early. */
if (NM_FLAGS_HAS (priv->delayed_action.flags, DELAYED_ACTION_TYPE_READ_NETLINK)) {
_LOGT_delayed_action (DELAYED_ACTION_TYPE_READ_NETLINK, NULL, "handle");
_LOGt_delayed_action (DELAYED_ACTION_TYPE_READ_NETLINK, NULL, "handle");
priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_READ_NETLINK;
delayed_action_handle_READ_NETLINK (platform);
return TRUE;
@ -1606,10 +1606,10 @@ delayed_action_handle_one (NMPlatform *platform)
priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_REFRESH_ALL;
if (_LOGT_ENABLED ()) {
if (_LOGt_ENABLED ()) {
for (iflags = (DelayedActionType) 0x1LL; iflags <= DELAYED_ACTION_TYPE_MAX; iflags <<= 1) {
if (NM_FLAGS_HAS (flags, iflags))
_LOGT_delayed_action (iflags, NULL, "handle");
_LOGt_delayed_action (iflags, NULL, "handle");
}
}
@ -1626,7 +1626,7 @@ delayed_action_handle_one (NMPlatform *platform)
priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_REFRESH_LINK;
nm_assert (_nm_utils_ptrarray_find_first (priv->delayed_action.list_refresh_link->pdata, priv->delayed_action.list_refresh_link->len, user_data) < 0);
_LOGT_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, user_data, "handle");
_LOGt_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, user_data, "handle");
delayed_action_handle_REFRESH_LINK (platform, GPOINTER_TO_INT (user_data));
@ -1677,7 +1677,7 @@ delayed_action_clear_REFRESH_LINK (NMPlatform *platform, int ifindex)
if (idx < 0)
return;
_LOGT_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, user_data, "clear");
_LOGt_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, user_data, "clear");
g_ptr_array_remove_index_fast (priv->delayed_action.list_refresh_link, idx);
if (priv->delayed_action.list_refresh_link->len == 0)
@ -1705,10 +1705,10 @@ delayed_action_schedule (NMPlatform *platform, DelayedActionType action_type, gp
priv->delayed_action.flags |= action_type;
if (_LOGT_ENABLED ()) {
if (_LOGt_ENABLED ()) {
for (iflags = (DelayedActionType) 0x1LL; iflags <= DELAYED_ACTION_TYPE_MAX; iflags <<= 1) {
if (NM_FLAGS_HAS (action_type, iflags))
_LOGT_delayed_action (iflags, user_data, "schedule");
_LOGt_delayed_action (iflags, user_data, "schedule");
}
}
@ -1726,7 +1726,7 @@ cache_prune_candidates_record_all (NMPlatform *platform, NMPObjectType obj_type)
priv->prune_candidates = nmp_cache_lookup_all_to_hash (priv->cache,
nmp_cache_id_init_object_type (NMP_CACHE_ID_STATIC, obj_type, FALSE),
priv->prune_candidates);
_LOGT ("cache-prune: record %s (now %u candidates)", nmp_class_from_type (obj_type)->obj_type_name,
_LOGt ("cache-prune: record %s (now %u candidates)", nmp_class_from_type (obj_type)->obj_type_name,
priv->prune_candidates ? g_hash_table_size (priv->prune_candidates) : 0);
}
@ -1743,8 +1743,8 @@ cache_prune_candidates_record_one (NMPlatform *platform, NMPObject *obj)
if (!priv->prune_candidates)
priv->prune_candidates = g_hash_table_new_full (NULL, NULL, (GDestroyNotify) nmp_object_unref, NULL);
if (_LOGT_ENABLED () && !g_hash_table_contains (priv->prune_candidates, obj))
_LOGT ("cache-prune: record-one: %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
if (_LOGt_ENABLED () && !g_hash_table_contains (priv->prune_candidates, obj))
_LOGt ("cache-prune: record-one: %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
g_hash_table_add (priv->prune_candidates, nmp_object_ref (obj));
}
@ -1758,8 +1758,8 @@ cache_prune_candidates_drop (NMPlatform *platform, const NMPObject *obj)
priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
if (priv->prune_candidates) {
if (_LOGT_ENABLED () && g_hash_table_contains (priv->prune_candidates, obj))
_LOGT ("cache-prune: drop-one: %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
if (_LOGt_ENABLED () && g_hash_table_contains (priv->prune_candidates, obj))
_LOGt ("cache-prune: drop-one: %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
g_hash_table_remove (priv->prune_candidates, obj);
}
}
@ -1784,7 +1784,7 @@ cache_prune_candidates_prune (NMPlatform *platform)
while (g_hash_table_iter_next (&iter, (gpointer *)&obj, NULL)) {
auto_nmp_obj NMPObject *obj_cache = NULL;
_LOGT ("cache-prune: prune %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
_LOGt ("cache-prune: prune %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ALL, NULL, 0));
cache_op = nmp_cache_remove (priv->cache, obj, TRUE, &obj_cache, &was_visible, cache_pre_hook, platform);
do_emit_signal (platform, obj_cache, cache_op, was_visible, NM_PLATFORM_REASON_INTERNAL);
}
@ -1818,7 +1818,7 @@ cache_delayed_deletion_prune (NMPlatform *platform)
if (prune_list) {
for (i = 0; i < prune_list->len; i++) {
obj = prune_list->pdata[i];
_LOGT ("delayed-deletion: delete %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("delayed-deletion: delete %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
cache_remove_netlink (platform, obj, NULL, NULL, NM_PLATFORM_REASON_EXTERNAL);
}
g_ptr_array_unref (prune_list);
@ -1845,7 +1845,7 @@ cache_pre_hook (NMPCache *cache, const NMPObject *old, const NMPObject *new, NMP
nm_assert (klass == (new ? NMP_OBJECT_GET_CLASS (new) : NMP_OBJECT_GET_CLASS (old)));
_LOGT ("update-cache-%s: %s: %s%s%s",
_LOGt ("update-cache-%s: %s: %s%s%s",
klass->obj_type_name,
(ops_type == NMP_CACHE_OPS_UPDATED
? "UPDATE"
@ -2037,7 +2037,7 @@ _new_sequence_number (NMPlatform *platform, guint32 seq)
{
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
_LOGT ("_new_sequence_number(): new sequence number %u", seq);
_LOGt ("_new_sequence_number(): new sequence number %u", seq);
priv->nlh_seq_expect = seq;
}
@ -2048,7 +2048,7 @@ do_request_link (NMPlatform *platform, int ifindex, const char *name, gboolean h
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
guint32 seq;
_LOGT ("do_request_link (%d,%s)", ifindex, name ? name : "");
_LOGt ("do_request_link (%d,%s)", ifindex, name ? name : "");
if (ifindex > 0) {
NMPObject *obj;
@ -2056,7 +2056,7 @@ do_request_link (NMPlatform *platform, int ifindex, const char *name, gboolean h
cache_prune_candidates_record_one (platform,
(NMPObject *) nmp_cache_lookup_link (priv->cache, ifindex));
obj = nmp_object_new_link (ifindex);
_LOGT ("delayed-deletion: protect object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("delayed-deletion: protect object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
g_hash_table_insert (priv->delayed_deletion, obj, NULL);
}
@ -2101,11 +2101,11 @@ do_request_all (NMPlatform *platform, DelayedActionType action_type, gboolean ha
/* clear any delayed action that request a refresh of this object type. */
priv->delayed_action.flags &= ~iflags;
_LOGT_delayed_action (iflags, NULL, "handle (do-request-all)");
_LOGt_delayed_action (iflags, NULL, "handle (do-request-all)");
if (obj_type == NMP_OBJECT_TYPE_LINK) {
priv->delayed_action.flags &= ~DELAYED_ACTION_TYPE_REFRESH_LINK;
g_ptr_array_set_size (priv->delayed_action.list_refresh_link, 0);
_LOGT_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, NULL, "clear (do-request-all)");
_LOGt_delayed_action (DELAYED_ACTION_TYPE_REFRESH_LINK, NULL, "clear (do-request-all)");
}
event_handler_read_netlink_all (platform, FALSE);
@ -2146,7 +2146,7 @@ kernel_add_object (NMPlatform *platform, NMPObjectType obj_type, const struct nl
g_return_val_if_reached (-NLE_INVAL);
}
_LOGT ("kernel-add-%s: returned %s (%d)",
_LOGt ("kernel-add-%s: returned %s (%d)",
nmp_class_from_type (obj_type)->obj_type_name, nl_geterror (nle), -nle);
switch (nle) {
@ -2190,20 +2190,20 @@ kernel_delete_object (NMPlatform *platform, NMPObjectType object_type, const str
case -NLE_SUCCESS:
return NLE_SUCCESS;
case -NLE_OBJ_NOTFOUND:
_LOGT ("kernel-delete-%s: failed with \"%s\" (%d), meaning the object was already removed",
_LOGt ("kernel-delete-%s: failed with \"%s\" (%d), meaning the object was already removed",
nmp_class_from_type (object_type)->obj_type_name, nl_geterror (nle), -nle);
return -NLE_SUCCESS;
case -NLE_FAILURE:
if (object_type == NMP_OBJECT_TYPE_IP6_ADDRESS) {
/* On RHEL7 kernel, deleting a non existing address fails with ENXIO (which libnl maps to NLE_FAILURE) */
_LOGT ("kernel-delete-%s: deleting address failed with \"%s\" (%d), meaning the address was already removed",
_LOGt ("kernel-delete-%s: deleting address failed with \"%s\" (%d), meaning the address was already removed",
nmp_class_from_type (object_type)->obj_type_name, nl_geterror (nle), -nle);
return NLE_SUCCESS;
}
break;
case -NLE_NOADDR:
if (object_type == NMP_OBJECT_TYPE_IP4_ADDRESS || object_type == NMP_OBJECT_TYPE_IP6_ADDRESS) {
_LOGT ("kernel-delete-%s: deleting address failed with \"%s\" (%d), meaning the address was already removed",
_LOGt ("kernel-delete-%s: deleting address failed with \"%s\" (%d), meaning the address was already removed",
nmp_class_from_type (object_type)->obj_type_name, nl_geterror (nle), -nle);
return -NLE_SUCCESS;
}
@ -2211,7 +2211,7 @@ kernel_delete_object (NMPlatform *platform, NMPObjectType object_type, const str
default:
break;
}
_LOGT ("kernel-delete-%s: failed with %s (%d)",
_LOGt ("kernel-delete-%s: failed with %s (%d)",
nmp_class_from_type (object_type)->obj_type_name, nl_geterror (nle), -nle);
return nle;
}
@ -2248,7 +2248,7 @@ kernel_change_link (NMPlatform *platform, struct rtnl_link *nlo, gboolean *compl
obj_cache = nmp_cache_lookup_link (priv->cache, ifindex);
if (!obj_cache || !obj_cache->_link.netlink.is_in_netlink) {
_LOGT ("kernel-change-link: failure changing link %d: cannot complete link", ifindex);
_LOGt ("kernel-change-link: failure changing link %d: cannot complete link", ifindex);
*complete_from_cache = FALSE;
return -NLE_INVAL;
}
@ -2269,7 +2269,7 @@ kernel_change_link (NMPlatform *platform, struct rtnl_link *nlo, gboolean *compl
nle = rtnl_link_build_add_request (nlo, nlflags, &msg);
if (nle < 0) {
_LOGT ("kernel-change-link: failure changing link %d: cannot construct message (%s, %d)",
_LOGt ("kernel-change-link: failure changing link %d: cannot construct message (%s, %d)",
ifindex, nl_geterror (nle), -nle);
return nle;
}
@ -2299,18 +2299,18 @@ errout:
*/
switch (nle) {
case -NLE_SUCCESS:
_LOGT ("kernel-change-link: success changing link %d", ifindex);
_LOGt ("kernel-change-link: success changing link %d", ifindex);
break;
case -NLE_EXIST:
_LOGT ("kernel-change-link: success changing link %d: %s (%d)",
_LOGt ("kernel-change-link: success changing link %d: %s (%d)",
ifindex, nl_geterror (nle), -nle);
break;
case -NLE_OBJ_NOTFOUND:
_LOGT ("kernel-change-link: failure changing link %d: firmware not found (%s, %d)",
_LOGt ("kernel-change-link: failure changing link %d: firmware not found (%s, %d)",
ifindex, nl_geterror (nle), -nle);
break;
default:
_LOGT ("kernel-change-link: failure changing link %d: netlink error (%s, %d)",
_LOGt ("kernel-change-link: failure changing link %d: netlink error (%s, %d)",
ifindex, nl_geterror (nle), -nle);
break;
}
@ -2342,13 +2342,13 @@ event_seq_check (struct nl_msg *msg, gpointer user_data)
priv->nlh_seq_last = hdr->nlmsg_seq;
if (priv->nlh_seq_expect == 0)
_LOGT ("event_seq_check(): seq %u received (not waited)", hdr->nlmsg_seq);
_LOGt ("event_seq_check(): seq %u received (not waited)", hdr->nlmsg_seq);
else if (hdr->nlmsg_seq == priv->nlh_seq_expect) {
_LOGT ("event_seq_check(): seq %u received", hdr->nlmsg_seq);
_LOGt ("event_seq_check(): seq %u received", hdr->nlmsg_seq);
priv->nlh_seq_expect = 0;
} else
_LOGT ("event_seq_check(): seq %u received (wait for %u)", hdr->nlmsg_seq, priv->nlh_seq_last);
_LOGt ("event_seq_check(): seq %u received (wait for %u)", hdr->nlmsg_seq, priv->nlh_seq_last);
return NL_OK;
}
@ -2356,7 +2356,7 @@ event_seq_check (struct nl_msg *msg, gpointer user_data)
static int
event_err (struct sockaddr_nl *nla, struct nlmsgerr *nlerr, gpointer platform)
{
_LOGT ("event_err(): error from kernel: %s (%d) for request %d",
_LOGt ("event_err(): error from kernel: %s (%d) for request %d",
strerror (nlerr ? -nlerr->error : 0),
nlerr ? -nlerr->error : 0,
NM_LINUX_PLATFORM_GET_PRIVATE (platform)->nlh_seq_last);
@ -2398,13 +2398,13 @@ event_notification (struct nl_msg *msg, gpointer user_data)
/* The event notifies about a deleted object. We don't need to initialize all the
* fields of the nmp-object. Shortcut nmp_object_from_nl(). */
obj = nmp_object_from_nl (platform, nlo, TRUE, TRUE);
_LOGt ("event-notification: %s, seq %u: %s",
_LOGT ("event-notification: %s, seq %u: %s",
_nl_nlmsg_type_to_str (msghdr->nlmsg_type, buf_nlmsg_type, sizeof (buf_nlmsg_type)),
msghdr->nlmsg_seq, nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
break;
default:
obj = nmp_object_from_nl (platform, nlo, FALSE, TRUE);
_LOGt ("event-notification: %s, seq %u: %s",
_LOGT ("event-notification: %s, seq %u: %s",
_nl_nlmsg_type_to_str (msghdr->nlmsg_type, buf_nlmsg_type, sizeof (buf_nlmsg_type)),
msghdr->nlmsg_seq, nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
break;
@ -2420,7 +2420,7 @@ event_notification (struct nl_msg *msg, gpointer user_data)
if (g_hash_table_lookup (priv->delayed_deletion, obj) != NULL) {
/* the object is scheduled for delayed deletion. Replace that object
* by clearing the value from priv->delayed_deletion. */
_LOGT ("delayed-deletion: clear delayed deletion of protected object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("delayed-deletion: clear delayed deletion of protected object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
g_hash_table_insert (priv->delayed_deletion, nmp_object_ref (obj), NULL);
}
delayed_action_clear_REFRESH_LINK (platform, obj->link.ifindex);
@ -2436,7 +2436,7 @@ event_notification (struct nl_msg *msg, gpointer user_data)
&& g_hash_table_contains (priv->delayed_deletion, obj)) {
/* We sometimes receive spurious RTM_DELLINK events. In this case, we want to delay
* the deletion of the object until later. */
_LOGT ("delayed-deletion: delay deletion of protected object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("delayed-deletion: delay deletion of protected object %s", nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
g_hash_table_insert (priv->delayed_deletion, nmp_object_ref (obj), nmp_object_ref (obj));
break;
}
@ -2748,7 +2748,7 @@ do_add_link (NMPlatform *platform, const char *name, const struct rtnl_link *nlo
* link so that it is in the cache. A better solution would be to do everything
* via one netlink socket. */
if (!nmp_cache_lookup_link_full (NM_LINUX_PLATFORM_GET_PRIVATE (platform)->cache, 0, obj_needle.link.name, FALSE, NM_LINK_TYPE_NONE, NULL, NULL)) {
_LOGT ("do-add-link: reload: the added link is not yet ready. Request %s", obj_needle.link.name);
_LOGt ("do-add-link: reload: the added link is not yet ready. Request %s", obj_needle.link.name);
do_request_link (platform, 0, obj_needle.link.name, TRUE);
}
@ -2800,7 +2800,7 @@ do_add_addrroute (NMPlatform *platform, const NMPObject *obj_id, const struct nl
/* FIXME: instead of re-requesting the added object, add it via nlh_event
* so that the events are in sync. */
if (!nmp_cache_lookup_obj (NM_LINUX_PLATFORM_GET_PRIVATE (platform)->cache, obj_id)) {
_LOGT ("do-add-%s: reload: the added object is not yet ready. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("do-add-%s: reload: the added object is not yet ready. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
do_request_one_type (platform, NMP_OBJECT_GET_TYPE (obj_id), TRUE);
}
@ -2838,12 +2838,12 @@ do_delete_object (NMPlatform *platform, const NMPObject *obj_id, const struct nl
obj = nmp_cache_lookup_link_full (priv->cache, obj_id->link.ifindex, obj_id->link.ifindex <= 0 && obj_id->link.name[0] ? obj_id->link.name : NULL, FALSE, NM_LINK_TYPE_NONE, NULL, NULL);
if (obj && obj->_link.netlink.is_in_netlink) {
_LOGT ("do-delete-%s: reload: the deleted object is not yet removed. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("do-delete-%s: reload: the deleted object is not yet removed. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
do_request_link (platform, obj_id->link.ifindex, obj_id->link.name, TRUE);
}
} else {
if (nmp_cache_lookup_obj (priv->cache, obj_id)) {
_LOGT ("do-delete-%s: reload: the deleted object is not yet removed. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
_LOGt ("do-delete-%s: reload: the deleted object is not yet removed. Request %s", NMP_OBJECT_GET_CLASS (obj_id)->obj_type_name, nmp_object_to_string (obj_id, NMP_OBJECT_TO_STRING_ID, NULL, 0));
do_request_one_type (platform, NMP_OBJECT_GET_TYPE (obj_id), TRUE);
}
}
@ -4688,7 +4688,7 @@ event_handler_read_netlink_all (NMPlatform *platform, gboolean wait_for_acks)
if (!wait_for_acks || priv->nlh_seq_expect == 0) {
if (wait_for_seq)
_LOGT ("read-netlink-all: ACK for sequence number %u received", priv->nlh_seq_expect);
_LOGt ("read-netlink-all: ACK for sequence number %u received", priv->nlh_seq_expect);
return any;
}
@ -4696,7 +4696,7 @@ event_handler_read_netlink_all (NMPlatform *platform, gboolean wait_for_acks)
if (wait_for_seq != priv->nlh_seq_expect) {
/* We are waiting for a new sequence number (or we will wait for the first time).
* Reset/start counting the overall wait time. */
_LOGT ("read-netlink-all: wait for ACK for sequence number %u...", priv->nlh_seq_expect);
_LOGt ("read-netlink-all: wait for ACK for sequence number %u...", priv->nlh_seq_expect);
wait_for_seq = priv->nlh_seq_expect;
timestamp = now;
timeout = TIMEOUT;

View file

@ -427,7 +427,7 @@ nm_platform_link_get_all (NMPlatform *self)
for (i = 0; i < links->len; i++) {
item = &g_array_index (links, NMPlatformLink, i);
_LOGT ("link-get: %3d: %s", i, nm_platform_link_to_string (item));
_LOGt ("link-get: %3d: %s", i, nm_platform_link_to_string (item));
nm_assert (item->ifindex > 0 && !g_hash_table_contains (unseen, GINT_TO_POINTER (item->ifindex)));
@ -483,7 +483,7 @@ nm_platform_link_get_all (NMPlatform *self)
if (item->parent > 0 && g_hash_table_contains (unseen, GINT_TO_POINTER (item->parent)))
continue;
_LOGT ("link-get: add %3d -> %3d: %s", i, j, nm_platform_link_to_string (item));
_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_array_index (result, NMPlatformLink, j++) = *item;
@ -496,7 +496,7 @@ nm_platform_link_get_all (NMPlatform *self)
* This can happen for veth pairs where each peer is parent of the other end. */
item = &g_array_index (links, NMPlatformLink, first_idx);
_LOGT ("link-get: add (loop) %3d -> %3d: %s", first_idx, j, nm_platform_link_to_string (item));
_LOGt ("link-get: add (loop) %3d -> %3d: %s", first_idx, j, nm_platform_link_to_string (item));
g_hash_table_remove (unseen, GINT_TO_POINTER (item->ifindex));
g_array_index (result, NMPlatformLink, j++) = *item;

View file

@ -178,7 +178,7 @@ nmp_object_ref (NMPObject *obj)
g_return_val_if_fail (obj->_ref_count != NMP_REF_COUNT_STACKINIT, NULL);
obj->_ref_count++;
_LOGT (obj, "ref: %d", obj->_ref_count);
_LOGt (obj, "ref: %d", obj->_ref_count);
return obj;
}
@ -189,7 +189,7 @@ nmp_object_unref (NMPObject *obj)
if (obj) {
g_return_if_fail (obj->_ref_count > 0);
g_return_if_fail (obj->_ref_count != NMP_REF_COUNT_STACKINIT);
_LOGT (obj, "%s: %d",
_LOGt (obj, "%s: %d",
obj->_ref_count <= 1 ? "destroy" : "unref",
obj->_ref_count - 1);
if (--obj->_ref_count <= 0) {
@ -221,7 +221,7 @@ _nmp_object_new_from_class (const NMPClass *klass)
obj = g_slice_alloc0 (klass->sizeof_data + G_STRUCT_OFFSET (NMPObject, object));
obj->_class = klass;
obj->_ref_count = 1;
_LOGT (obj, "new");
_LOGt (obj, "new");
return obj;
}