Remove hlist from kcompat's headers and code
[ust.git] / libust / channels.c
index 32942cf795f79a4d7c1f7b63755eef68a9c4fdf8..6716b5d774762991f9b716d3d9d1c73bd9c172cb 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include <stdlib.h>
-#include <ust/kernelcompat.h>
 #include <ust/marker.h>
 #include "channels.h"
 #include "usterr.h"
@@ -34,7 +33,7 @@
  * ltt_channel_mutex mutex may be nested inside markers mutex.
  */
 static DEFINE_MUTEX(ltt_channel_mutex);
-static LIST_HEAD(ltt_channels);
+static CDS_LIST_HEAD(ltt_channels);
 /*
  * Index of next channel in array. Makes sure that as long as a trace channel is
  * allocated, no array index will be re-used when a channel is freed and then
@@ -52,7 +51,7 @@ static struct ltt_channel_setting *lookup_channel(const char *name)
 {
        struct ltt_channel_setting *iter;
 
-       list_for_each_entry(iter, &ltt_channels, list)
+       cds_list_for_each_entry(iter, &ltt_channels, list)
                if (strcmp(name, iter->name) == 0)
                        return iter;
        return NULL;
@@ -67,17 +66,17 @@ 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;
 
        if (uatomic_read(&index_kref.refcount) == 0
            && uatomic_read(&setting->kref.refcount) == 0) {
-               list_del(&setting->list);
+               cds_list_del(&setting->list);
                free(setting);
 
                free_index = 0;
-               list_for_each_entry(iter, &ltt_channels, list) {
+               cds_list_for_each_entry(iter, &ltt_channels, list) {
                        iter->index = free_index++;
                        iter->free_event_id = 0;
                }
@@ -95,7 +94,7 @@ static void release_trace_channel(struct kref *kref)
 {
        struct ltt_channel_setting *iter, *n;
 
-       list_for_each_entry_safe(iter, n, &ltt_channels, list)
+       cds_list_for_each_entry_safe(iter, n, &ltt_channels, list)
                release_channel_setting(&iter->kref);
 }
 
@@ -110,7 +109,7 @@ int ltt_channels_register(const char *name)
        struct ltt_channel_setting *setting;
        int ret = 0;
 
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        setting = lookup_channel(name);
        if (setting) {
                if (uatomic_read(&setting->kref.refcount) == 0)
@@ -125,13 +124,13 @@ int ltt_channels_register(const char *name)
                ret = -ENOMEM;
                goto end;
        }
-       list_add(&setting->list, &ltt_channels);
+       cds_list_add(&setting->list, &ltt_channels);
        strncpy(setting->name, name, PATH_MAX-1);
        setting->index = free_index++;
 init_kref:
        kref_init(&setting->kref);
 end:
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_channels_register);
@@ -147,7 +146,7 @@ int ltt_channels_unregister(const char *name)
        struct ltt_channel_setting *setting;
        int ret = 0;
 
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        setting = lookup_channel(name);
        if (!setting || uatomic_read(&setting->kref.refcount) == 0) {
                ret = -ENOENT;
@@ -155,7 +154,7 @@ int ltt_channels_unregister(const char *name)
        }
        kref_put(&setting->kref, release_channel_setting);
 end:
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_channels_unregister);
@@ -173,7 +172,7 @@ int ltt_channels_set_default(const char *name,
        struct ltt_channel_setting *setting;
        int ret = 0;
 
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        setting = lookup_channel(name);
        if (!setting || uatomic_read(&setting->kref.refcount) == 0) {
                ret = -ENOENT;
@@ -182,7 +181,7 @@ int ltt_channels_set_default(const char *name,
        setting->subbuf_size = subbuf_size;
        setting->subbuf_cnt = subbuf_cnt;
 end:
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_channels_set_default);
@@ -198,7 +197,7 @@ const char *ltt_channels_get_name_from_index(unsigned int index)
 {
        struct ltt_channel_setting *iter;
 
-       list_for_each_entry(iter, &ltt_channels, list)
+       cds_list_for_each_entry(iter, &ltt_channels, list)
                if (iter->index == index && uatomic_read(&iter->kref.refcount))
                        return iter->name;
        return NULL;
@@ -210,7 +209,7 @@ ltt_channels_get_setting_from_name(const char *name)
 {
        struct ltt_channel_setting *iter;
 
-       list_for_each_entry(iter, &ltt_channels, list)
+       cds_list_for_each_entry(iter, &ltt_channels, list)
                if (!strcmp(iter->name, name)
                    && uatomic_read(&iter->kref.refcount))
                        return iter;
@@ -255,7 +254,7 @@ struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
        struct ust_channel *channel = NULL;
        struct ltt_channel_setting *iter;
 
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        if (!free_index) {
                WARN("ltt_channels_trace_alloc: no free_index; are there any probes connected?");
                goto end;
@@ -270,7 +269,7 @@ struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
                WARN("ltt_channel_struct: channel null after alloc");
                goto end;
        }
-       list_for_each_entry(iter, &ltt_channels, list) {
+       cds_list_for_each_entry(iter, &ltt_channels, list) {
                if (!uatomic_read(&iter->kref.refcount))
                        continue;
                channel[iter->index].subbuf_size = iter->subbuf_size;
@@ -281,7 +280,7 @@ struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
                channel[iter->index].channel_name = iter->name;
        }
 end:
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        return channel;
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_channels_trace_alloc);
@@ -296,10 +295,10 @@ end:
 void ltt_channels_trace_free(struct ust_channel *channels)
 {
        lock_markers();
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        free(channels);
        kref_put(&index_kref, release_trace_channel);
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        unlock_markers();
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_channels_trace_free);
@@ -353,9 +352,9 @@ int ltt_channels_get_event_id(const char *channel, const char *name)
 {
        int ret;
 
-       mutex_lock(&ltt_channel_mutex);
+       pthread_mutex_lock(&ltt_channel_mutex);
        ret = _ltt_channels_get_event_id(channel, name);
-       mutex_unlock(&ltt_channel_mutex);
+       pthread_mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
 
This page took 0.02482 seconds and 4 git commands to generate.