Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/bitops.h>
4#include <linux/find.h>
5
6__rust_helper
7void rust_helper___set_bit(unsigned long nr, unsigned long *addr)
8{
9 __set_bit(nr, addr);
10}
11
12__rust_helper
13void rust_helper___clear_bit(unsigned long nr, unsigned long *addr)
14{
15 __clear_bit(nr, addr);
16}
17
18__rust_helper
19void rust_helper_set_bit(unsigned long nr, volatile unsigned long *addr)
20{
21 set_bit(nr, addr);
22}
23
24__rust_helper
25void rust_helper_clear_bit(unsigned long nr, volatile unsigned long *addr)
26{
27 clear_bit(nr, addr);
28}
29
30/*
31 * The rust_helper_ prefix is intentionally omitted below so that the
32 * declarations in include/linux/find.h are compatible with these helpers.
33 *
34 * Note that the below #ifdefs mean that the helper is only created if C does
35 * not provide a definition.
36 */
37#ifdef find_first_zero_bit
38__rust_helper
39unsigned long _find_first_zero_bit(const unsigned long *p, unsigned long size)
40{
41 return find_first_zero_bit(p, size);
42}
43#endif /* find_first_zero_bit */
44
45#ifdef find_next_zero_bit
46__rust_helper
47unsigned long _find_next_zero_bit(const unsigned long *addr,
48 unsigned long size, unsigned long offset)
49{
50 return find_next_zero_bit(addr, size, offset);
51}
52#endif /* find_next_zero_bit */
53
54#ifdef find_first_bit
55__rust_helper
56unsigned long _find_first_bit(const unsigned long *addr, unsigned long size)
57{
58 return find_first_bit(addr, size);
59}
60#endif /* find_first_bit */
61
62#ifdef find_next_bit
63__rust_helper
64unsigned long _find_next_bit(const unsigned long *addr, unsigned long size,
65 unsigned long offset)
66{
67 return find_next_bit(addr, size, offset);
68}
69#endif /* find_next_bit */