New naming convention for internal macros
authorDavid Goulet <david.goulet@polymtl.ca>
Tue, 28 Sep 2010 13:05:49 +0000 (15:05 +0200)
committerNils Carlson <nils.carlson@ericsson.com>
Thu, 30 Sep 2010 07:59:02 +0000 (09:59 +0200)
This is the first patch introducing the new naming convention
for the UST tracer. To prevent namespace pollution, _ust_ prefix
is added to internal macros which are visible in the global header.

For this patch, only the container_of macro is renamed and the
redundant definition in kcompat/simple.h is removed.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
include/ust/core.h
include/ust/kcompat/simple.h
libust/buffers.c
libust/channels.c
libust/marker.c
libust/tracepoint.c
libust/tracer.c

index 0172614331dfd4ae70bfe339c9447f75500ed33f..e781a3a6c5542e85f98898ee8beb3314be8869a8 100644 (file)
@@ -141,7 +141,7 @@ static __inline__ int get_count_order(unsigned int count)
        return order;
 }
 
-#define container_of(ptr, type, member) ({                      \
+#define _ust_container_of(ptr, type, member) ({                      \
         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
         (type *)( (char *)__mptr - offsetof(type,member) );})
 
index 762d802920a6c0be6d65c530015b2b700e4823a4..38a9be5988d7dd17581e318ea3131dbb106809ad 100644 (file)
 #ifndef KCOMPAT_SIMPLE_H
 #define KCOMPAT_SIMPLE_H
 
-/**
- * container_of - cast a member of a structure out to the containing structure
- * @ptr:       the pointer to the member.
- * @type:      the type of the container struct this is embedded in.
- * @member:    the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({                     \
-       const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
-
-
 /* libkcompat: from rcupdate.h */
 
 struct rcu_head {
index 374ec613240fde5028fbac694b9a4d49a22c20c8..bb5d8c581918c191da90e370dafd00c667dcac08 100644 (file)
@@ -203,7 +203,7 @@ int ust_buffers_create_buf(struct ust_channel *channel, int cpu)
 
 static void ust_buffers_destroy_channel(struct kref *kref)
 {
-       struct ust_channel *chan = container_of(kref, struct ust_channel, kref);
+       struct ust_channel *chan = _ust_container_of(kref, struct ust_channel, kref);
        free(chan);
 }
 
@@ -225,7 +225,7 @@ static void ust_buffers_destroy_buf(struct ust_buffer *buf)
 /* called from kref_put */
 static void ust_buffers_remove_buf(struct kref *kref)
 {
-       struct ust_buffer *buf = container_of(kref, struct ust_buffer, kref);
+       struct ust_buffer *buf = _ust_container_of(kref, struct ust_buffer, kref);
        ust_buffers_destroy_buf(buf);
 }
 
@@ -592,7 +592,7 @@ static void ltt_relay_print_buffer_errors(struct ust_channel *channel, int cpu)
 
 static void ltt_relay_release_channel(struct kref *kref)
 {
-       struct ust_channel *ltt_chan = container_of(kref,
+       struct ust_channel *ltt_chan = _ust_container_of(kref,
                        struct ust_channel, kref);
        free(ltt_chan->buf);
 }
index df1a9725735704b779abbdd06f93b204e4c28413..57e980104fd5ad40b3bbf9ed9841d53d69801bfb 100644 (file)
@@ -66,7 +66,7 @@ static struct ltt_channel_setting *lookup_channel(const char *name)
  */
 static void release_channel_setting(struct kref *kref)
 {
-       struct ltt_channel_setting *setting = container_of(kref,
+       struct ltt_channel_setting *setting = _ust_container_of(kref,
                struct ltt_channel_setting, kref);
        struct ltt_channel_setting *iter;
 
index dbabf3eeef563f415e2f5e16fae74b2a8f30e17a..0c85cc3997f0d8669473c91055b7582ea4ad4f7c 100644 (file)
@@ -235,7 +235,7 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata,
 
 static void free_old_closure(struct rcu_head *head)
 {
-       struct marker_entry *entry = container_of(head,
+       struct marker_entry *entry = _ust_container_of(head,
                struct marker_entry, rcu);
        free(entry->oldptr);
        /* Make sure we free the data before setting the pending flag to 0 */
index 16b4819b88e686f01a6f3ad08a6de3cecf783f0c..2b33d84428ef29557d7897788c6aa816c7076545 100644 (file)
@@ -87,7 +87,7 @@ static inline void *allocate_probes(int count)
 static inline void release_probes(void *old)
 {
        if (old) {
-               struct tp_probes *tp_probes = container_of(old,
+               struct tp_probes *tp_probes = _ust_container_of(old,
                        struct tp_probes, probes[0]);
 //ust//                call_rcu_sched(&tp_probes->u.rcu, rcu_free_old_probes);
                synchronize_rcu();
@@ -427,7 +427,7 @@ static void tracepoint_add_old_probes(void *old)
 {
        need_update = 1;
        if (old) {
-               struct tp_probes *tp_probes = container_of(old,
+               struct tp_probes *tp_probes = _ust_container_of(old,
                        struct tp_probes, probes[0]);
                list_add(&tp_probes->u.list, &old_probes);
        }
index 8c3f77466f057f8fc89afcfc3c1dd2a5ac57b45f..c9422c8fec5c27668552693e93acde510a0baf2d 100644 (file)
@@ -337,7 +337,7 @@ void ltt_release_transport(struct kref *kref)
  */
 void ltt_release_trace(struct kref *kref)
 {
-       struct ust_trace *trace = container_of(kref,
+       struct ust_trace *trace = _ust_container_of(kref,
                        struct ust_trace, kref);
        ltt_channels_trace_free(trace->channels);
        free(trace);
This page took 0.028618 seconds and 4 git commands to generate.