X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=wrapper%2Flist.h;h=26594f41c9a9402e450a470f062231f2f733c056;hb=b7cdc18250880cc44edeef4a4b42c8ac7a135a6d;hp=0d79e5128c7b36555fee4a266d24a99a2550054a;hpb=7a09dcb7df9caab5c867f39f53009e860b98accb;p=lttng-modules.git diff --git a/wrapper/list.h b/wrapper/list.h index 0d79e512..26594f41 100644 --- a/wrapper/list.h +++ b/wrapper/list.h @@ -1,34 +1,29 @@ -#ifndef _LTTNG_WRAPPER_LIST_H -#define _LTTNG_WRAPPER_LIST_H - -/* +/* SPDX-License-Identifier: GPL-2.0-only + * * wrapper/list.h * * wrapper around linux/list.h. * * Copyright (C) 2015 Mathieu Desnoyers * - * 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 #include +/* + * 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; \