diff options
author | Thomas Bertschinger <tahbertschinger@gmail.com> | 2024-01-15 23:41:02 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-16 01:47:05 -0500 |
commit | f5baaf48e3e82b1caf9f5cd1207d4d6feba3a2e5 (patch) | |
tree | 59f7b0e4667df7a9d3d5a45725f2aaab3e79b4c5 /c_src/include/linux/rcupdate.h | |
parent | fb35dbfdc5a9446fbb856dae5542b23963e28b89 (diff) |
move Rust sources to top level, C sources into c_src
This moves the Rust sources out of rust_src/ and into the top level.
Running the bcachefs executable out of the development tree is now:
$ ./target/release/bcachefs command
or
$ cargo run --profile release -- command
instead of "./bcachefs command".
Building and installing is still:
$ make && make install
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/include/linux/rcupdate.h')
-rw-r--r-- | c_src/include/linux/rcupdate.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/c_src/include/linux/rcupdate.h b/c_src/include/linux/rcupdate.h new file mode 100644 index 00000000..f5260270 --- /dev/null +++ b/c_src/include/linux/rcupdate.h @@ -0,0 +1,48 @@ +#ifndef __TOOLS_LINUX_RCUPDATE_H +#define __TOOLS_LINUX_RCUPDATE_H + +#include <urcu.h> +#include <linux/compiler.h> + +#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) + +#define rcu_dereference_check(p, c) rcu_dereference(p) +#define rcu_dereference_raw(p) rcu_dereference(p) +#define rcu_dereference_protected(p, c) rcu_dereference(p) +#define rcu_access_pointer(p) READ_ONCE(p) + +#define kfree_rcu(ptr, rcu_head) kfree(ptr) /* XXX */ +#define kfree_rcu_mightsleep(ptr) kfree(ptr) /* XXX */ +#define kvfree_rcu_mightsleep(ptr) kfree(ptr) /* XXX */ + +#define RCU_INIT_POINTER(p, v) WRITE_ONCE(p, v) + +/* Has the specified rcu_head structure been handed to call_rcu()? */ + +/** + * rcu_head_init - Initialize rcu_head for rcu_head_after_call_rcu() + * @rhp: The rcu_head structure to initialize. + * + * If you intend to invoke rcu_head_after_call_rcu() to test whether a + * given rcu_head structure has already been passed to call_rcu(), then + * you must also invoke this rcu_head_init() function on it just after + * allocating that structure. Calls to this function must not race with + * calls to call_rcu(), rcu_head_after_call_rcu(), or callback invocation. + */ +static inline void rcu_head_init(struct rcu_head *rhp) +{ + rhp->func = (void *)~0L; +} + +static inline bool +rcu_head_after_call_rcu(struct rcu_head *rhp, + void (*f)(struct rcu_head *head)) +{ + void (*func)(struct rcu_head *head) = READ_ONCE(rhp->func); + + if (func == f) + return true; + return false; +} + +#endif /* __TOOLS_LINUX_RCUPDATE_H */ |