From 8a9208612eec8ddae4c418485d848ecfa0613699 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Mon, 30 Oct 2023 22:12:14 +0100 Subject: Meta: Move kernel and userland to their own folders. This is to allow both the kernel and the userland to share certain header files and to make the folder structure a bit more clear. --- halts.c | 102 ---------------------------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 halts.c (limited to 'halts.c') diff --git a/halts.c b/halts.c deleted file mode 100644 index 821299d..0000000 --- a/halts.c +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include - -int create_disconnect_inode_halt(vfs_inode_t *inode) { - volatile process_t *p = get_current_task(); - int i; - for (i = 0; i < 100; i++) - if (!p->disconnect_halt_inode[i]) - break; - - if (p->disconnect_halt_inode[i]) - return -1; - - p->disconnect_halt_inode[i] = inode; - - return i; -} - -int create_disconnect_fdhalt(vfs_fd_t *fd) { - assert(fd); - return create_disconnect_inode_halt(fd->inode); -} - -int create_read_inode_halt(vfs_inode_t *inode) { - volatile process_t *p = get_current_task(); - int i; - for (i = 0; i < 100; i++) - if (!p->read_halt_inode[i]) - break; - - if (p->read_halt_inode[i]) - return -1; - - p->read_halt_inode[i] = inode; - - return i; -} - -int create_read_fdhalt(vfs_fd_t *fd) { - assert(fd); - return create_read_inode_halt(fd->inode); -} - -int create_write_inode_halt(vfs_inode_t *inode) { - volatile process_t *p = get_current_task(); - int i; - for (i = 0; i < 100; i++) - if (!p->write_halt_inode[i]) - break; - - if (p->write_halt_inode[i]) - return -1; - - p->write_halt_inode[i] = inode; - - return i; -} - -int create_write_fdhalt(vfs_fd_t *fd) { - return create_write_inode_halt(fd->inode); -} - -void unset_read_fdhalt(int i) { get_current_task()->read_halt_inode[i] = NULL; } - -void unset_write_fdhalt(int i) { - get_current_task()->write_halt_inode[i] = NULL; -} - -void unset_disconnect_fdhalt(int i) { - get_current_task()->disconnect_halt_inode[i] = NULL; -} - -int isset_fdhalt(vfs_inode_t *read_halts[], vfs_inode_t *write_halts[], - vfs_inode_t *disconnect_halts[]) { - int blocked = 0; - for (int i = 0; i < 100; i++) { - if (!read_halts[i]) - continue; - if (read_halts[i]->has_data) { - return 0; - } - blocked = 1; - } - for (int i = 0; i < 100; i++) { - if (!write_halts[i]) - continue; - if (write_halts[i]->can_write) { - return 0; - } - blocked = 1; - } - for (int i = 0; i < 100; i++) { - if (!disconnect_halts[i]) - continue; - if (!disconnect_halts[i]->is_open) { - return 0; - } - blocked = 1; - } - return blocked; -} -- cgit v1.2.3