Move string functions/utils from HAL to std/string

This commit is contained in:
2025-11-11 19:54:09 +01:00
parent f5dae4984d
commit 344952fb5f
27 changed files with 200 additions and 228 deletions

View File

@ -14,6 +14,7 @@
#include "storedev/storedev.h"
#include "util/util.h"
#include "hshtb.h"
#include "std/string.h"
int32_t SYSCALL4(sys_vfsmount, mountpoint1, fstypestr1, devid1, format1) {
int32_t ret = E_OK;
@ -30,7 +31,7 @@ int32_t SYSCALL4(sys_vfsmount, mountpoint1, fstypestr1, devid1, format1) {
int32_t fstype;
if (hal_strcmp(fstypestr, "LittleFS") == 0) {
if (strcmp(fstypestr, "LittleFS") == 0) {
fstype = VFS_LITTLEFS;
} else {
ret = E_INVALIDARGUMENT;
@ -76,7 +77,7 @@ int32_t SYSCALL1(sys_vfsavailmounts, availmounts1) {
for (size_t i = 0; i < VFS_MOUNTPOINTS_MAX; i++) {
VfsMountPoint *vmp = &VFS_TABLE.mountpoints[i];
if (vmp->_hshtbstate == HSHTB_TAKEN) {
hal_memcpy(availmounts->labels[i], vmp->label, VFS_MOUNTPOINT_LABEL_MAX);
memcpy(availmounts->labels[i], vmp->label, VFS_MOUNTPOINT_LABEL_MAX);
availmounts->fieldavail[i] = 1;
}
}
@ -105,7 +106,7 @@ int32_t SYSCALL2(sys_vfsmountstat, statbuf1, label1) {
return E_NOENTRY;
}
hal_memcpy(statbuf->label, vmp->label, sizeof(statbuf->label));
memcpy(statbuf->label, vmp->label, sizeof(statbuf->label));
statbuf->fstype = vmp->fstype;
StoreDev *vmpsd = vmp->backingsd;
@ -113,7 +114,7 @@ int32_t SYSCALL2(sys_vfsmountstat, statbuf1, label1) {
for (size_t i = 0; i < LEN(DEVTABLE.devs); i++) {
Dev *dev = &DEVTABLE.devs[i];
if (dev->extra != NULL && ((StoreDev *)dev->extra)->_magic == STOREDEV_MAGIC && vmpsd == dev->extra) {
hal_memcpy(statbuf->devname, dev->ident, sizeof(statbuf->devname));
memcpy(statbuf->devname, dev->ident, sizeof(statbuf->devname));
break;
}
}