Cleanup: move to kernel style SPDX license identifiers
[lttng-modules.git] / wrapper / list.h
index c816684ddf7eb35fd5421f285b80e5182c1ff305..4e167862f1b09acf9de241197c0206663de2ffe3 100644 (file)
@@ -1,34 +1,29 @@
-#ifndef _LTTNG_WRAPPER_LIST_H
-#define _LTTNG_WRAPPER_LIST_H
-
-/*
+/* SPDX-License-Identifier: GPL-2.0
+ *
  * wrapper/list.h
  *
  * wrapper around linux/list.h.
  *
  * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; only version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
  * 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; \
             pos && ({ n = pos->member.next; 1; });                     \
             pos = lttng_hlist_entry_safe(n, typeof(*pos), member))
 
-#ifndef rcu_dereference_raw_notrace
-#define rcu_dereference_raw_notrace(p) rcu_dereference_raw(p)
-#endif
-
-/**
- * lttng_hlist_for_each_entry_rcu_notrace - 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_notrace(pos, head, member)      \
-       for (pos = lttng_hlist_entry_safe (rcu_dereference_raw_notrace(hlist_first_rcu(head)),\
-                       typeof(*(pos)), member);                        \
-               pos;                                                    \
-               pos = lttng_hlist_entry_safe(rcu_dereference_raw_notrace(hlist_next_rcu(\
-                       &(pos)->member)), typeof(*(pos)), member))
-
 #endif /* _LTTNG_WRAPPER_LIST_H */
This page took 0.023153 seconds and 4 git commands to generate.