changeset 260:98902fad1e2e menikon_thesis

final fix
author menikon
date Fri, 07 Feb 2020 14:27:05 +0900
parents 40e9dd5ff084
children 7d77c5005cb6
files src/impl/fs_impl.cbc src/impl/fs_impl.h src/interface/fs.dg
diffstat 3 files changed, 59 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/fs_impl.cbc	Thu Feb 06 18:27:50 2020 +0900
+++ b/src/impl/fs_impl.cbc	Fri Feb 07 14:27:05 2020 +0900
@@ -25,23 +25,55 @@
     struct fs_impl* fs_impl = new fs_impl();
     fs->fs = (union Data*)fs_impl;
     fs_impl->fs_impl = NULL;
-    fs->readsb = C_readsbfs_impl;
-    fs->iinit = C_iinitfs_impl;
-    fs->ialloc = C_iallocfs_impl;
+    fs_impl->sb = NULL;
+    fs_impl->ret  = 0;
+    fs_impl->dev  = 0;
+    fs_impl->type  = 0;
+    fs_impl->bp = NULL;
+    fs_impl->dip = NULL;
+    fs_impl->inum  = 0;
+    fs_impl->dp = NULL;
+    fs_impl->name = NULL;
+    fs_impl->off  = 0;
+    fs_impl->poff = NULL;
+    fs_impl->de = NULL;
+    fs_impl->tot  = 0;
+    fs_impl->m  = 0;
+    fs_impl->dst = NULL;
+    fs_impl->n  = 0;
+    fs_impl->src = NULL;
     fs_impl->allocinode = C_allocinode;
     fs_impl->allocinode_loop = C_allocinode_loop;
     fs_impl->allocinode_loopcheck = C_allocinode_loopcheck;
     fs_impl->allocinode_noloop = C_allocinode_noloop;
+    fs_impl->lockinode1 = C_lockinode1;
+    fs_impl->lockinode2 = C_lockinode2;
+    fs_impl->lockinode_sleepcheck = C_lockinode_sleepcheck;
+    fs_impl->iput_check = C_iput_check;
+    fs_impl->iput_inode_nolink = C_iput_inode_nolink;
+    fs_impl->readi_check_diskinode = C_readi_check_diskinode;
+    fs_impl->readi_loopcheck = C_readi_loopcheck;
+    fs_impl->readi_loop = C_readi_loop;
+    fs_impl->readi_noloop = C_readi_noloop;
+    fs_impl->writei_check_diskinode = C_writei_check_diskinode;
+    fs_impl->writei_loopcheck = C_writei_loopcheck;
+    fs_impl->writei_loop = C_writei_loop;
+    fs_impl->writei_noloop = C_writei_noloop;
+    fs_impl->dirlookup_loopcheck = C_dirlookup_loopcheck;
+    fs_impl->dirlookup_loop = C_dirlookup_loop;
+    fs_impl->dirlookup_noloop = C_dirlookup_noloop;
+    fs_impl->dirlink_namecheck = C_dirlink_namecheck;
+    fs_impl->dirlink_loopcheck = C_dirlink_loopcheck;
+    fs_impl->dirlink_loop = C_dirlink_loop;
+    fs_impl->dirlink_noloop = C_dirlink_noloop;
+    fs->readsb = C_readsbfs_impl;
+    fs->iinit = C_iinitfs_impl;
+    fs->ialloc = C_iallocfs_impl;
     fs->iupdate = C_iupdatefs_impl;
     fs->idup = C_idupfs_impl;
     fs->ilock = C_ilockfs_impl;
-    fs_impl->lockinode1 = C_lockinode1;
-    fs_impl->lockinode2 = C_lockinode2;
-    fs_impl->lockinode_sleepcheck = C_lockinode_sleepcheck;
     fs->iunlock = C_iunlockfs_impl;
     fs->iput = C_iputfs_impl;
-    fs_impl->iput_check = C_iput_check;
-    fs_impl->iput_inode_nolink = C_iput_inode_nolink;
     fs->iunlockput = C_iunlockputfs_impl;
     fs->stati = C_statifs_impl;
     fs->readi = C_readifs_impl;
@@ -190,6 +222,7 @@
         ret = -1;
         goto next(ret, ...);
     }
+    Gearef(cbc_context, fs)->tot = 0;
     goto writei_loopcheck(fs, tot, m, src, off, n, next(...));
 }
 
--- a/src/impl/fs_impl.h	Thu Feb 06 18:27:50 2020 +0900
+++ b/src/impl/fs_impl.h	Fri Feb 07 14:27:05 2020 +0900
@@ -18,30 +18,30 @@
     uint n;
     char* src;
 
-    __code allocinode(Type* fs_impl, uint dev, short type, __code next(...));
-    __code allocinode_loop(Type* fs_impl, uint inum, uint dev, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(...));
+    __code allocinode(Type* fs_impl, uint dev, struct superblock* sb, __code next(...));
+    __code allocinode_loop(Type* fs_impl, uint inum, uint dev, short type, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(...));
     __code allocinode_loopcheck(Type* fs_impl, uint inum, uint dev, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(...));
-    __code allocinode_noloop(Type* fs_impl, uint inum, uint dev, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(int ret, ...));
+    __code allocinode_noloop(Type* fs_impl, uint inum, uint dev, short type, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(int ret, ...));
     __code lockinode1(Type* fs_impl, struct inode *ip, struct buf *bp, struct dinode *dip, __code next(...));
     __code lockinode2(Type* fs_impl, struct inode* ip, struct buf* bp, struct dinode* dip, __code next(...));
     __code lockinode_sleepcheck(Type* fs_impl, struct inode* ip, __code next(...));
     __code iput_check(Type* fs_impl, struct inode* ip, __code next(...));
     __code iput_inode_nolink(Type* fs_impl, struct inode* ip, __code next(...));
-    __code readi_check_diskinode(struct fs_impl* fs_impl,struct inode* ip, char* dst, uint n, next(int ret, ...));
-    __code readi_loopcheck(struct fs_impl* fs_impl, uint tot, uint m, char* dst, uint off, uint n, __code next(...));
-    __code readi_loop(struct fs_impl* fs_impl, struct inode *ip, struct buf* bp, uint tot, uint m, char* dst, uint off, uint n, __code next(...));
-    __code readi_noloop(struct fs_impl* fs_impl, uint n, __code next(int ret, ...));
-    __code writei_check_diskinode(struct fs_impl* fs_impl,struct inode* ip, char* src, uint n, __code next(int ret, ...));
-    __code writei_loopcheck(struct fs_impl* fs_impl, uint tot, uint m, char* src, uint off, uint n, __code next(...));
-    __code writei_loop(struct fs_impl* fs_impl, struct inode* ip, struct buf* bp, uint tot, uint m, char* src, uint off, uint n, __code next(...));
-    __code writei_noloop(struct fs_impl* fs_impl, struct inode* ip, uint n, uint off, __code next(int ret, ...));
+    __code readi_check_diskinode(Type* fs_impl,struct inode* ip, char* dst, uint n, next(int ret, ...));
+    __code readi_loopcheck(Type* fs_impl, uint tot, uint m, char* dst, uint off, uint n, __code next(...));
+    __code readi_loop(Type* fs_impl, struct inode *ip, struct buf* bp, uint tot, uint m, char* dst, uint off, uint n, __code next(...));
+    __code readi_noloop(Type* fs_impl, uint n, __code next(int ret, ...));
+    __code writei_check_diskinode(Type* fs_impl,struct inode* ip, char* src, uint n, __code next(int ret, ...));
+    __code writei_loopcheck(Type* fs_impl, uint tot, uint m, char* src, uint off, uint n, __code next(...));
+    __code writei_loop(Type* fs_impl, struct inode* ip, struct buf* bp, uint tot, uint m, char* src, uint off, uint n, __code next(...));
+    __code writei_noloop(Type* fs_impl, struct inode* ip, uint n, uint off, __code next(int ret, ...));
     __code dirlookup_loopcheck(Type* fs_impl, struct inode* dp, char* name, uint off, uint* poff, dirent* de, next(...));
-    __code dirlookup_loop(struct fs_impl* fs_impl, struct inode* dp, char* name, uint off, uint* poff, dirent* de, __code next(...));
-    __code dirlookup_noloop(struct fs_impl* fs_impl, __code next(int ret, ...));
-    __code dirlink_namecheck(struct fs_impl* fs_impl, struct inode* ip, __code next(int ret, ...));
-    __code dirlink_loopcheck(struct fs_impl* fs_impl, struct dirent* de, struct inode* dp, uint off, __code next(...));
-    __code dirlink_loop(struct fs_impl* fs_impl, struct dirent* de, struct inode* ip, uint off, uint inum, __code next(...));
-    __code dirlink_noloop(struct fs_impl* fs_impl, struct dirent* de, struct inode* dp, uint off, uint inum, char* name, __code next(...));
+    __code dirlookup_loop(Type* fs_impl, struct inode* dp, char* name, uint off, uint inum, uint* poff, dirent* de, __code next(int ret, ...));
+    __code dirlookup_noloop(Type* fs_impl, __code next(int ret, ...));
+    __code dirlink_namecheck(Type* fs_impl, struct inode* ip, __code next(int ret, ...));
+    __code dirlink_loopcheck(Type* fs_impl, struct dirent* de, struct inode* dp, uint off, __code next(...));
+    __code dirlink_loop(Type* fs_impl, struct dirent* de, struct inode* dp, uint off, uint inum, __code next(...));
+    __code dirlink_noloop(Type* fs_impl, struct dirent* de, struct inode* dp, uint off, uint inum, char* name, __code next(int ret, ...));
     __code next(...);
     __code next2(...);
 } fs_impl;
--- a/src/interface/fs.dg	Thu Feb 06 18:27:50 2020 +0900
+++ b/src/interface/fs.dg	Fri Feb 07 14:27:05 2020 +0900
@@ -34,7 +34,7 @@
     __code readi(Impl* fs, struct inode* ip, char* dst, uint off, uint tot, uint n, __code next(int ret, ...));
     __code writei(Impl* fs, struct inode* ip, char* src, uint off, uint tot, uint n, __code next(int ret, ...));
     __code namecmp(Impl* fs, const char* s, const char* t, __code next(int strncmp_val, ...));
-    __code dirlookup(struct inode* dp, char* name, uint* poff, dirent* de, __code next(int ret, ...));
+    __code dirlookup(Impl* fs, struct inode* dp, char* name, uint off, uint* poff, dirent* de, __code next(int ret, ...));
     __code dirlink(struct fs_impl* fs, struct inode* ip, struct dirent* de, struct inode* dp, char* name, uint off, uint inum, __code next(...));
     __code namei(Impl* fs, char* path, __code next(int namex_val, ...));
     __code nameiparent(Impl* fs, char* path, char* name, __code next(int namex_val, ...));