From 0d9eb700fb02e354d28979b7afe3eb3c8a1684a9 Mon Sep 17 00:00:00 2001 From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk> Date: Wed, 4 Dec 2019 15:39:41 +0000 Subject: [PATCH] Converted to use new filesystem --- userprog/syscall_filesize.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/userprog/syscall_filesize.c b/userprog/syscall_filesize.c index c3eedaa..d0a6f8e 100644 --- a/userprog/syscall_filesize.c +++ b/userprog/syscall_filesize.c @@ -8,14 +8,13 @@ #include "filesys/file.h" int syscall_filesize(struct intr_frame *f) { - struct file_map *f_map; // Described in system_calls.h // pop off first int argument from interrupt frame - f_map->file_descriptor = *((int*)f->esp + 1); - file_search(*f_map); - if (f_map->file == NULL) { // Checking if file is empty or non-existent + int file_descriptor = *((int*)f->esp + 1); + struct file *file = get_associated_file_pointer(file_descriptor); + if (file == NULL) { // Checking if file is empty or non-existent f->eax -1; // Returning failure state } // Using the file_length function in file.h to get the length and store it - int size = file_length(f_map->file); + int size = file_length(file); f->eax = size; } \ No newline at end of file -- GitLab