* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//ust// #include <linux/module.h>
-//ust// #include <linux/ltt-channels.h>
-//ust// #include <linux/mutex.h>
-//ust// #include <linux/vmalloc.h>
-
+#include <stdlib.h>
#include <ust/kernelcompat.h>
+#include <ust/marker.h>
#include "channels.h"
#include "usterr.h"
-#include <ust/marker.h>
/*
* ltt_channel_mutex may be nested inside the LTT trace mutex.
struct ltt_channel_setting, kref);
struct ltt_channel_setting *iter;
- if (atomic_read(&index_kref.refcount) == 0
- && atomic_read(&setting->kref.refcount) == 0) {
+ if (uatomic_read(&index_kref.refcount) == 0
+ && uatomic_read(&setting->kref.refcount) == 0) {
list_del(&setting->list);
- kfree(setting);
+ free(setting);
free_index = 0;
list_for_each_entry(iter, <t_channels, list) {
iter->index = free_index++;
iter->free_event_id = 0;
}
+ /* FIXME: why not run this? */
//ust// markers_compact_event_ids();
}
}
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
if (setting) {
- if (atomic_read(&setting->kref.refcount) == 0)
+ if (uatomic_read(&setting->kref.refcount) == 0)
goto init_kref;
else {
kref_get(&setting->kref);
goto end;
}
}
- setting = kzalloc(sizeof(*setting), GFP_KERNEL);
+ setting = zmalloc(sizeof(*setting));
if (!setting) {
ret = -ENOMEM;
goto end;
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
- if (!setting || atomic_read(&setting->kref.refcount) == 0) {
+ if (!setting || uatomic_read(&setting->kref.refcount) == 0) {
ret = -ENOENT;
goto end;
}
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
- if (!setting || atomic_read(&setting->kref.refcount) == 0) {
+ if (!setting || uatomic_read(&setting->kref.refcount) == 0) {
ret = -ENOENT;
goto end;
}
struct ltt_channel_setting *iter;
list_for_each_entry(iter, <t_channels, list)
- if (iter->index == index && atomic_read(&iter->kref.refcount))
+ if (iter->index == index && uatomic_read(&iter->kref.refcount))
return iter->name;
return NULL;
}
list_for_each_entry(iter, <t_channels, list)
if (!strcmp(iter->name, name)
- && atomic_read(&iter->kref.refcount))
+ && uatomic_read(&iter->kref.refcount))
return iter;
return NULL;
}
WARN("ltt_channels_trace_alloc: no free_index; are there any probes connected?");
goto end;
}
- if (!atomic_read(&index_kref.refcount))
+ if (!uatomic_read(&index_kref.refcount))
kref_init(&index_kref);
else
kref_get(&index_kref);
*nr_channels = free_index;
- channel = kzalloc(sizeof(struct ust_channel) * free_index,
- GFP_KERNEL);
+ channel = zmalloc(sizeof(struct ust_channel) * free_index);
if (!channel) {
WARN("ltt_channel_struct: channel null after alloc");
goto end;
}
list_for_each_entry(iter, <t_channels, list) {
- if (!atomic_read(&iter->kref.refcount))
+ if (!uatomic_read(&iter->kref.refcount))
continue;
channel[iter->index].subbuf_size = iter->subbuf_size;
channel[iter->index].subbuf_cnt = iter->subbuf_cnt;
{
lock_markers();
mutex_lock(<t_channel_mutex);
- kfree(channels);
+ free(channels);
kref_put(&index_kref, release_trace_channel);
mutex_unlock(<t_channel_mutex);
unlock_markers();