From abe62e2a4a12bde9a50883a554cbfca8dad69405 Mon Sep 17 00:00:00 2001
From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk>
Date: Tue, 3 Dec 2019 23:34:04 +0000
Subject: [PATCH] Broken file_search in syscall.c DO NOT MERGE until working

---
 userprog/syscall.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/userprog/syscall.c b/userprog/syscall.c
index 0d41629..3a6db12 100644
--- a/userprog/syscall.c
+++ b/userprog/syscall.c
@@ -4,6 +4,7 @@
 #include "system_calls.h"
 #include "threads/interrupt.h"
 #include "threads/thread.h"
+#include "lib/kernel/list.h" // Dependencies for 
 
 
 /* System call numbers. */
@@ -85,8 +86,17 @@ syscall_handler (struct intr_frame *f UNUSED)
   }
 }
 
+static struct list *file_list;
 
 void file_search(struct file_map *f) {
 	// TODO: Write file search
+	struct file_map *curr_file;
+	*curr_file->list_element = list_begin(file_list);
+	while (
+		(curr_file->file_descriptor != f->file_descriptor) && 
+		(*curr_file->list_element != file_list->tail)
+		) {
+		list_next(*curr_file->list_element);
+	}
 	f->file = NULL;
 }
\ No newline at end of file
-- 
GitLab