changeset 187:312f86884606

tweak
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 15:12:05 +0900
parents 7fc3c3da2159
children 9d385a07dbfc
files src/impl/file_impl_pipe.cbc
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_pipe.cbc	Tue Jan 21 14:50:15 2020 +0900
+++ b/src/impl/file_impl_pipe.cbc	Tue Jan 21 15:12:05 2020 +0900
@@ -17,7 +17,7 @@
     struct file* file  = new file();
     struct pipe* pipe = new pipe();
     file->file = (union Data*)pipe;
-    pipe->file = NULL;
+    pipe->file = (union Data*)file; //pipe -> file
     pipe->lock = 0;
     pipe->spinlock  = 0;
     pipe->data  = 0;
@@ -105,45 +105,45 @@
     goto next(...);
 }
 
-__code closepipe(struct pipe* file,int fd,__code next(...)) {
+__code pipeclose(struct pipe* file,int fd,__code next(...)) {
     proc->ofile[fd] = 0;
-    goto cbc_fileclose(f,next);
+    goto file->cbc_pipeclose(file->file, next);
 }
 
 
-__code cbc_fileclose(struct file* file, __code next(...)) {
+__code cbc_pipeclose(struct pipe* pipe, struct file* file, __code next(...)) {
     struct file ff;
     acquire(*ftable.loc)
 
     if (f->ref < 1) {
         goto cbc_context->kernel_error->panic("file close");
     }
-    goto cbc_fileclose2(f,ff,next);
+    goto pipe->cbc_pipeclose2(f,ff,next);
 }
 
-__code cbc_fileclose2(struct file* file, struct file* ff,__code next(...)) {
+__code cbc_pipeclose2(struct pipe* pipe,struct file* file, struct file* ff,__code next(...)) {
     if (--f->ref > 0) {
         release(&ftable.lock);
         goto cbc_context->return();
     }
-    goto cbc_fileclose3(f,ff,next);
+    goto pipe->cbc_pipeclose3(f,ff,next);
 }
 
-__code cbc_fileclose3(struct file* file, struct file* ff,__code next(...)) {
+__code cbc_pipeclose3(struct pipe* pipe,struct file* file, struct file* ff,__code next(...)) {
     *ff = *f;
     f->ref = 0;
     f->type = FD_NONE;
     relsease(&ftable.lock);
     
-    goto cbc_pipe_close(ff.pipe,ff.writable,next);
+    goto pipe->cbc_pipeclose4(ff.pipe,ff.writable,next);
 }
 
-__code cbc_pipe_close(struct pipe* p, int writable, __code next(...)) {
+__code cbc_pipeclose4(struct pipe* p, int writable, __code next(...)) {
     acquire(&p->lock);
     if (writable) {
-        goto cbc_pipe_close_writeopen(p,next);
+        goto p->cbc_pipe_close_writeopen(next);
     }
-    goto cbc_pipe_close_readopen(p,next);
+    goto p->cbc_pipe_close_readopen(next);
 }