Mercurial > hg > Members > anatofuz > CbC_xv6
comparison src/file.cbc @ 91:b5ddf6fb0a6d
use CbCFile instead of File struct Interface
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Oct 2019 20:39:36 +0900 |
parents | 214d21c891c7 |
children | bc5bcfd2f6d6 |
comparison
equal
deleted
inserted
replaced
90:dd1d9ea1b7b5 | 91:b5ddf6fb0a6d |
---|---|
111 f->off += r; | 111 f->off += r; |
112 iunlock(f->ip); | 112 iunlock(f->ip); |
113 goto next(r); | 113 goto next(r); |
114 } | 114 } |
115 | 115 |
116 __ncode cbc_fileread (struct file *f, char *addr, int n, __code (*next)(int ret)) | 116 |
117 __code cbc_fileread (struct file *f, char *addr, int n, __code (*next)(int ret)) | |
117 { | 118 { |
118 if (f->readable == 0) { | 119 if (f->readable == 0) { |
119 goto next(-1); | 120 goto next(-1); |
120 } | 121 } |
121 | 122 |
129 proc->cbc_arg.cbc_console_arg.f = f; | 130 proc->cbc_arg.cbc_console_arg.f = f; |
130 goto cbc_readi(f->ip, addr, f->off, n, cbc_fileread1); | 131 goto cbc_readi(f->ip, addr, f->off, n, cbc_fileread1); |
131 } | 132 } |
132 | 133 |
133 goto cbc_panic("fileread"); | 134 goto cbc_panic("fileread"); |
135 } | |
136 | |
137 __code cbc_fileread_stub(struct Context* cbc_context) { | |
138 struct CbCFile* cbc_file = &cbc_context->data[D_CbCFile]->CbCFile; | |
139 enum Code next = cbc_context->next; | |
140 goto cbc_fileread(cbc_file->f, cbc_file->p, cbc_file->n, cbc_context->code[next]); | |
134 } | 141 } |
135 | 142 |
136 // Read from file f. | 143 // Read from file f. |
137 int fileread (struct file *f, char *addr, int n) | 144 int fileread (struct file *f, char *addr, int n) |
138 { | 145 { |