diff src/pipe.cbc @ 113:ef44d384ad9d

rollback rev 52
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 02 Dec 2019 11:17:04 +0900
parents d5c4016c65b8
children 343f8f3c8f18
line wrap: on
line diff
--- a/src/pipe.cbc	Thu Nov 28 16:58:04 2019 +0900
+++ b/src/pipe.cbc	Mon Dec 02 11:17:04 2019 +0900
@@ -20,14 +20,6 @@
     int writeopen;  // write fd is still open
 };
 
-struct PipeRead* create_pipe_read(struct Context* context) {
-    struct SysRead* sys_read = new SysRead();
-    struct PipeRead* pipe_read = new PipeRead();
-    sys_read->sys_read = (union Data*)pipe_read;
-    sys_red->read = C_cbc_piperead;
-    return sys_read;
-}
-
 int pipealloc(struct file **f0, struct file **f1)
 {
     struct pipe *p;
@@ -152,30 +144,30 @@
     goto cbc_wakeup(&p->nwrite, cbc_piperead3);  //DOC: piperead-wakeup
 }
 
-__ncode cbc_piperead1(struct PipeRead* pipe_read){
-    struct pipe *p = pipe_read->pipe;
+__ncode cbc_piperead1(){
+    struct pipe *p = proc->cbc_arg.cbc_console_arg.p;
     __code(*next)(int ret) = proc->cbc_arg.cbc_console_arg.next;
-    if (pipe->nread == pipe->nwrite && pipe->writeopen){
+    if (p->nread == p->nwrite && p->writeopen){
         if(proc->killed){
-            release(&pipe->lock);
+            release(&p->lock);
             goto next(-1);
         }
-        //pipe_read->pipe = p;
-        goto cbc_sleep(&pipe->nread, &pipe->lock, cbc_piperead1);        
+        proc->cbc_arg.cbc_console_arg.p = p;
+        goto cbc_sleep(&p->nread, &p->lock, cbc_piperead1);        
     }
     int i = 0;
-    pipe_read->i->value = i;
-    //pipe_read->pipe = p;
+    proc->cbc_arg.cbc_console_arg.i = i;
+    proc->cbc_arg.cbc_console_arg.p = p;
     goto cbc_piperead2();
 }
 
-__ncode cbc_piperead(struct PipeRead* pipe_read, struct pipe *p, char *addr, int n, __code (*next)(int ret))
+__ncode cbc_piperead(struct pipe *p, char *addr, int n, __code (*next)(int ret))
 {
     acquire(&p->lock);
-    //proc->cbc_arg.cbc_console_arg.n = n;
-    //proc->cbc_arg.cbc_console_arg.p = p;
-    //proc->cbc_arg.cbc_console_arg.addr = addr;
-    //proc->cbc_arg.cbc_console_arg.next = next;
+    proc->cbc_arg.cbc_console_arg.n = n;
+    proc->cbc_arg.cbc_console_arg.p = p;
+    proc->cbc_arg.cbc_console_arg.addr = addr;
+    proc->cbc_arg.cbc_console_arg.next = next;
     goto cbc_piperead1();
 }