1 /* SPDX-License-Identifier: GPL-2.0
5 * wrapper around linux/kref.h.
7 * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * This wrapper code is derived from Linux 3.19.2 include/linux/list.h
10 * and include/linux/rculist.h, hence the GPLv2 license applied to this
14 #ifndef _LTTNG_WRAPPER_KREF_H
15 #define _LTTNG_WRAPPER_KREF_H
17 #include <linux/kref.h>
18 #include <linux/rculist.h>
19 #include <linux/version.h>
22 * lttng_kref_get: get reference count, checking for overflow.
24 * Return 1 if reference is taken, 0 otherwise (overflow).
26 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
27 static inline int lttng_kref_get(struct kref
*kref
)
32 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
33 static inline int lttng_kref_get(struct kref
*kref
)
35 return atomic_add_unless(&kref
->refcount
, 1, INT_MAX
);
37 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) */
39 #endif /* _LTTNG_WRAPPER_KREF_H */
This page took 0.030085 seconds and 4 git commands to generate.