Mercurial > hg > Members > menikon > CbC_xv6
comparison src/file.cbc @ 96:d5c4016c65b8
implement read interfacce
author | anatofuz |
---|---|
date | Sat, 09 Nov 2019 19:56:07 +0900 |
parents | 0ddcd561d975 |
children | 4f9d95dc4efd |
comparison
equal
deleted
inserted
replaced
95:0ddcd561d975 | 96:d5c4016c65b8 |
---|---|
10 #include "spinlock.h" | 10 #include "spinlock.h" |
11 #include "proc.h" | 11 #include "proc.h" |
12 | 12 |
13 #define __ncode __code | 13 #define __ncode __code |
14 # | 14 # |
15 | |
16 #interface "SysRead.h" | |
17 | |
18 | |
15 struct devsw devsw[NDEV]; | 19 struct devsw devsw[NDEV]; |
16 struct cbc_devsw cbc_devsw[NDEV]; | 20 struct cbc_devsw cbc_devsw[NDEV]; |
17 | 21 |
18 struct { | 22 struct { |
19 struct spinlock lock; | 23 struct spinlock lock; |
21 } ftable; | 25 } ftable; |
22 | 26 |
23 void fileinit (void) | 27 void fileinit (void) |
24 { | 28 { |
25 initlock(&ftable.lock, "ftable"); | 29 initlock(&ftable.lock, "ftable"); |
30 } | |
31 | |
32 struct SysFileRead* createSysFileRead(struct Context* context) { | |
33 struct SysRead* sys_read = new SysRead(); | |
34 struct SysFileRead* sys_file_read = new SysFileRead(); | |
35 sys_read->sys_read = (union Data*)sys_file_read; | |
36 sys_read->read = C_cbc_fileread; | |
37 sys_read->ret = C_cbc_fileret; | |
38 sys_read->next = NULL; | |
39 return sys_read; | |
26 } | 40 } |
27 | 41 |
28 // Allocate a file structure. | 42 // Allocate a file structure. |
29 struct file* filealloc (void) | 43 struct file* filealloc (void) |
30 { | 44 { |
219 | 233 |
220 return i == n ? n : -1; | 234 return i == n ? n : -1; |
221 } | 235 } |
222 | 236 |
223 panic("filewrite"); | 237 panic("filewrite"); |
224 } | |
225 |