1 #ifndef _KCOMPAT_KREF_H
2 #define _KCOMPAT_KREF_H
5 * Kernel sourcecode compatible reference counting implementation
7 * Copyright (C) 2009 Novell Inc.
9 * Author: Jan Blunck <jblunck@suse.de>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License version 2.1 as
13 * published by the Free Software Foundation.
17 #include <urcu/uatomic_arch.h>
20 long refcount
; /* ATOMIC */
23 static inline void kref_set(struct kref
*ref
, int val
)
25 uatomic_set(&ref
->refcount
, val
);
28 static inline void kref_init(struct kref
*ref
)
33 static inline void kref_get(struct kref
*ref
)
35 long result
= uatomic_add_return(&ref
->refcount
, 1);
39 static inline void kref_put(struct kref
*ref
, void (*release
)(struct kref
*))
41 long res
= uatomic_sub_return(&ref
->refcount
, 1);
46 #endif /* _KCOMPAT_KREF_H */
This page took 0.030877 seconds and 4 git commands to generate.