changeset 154:343f8f3c8f18

add pipe.h
author anatofuz
date Thu, 19 Dec 2019 11:32:40 +0900
parents 49d8aba0002a
children 2c63276c6b04
files src/CMakeLists.txt src/gearsTools/lib/Gears/Context.pm src/move_data_gears/pipe.h src/pipe.cbc src/sys_pipe_read.cbc
diffstat 5 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Wed Dec 18 15:55:22 2019 +0900
+++ b/src/CMakeLists.txt	Thu Dec 19 11:32:40 2019 +0900
@@ -126,8 +126,8 @@
   SOURCES
 	string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.cbc fs.c log.c main.c memide.c pipe.cbc proc.cbc spinlock.cbc 
 	start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c 
-  SingleLinkedStack.cbc sys_open_impl.cbc
+  SingleLinkedStack.cbc sys_open_impl.cbc sys_pipe_read.cbc file_read.cbc
          entry.S 
 )
 
-# sys_read_impl.cbc
\ No newline at end of file
+# sys_read_impl.cbc
--- a/src/gearsTools/lib/Gears/Context.pm	Wed Dec 18 15:55:22 2019 +0900
+++ b/src/gearsTools/lib/Gears/Context.pm	Thu Dec 19 11:32:40 2019 +0900
@@ -41,15 +41,15 @@
          next;
        }
 
-       if ($line =~ /^(\w+)(\*)+  *create(\w+)\(([^]]*)\)/) {
-          my $interface = $1;
-          my $implementation = $3;
-          $self->{data_gears_with_count}->{$interface}->{caller}->{$cbc_file}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
-          $counter{interfaces}->{$interface}++;
-          $counter{impl}->{$implementation}++;
-          next;
-       }
+       #if ($line =~ /^(\w+)(\*)+  *create(\w+)\(([^]]*)\)/) {
+       #   my $interface = $1;
+       #   my $implementation = $3;
+       #   $self->{data_gears_with_count}->{$interface}->{caller}->{$cbc_file}++;
+       #   $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+       #   $counter{interfaces}->{$interface}++;
+       #   $counter{impl}->{$implementation}++;
+       #   next;
+       #}
 
        if ($line =~ /Gearef\(context,\s*(\w+)\)/) {
           my $implementation = $1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/move_data_gears/pipe.h	Thu Dec 19 11:32:40 2019 +0900
@@ -0,0 +1,9 @@
+typedef struct pipe<Impl> {
+    #define PIPESIZE 512
+    struct spinlock lock;
+    char data[PIPESIZE];
+    uint nread;     // number of bytes read
+    uint nwrite;    // number of bytes written
+    int readopen;   // read fd is still open
+    int writeopen;  // write fd is still open
+} pipe;
--- a/src/pipe.cbc	Wed Dec 18 15:55:22 2019 +0900
+++ b/src/pipe.cbc	Thu Dec 19 11:32:40 2019 +0900
@@ -11,6 +11,7 @@
 
 #define __ncode __code
 #
+/*
 struct pipe {
     struct spinlock lock;
     char data[PIPESIZE];
@@ -19,6 +20,7 @@
     int readopen;   // read fd is still open
     int writeopen;  // write fd is still open
 };
+*/
 
 int pipealloc(struct file **f0, struct file **f1)
 {
--- a/src/sys_pipe_read.cbc	Wed Dec 18 15:55:22 2019 +0900
+++ b/src/sys_pipe_read.cbc	Thu Dec 19 11:32:40 2019 +0900
@@ -35,10 +35,9 @@
             release(&p->lock);
             goto next();
         }
-        proc->cbc_arg.cbc_console_arg.p = p;
         goto cbc_sleep(&p->nread, &p->lock, cbc_piperead1);
     }
-    goto cbc_piperead2SysReadImpl(sys_read,0,sys_read->n,sys_read->p);
+    goto next(sys_read,0,sys_read->n,sys_read->p,cbc_piperead2SysReadImpl);
 }
 
 __code cbc_piperead2PipeRead(struct PipeRead* sys_read, int i, int n, struct pipe* p, __code next(...)) {