summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-01-20 12:01:46 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-01-24 11:48:06 +0100
commit783da99f3668b165bd11929bc0c7aebbe7bcf752 (patch)
treec23f84d94702967bba6268e44cce8915887aaea7
parent79a38d9428030028696abe2ed8c30e3f6b7c4504 (diff)
downloadconnman-783da99f3668b165bd11929bc0c7aebbe7bcf752.tar.gz
connman-783da99f3668b165bd11929bc0c7aebbe7bcf752.tar.bz2
connman-783da99f3668b165bd11929bc0c7aebbe7bcf752.zip
ipconfig: Add caller information to ref/unref debug prints.
-rw-r--r--src/connman.h13
-rw-r--r--src/ipconfig.c13
2 files changed, 20 insertions, 6 deletions
diff --git a/src/connman.h b/src/connman.h
index c5803e11..158f51f0 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -198,8 +198,17 @@ struct connman_ipconfig_ops {
struct connman_ipconfig *__connman_ipconfig_create(int index,
enum connman_ipconfig_type type);
-struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfig);
-void __connman_ipconfig_unref(struct connman_ipconfig *ipconfig);
+
+#define __connman_ipconfig_ref(ipconfig) \
+ __connman_ipconfig_ref_debug(ipconfig, __FILE__, __LINE__, __func__)
+#define __connman_ipconfig_unref(ipconfig) \
+ __connman_ipconfig_unref_debug(ipconfig, __FILE__, __LINE__, __func__)
+
+struct connman_ipconfig *
+__connman_ipconfig_ref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller);
+void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller);
void *__connman_ipconfig_get_data(struct connman_ipconfig *ipconfig);
void __connman_ipconfig_set_data(struct connman_ipconfig *ipconfig, void *data);
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 75cb56e5..34a8ddcb 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1297,9 +1297,12 @@ struct connman_ipconfig *__connman_ipconfig_create(int index,
*
* Increase reference counter of ipconfig
*/
-struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfig)
+struct connman_ipconfig *
+__connman_ipconfig_ref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller)
{
- DBG("ipconfig %p refcount %d", ipconfig, ipconfig->refcount + 1);
+ DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount + 1,
+ file, line, caller);
__sync_fetch_and_add(&ipconfig->refcount, 1);
@@ -1312,12 +1315,14 @@ struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfi
*
* Decrease reference counter of ipconfig
*/
-void __connman_ipconfig_unref(struct connman_ipconfig *ipconfig)
+void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller)
{
if (ipconfig == NULL)
return;
- DBG("ipconfig %p refcount %d", ipconfig, ipconfig->refcount - 1);
+ DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount - 1,
+ file, line, caller);
if (__sync_fetch_and_sub(&ipconfig->refcount, 1) != 1)
return;