annotate src/impl/fs_impl.cbc @ 301:7ec574dfe64f

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