Move string functions/utils from HAL to std/string
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
#include "util/util.h"
|
||||
#include "hshtb.h"
|
||||
#include "dev/dev.h"
|
||||
#include "std/string.h"
|
||||
|
||||
int32_t SYSCALL2(sys_dev_gethandle, dev1, devname1) {
|
||||
uint64_t *devh = (uint64_t *)dev1;
|
||||
@ -87,7 +88,7 @@ int32_t SYSCALL2(sys_dev_stat, devstat1, idx1) {
|
||||
for (size_t i = 0; i < LEN(DEVTABLE.devs); i++) {
|
||||
if (i == idx && DEVTABLE.devs[i]._hshtbstate == HSHTB_TAKEN) {
|
||||
Dev *dev = &DEVTABLE.devs[i];
|
||||
hal_memcpy(devstat->name, dev->ident, sizeof(dev->ident));
|
||||
memcpy(devstat->name, dev->ident, sizeof(dev->ident));
|
||||
for (size_t j = 0; j < DEV_FNS_MAX; j++) {
|
||||
if (dev->fns[j] != NULL) {
|
||||
devstat->nfns++;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "dlmalloc/malloc.h"
|
||||
#include "kprintf.h"
|
||||
#include "std/string.h"
|
||||
|
||||
int32_t SYSCALL5(sys_mman_map, addr1, size1, prot1, flags1, out1) {
|
||||
uint8_t *addr = (uint8_t *)addr1;
|
||||
@ -28,7 +29,7 @@ int32_t SYSCALL5(sys_mman_map, addr1, size1, prot1, flags1, out1) {
|
||||
|
||||
size_t pages = _DIV_ROUNDUP(size, HAL_PAGE_SIZE);
|
||||
uint8_t *phys = (uint8_t *)pmm_alloc(pages);
|
||||
hal_memset(VIRT(phys), 0, pages * HAL_PAGE_SIZE);
|
||||
memset(VIRT(phys), 0, pages * HAL_PAGE_SIZE);
|
||||
|
||||
spinlock_acquire(&PROCS.spinlock);
|
||||
Proc *proc = NULL;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "kprintf.h"
|
||||
#include "dlmalloc/malloc.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "std/string.h"
|
||||
|
||||
#define _MP_MAX 0xff
|
||||
#define _PATH_MAX VFS_PATH_MAX
|
||||
@ -178,7 +179,7 @@ int32_t SYSCALL4(sys_proc_argv, pid1, argslen1, argbuf1, maxargs1) {
|
||||
ret = E_INVALIDARGUMENT;
|
||||
goto done;
|
||||
}
|
||||
hal_strcpy(argbuf[i], arg->string);
|
||||
strcpy(argbuf[i], arg->string);
|
||||
}
|
||||
*argslen = i;
|
||||
|
||||
@ -214,7 +215,7 @@ int32_t SYSCALL2(sys_proc_stat, pidx, pstat1) {
|
||||
LL_FOREACH_SAFE_IDX(PROCS.procs, p, ptmp, i) {
|
||||
if (i == pidx) {
|
||||
stat->pid = p->pid;
|
||||
hal_strcpy(stat->name, p->name);
|
||||
strcpy(stat->name, p->name);
|
||||
stat->state = p->state;
|
||||
|
||||
VasRange *vas, *vastmp;
|
||||
@ -222,7 +223,7 @@ int32_t SYSCALL2(sys_proc_stat, pidx, pstat1) {
|
||||
stat->usemem += vas->size;
|
||||
}
|
||||
|
||||
hal_memcpy(&stat->time, &p->time, sizeof(p->time));
|
||||
memcpy(&stat->time, &p->time, sizeof(p->time));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user