diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 21:22:14 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-01-09 21:26:23 +0100 |
commit | c6e1454fbb872aed5d445d458958943556271529 (patch) | |
tree | 4951f6a95e4ddead170a355940822f8c86b6ed63 /stage3/fs.c | |
parent | 59f22bc7ce5bbadf62722f3db5c93b45e86e4cca (diff) | |
download | cuddles-c6e1454fbb872aed5d445d458958943556271529.tar.xz |
rename some functions to not use standard names
this avoids confusion when some of those functions differ subtly from their standard versions.
free -> kfree
realloc -> krealloc
malloc -> kmalloc
rationale: kmalloc() behaves different from malloc() in that it will never return NULL. it will panic on OOM. try_kmalloc behaves like the usual malloc.
memcpy -> lmemcpy
memcpy_r -> rmemcpy
rationale: by design, lmemcpy() and rmemcpy() allow memory areas to overlap. the 'l' and 'r' indicate the direction of the copy operation.
Diffstat (limited to 'stage3/fs.c')
-rw-r--r-- | stage3/fs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stage3/fs.c b/stage3/fs.c index b1080b6..d96d014 100644 --- a/stage3/fs.c +++ b/stage3/fs.c @@ -14,7 +14,7 @@ void fs_walk(FS_WALKER(*fun), void *arg) u8 *info = ata_read_full(lba, 1); if (memcmp(info+257, "ustar", 5) != 0) { - free(info); + kfree(info); break; } @@ -26,7 +26,7 @@ void fs_walk(FS_WALKER(*fun), void *arg) bool done = fun(filename, lba, fsize, fsect, arg); - free(info); + kfree(info); if (done) break; @@ -126,7 +126,7 @@ static FS_WALKER(fs_readdir_walker) case HER_CHILD: if (arg->result.len == arg->cap) - arg->result.data = realloc(arg->result.data, + arg->result.data = krealloc(arg->result.data, sizeof(dirent) * (arg->cap = arg->cap ? arg->cap*2 : 1)); arg->result.data[arg->result.len++] = (dirent) { .name = str_clone(entn), |