changeset 193:a961a3378174

merge
author menikon <e165723@ie.u-ryukyu.ac.jp>
date Wed, 22 Jan 2020 00:40:07 +0900
parents e2b0a3e0c97a (current diff) 000e247dc51d (diff)
children 4cfff673e1f6
files
diffstat 3 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_pipe.cbc	Tue Jan 21 17:02:11 2020 +0900
+++ b/src/impl/file_impl_pipe.cbc	Wed Jan 22 00:40:07 2020 +0900
@@ -12,6 +12,11 @@
 //     int readopen;   // read fd is still open
 //     int writeopen;  // write fd is still open
 //
+//     int          ref;   // reference count
+//     char         readable;
+//     char         writable;
+//     unsigned int off;
+//
 //     // interface field
 //     int n;
 //     char* addr;
@@ -32,7 +37,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->lock = 0;
     pipe->spinlock  = 0;
     pipe->data  = 0;
@@ -40,14 +45,15 @@
     pipe->nwrite  = 0;
     pipe->readopen  = 0;
     pipe->writeopen  = 0;
+    pipe->ref  = 0;
+    pipe->readable  = 0;
+    pipe->writable  = 0;
+    pipe->off = 0;
+    pipe->int  = 0;
     pipe->n  = 0;
     pipe->addr = NULL;
-    file->remoe  = 0;
-    file->off = 0;
     file->st = NULL;
     file->addr = NULL;
-    file->pipe  = 0;
-    file->inode  = 0;
     file->n  = 0;
     file->fd  = 0;
     pipe->piperead1 = C_piperead1pipe;
@@ -58,13 +64,13 @@
     pipe->cbc_pipeclose4 = C_cbc_pipeclose4pipe;
     pipe->cbc_pipe_close_writeopen = C_cbc_pipe_close_writeopenpipe;
     pipe->cbc_pipe_close_readopen = C_cbc_pipe_close_readopenpipe;
-    file->stat = C_statpipe;
     file->read = C_readpipe;
     file->write = C_writepipe;
     file->close = C_closepipe;
     return file;
 }
 
+
 __code statpipe(struct pipe* file, struct stat* st, __code next(...)) { //:skip
 
     goto next(...);
--- a/src/impl/pipe.h	Tue Jan 21 17:02:11 2020 +0900
+++ b/src/impl/pipe.h	Wed Jan 22 00:40:07 2020 +0900
@@ -8,6 +8,11 @@
     int readopen;   // read fd is still open
     int writeopen;  // write fd is still open
 
+    int ref;   // reference count
+    char readable;
+    char writable;
+    unsigned int off;
+
     // interface field
     int n;
     char* addr;
--- a/src/interface/file.dg	Tue Jan 21 17:02:11 2020 +0900
+++ b/src/interface/file.dg	Wed Jan 22 00:40:07 2020 +0900
@@ -1,17 +1,9 @@
 typedef struct file <Impl> {
     union Data* file;
-    enum { FD_NONE, FD_PIPE, FD_INODE } type; //TODO: after remoe
-    int          ref;   // reference count
-    char         readable;
-    char         writable;
-    unsigned int off;
     struct stat* st;
     char* addr;
-    struct pipe *pipe; //TODO : remove
-    struct inode *ip; //TODO : remove
     int n;
     int fd;
-    __code stat(Impl* file, struct stat* st, __code next(...));
     __code read(Impl* file, char* addr, __code next(...));
     __code write(Impl* file, char* addr, int n, __code next(...));
     __code close(Impl* file,int fd, __code next(...));