X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=libust%2Fchannels.c;h=b7f35439a86e189413e7fa8ef81374c30a945d12;hb=b102c2b0b07a155285716d9f7fd788662cecd54b;hp=a8df3c48ad916a03661d786e6860491dec68aca0;hpb=b4512257eb71d0432554047acf6278dc42a15a75;p=ust.git diff --git a/libust/channels.c b/libust/channels.c index a8df3c4..b7f3543 100644 --- a/libust/channels.c +++ b/libust/channels.c @@ -7,6 +7,20 @@ * * Author: * Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ //ust// #include @@ -14,9 +28,10 @@ //ust// #include //ust// #include -#include "kernelcompat.h" +#include #include "channels.h" #include "usterr.h" +#include /* * ltt_channel_mutex may be nested inside the LTT trace mutex. @@ -57,8 +72,8 @@ static void release_channel_setting(struct kref *kref) 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); @@ -98,7 +113,7 @@ int ltt_channels_register(const char *name) 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); @@ -134,7 +149,7 @@ int ltt_channels_unregister(const char *name) 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; } @@ -160,7 +175,7 @@ int ltt_channels_set_default(const char *name, 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; } @@ -184,7 +199,7 @@ const char *ltt_channels_get_name_from_index(unsigned int index) 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; } @@ -197,7 +212,7 @@ ltt_channels_get_setting_from_name(const char *name) 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; } @@ -232,11 +247,11 @@ int ltt_channels_get_index_from_name(const char *name) * Called with trace lock held. Does not perform the trace buffer allocation, * because we must let the user overwrite specific channel sizes. */ -struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels, +struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels, int overwrite, int active) { - struct ltt_channel_struct *channel = NULL; + struct ust_channel *channel = NULL; struct ltt_channel_setting *iter; mutex_lock(<t_channel_mutex); @@ -244,19 +259,19 @@ struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels, 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 ltt_channel_struct) * free_index, + channel = kzalloc(sizeof(struct ust_channel) * free_index, GFP_KERNEL); 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; @@ -277,7 +292,7 @@ end: * Called with trace lock held. The actual channel buffers must be freed before * this function is called. */ -void ltt_channels_trace_free(struct ltt_channel_struct *channels) +void ltt_channels_trace_free(struct ust_channel *channels) { lock_markers(); mutex_lock(<t_channel_mutex);