1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright 2023 Red Hat 4 */ 5 6 #ifndef VDO_THREAD_REGISTRY_H 7 #define VDO_THREAD_REGISTRY_H 8 9 #include <linux/list.h> 10 #include <linux/spinlock.h> 11 12 struct thread_registry { 13 struct list_head links; 14 spinlock_t lock; 15 }; 16 17 struct registered_thread { 18 struct list_head links; 19 const void *pointer; 20 struct task_struct *task; 21 }; 22 23 void vdo_initialize_thread_registry(struct thread_registry *registry); 24 25 void vdo_register_thread(struct thread_registry *registry, 26 struct registered_thread *new_thread, const void *pointer); 27 28 void vdo_unregister_thread(struct thread_registry *registry); 29 30 const void *vdo_lookup_thread(struct thread_registry *registry); 31 32 #endif /* VDO_THREAD_REGISTRY_H */ 33