summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenji Huang <wenji.huang@oracle.com>2008-11-17 00:06:59 -0500
committerWenji Huang <wenji.huang@oracle.com>2008-11-17 00:06:59 -0500
commita6ce170764b0ec75d3ddbca20823b2a951a225d2 (patch)
tree8e1534f74dfb3cd53305a71c4ec07f1fd71da706
parentb3e8f644958f5033beebeb91edf11d5edf21c8c1 (diff)
downloadsystemtap-steved-a6ce170764b0ec75d3ddbca20823b2a951a225d2.tar.gz
systemtap-steved-a6ce170764b0ec75d3ddbca20823b2a951a225d2.tar.xz
systemtap-steved-a6ce170764b0ec75d3ddbca20823b2a951a225d2.zip
Fix the conflicted for_each_cpu macro with 2.6.28.
-rw-r--r--runtime/ChangeLog10
-rw-r--r--runtime/counter.c4
-rw-r--r--runtime/map-stat.c4
-rw-r--r--runtime/map.c14
-rw-r--r--runtime/pmap-gen.c6
-rw-r--r--runtime/runtime.h10
-rw-r--r--runtime/stat.c6
-rw-r--r--runtime/transport/procfs.c6
8 files changed, 38 insertions, 22 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog
index af067ed3..3b935e3a 100644
--- a/runtime/ChangeLog
+++ b/runtime/ChangeLog
@@ -1,3 +1,13 @@
+2008-11-17 Wenji Huang <wenji.huang@oracle.com>
+
+ * runtime.h: Rename for_each_cpu to stp_for_each_cpu for 2.6.28.
+ * counter.c: Ditto.
+ * map-stat.c: Ditto.
+ * map.c: Ditto.
+ * pmap-gen.c: Ditto.
+ * stat.c: Ditto.
+ * transport/procfs.c: Ditto.
+
2008-11-04 David Smith <dsmith@redhat.com>
PR 5274.
diff --git a/runtime/counter.c b/runtime/counter.c
index d0376547..a3c3669b 100644
--- a/runtime/counter.c
+++ b/runtime/counter.c
@@ -58,7 +58,7 @@ Counter _stp_counter_init (void)
#if NEED_COUNTER_LOCKS == 1
{
int i;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
Counter c = per_cpu_ptr (cnt, i);
spin_lock_init(c->lock);
}
@@ -119,7 +119,7 @@ int64_t _stp_counter_get (Counter cnt, int clear)
int i;
int64_t sum = 0;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
Counter c = per_cpu_ptr (cnt, i);
COUNTER_LOCK(c);
sum += c->count;
diff --git a/runtime/map-stat.c b/runtime/map-stat.c
index dc3fd6ac..c557d18a 100644
--- a/runtime/map-stat.c
+++ b/runtime/map-stat.c
@@ -68,7 +68,7 @@ static PMAP _stp_pmap_new_hstat_linear (unsigned max_entries, int ksize, int sta
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->hist.type = HIST_LINEAR;
m->hist.start = start;
@@ -95,7 +95,7 @@ static PMAP _stp_pmap_new_hstat_log (unsigned max_entries, int key_size)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->hist.type = HIST_LOG;
m->hist.buckets = HIST_LOG_BUCKETS;
diff --git a/runtime/map.c b/runtime/map.c
index bb221cd2..5108e596 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -250,7 +250,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data
/* initialize the memory lists first so if allocations fail */
/* at some point, it is easy to clean up. */
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (map, i);
INIT_LIST_HEAD(&m->pool);
INIT_LIST_HEAD(&m->head);
@@ -258,7 +258,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data
INIT_LIST_HEAD(&pmap->agg.pool);
INIT_LIST_HEAD(&pmap->agg.head);
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (map, i);
if (_stp_map_init(m, max_entries, type, key_size, data_size, i)) {
goto err1;
@@ -271,7 +271,7 @@ static PMAP _stp_pmap_new(unsigned max_entries, int type, int key_size, int data
return pmap;
err1:
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (map, i);
__stp_map_del(m);
}
@@ -358,7 +358,7 @@ void _stp_pmap_clear(PMAP pmap)
if (pmap == NULL)
return;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
MAP m = per_cpu_ptr (pmap->map, i);
#if NEED_MAP_LOCKS
spin_lock(&m->lock);
@@ -410,7 +410,7 @@ void _stp_pmap_del(PMAP pmap)
if (pmap == NULL)
return;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
MAP m = per_cpu_ptr (pmap->map, i);
__stp_map_del(m);
}
@@ -740,7 +740,7 @@ MAP _stp_pmap_agg (PMAP pmap)
/* every time we aggregate. which would be best? */
_stp_map_clear (agg);
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (pmap->map, i);
#if NEED_MAP_LOCKS
spin_lock(&m->lock);
@@ -916,7 +916,7 @@ int _stp_pmap_size (PMAP pmap)
{
int i, num = 0;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
MAP m = per_cpu_ptr (pmap->map, i);
num += m->num;
}
diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c
index 8666549b..7f7ddeb0 100644
--- a/runtime/pmap-gen.c
+++ b/runtime/pmap-gen.c
@@ -406,7 +406,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = (MAP)per_cpu_ptr (pmap->map, i);
m->get_key = KEYSYM(pmap_get_key);
m->copy = KEYSYM(pmap_copy_keys);
@@ -459,7 +459,7 @@ PMAP KEYSYM(_stp_pmap_new) (unsigned max_entries, int htype, ...)
if (pmap) {
int i;
MAP m;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
m = per_cpu_ptr (pmap->map, i);
m->get_key = KEYSYM(pmap_get_key);
m->copy = KEYSYM(pmap_copy_keys);
@@ -649,7 +649,7 @@ VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key))
}
/* now total each cpu */
- for_each_cpu(cpu) {
+ stp_for_each_cpu(cpu) {
map = per_cpu_ptr (pmap->map, cpu);
head = &map->hashes[hv];
diff --git a/runtime/runtime.h b/runtime/runtime.h
index cd3d0b11..7507e594 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -39,8 +39,14 @@
#define STP_OLD_TRANSPORT
#endif
-#ifndef for_each_cpu
-#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+#ifndef stp_for_each_cpu
+#define stp_for_each_cpu(cpu) for_each_cpu((cpu), cpu_possible_map)
+#endif
+#else
+#ifndef stp_for_each_cpu
+#define stp_for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
+#endif
#endif
static void _stp_dbug (const char *func, int line, const char *fmt, ...);
diff --git a/runtime/stat.c b/runtime/stat.c
index 8bd7bf12..e40a4f2d 100644
--- a/runtime/stat.c
+++ b/runtime/stat.c
@@ -109,7 +109,7 @@ Stat _stp_stat_init (int type, ...)
#if NEED_STAT_LOCKS == 1
{
int i;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
stat *sdp = per_cpu_ptr (sd, i);
spin_lock_init(sdp->lock);
}
@@ -210,7 +210,7 @@ stat *_stp_stat_get (Stat st, int clear)
STAT_LOCK(agg);
_stp_stat_clear_data (st, agg);
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
stat *sd = per_cpu_ptr (st->sd, i);
STAT_LOCK(sd);
if (sd->count) {
@@ -245,7 +245,7 @@ stat *_stp_stat_get (Stat st, int clear)
void _stp_stat_clear (Stat st)
{
int i;
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
stat *sd = per_cpu_ptr (st->sd, i);
STAT_LOCK(sd);
_stp_stat_clear_data (st, sd);
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index e0ecd9b3..ca33e0fd 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -328,7 +328,7 @@ static int _stp_register_ctl_channel(void)
#ifdef STP_BULKMODE
/* now for each cpu "n", create /proc/systemtap/module_name/n */
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
sprintf(buf, "%d", i);
de = create_proc_entry(buf, 0600, _stp_proc_root);
if (de == NULL)
@@ -361,7 +361,7 @@ err1:
#ifdef STP_BULKMODE
for (de = _stp_proc_root->subdir; de; de = de->next)
_stp_kfree(de->data);
- for_each_cpu(j) {
+ stp_for_each_cpu(j) {
if (j == i)
break;
sprintf(buf, "%d", j);
@@ -389,7 +389,7 @@ static void _stp_unregister_ctl_channel(void)
for (de = _stp_proc_root->subdir; de; de = de->next)
_stp_kfree(de->data);
- for_each_cpu(i) {
+ stp_for_each_cpu(i) {
sprintf(buf, "%d", i);
remove_proc_entry(buf, _stp_proc_root);
}