295
|
1 #include "../../context.h"
|
301
|
2 #include "defs.h"
|
|
3 #include "fs.h"
|
|
4 #include "buf.h"
|
295
|
5 #interface "fs.dg"
|
294
|
6
|
|
7 // ----
|
|
8 // typedef struct fs_impl<Impl, Isa> impl fs{
|
|
9 // union Data* fs_impl;
|
|
10 //
|
|
11 //
|
|
12 //
|
|
13 //
|
|
14 // } fs_impl;
|
|
15 // ----
|
|
16
|
|
17 fs* createfs_impl(struct Context* cbc_context) {
|
|
18 struct fs* fs = new fs();
|
|
19 struct fs_impl* fs_impl = new fs_impl();
|
|
20 fs->fs = (union Data*)fs_impl;
|
|
21 fs_impl->fs_impl = NULL;
|
|
22 fs->readsb = C_readsbfs_impl;
|
|
23 fs->iinit = C_iinitfs_impl;
|
|
24 fs->ialloc = C_iallocfs_impl;
|
|
25 fs->iupdate = C_iupdatefs_impl;
|
|
26 fs->idup = C_idupfs_impl;
|
|
27 fs->ilock = C_ilockfs_impl;
|
|
28 fs->iunlock = C_iunlockfs_impl;
|
|
29 fs->iput = C_iputfs_impl;
|
|
30 fs->iunlockput = C_iunlockputfs_impl;
|
|
31 fs->stati = C_statifs_impl;
|
|
32 fs->readi = C_readifs_impl;
|
|
33 fs->writei = C_writeifs_impl;
|
|
34 fs->namecmp = C_namecmpfs_impl;
|
|
35 fs->dirlookup = C_dirlookupfs_impl;
|
296
|
36 fs->dirlink = C_dirlinkfs_impl;
|
294
|
37 fs->namei = C_nameifs_impl;
|
|
38 fs->nameiparent = C_nameiparentfs_impl;
|
|
39 return fs;
|
|
40 }
|
298
|
41
|
299
|
42 typedef struct superblock superblock;
|
296
|
43 __code readsbfs_impl(struct fs_impl* fs, uint dev, struct superblock* sb, __code next(...)) { //:skip
|
294
|
44
|
301
|
45 struct buf* bp;
|
|
46
|
|
47 bp = bread(dev, 1);
|
|
48 memmove(sb, bp->data, sizeof(*sb));
|
|
49 brelse(bp);
|
|
50
|
294
|
51 goto next(...);
|
|
52 }
|
|
53
|
|
54 __code iinitfs_impl(struct fs_impl* fs, __code next(...)) {
|
|
55
|
|
56 goto next(...);
|
|
57 }
|
|
58
|
|
59 __code iallocfs_impl(struct fs_impl* fs, uint dev, short type, __code next(...)) {
|
|
60
|
|
61 goto next(...);
|
|
62 }
|
|
63
|
|
64 __code iupdatefs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
65
|
|
66 goto next(...);
|
|
67 }
|
|
68
|
|
69 __code idupfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
70
|
|
71 goto next(...);
|
|
72 }
|
|
73
|
|
74 __code ilockfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
75
|
|
76 goto next(...);
|
|
77 }
|
|
78
|
|
79 __code iunlockfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
80
|
|
81 goto next(...);
|
|
82 }
|
|
83
|
|
84 __code iputfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
85
|
|
86 goto next(...);
|
|
87 }
|
|
88
|
|
89 __code iunlockputfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
|
|
90
|
|
91 goto next(...);
|
|
92 }
|
|
93
|
299
|
94 typedef struct stat stat;
|
296
|
95 __code statifs_impl(struct fs_impl* fs , struct inode* ip, struct stat* st, __code next(...)) { //:skip
|
294
|
96
|
|
97 goto next(...);
|
|
98 }
|
|
99
|
|
100 __code readifs_impl(struct fs_impl* fs, struct inode* ip, char* dst, uint off, uint n, __code next(...)) {
|
|
101
|
|
102 goto next(...);
|
|
103 }
|
|
104
|
|
105 __code writeifs_impl(struct fs_impl* fs, struct inode* ip, char* src, uint off, uint n, __code next(...)) {
|
|
106
|
|
107 goto next(...);
|
|
108 }
|
|
109
|
|
110 __code namecmpfs_impl(struct fs_impl* fs, const char* s, const char* t, __code next(...)) {
|
|
111
|
|
112 goto next(...);
|
|
113 }
|
|
114
|
|
115 __code dirlookupfs_impl(struct inode* dp, char* name, uint* poff, __code next(...)) {
|
|
116
|
|
117 goto next(...);
|
|
118 }
|
|
119
|
296
|
120 __code dirlinkfs_impl(struct fs_impl* fs, struct inode* dp, char* name, uint inum, __code next(...)) {
|
294
|
121
|
296
|
122 goto next(...);
|
294
|
123 }
|
|
124
|
|
125 __code nameifs_impl(struct fs_impl* fs, char* path, __code next(...)) {
|
|
126
|
|
127 goto next(...);
|
|
128 }
|
|
129
|
|
130 __code nameiparentfs_impl(struct fs_impl* fs, char* path, char* name, __code next(...)) {
|
|
131
|
|
132 goto next(...);
|
|
133 }
|
|
134
|