changeset 188:64a1b9b8f08e

remove_interface_field
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 20:06:28 +0900
parents 9d385a07dbfc
children 000e247dc51d
files src/impl/file_impl_pipe.cbc src/impl/pipe.h src/interface/file.dg
diffstat 3 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_pipe.cbc	Tue Jan 21 15:30:43 2020 +0900
+++ b/src/impl/file_impl_pipe.cbc	Tue Jan 21 20:06:28 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,12 @@
     pipe->nwrite  = 0;
     pipe->readopen  = 0;
     pipe->writeopen  = 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,7 +61,6 @@
     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;
--- a/src/impl/pipe.h	Tue Jan 21 15:30:43 2020 +0900
+++ b/src/impl/pipe.h	Tue Jan 21 20:06:28 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 15:30:43 2020 +0900
+++ b/src/interface/file.dg	Tue Jan 21 20:06:28 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(...));