diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2018-11-20 10:43:33 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2018-11-20 10:43:33 -0500 |
commit | 22615096dee294f63c6940c17f2a448da51d9197 (patch) | |
tree | cf38db8d010344e445210c35348ec457f33b7a7e /src/fs | |
parent | e88b4f9040b63d70563bee8553596f3c317022a5 (diff) |
fs work, initrd/stdio
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/initrd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/fs/initrd.c b/src/fs/initrd.c index 5731ab5..44e5493 100644 --- a/src/fs/initrd.c +++ b/src/fs/initrd.c @@ -1,5 +1,4 @@ #include <stdint.h> -#include <string.h> #include <kernel/heap.h> #include <kernel/vfs.h> @@ -30,6 +29,16 @@ static const vfs_volume_funcs initrd_funcs = { 0 // readdir }; +int initrd_strncmp(const char *a, const char *b, unsigned int n) +{ + for (unsigned int i = 0; i < n; i++) { + if (a[i] != b[i]) + return 1; + } + + return 0; +} + void initrd_init(void) { vfs_mount(&initrd_funcs, VFS_READONLY); @@ -40,7 +49,7 @@ void *initrd_open(const char *file) char *ptr; for (uint32_t i = 0; ptr = initrd_getfile(i), ptr != 0; i++) { uint32_t len = *((uint32_t *)ptr); - if (!strncmp(file, ptr + 4, len)) { + if (!initrd_strncmp(file, ptr + 4, len)) { initrd_info *file = (initrd_info *)malloc( sizeof(initrd_info)); file->address = ptr + len + 8; |