File Index
Files and directories
Sign in
FILE

bitops.c

File preview with syntax highlighting.

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