Mercurial > hg > Members > innparusu > xv6-rpi
comparison src/file.c @ 33:7a63dacab7f8
fix cbc_read
author | mir3636 |
---|---|
date | Tue, 22 Jan 2019 17:32:06 +0900 |
parents | 96af12a50fdb |
children | ad1d3b268e2d |
comparison
equal
deleted
inserted
replaced
32:96af12a50fdb | 33:7a63dacab7f8 |
---|---|
99 } | 99 } |
100 | 100 |
101 return -1; | 101 return -1; |
102 } | 102 } |
103 | 103 |
104 __code cbc_fileread1 (int r, struct file *f, __code (*next)(int ret)) | 104 __code cbc_fileread1 (int r) |
105 { | 105 { |
106 struct file *f = proc->cbc_arg.cbc_console_arg.f; | |
107 __code (*next)(int ret) = cbc_ret; | |
106 if (r > 0) | 108 if (r > 0) |
107 f->off += r; | 109 f->off += r; |
108 iunlock(f->ip); | 110 iunlock(f->ip); |
109 goto next(r); | 111 goto next(r); |
110 } | 112 } |
120 goto next(-1); | 122 goto next(-1); |
121 } | 123 } |
122 | 124 |
123 if (f->type == FD_INODE) { | 125 if (f->type == FD_INODE) { |
124 ilock(f->ip); | 126 ilock(f->ip); |
125 goto cbc_readi(f->ip, addr, f->off, n, f, next); | 127 proc->cbc_arg.cbc_console_arg.f = f; |
128 goto cbc_readi(f->ip, addr, f->off, n, cbc_fileread1); | |
126 } | 129 } |
127 | 130 |
128 goto cbc_panic("fileread"); | 131 goto cbc_panic("fileread"); |
129 } | 132 } |
130 | 133 |