dm vdo string-utils: change from uds_ to vdo_ namespace

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Chung Chung <cchung@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
This commit is contained in:
Mike Snitzer 2024-02-14 09:34:46 -06:00
parent 3584240b9c
commit 900d337b46
6 changed files with 19 additions and 19 deletions

View file

@ -340,7 +340,7 @@ static int join_strings(char **substring_array, size_t array_length, char separa
current_position = &output[0];
for (i = 0; (i < array_length) && (substring_array[i] != NULL); i++) {
current_position = uds_append_to_buffer(current_position,
current_position = vdo_append_to_buffer(current_position,
output + string_length, "%s",
substring_array[i]);
*current_position = separator;

View file

@ -154,19 +154,19 @@ const char *uds_string_error(int errnum, char *buf, size_t buflen)
block_name = get_error_info(errnum, &info);
if (block_name != NULL) {
if (info != NULL) {
buffer = uds_append_to_buffer(buffer, buf_end, "%s: %s",
buffer = vdo_append_to_buffer(buffer, buf_end, "%s: %s",
block_name, info->message);
} else {
buffer = uds_append_to_buffer(buffer, buf_end, "Unknown %s %d",
buffer = vdo_append_to_buffer(buffer, buf_end, "Unknown %s %d",
block_name, errnum);
}
} else if (info != NULL) {
buffer = uds_append_to_buffer(buffer, buf_end, "%s", info->message);
buffer = vdo_append_to_buffer(buffer, buf_end, "%s", info->message);
} else {
const char *tmp = system_string_error(errnum, buffer, buf_end - buffer);
if (tmp != buffer)
buffer = uds_append_to_buffer(buffer, buf_end, "%s", tmp);
buffer = vdo_append_to_buffer(buffer, buf_end, "%s", tmp);
else
buffer += strlen(tmp);
}
@ -188,19 +188,19 @@ const char *uds_string_error_name(int errnum, char *buf, size_t buflen)
block_name = get_error_info(errnum, &info);
if (block_name != NULL) {
if (info != NULL) {
buffer = uds_append_to_buffer(buffer, buf_end, "%s", info->name);
buffer = vdo_append_to_buffer(buffer, buf_end, "%s", info->name);
} else {
buffer = uds_append_to_buffer(buffer, buf_end, "%s %d",
buffer = vdo_append_to_buffer(buffer, buf_end, "%s %d",
block_name, errnum);
}
} else if (info != NULL) {
buffer = uds_append_to_buffer(buffer, buf_end, "%s", info->name);
buffer = vdo_append_to_buffer(buffer, buf_end, "%s", info->name);
} else {
const char *tmp;
tmp = system_string_error(errnum, buffer, buf_end - buffer);
if (tmp != buffer)
buffer = uds_append_to_buffer(buffer, buf_end, "%s", tmp);
buffer = vdo_append_to_buffer(buffer, buf_end, "%s", tmp);
else
buffer += strlen(tmp);
}

View file

@ -368,6 +368,6 @@ void vdo_dump_logical_zone(const struct logical_zone *zone)
(unsigned long long) READ_ONCE(zone->flush_generation),
(unsigned long long) READ_ONCE(zone->oldest_active_generation),
(unsigned long long) READ_ONCE(zone->notification_generation),
uds_bool_to_string(READ_ONCE(zone->notifying)),
vdo_bool_to_string(READ_ONCE(zone->notifying)),
(unsigned long long) READ_ONCE(zone->ios_in_flush_generation));
}

View file

@ -3597,8 +3597,8 @@ void vdo_dump_block_allocator(const struct block_allocator *allocator)
vdo_log_info(" slab journal: entry_waiters=%zu waiting_to_commit=%s updating_slab_summary=%s head=%llu unreapable=%llu tail=%llu next_commit=%llu summarized=%llu last_summarized=%llu recovery_lock=%llu dirty=%s",
vdo_waitq_num_waiters(&journal->entry_waiters),
uds_bool_to_string(journal->waiting_to_commit),
uds_bool_to_string(journal->updating_slab_summary),
vdo_bool_to_string(journal->waiting_to_commit),
vdo_bool_to_string(journal->updating_slab_summary),
(unsigned long long) journal->head,
(unsigned long long) journal->unreapable,
(unsigned long long) journal->tail,
@ -3606,7 +3606,7 @@ void vdo_dump_block_allocator(const struct block_allocator *allocator)
(unsigned long long) journal->summarized,
(unsigned long long) journal->last_summarized,
(unsigned long long) journal->recovery_lock,
uds_bool_to_string(journal->recovery_lock != 0));
vdo_bool_to_string(journal->recovery_lock != 0));
/*
* Given the frequency with which the locks are just a tiny bit off, it might be
* worth dumping all the locks, but that might be too much logging.

View file

@ -5,7 +5,7 @@
#include "string-utils.h"
char *uds_append_to_buffer(char *buffer, char *buf_end, const char *fmt, ...)
char *vdo_append_to_buffer(char *buffer, char *buf_end, const char *fmt, ...)
{
va_list args;
size_t n;

View file

@ -3,21 +3,21 @@
* Copyright 2023 Red Hat
*/
#ifndef UDS_STRING_UTILS_H
#define UDS_STRING_UTILS_H
#ifndef VDO_STRING_UTILS_H
#define VDO_STRING_UTILS_H
#include <linux/kernel.h>
#include <linux/string.h>
/* Utilities related to string manipulation */
static inline const char *uds_bool_to_string(bool value)
static inline const char *vdo_bool_to_string(bool value)
{
return value ? "true" : "false";
}
/* Append a formatted string to the end of a buffer. */
char *uds_append_to_buffer(char *buffer, char *buf_end, const char *fmt, ...)
char *vdo_append_to_buffer(char *buffer, char *buf_end, const char *fmt, ...)
__printf(3, 4);
#endif /* UDS_STRING_UTILS_H */
#endif /* VDO_STRING_UTILS_H */