wrapper: remove list wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 19:37:48 +0000 (15:37 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 19:39:49 +0000 (15:39 -0400)
lttng-events.c
lttng-filter-validator.c
lttng-syscalls.c
lttng-tracepoint.c
lttng-tracker-id.c
wrapper/list.h [deleted file]
wrapper/rcu.h

index dbf267f811f5f0865c1f387219cefd334800fea9..b2eeec71d556712fff83ffba13fae75d10be7b2d 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/limits.h>
 
 #include <wrapper/random.h>
-#include <wrapper/list.h>
 #include <lttng-kernel-version.h>
 #include <lttng-events.h>
 #include <lttng-tracer.h>
@@ -611,7 +610,7 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
        name_len = strlen(event_name);
        hash = jhash(event_name, name_len, 0);
        head = &session->events_ht.table[hash & (LTTNG_EVENT_HT_SIZE - 1)];
-       lttng_hlist_for_each_entry(event, head, hlist) {
+       hlist_for_each_entry(event, head, hlist) {
                WARN_ON_ONCE(!event->desc);
                if (!strncmp(event->desc->name, event_name,
                                        LTTNG_KERNEL_SYM_NAME_LEN - 1)
@@ -997,7 +996,7 @@ void *id_list_start(struct seq_file *m, loff_t *pos)
                for (i = 0; i < LTTNG_ID_TABLE_SIZE; i++) {
                        struct hlist_head *head = &id_tracker_p->id_hash[i];
 
-                       lttng_hlist_for_each_entry(e, head, hlist) {
+                       hlist_for_each_entry(e, head, hlist) {
                                if (iter++ >= *pos)
                                        return e;
                        }
@@ -1027,7 +1026,7 @@ void *id_list_next(struct seq_file *m, void *p, loff_t *ppos)
                for (i = 0; i < LTTNG_ID_TABLE_SIZE; i++) {
                        struct hlist_head *head = &id_tracker_p->id_hash[i];
 
-                       lttng_hlist_for_each_entry(e, head, hlist) {
+                       hlist_for_each_entry(e, head, hlist) {
                                if (iter++ >= *ppos)
                                        return e;
                        }
@@ -1294,7 +1293,7 @@ void lttng_create_tracepoint_if_missing(struct lttng_enabler *enabler)
                         */
                        hash = jhash(event_name, name_len, 0);
                        head = &session->events_ht.table[hash & (LTTNG_EVENT_HT_SIZE - 1)];
-                       lttng_hlist_for_each_entry(event, head, hlist) {
+                       hlist_for_each_entry(event, head, hlist) {
                                if (event->desc == desc
                                                && event->chan == enabler->chan)
                                        found = 1;
index c479af08153c1d152793f2a4a9260ac7b11b21ed..c9094547fa47bef52d0b00e53b609f635d4b87b5 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/jhash.h>
 #include <linux/slab.h>
 
-#include <wrapper/list.h>
 #include <lttng-filter.h>
 
 #define MERGE_POINT_TABLE_BITS         7
@@ -75,7 +74,7 @@ int merge_point_add_check(struct mp_table *mp_table, unsigned long target_pc,
        memcpy(&mp_node->stack, stack, sizeof(mp_node->stack));
 
        head = &mp_table->mp_head[hash & (MERGE_POINT_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry(lookup_node, head, node) {
+       hlist_for_each_entry(lookup_node, head, node) {
                if (lttng_hash_match(lookup_node, target_pc)) {
                        found = 1;
                        break;
@@ -538,7 +537,7 @@ unsigned long delete_all_nodes(struct mp_table *mp_table)
                struct hlist_head *head;
 
                head = &mp_table->mp_head[i];
-               lttng_hlist_for_each_entry_safe(mp_node, tmp, head, node) {
+               hlist_for_each_entry_safe(mp_node, tmp, head, node) {
                        kfree(mp_node);
                        nr_nodes++;
                }
@@ -1099,7 +1098,7 @@ int validate_instruction_all_contexts(struct bytecode_runtime *bytecode,
        /* Validate merge points */
        hash = jhash_1word(target_pc, 0);
        head = &mp_table->mp_head[hash & (MERGE_POINT_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry(mp_node, head, node) {
+       hlist_for_each_entry(mp_node, head, node) {
                if (lttng_hash_match(mp_node, target_pc)) {
                        found = 1;
                        break;
index 18a906a48f3f3a05ba58523204c46b78555e46c3..3ecb42d98f01fd94a1ada5d3c8baf1404908f546 100644 (file)
@@ -23,7 +23,6 @@
 #include <asm/syscall.h>
 
 #include <lib/bitfield.h>
-#include <wrapper/rcu.h>
 #include <lttng-events.h>
 #include "lttng-tracepoint.h"
 
index a01cbc402e56472685c263440f91fa2b1dda3031..3d0cafd764fb85ee7edecd85c28f6a0ae16df6dd 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/module.h>
 
 #include <lttng-tracepoint.h>
-#include <wrapper/list.h>
 
 /*
  * Protect the tracepoint table. lttng_tracepoint_mutex nests within
@@ -106,7 +105,7 @@ struct tracepoint_entry *get_tracepoint(const char *name)
        u32 hash = jhash(name, strlen(name), 0);
 
        head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry(e, head, hlist) {
+       hlist_for_each_entry(e, head, hlist) {
                if (!strcmp(name, e->name))
                        return e;
        }
@@ -126,7 +125,7 @@ struct tracepoint_entry *add_tracepoint(const char *name)
        u32 hash = jhash(name, name_len - 1, 0);
 
        head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry(e, head, hlist) {
+       hlist_for_each_entry(e, head, hlist) {
                if (!strcmp(name, e->name)) {
                        printk(KERN_NOTICE
                                "tracepoint %s busy\n", name);
index 55d8cef1bf15ba12f1d86e6983f573b9a7e203dd..a789e7c4919d3db0eca007bcdf2e92a410a78c4c 100644 (file)
@@ -15,8 +15,6 @@
 #include <linux/hash.h>
 #include <linux/rcupdate.h>
 
-#include <wrapper/rcu.h>
-#include <wrapper/list.h>
 #include <lttng-events.h>
 
 /*
@@ -46,7 +44,7 @@ bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id)
        uint32_t hash = hash_32(id, 32);
 
        head = &p->id_hash[hash & (LTTNG_ID_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry_rcu(e, head, hlist) {
+       hlist_for_each_entry_rcu_notrace(e, head, hlist) {
                if (id == e->id)
                        return true;    /* Found */
        }
@@ -82,7 +80,7 @@ int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id)
                allocated = true;
        }
        head = &p->id_hash[hash & (LTTNG_ID_TABLE_SIZE - 1)];
-       lttng_hlist_for_each_entry(e, head, hlist) {
+       hlist_for_each_entry(e, head, hlist) {
                if (id == e->id)
                        return -EEXIST;
        }
@@ -138,7 +136,7 @@ int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id)
         * No need of _safe iteration, because we stop traversal as soon
         * as we remove the entry.
         */
-       lttng_hlist_for_each_entry(e, head, hlist) {
+       hlist_for_each_entry(e, head, hlist) {
                if (id == e->id) {
                        id_tracker_del_node_rcu(e);
                        return 0;
@@ -158,7 +156,7 @@ static void lttng_id_tracker_rcu_destroy(struct lttng_id_tracker_rcu *p)
                struct lttng_id_hash_node *e;
                struct hlist_node *tmp;
 
-               lttng_hlist_for_each_entry_safe(e, tmp, head, hlist)
+               hlist_for_each_entry_safe(e, tmp, head, hlist)
                        id_tracker_del_node(e);
        }
        kfree(p);
diff --git a/wrapper/list.h b/wrapper/list.h
deleted file mode 100644 (file)
index 26594f4..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only
- *
- * wrapper/list.h
- *
- * wrapper around linux/list.h.
- *
- * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This wrapper code is derived from Linux 3.19.2 include/linux/list.h
- * and include/linux/rculist.h, hence the GPLv2 license applied to this
- * file.
- */
-
-#ifndef _LTTNG_WRAPPER_LIST_H
-#define _LTTNG_WRAPPER_LIST_H
-
-#include <linux/list.h>
-#include <linux/rculist.h>
-
-/*
- * return the first or the next element in an RCU protected hlist
- */
-#define lttng_hlist_first_rcu(head)    (*((struct hlist_node __rcu **)(&(head)->first)))
-#define lttng_hlist_next_rcu(node)     (*((struct hlist_node __rcu **)(&(node)->next)))
-#define lttng_hlist_pprev_rcu(node)    (*((struct hlist_node __rcu **)((node)->pprev)))
-
-#define lttng_hlist_entry_safe(ptr, type, member) \
-       ({ typeof(ptr) ____ptr = (ptr); \
-          ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
-       })
-
-/**
- * lttng_hlist_for_each_entry  - iterate over list of given type
- * @pos:       the type * to use as a loop cursor.
- * @head:      the head for your list.
- * @member:    the name of the hlist_node within the struct.
- */
-#define lttng_hlist_for_each_entry(pos, head, member)                  \
-       for (pos = lttng_hlist_entry_safe((head)->first, typeof(*(pos)), member);\
-            pos;                                                       \
-            pos = lttng_hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
-
-/**
- * lttng_hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:       the type * to use as a loop cursor.
- * @n:         another &struct hlist_node to use as temporary storage
- * @head:      the head for your list.
- * @member:    the name of the hlist_node within the struct.
- */
-#define lttng_hlist_for_each_entry_safe(pos, n, head, member)          \
-       for (pos = lttng_hlist_entry_safe((head)->first, typeof(*pos), member);\
-            pos && ({ n = pos->member.next; 1; });                     \
-            pos = lttng_hlist_entry_safe(n, typeof(*pos), member))
-
-#endif /* _LTTNG_WRAPPER_LIST_H */
index 29f60947c05f2a3e6bbd975e4904630f0dd3ade3..b1877a49ea1429ba2d0ffe40241fa19e3cf964df 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/version.h>
 #include <linux/rculist.h>
 #include <linux/rcupdate.h>
-#include <wrapper/list.h>
 
 #ifndef rcu_dereference_raw_notrace
 #define rcu_dereference_raw_notrace(p) rcu_dereference_raw(p)
                &pos->member != (head); \
                pos = lttng_list_entry_rcu(pos->member.next, typeof(*pos), member))
 
-/**
- * lttng_hlist_for_each_entry_rcu - iterate over rcu list of given type (for tracing)
- * @pos:       the type * to use as a loop cursor.
- * @head:      the head for your list.
- * @member:    the name of the hlist_node within the struct.
- *
- * This list-traversal primitive may safely run concurrently with
- * the _rcu list-mutation primitives such as hlist_add_head_rcu()
- * as long as the traversal is guarded by rcu_read_lock().
- *
- * This is the same as hlist_for_each_entry_rcu() except that it does
- * not do any RCU debugging or tracing.
- */
-#define lttng_hlist_for_each_entry_rcu(pos, head, member)      \
-       for (pos = lttng_hlist_entry_safe (lttng_rcu_dereference(lttng_hlist_first_rcu(head)), \
-                       typeof(*(pos)), member);                \
-               pos;                                            \
-               pos = lttng_hlist_entry_safe(lttng_rcu_dereference(lttng_hlist_next_rcu( \
-                       &(pos)->member)), typeof(*(pos)), member))
-
 #endif /* _LTTNG_WRAPPER_RCU_H */
This page took 0.030912 seconds and 4 git commands to generate.