summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-06-19 00:54:04 +0300
committerAnup Patel <anup.patel@wdc.com>2019-06-19 07:18:59 +0300
commit200ed7c1bdb4d39caf9d0126e3741e72982852b0 (patch)
tree11bff85604758f4af128920635091c42d84f1dfb /lib/utils
parent793e5e1184f04012804914bd922e68536f3b68dd (diff)
downloadopensbi-200ed7c1bdb4d39caf9d0126e3741e72982852b0.tar.xz
lib: Rename string.x to sbi_string.x
All string functions are part of libsbi. It makes more sense to rename them to sbi_string.x as the libsbi can be linked with external libraries that can have similar implementation. Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/irqchip/plic.c4
-rw-r--r--lib/utils/libfdt/libfdt_env.h14
-rw-r--r--lib/utils/tinyfdt.c12
3 files changed, 21 insertions, 9 deletions
diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c
index 2131707..9cc2108 100644
--- a/lib/utils/irqchip/plic.c
+++ b/lib/utils/irqchip/plic.c
@@ -10,7 +10,7 @@
#include <sbi/riscv_io.h>
#include <sbi/riscv_encoding.h>
#include <sbi/sbi_console.h>
-#include <sbi/string.h>
+#include <sbi/sbi_string.h>
#include <sbi_utils/tinyfdt.h>
#include <sbi_utils/irqchip/plic.h>
@@ -54,7 +54,7 @@ static void plic_fdt_fixup_prop(const struct fdt_node *node,
if (!prop)
return;
- if (strcmp(prop->name, "interrupts-extended"))
+ if (sbi_strcmp(prop->name, "interrupts-extended"))
return;
cells = prop->value;
diff --git a/lib/utils/libfdt/libfdt_env.h b/lib/utils/libfdt/libfdt_env.h
index c2b0c34..535b637 100644
--- a/lib/utils/libfdt/libfdt_env.h
+++ b/lib/utils/libfdt/libfdt_env.h
@@ -52,7 +52,7 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sbi/string.h>
+#include <sbi/sbi_string.h>
#include <sbi/sbi_types.h>
#define INT_MAX ((int)(~0U >> 1))
@@ -66,6 +66,18 @@
#define FDT_BITWISE
#endif
+#define memmove sbi_memmove
+#define memcpy sbi_memcpy
+#define memcmp sbi_memcmp
+#define memchr sbi_memchr
+#define memset sbi_memset
+#define strchr sbi_strchr
+#define strrchr sbi_strrchr
+#define strcpy sbi_strcpy
+#define strcmp sbi_strcmp
+#define strlen sbi_strlen
+#define strnlen sbi_strnlen
+
typedef uint16_t FDT_BITWISE fdt16_t;
typedef uint32_t FDT_BITWISE fdt32_t;
typedef uint64_t FDT_BITWISE fdt64_t;
diff --git a/lib/utils/tinyfdt.c b/lib/utils/tinyfdt.c
index da5c0f7..7d27030 100644
--- a/lib/utils/tinyfdt.c
+++ b/lib/utils/tinyfdt.c
@@ -7,7 +7,7 @@
* Anup Patel <anup.patel@wdc.com>
*/
-#include <sbi/string.h>
+#include <sbi/sbi_string.h>
#include <sbi_utils/tinyfdt.h>
#define FDT_MAGIC 0xd00dfeed
@@ -48,10 +48,10 @@ int fdt_prop_string_index(const struct fdt_prop *prop, const char *str)
end = p + prop->len;
for (i = 0; p < end; i++, p += l) {
- l = strlen(p) + 1;
+ l = sbi_strlen(p) + 1;
if (p + l > end)
return -1;
- if (strcmp(str, p) == 0)
+ if (sbi_strcmp(str, p) == 0)
return i; /* Found it; return index */
}
@@ -83,7 +83,7 @@ static void recursive_iter(char **data, struct recursive_iter_info *info,
node.parent = parent;
node.name = *data;
- *data += strlen(*data) + 1;
+ *data += sbi_strlen(*data) + 1;
while ((ulong)(*data) % sizeof(u32) != 0)
(*data)++;
@@ -154,7 +154,7 @@ static void match_iter(const struct fdt_node *node, const struct fdt_prop *prop,
data += sizeof(u32);
/* Skip node name */
- data += strlen(data) + 1;
+ data += sbi_strlen(data) + 1;
while ((ulong)(data) % sizeof(u32) != 0)
data++;
@@ -228,7 +228,7 @@ static int match_compat(const struct fdt_node *node,
if (!prop)
return 0;
- if (strcmp(prop->name, "compatible"))
+ if (sbi_strcmp(prop->name, "compatible"))
return 0;
if (fdt_prop_string_index(prop, cinfo->compat) < 0)