Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linuxkpi/common/include/linux/rculist.h
| Show All 27 Lines | |||||
| */ | */ | ||||
| #ifndef _LINUX_RCULIST_H_ | #ifndef _LINUX_RCULIST_H_ | ||||
| #define _LINUX_RCULIST_H_ | #define _LINUX_RCULIST_H_ | ||||
| #include <linux/list.h> | #include <linux/list.h> | ||||
| #include <linux/rcupdate.h> | #include <linux/rcupdate.h> | ||||
| #define list_entry_rcu(ptr, type, member) \ | |||||
| container_of(READ_ONCE(ptr), type, member) | |||||
| #define list_next_rcu(head) (*((struct list_head **)(&(head)->next))) | |||||
| #define list_for_each_entry_rcu(pos, head, member) \ | |||||
| for (pos = list_entry_rcu((head)->next, typeof(*(pos)), member); \ | |||||
| &(pos)->member != (head); \ | |||||
| pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member)) | |||||
| static inline void | |||||
| list_add_rcu(struct list_head *new, struct list_head *prev) | |||||
| { | |||||
| new->next = prev->next; | |||||
| new->prev = prev; | |||||
| rcu_assign_pointer(list_next_rcu(prev), new); | |||||
| prev->prev = new; | |||||
| } | |||||
| #define hlist_first_rcu(head) (*((struct hlist_node **)(&(head)->first))) | #define hlist_first_rcu(head) (*((struct hlist_node **)(&(head)->first))) | ||||
| #define hlist_next_rcu(node) (*((struct hlist_node **)(&(node)->next))) | #define hlist_next_rcu(node) (*((struct hlist_node **)(&(node)->next))) | ||||
| #define hlist_pprev_rcu(node) (*((struct hlist_node **)((node)->pprev))) | #define hlist_pprev_rcu(node) (*((struct hlist_node **)((node)->pprev))) | ||||
| static inline void | static inline void | ||||
| hlist_add_behind_rcu(struct hlist_node *n, struct hlist_node *prev) | hlist_add_behind_rcu(struct hlist_node *n, struct hlist_node *prev) | ||||
| { | { | ||||
| n->next = prev->next; | n->next = prev->next; | ||||
| n->pprev = &prev->next; | n->pprev = &prev->next; | ||||
| rcu_assign_pointer(hlist_next_rcu(prev), n); | rcu_assign_pointer(hlist_next_rcu(prev), n); | ||||
| if (n->next) | if (n->next) | ||||
| n->next->pprev = &n->next; | n->next->pprev = &n->next; | ||||
| } | } | ||||
| #define hlist_for_each_entry_rcu(pos, head, member) \ | #define hlist_for_each_entry_rcu(pos, head, member) \ | ||||
| hlist_for_each_entry(pos, head, member) | for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ | ||||
| typeof(*(pos)), member); \ | |||||
| (pos); \ | |||||
| pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ | |||||
| &(pos)->member)), typeof(*(pos)), member)) | |||||
| static inline void | static inline void | ||||
| hlist_del_rcu(struct hlist_node *n) | hlist_del_rcu(struct hlist_node *n) | ||||
| { | { | ||||
| struct hlist_node *next = n->next; | struct hlist_node *next = n->next; | ||||
| struct hlist_node **pprev = n->pprev; | struct hlist_node **pprev = n->pprev; | ||||
| WRITE_ONCE(*pprev, next); | WRITE_ONCE(*pprev, next); | ||||
| Show All 26 Lines | |||||