From 834389ca8b81755c1e547655eca07eb328f7d97b Mon Sep 17 00:00:00 2001 From: CCXXXI Date: Mon, 11 Jan 2021 00:14:21 +0800 Subject: [PATCH] reformat --- src/userprog/syscall.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index fc8257c..7b155d9 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -191,7 +191,7 @@ static struct open_file *get_file_by_fd(const int fd) return f; } - return NULL; + USER_ASSERT(false); } /* Terminates the current user program, returning @@ -234,8 +234,6 @@ static int write(int fd, const void *buffer, unsigned size) struct open_file *f = get_file_by_fd(fd); - USER_ASSERT(f != NULL); - lock_acquire(&file_lock); int ret = file_write(f->file, buffer, size); lock_release(&file_lock); @@ -406,8 +404,6 @@ static int filesize(int fd) { struct open_file *f = get_file_by_fd(fd); - USER_ASSERT(f != NULL); - lock_acquire(&file_lock); int ret = file_length(f->file); lock_release(&file_lock); @@ -436,8 +432,6 @@ static int read(int fd, void *buffer, unsigned size) struct open_file *f = get_file_by_fd(fd); - USER_ASSERT(f != NULL); - lock_acquire(&file_lock); int ret = file_read(f->file, buffer, size); lock_release(&file_lock); @@ -459,8 +453,6 @@ static void seek(int fd, unsigned position) { struct open_file *f = get_file_by_fd(fd); - USER_ASSERT(f != NULL); - lock_acquire(&file_lock); file_seek(f->file, position); lock_release(&file_lock);