Skip to content

Commit

Permalink
dm vdo string-utils: change from uds_ to vdo_ namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Chung Chung <[email protected]>
Signed-off-by: Matthew Sakai <[email protected]>
  • Loading branch information
Mike Snitzer authored and lorelei-sakai committed Mar 2, 2024
1 parent 585ecd3 commit df0467e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/dm-vdo-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions drivers/md/dm-vdo/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/logical-zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
6 changes: 3 additions & 3 deletions drivers/md/dm-vdo/slab-depot.c
Original file line number Diff line number Diff line change
Expand Up @@ -3597,16 +3597,16 @@ 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,
(unsigned long long) journal->next_commit,
(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.
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-vdo/string-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions drivers/md/dm-vdo/string-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit df0467e

Please sign in to comment.