changeset 198:6e28bd30e8a7

fix
author menikon <e165723@ie.u-ryukyu.ac.jp>
date Wed, 22 Jan 2020 20:28:26 +0900
parents 4cfff673e1f6
children 34fae66beb7e
files src/impl/file_impl_inode.cbc
diffstat 1 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_inode.cbc	Wed Jan 22 00:46:46 2020 +0900
+++ b/src/impl/file_impl_inode.cbc	Wed Jan 22 20:28:26 2020 +0900
@@ -32,5 +32,39 @@
 
 __code closeinode(struct inode* file,int fd, __code next(...)) {
 
-    goto next(...);
+    goto file->cbc_inodecolse(file->file, next);
+}
+
+__code cbc_inodeclose(struct inode* inode, struct file* file, __code next(...)){
+  struct file ff;
+  acquire(*ftable.loc)
+
+  if (f->ref < 1) {
+      goto cbc_context->kernel_error->panic("file close");
+  }
+  goto inode->cbc_inodeclose2(f,ff,next);
 }
+
+__code cbc_inodeclose2(struct inode* inode, struct file* file, struct file* ff, __code next(...)){
+  if (--f->ref > 0) {
+     release(&ftable.lock);
+     goto cbc_context->return();
+  }
+  goto inode->cbc_inodeclose3(f,ff,next);
+}
+
+__code cbc_inodeclose3(struct inode* inode, struct file* file, struct file* ff, __code next(...)){
+  *ff = *f;
+  f->ref = 0;
+  f->type = FD_NONE;
+  relsease(&ftable.lock);
+  struct inode* i = ff.inode;
+
+  goto inode->cbc_inodeclose4(i,next);
+}
+
+__code cbc_inodeclose4(struct inode* inode,__code next(...)){
+
+
+
+}