| 1 | |
| 2 | |
| 3 | * Copyright 2023 Red Hat
|
| 4 |
|
| 5 |
|
| 6 | #include "thread-device.h"
|
| 7 |
|
| 8 |
|
| 9 | static struct thread_registry device_id_thread_registry;
|
| 10 |
|
| 11 |
|
| 12 | void vdo_register_thread_device_id(struct registered_thread *new_thread,
|
| 13 | unsigned int *id_ptr)
|
| 14 | {
|
| 15 | vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr);
|
| 16 | }
|
| 17 |
|
| 18 | void vdo_unregister_thread_device_id(void)
|
| 19 | {
|
| 20 | vdo_unregister_thread(&device_id_thread_registry);
|
| 21 | }
|
| 22 |
|
| 23 | int vdo_get_thread_device_id(void)
|
| 24 | {
|
| 25 | const unsigned int *pointer;
|
| 26 |
|
| 27 | pointer = vdo_lookup_thread(&device_id_thread_registry);
|
| 28 | return (pointer != NULL) ? *pointer : -1;
|
| 29 | }
|
| 30 |
|
| 31 | void vdo_initialize_thread_device_registry(void)
|
| 32 | {
|
| 33 | vdo_initialize_thread_registry(&device_id_thread_registry);
|
| 34 | }
|