summaryrefslogtreecommitdiff
path: root/drivers/md/dm-vdo/string-utils.h
diff options
context:
space:
mode:
authorMatthew Sakai <msakai@redhat.com>2023-11-16 19:44:01 -0500
committerMike Snitzer <snitzer@kernel.org>2024-02-20 13:43:13 -0500
commit03d1089e1dc7f05afb2bfc76bffc71de17e4297e (patch)
treeef710d43041426d0d231556db3936bbab6ddfcf4 /drivers/md/dm-vdo/string-utils.h
parent46766d4888ffdfd2bce91a6879bd6285a92a4881 (diff)
dm vdo: add basic logging and support utilities
Add various support utilities for the vdo target and deduplication index, including logging utilities, string and time management, and index-specific error codes. Co-developed-by: J. corwin Coburn <corwin@hurlbutnet.net> Signed-off-by: J. corwin Coburn <corwin@hurlbutnet.net> Co-developed-by: Michael Sclafani <dm-devel@lists.linux.dev> Signed-off-by: Michael Sclafani <dm-devel@lists.linux.dev> Co-developed-by: Thomas Jaskiewicz <tom@jaskiewicz.us> Signed-off-by: Thomas Jaskiewicz <tom@jaskiewicz.us> Co-developed-by: Ken Raeburn <raeburn@redhat.com> Signed-off-by: Ken Raeburn <raeburn@redhat.com> Signed-off-by: Matthew Sakai <msakai@redhat.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-vdo/string-utils.h')
-rw-r--r--drivers/md/dm-vdo/string-utils.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/md/dm-vdo/string-utils.h b/drivers/md/dm-vdo/string-utils.h
new file mode 100644
index 000000000000..8275af582cf7
--- /dev/null
+++ b/drivers/md/dm-vdo/string-utils.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2023 Red Hat
+ */
+
+#ifndef UDS_STRING_UTILS_H
+#define UDS_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)
+{
+ 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, ...)
+ __printf(3, 4);
+
+#endif /* UDS_STRING_UTILS_H */