New option -r to reboot the VM after actions are complete.
[pintos-anon] / solutions / p4.patch
index fff8ca1cba1625519d1611ec845392aa75f42a41..77e8e81c35ae38e7b39c090c7e6c1f3b9f9bf07c 100644 (file)
@@ -1310,17 +1310,17 @@ diff -u src/filesys/fsutil.c~ src/filesys/fsutil.c
    if (file == NULL)
      PANIC ("%s: open failed", file_name);
    buffer = palloc_get_page (PAL_ASSERT);
-@@ -110,9 +110,9 @@ fsutil_put (char **argv) 
-     PANIC ("%s: invalid file size %d", file_name, size);
-   
-   /* Create destination file. */
--  if (!filesys_create (file_name, size))
-+  if (!filesys_create (file_name, size, FILE_INODE))
-     PANIC ("%s: create failed", file_name);
--  dst = filesys_open (file_name);
-+  dst = file_open (filesys_open (file_name));
-   if (dst == NULL)
-     PANIC ("%s: open failed", file_name);
+@@ -117,9 +117,9 @@
+           printf ("Putting '%s' into the file system...\n", file_name);
+           /* Create destination file. */
+-          if (!filesys_create (file_name, size))
++          if (!filesys_create (file_name, size, FILE_INODE))
+             PANIC ("%s: create failed", file_name);
+-          dst = filesys_open (file_name);
++          dst = file_open (filesys_open (file_name));
+           if (dst == NULL)
+             PANIC ("%s: open failed", file_name);
  
 @@ -162,7 +162,7 @@ fsutil_get (char **argv)
      PANIC ("couldn't allocate buffer");
@@ -2236,9 +2236,9 @@ diff -u src/threads/thread.h~ src/threads/thread.h
 +    struct semaphore dead;              /* 1=child alive, 0=child dead. */
 +  };
 +
- void thread_init (void);
- void thread_start (void);
+ /* If false (default), use round-robin scheduler.
+    If true, use multi-level feedback queue scheduler.
+    Controlled by kernel command-line options "-o mlfqs".
 Index: src/userprog/exception.c
 diff -u src/userprog/exception.c~ src/userprog/exception.c
 --- src/userprog/exception.c~
@@ -2305,12 +2305,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c
 +#include "vm/page.h"
 +#include "vm/frame.h"
  
- static thread_func execute_thread NO_RETURN;
+ static thread_func start_process NO_RETURN;
 -static bool load (const char *cmdline, void (**eip) (void), void **esp);
 +static bool load (const char *cmd_line, void (**eip) (void), void **esp);
 +
 +/* Data structure shared between process_execute() in the
-+   invoking thread and execute_thread() in the newly invoked
++   invoking thread and start_process() in the newly invoked
 +   thread. */
 +struct exec_info 
 +  {
@@ -2347,12 +2347,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c
 +  sema_init (&exec.load_done, 0);
  
    /* Create a new thread to execute FILE_NAME. */
--  tid = thread_create (file_name, PRI_DEFAULT, execute_thread, fn_copy);
+-  tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy);
 -  if (tid == TID_ERROR)
 -    palloc_free_page (fn_copy); 
 +  strlcpy (thread_name, file_name, sizeof thread_name);
 +  strtok_r (thread_name, " ", &save_ptr);
-+  tid = thread_create (thread_name, PRI_DEFAULT, execute_thread, &exec);
++  tid = thread_create (thread_name, PRI_DEFAULT, start_process, &exec);
 +  if (tid != TID_ERROR)
 +    {
 +      sema_down (&exec.load_done);
@@ -2373,8 +2373,8 @@ diff -u src/userprog/process.c~ src/userprog/process.c
  /* A thread function that loads a user process and starts it
     running. */
  static void
--execute_thread (void *file_name_)
-+execute_thread (void *exec_)
+-start_process (void *file_name_)
++start_process (void *exec_)
  {
 -  char *file_name = file_name_;
 +  struct exec_info *exec = exec_;
@@ -2416,7 +2416,7 @@ diff -u src/userprog/process.c~ src/userprog/process.c
    if (!success) 
      thread_exit ();
  
-@@ -76,18 +128,47 @@ execute_thread (void *file_name_)
+@@ -76,18 +128,47 @@ start_process (void *file_name_)
    NOT_REACHED ();
  }