changeset 319:71c7bd0d047e

build success
author menikon
date Thu, 06 Feb 2020 17:21:04 +0900
parents d4ff2fb275b5
children 40e9dd5ff084
files src/impl/fs_impl.cbc src/impl/fs_impl.h src/impl/fs_impl_private.cbc src/interface/fs.dg
diffstat 4 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/fs_impl.cbc	Thu Feb 06 17:08:13 2020 +0900
+++ b/src/impl/fs_impl.cbc	Thu Feb 06 17:21:04 2020 +0900
@@ -159,7 +159,7 @@
     goto next(...);
 }
 
-__code readifs_impl(struct fs_impl* fs, struct inode* ip, char* dst, uint off, uint n, __code next(int ret, ...)) {
+__code readifs_impl(struct fs_impl* fs, struct inode* ip, char* dst, uint off, uint tot, uint n, __code next(int ret, ...)) {
     if (ip->type == T_DEV) {
         goto readi_check_diskinode(fs, ip, dst, n, next(...));
     }
@@ -172,6 +172,7 @@
     if (off + n > ip->size) {
         n = ip->size - off;
     }
+    Gearef(cbc_context, fs)->tot = 0;
     goto readi_loopcheck(fs, tot, m, dst, off, n, next(...));
 }
 
--- a/src/impl/fs_impl.h	Thu Feb 06 17:08:13 2020 +0900
+++ b/src/impl/fs_impl.h	Thu Feb 06 17:21:04 2020 +0900
@@ -26,7 +26,7 @@
     __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(...));
+    __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, ...));
--- a/src/impl/fs_impl_private.cbc	Thu Feb 06 17:08:13 2020 +0900
+++ b/src/impl/fs_impl_private.cbc	Thu Feb 06 17:21:04 2020 +0900
@@ -236,8 +236,14 @@
     goto next(...);
 }
 
-__code readi_check_diskinode(struct fs_impl* fs_impl,struct inode* ip, char* dst, uint n, __code next(...)){
-    goto next(...);
+__code readi_check_diskinode(struct fs_impl* fs_impl,struct inode* ip, char* dst, uint n, __code next(int ret, ...)){
+    if (ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) {
+        ret = -1;
+        goto next(ret, ...);
+    }
+
+    ret = devsw[ip->major].read(ip, dst, n);
+    goto next(ret, ...);
 }
 
 __code readi_loopcheck(struct fs_impl* fs_impl, uint tot, uint m, char* dst, uint off, uint n, __code next(...)){
--- a/src/interface/fs.dg	Thu Feb 06 17:08:13 2020 +0900
+++ b/src/interface/fs.dg	Thu Feb 06 17:21:04 2020 +0900
@@ -20,7 +20,7 @@
     int strncmp_val;
     dirent* de;
     int ret;
-
+    uint tot;
     __code readsb(Impl* fs, uint dev, struct superblock* sb, __code next(...));
     __code iinit(Impl* fs, __code next(...));
     __code ialloc(Impl* fs, uint dev, short type, __code next(...));
@@ -31,7 +31,7 @@
     __code iput(Impl* fs, struct inode* ip, __code next(...));
     __code iunlockput(Impl* fs, struct inode* ip, __code next(...));
     __code stati(Impl* fs , struct inode* ip, struct stat* st, __code next(...));
-    __code readi(Impl* fs, struct inode* ip, char* dst, uint off, uint n, __code next(...));
+    __code readi(Impl* fs, struct inode* ip, char* dst, uint off, uint tot, uint n, __code next(...));
     __code writei(Impl* fs, struct inode* ip, char* src, uint off, uint n, __code next(...));
     __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, ...));