diff src/console.c @ 33:7a63dacab7f8

fix cbc_read
author mir3636
date Tue, 22 Jan 2019 17:32:06 +0900
parents 96af12a50fdb
children a7144583914c
line wrap: on
line diff
--- a/src/console.c	Tue Jan 22 15:48:35 2019 +0900
+++ b/src/console.c	Tue Jan 22 17:32:06 2019 +0900
@@ -255,7 +255,6 @@
     int target = proc->cbc_arg.cbc_console_arg.target;
     char* dst = proc->cbc_arg.cbc_console_arg.dst;
     struct inode *ip = proc->cbc_arg.cbc_console_arg.ip;
-    struct file *f = proc->cbc_arg.cbc_console_arg.f;
     __code(*next)(int ret) = proc->cbc_arg.cbc_console_arg.next;
     
     int c = input.buf[input.r++ % INPUT_BUF];
@@ -282,7 +281,6 @@
             proc->cbc_arg.cbc_console_arg.target = target;
             proc->cbc_arg.cbc_console_arg.dst = dst;
             proc->cbc_arg.cbc_console_arg.ip = ip;
-            proc->cbc_arg.cbc_console_arg.f = f;
             proc->cbc_arg.cbc_console_arg.next = next;
             goto cbc_sleep(&input.r, &input.lock, cbc_consoleread2);
         }
@@ -291,18 +289,18 @@
     release(&input.lock);
     ilock(ip);
 
-    int r = target - n;
+    //int r = target - n;
 
-    if (r > 0)
-        f->off += r;
-    iunlock(f->ip);
+    //if (r > 0)
+    //    f->off += r;
+    //iunlock(f->ip);
 
-    //goto next(target - n);
+    goto next(target - n);
 
-    goto next(r);
+    //goto next(r);
 }
 
-__code cbc_consoleread (struct inode *ip, char *dst, int n, struct file *f, __code(*next)(int ret))
+__code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret))
 {
     uint target;
 
@@ -316,7 +314,6 @@
         proc->cbc_arg.cbc_console_arg.target = target;
 	proc->cbc_arg.cbc_console_arg.dst = dst;
 	proc->cbc_arg.cbc_console_arg.ip = ip;
-	proc->cbc_arg.cbc_console_arg.f = f;
 	proc->cbc_arg.cbc_console_arg.next = next;
         if (input.r == input.w) {
             if (proc->killed) {
@@ -327,7 +324,7 @@
 
             goto cbc_sleep(&input.r, &input.lock, cbc_consoleread2);
         }
-	goto cbc_consoleread1(0);
+	goto cbc_consoleread1();
     }
 }