Commit 6a87a8a2 authored by Mike Snitzer's avatar Mike Snitzer

dm vdo thread-device: rename all methods to reflect vdo-only use

Also moved vdo_init()'s call to vdo_initialize_thread_device_registry
next to other registry initialization.
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent 82b354ff
...@@ -1107,7 +1107,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv, ...@@ -1107,7 +1107,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv,
vdo = get_vdo_for_target(ti); vdo = get_vdo_for_target(ti);
uds_register_allocating_thread(&allocating_thread, NULL); uds_register_allocating_thread(&allocating_thread, NULL);
uds_register_thread_device_id(&instance_thread, &vdo->instance); vdo_register_thread_device_id(&instance_thread, &vdo->instance);
/* /*
* Must be done here so we don't map return codes. The code in dm-ioctl expects a 1 for a * Must be done here so we don't map return codes. The code in dm-ioctl expects a 1 for a
...@@ -1120,7 +1120,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv, ...@@ -1120,7 +1120,7 @@ static int vdo_message(struct dm_target *ti, unsigned int argc, char **argv,
result = vdo_status_to_errno(process_vdo_message(vdo, argc, argv)); result = vdo_status_to_errno(process_vdo_message(vdo, argc, argv));
} }
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
uds_unregister_allocating_thread(); uds_unregister_allocating_thread();
return result; return result;
} }
...@@ -1632,9 +1632,9 @@ static int construct_new_vdo(struct dm_target *ti, unsigned int argc, char **arg ...@@ -1632,9 +1632,9 @@ static int construct_new_vdo(struct dm_target *ti, unsigned int argc, char **arg
if (result != VDO_SUCCESS) if (result != VDO_SUCCESS)
return -ENOMEM; return -ENOMEM;
uds_register_thread_device_id(&instance_thread, &instance); vdo_register_thread_device_id(&instance_thread, &instance);
result = construct_new_vdo_registered(ti, argc, argv, instance); result = construct_new_vdo_registered(ti, argc, argv, instance);
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
return result; return result;
} }
...@@ -1913,9 +1913,9 @@ static int vdo_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -1913,9 +1913,9 @@ static int vdo_ctr(struct dm_target *ti, unsigned int argc, char **argv)
if (vdo == NULL) { if (vdo == NULL) {
result = construct_new_vdo(ti, argc, argv); result = construct_new_vdo(ti, argc, argv);
} else { } else {
uds_register_thread_device_id(&instance_thread, &vdo->instance); vdo_register_thread_device_id(&instance_thread, &vdo->instance);
result = update_existing_vdo(device_name, ti, argc, argv, vdo); result = update_existing_vdo(device_name, ti, argc, argv, vdo);
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
} }
uds_unregister_allocating_thread(); uds_unregister_allocating_thread();
...@@ -1935,7 +1935,7 @@ static void vdo_dtr(struct dm_target *ti) ...@@ -1935,7 +1935,7 @@ static void vdo_dtr(struct dm_target *ti)
unsigned int instance = vdo->instance; unsigned int instance = vdo->instance;
struct registered_thread allocating_thread, instance_thread; struct registered_thread allocating_thread, instance_thread;
uds_register_thread_device_id(&instance_thread, &instance); vdo_register_thread_device_id(&instance_thread, &instance);
uds_register_allocating_thread(&allocating_thread, NULL); uds_register_allocating_thread(&allocating_thread, NULL);
device_name = vdo_get_device_name(ti); device_name = vdo_get_device_name(ti);
...@@ -1945,7 +1945,7 @@ static void vdo_dtr(struct dm_target *ti) ...@@ -1945,7 +1945,7 @@ static void vdo_dtr(struct dm_target *ti)
vdo_destroy(uds_forget(vdo)); vdo_destroy(uds_forget(vdo));
uds_log_info("device '%s' stopped", device_name); uds_log_info("device '%s' stopped", device_name);
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
uds_unregister_allocating_thread(); uds_unregister_allocating_thread();
release_instance(instance); release_instance(instance);
} else if (config == vdo->device_config) { } else if (config == vdo->device_config) {
...@@ -2104,7 +2104,7 @@ static void vdo_postsuspend(struct dm_target *ti) ...@@ -2104,7 +2104,7 @@ static void vdo_postsuspend(struct dm_target *ti)
const char *device_name; const char *device_name;
int result; int result;
uds_register_thread_device_id(&instance_thread, &vdo->instance); vdo_register_thread_device_id(&instance_thread, &vdo->instance);
device_name = vdo_get_device_name(vdo->device_config->owning_target); device_name = vdo_get_device_name(vdo->device_config->owning_target);
uds_log_info("suspending device '%s'", device_name); uds_log_info("suspending device '%s'", device_name);
...@@ -2129,7 +2129,7 @@ static void vdo_postsuspend(struct dm_target *ti) ...@@ -2129,7 +2129,7 @@ static void vdo_postsuspend(struct dm_target *ti)
device_name); device_name);
} }
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
} }
/** /**
...@@ -2846,11 +2846,11 @@ static int vdo_preresume(struct dm_target *ti) ...@@ -2846,11 +2846,11 @@ static int vdo_preresume(struct dm_target *ti)
struct vdo *vdo = get_vdo_for_target(ti); struct vdo *vdo = get_vdo_for_target(ti);
int result; int result;
uds_register_thread_device_id(&instance_thread, &vdo->instance); vdo_register_thread_device_id(&instance_thread, &vdo->instance);
result = vdo_preresume_registered(ti, vdo); result = vdo_preresume_registered(ti, vdo);
if ((result == VDO_PARAMETER_MISMATCH) || (result == VDO_INVALID_ADMIN_STATE)) if ((result == VDO_PARAMETER_MISMATCH) || (result == VDO_INVALID_ADMIN_STATE))
result = -EINVAL; result = -EINVAL;
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
return vdo_status_to_errno(result); return vdo_status_to_errno(result);
} }
...@@ -2858,10 +2858,10 @@ static void vdo_resume(struct dm_target *ti) ...@@ -2858,10 +2858,10 @@ static void vdo_resume(struct dm_target *ti)
{ {
struct registered_thread instance_thread; struct registered_thread instance_thread;
uds_register_thread_device_id(&instance_thread, vdo_register_thread_device_id(&instance_thread,
&get_vdo_for_target(ti)->instance); &get_vdo_for_target(ti)->instance);
uds_log_info("device '%s' resumed", vdo_get_device_name(ti)); uds_log_info("device '%s' resumed", vdo_get_device_name(ti));
uds_unregister_thread_device_id(); vdo_unregister_thread_device_id();
} }
/* /*
...@@ -2912,10 +2912,10 @@ static int __init vdo_init(void) ...@@ -2912,10 +2912,10 @@ static int __init vdo_init(void)
/* /*
* UDS module level initialization must be done first, as VDO initialization depends on it * UDS module level initialization must be done first, as VDO initialization depends on it
*/ */
uds_initialize_thread_device_registry();
uds_memory_init(); uds_memory_init();
uds_init_sysfs(); uds_init_sysfs();
vdo_initialize_thread_device_registry();
vdo_initialize_device_registry_once(); vdo_initialize_device_registry_once();
uds_log_info("loaded version %s", CURRENT_VERSION); uds_log_info("loaded version %s", CURRENT_VERSION);
......
...@@ -176,7 +176,7 @@ static void emit_log_message(int priority, const char *module, const char *prefi ...@@ -176,7 +176,7 @@ static void emit_log_message(int priority, const char *module, const char *prefi
} }
/* Not at interrupt level; we have a process we can look at, and might have a device ID. */ /* Not at interrupt level; we have a process we can look at, and might have a device ID. */
device_instance = uds_get_thread_device_id(); device_instance = vdo_get_thread_device_id();
if (device_instance >= 0) { if (device_instance >= 0) {
emit_log_message_to_kernel(priority, "%s%u:%s: %s%pV%pV\n", module, emit_log_message_to_kernel(priority, "%s%u:%s: %s%pV%pV\n", module,
device_instance, current->comm, prefix, vaf1, device_instance, current->comm, prefix, vaf1,
......
...@@ -5,24 +5,22 @@ ...@@ -5,24 +5,22 @@
#include "thread-device.h" #include "thread-device.h"
#include "thread-registry.h"
/* A registry of threads associated with device id numbers. */ /* A registry of threads associated with device id numbers. */
static struct thread_registry device_id_thread_registry; static struct thread_registry device_id_thread_registry;
/* Any registered thread must be unregistered. */ /* Any registered thread must be unregistered. */
void uds_register_thread_device_id(struct registered_thread *new_thread, void vdo_register_thread_device_id(struct registered_thread *new_thread,
unsigned int *id_ptr) unsigned int *id_ptr)
{ {
vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr); vdo_register_thread(&device_id_thread_registry, new_thread, id_ptr);
} }
void uds_unregister_thread_device_id(void) void vdo_unregister_thread_device_id(void)
{ {
vdo_unregister_thread(&device_id_thread_registry); vdo_unregister_thread(&device_id_thread_registry);
} }
int uds_get_thread_device_id(void) int vdo_get_thread_device_id(void)
{ {
const unsigned int *pointer; const unsigned int *pointer;
...@@ -30,7 +28,7 @@ int uds_get_thread_device_id(void) ...@@ -30,7 +28,7 @@ int uds_get_thread_device_id(void)
return (pointer != NULL) ? *pointer : -1; return (pointer != NULL) ? *pointer : -1;
} }
void uds_initialize_thread_device_registry(void) void vdo_initialize_thread_device_registry(void)
{ {
vdo_initialize_thread_registry(&device_id_thread_registry); vdo_initialize_thread_registry(&device_id_thread_registry);
} }
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
* Copyright 2023 Red Hat * Copyright 2023 Red Hat
*/ */
#ifndef UDS_THREAD_DEVICE_H #ifndef VDO_THREAD_DEVICE_H
#define UDS_THREAD_DEVICE_H #define VDO_THREAD_DEVICE_H
#include "thread-registry.h" #include "thread-registry.h"
void uds_register_thread_device_id(struct registered_thread *new_thread, void vdo_register_thread_device_id(struct registered_thread *new_thread,
unsigned int *id_ptr); unsigned int *id_ptr);
void uds_unregister_thread_device_id(void); void vdo_unregister_thread_device_id(void);
int uds_get_thread_device_id(void); int vdo_get_thread_device_id(void);
void uds_initialize_thread_device_registry(void); void vdo_initialize_thread_device_registry(void);
#endif /* UDS_THREAD_DEVICE_H */ #endif /* VDO_THREAD_DEVICE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment