summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-22 21:06:33 +0100
committerAnton Kling <anton@kling.gg>2023-11-22 21:06:33 +0100
commitf0af695b6c3289a041e8fce8926721063796c596 (patch)
tree7575159d8efbb60ccf1762f2da3e126661f5c7bd
parentb3866b0442f55b97833981a99c601f2143d10315 (diff)
Meta: Use dirent as a general include file
This include file is shared by the kernel and libc
-rw-r--r--include/dirent.h (renamed from userland/libc/include/dirent.h)2
-rw-r--r--kernel/Makefile2
-rw-r--r--kernel/fs/vfs.h6
3 files changed, 4 insertions, 6 deletions
diff --git a/userland/libc/include/dirent.h b/include/dirent.h
index 9f25cbf..153d36a 100644
--- a/userland/libc/include/dirent.h
+++ b/include/dirent.h
@@ -5,7 +5,9 @@
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
+#ifndef KERNEL
#include <unistd.h>
+#endif
#define S_ISREG(_m) (_m & (STAT_REG))
#define S_ISDIR(_m) (_m & (STAT_DIR))
diff --git a/kernel/Makefile b/kernel/Makefile
index e2c3db2..0542b49 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -1,7 +1,7 @@
CC="i686-sb-gcc"
AS="i686-sb-as"
OBJ = arch/i386/boot.o init/kernel.o cpu/gdt.o cpu/reload_gdt.o cpu/idt.o cpu/io.o libc/stdio/print.o drivers/keyboard.o log.o drivers/pit.o libc/string/memcpy.o libc/string/strlen.o libc/string/memcmp.o drivers/ata.o libc/string/memset.o cpu/syscall.o read_eip.o libc/exit/assert.o process.o cpu/int_syscall.o libc/string/strcpy.o arch/i386/mmu.o kmalloc.o fs/ext2.o fs/vfs.o fs/devfs.o cpu/spinlock.o random.o libc/string/strcmp.o crypto/ChaCha20/chacha20.o crypto/SHA1/sha1.o fs/tmpfs.o libc/string/isequal.o drivers/pst.o halts.o syscalls/ppoll.o syscalls/ftruncate.o kubsan.o syscalls/mmap.o drivers/serial.o syscalls/accept.o syscalls/bind.o syscalls/socket.o socket.o poll.o fs/fifo.o hashmap/hashmap.o fs/shm.o syscalls/shm.o elf.o ksbrk.o sched/scheduler.o syscalls/stat.o libc/string/copy.o libc/string/strncpy.o drivers/mouse.o libc/string/strlcpy.o libc/string/strcat.o drivers/vbe.o syscalls/msleep.o syscalls/uptime.o syscalls/mkdir.o drivers/pci.o drivers/rtl8139.o network/ethernet.o network/arp.o network/bytes.o network/ipv4.o network/udp.o syscalls/recvfrom.o math.o syscalls/sendto.o signal.o syscalls/kill.o syscalls/sigaction.o network/tcp.o drivers/ahci.o crypto/xoshiro256plusplus/xoshiro256plusplus.o syscalls/chdir.o syscalls/getcwd.o syscalls/isatty.o
-CFLAGS = -O0 -fsanitize=vla-bound,shift-exponent,pointer-overflow,shift,signed-integer-overflow,bounds -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign
+CFLAGS = -O0 -fsanitize=vla-bound,shift-exponent,pointer-overflow,shift,signed-integer-overflow,bounds -ggdb -ffreestanding -Wall -Werror -mgeneral-regs-only -Wimplicit-fallthrough -I./libc/include/ -I. -Wno-pointer-sign -DKERNEL
INCLUDE=-I./includes/ -I../include/ -I./libc/include/
all: myos.iso
diff --git a/kernel/fs/vfs.h b/kernel/fs/vfs.h
index 76c0a0c..d042acf 100644
--- a/kernel/fs/vfs.h
+++ b/kernel/fs/vfs.h
@@ -10,6 +10,7 @@ typedef struct vfs_mounts vfs_mounts_t;
#include <stddef.h>
#include <sys/stat.h>
#include <typedefs.h>
+#include <dirent.h>
// FIXME: Is there some standard value for this?
#define O_NONBLOCK (1 << 0)
@@ -38,11 +39,6 @@ struct vfs_mounts {
vfs_inode_t *local_root;
};
-struct dirent {
- unsigned int d_ino; // File serial number.
- char d_name[PATH_MAX]; // Filename string of entry.
-};
-
struct vfs_fd {
size_t offset;
int flags;