f30a9aed515db306a1803ff5e4bcc2612a75801b
1 #ifndef _LTTNG_WRAPPER_KREF_H
2 #define _LTTNG_WRAPPER_KREF_H
7 * wrapper around linux/kref.h.
9 * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; only version 2 of the License.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * This wrapper code is derived from Linux 3.19.2 include/linux/list.h
25 * and include/linux/rculist.h, hence the GPLv2 license applied to this
29 #include <linux/kref.h>
30 #include <linux/rculist.h>
33 * lttng_kref_get: get reference count, checking for overflow.
35 * Return 1 if reference is taken, 0 otherwise (overflow).
37 static inline int lttng_kref_get(struct kref
*kref
)
39 return atomic_add_unless(&kref
->refcount
, 1, INT_MAX
);
42 #endif /* _LTTNG_WRAPPER_KREF_H */
This page took 0.029649 seconds and 3 git commands to generate.