vfs: remove horrible fd_special temporary hack
This commit is contained in:
parent
ef0a8674ae
commit
2c553ed124
3 changed files with 0 additions and 53 deletions
|
|
@ -154,8 +154,6 @@ int closedir(DIR *dir);
|
||||||
|
|
||||||
char *basename(char *path);
|
char *basename(char *path);
|
||||||
char *dirname(char *path);
|
char *dirname(char *path);
|
||||||
struct file_descriptor *fd_special();
|
|
||||||
void fd_special_free(struct file_descriptor *fd);
|
|
||||||
|
|
||||||
int stdout_write(struct file_descriptor *fdesc, void *buf, size_t len);
|
int stdout_write(struct file_descriptor *fdesc, void *buf, size_t len);
|
||||||
|
|
||||||
|
|
|
||||||
32
sched/proc.c
32
sched/proc.c
|
|
@ -143,30 +143,6 @@ void schedule()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_descriptor *proc_insert_charfd(struct proc *proc, int fdno, int flags)
|
|
||||||
{
|
|
||||||
struct file_descriptor *fd = fd_special();
|
|
||||||
fd->file = vfs_open(NULL, (void *)0x4); /* FIXME LATER */
|
|
||||||
fd->pos = 0;
|
|
||||||
fd->fd = fdno;
|
|
||||||
fd->flags = flags;
|
|
||||||
fd->file->type = FTYPE_CHARDEV;
|
|
||||||
fd->file->vnode->flags = VFS_VNO_CHARDEV;
|
|
||||||
fd->buf = NULL;
|
|
||||||
fd->buf_len = 0;
|
|
||||||
fd->fs = NULL;
|
|
||||||
|
|
||||||
memset(fd->file->vnode, 0, sizeof(struct vnode));
|
|
||||||
|
|
||||||
fd->buf_write = NULL;
|
|
||||||
fd->buf_read = NULL;
|
|
||||||
|
|
||||||
struct rbnode *fd_node = rbt_insert(&proc->fd_map, fdno);
|
|
||||||
fd_node->value = (uintptr_t)fd;
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct proc *proc_create()
|
struct proc *proc_create()
|
||||||
{
|
{
|
||||||
struct proc *proc = slab_alloc(proc_slab);
|
struct proc *proc = slab_alloc(proc_slab);
|
||||||
|
|
@ -180,14 +156,6 @@ struct proc *proc_create()
|
||||||
struct rbnode *proc_node = rbt_insert(proc_tree, proc->pid);
|
struct rbnode *proc_node = rbt_insert(proc_tree, proc->pid);
|
||||||
proc_node->value = (uintptr_t)proc;
|
proc_node->value = (uintptr_t)proc;
|
||||||
|
|
||||||
/* insert stdin, stdout, stderr */
|
|
||||||
struct file_descriptor *fd;
|
|
||||||
fd = proc_insert_charfd(proc, STDIN_FILENO, O_RDONLY);
|
|
||||||
fd = proc_insert_charfd(proc, STDOUT_FILENO, O_WRONLY);
|
|
||||||
fd->buf_write = stdout_write;
|
|
||||||
fd = proc_insert_charfd(proc, STDERR_FILENO, O_WRONLY);
|
|
||||||
fd->buf_write = stdout_write;
|
|
||||||
|
|
||||||
spinlock_release(&proc->lock);
|
spinlock_release(&proc->lock);
|
||||||
|
|
||||||
return proc;
|
return proc;
|
||||||
|
|
|
||||||
|
|
@ -14,25 +14,6 @@ typedef void (*syscall_t)(uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t
|
||||||
syscall_t syscall_table[SYSCALL_MAX];
|
syscall_t syscall_table[SYSCALL_MAX];
|
||||||
slab_t *fd_slab;
|
slab_t *fd_slab;
|
||||||
|
|
||||||
struct file_descriptor *fd_special()
|
|
||||||
{
|
|
||||||
struct file_descriptor *fd = slab_alloc(fd_slab);
|
|
||||||
if (!fd) {
|
|
||||||
kprintf(LOG_ERROR "Failed to allocate file descriptor\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(fd, 0, sizeof(struct file_descriptor));
|
|
||||||
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fd_special_free(struct file_descriptor *fd)
|
|
||||||
{
|
|
||||||
slab_free(fd_slab, fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void syscall(uint64_t syscall_no, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5)
|
void syscall(uint64_t syscall_no, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5)
|
||||||
{
|
{
|
||||||
syscall_t syscall = (void *)syscall_table[syscall_no];
|
syscall_t syscall = (void *)syscall_table[syscall_no];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue