annotate src/file.h @ 181:f9df567f7f2d

tweak_gen_context.pl
author anatofuz
date Mon, 20 Jan 2020 16:44:55 +0900
parents 654f2dadd744
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
132
8e93917ce4be add sys_read_impl.cbc (incomplete)
anatofuz
parents: 116
diff changeset
1 /*
116
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
2 typedef struct file {
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
3 enum { FD_NONE, FD_PIPE, FD_INODE } type;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
4 int ref; // reference count
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
5 char readable;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
6 char writable;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
7 struct pipe *pipe;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
8 struct inode *ip;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
9 uint off;
e45b8d57b9e8 tweak context.pm
anatofuz
parents: 113
diff changeset
10 } file;
132
8e93917ce4be add sys_read_impl.cbc (incomplete)
anatofuz
parents: 116
diff changeset
11 */
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // in-memory copy of an inode
149
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
13
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
14 /*
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 struct inode {
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 uint dev; // Device number
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 uint inum; // Inode number
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 int ref; // Reference count
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 int flags; // I_BUSY, I_VALID
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 short type; // copy of disk inode
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 short major;
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 short minor;
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 short nlink;
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 uint size;
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 uint addrs[NDIRECT+1];
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 };
149
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
28 */
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
29
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #define I_BUSY 0x1
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #define I_VALID 0x2
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
149
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
33
654f2dadd744 add inode.h
menikon
parents: 132
diff changeset
34
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 // table mapping major device number to
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 // device functions
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 struct devsw {
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 int (*read) (struct inode*, char*, int);
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 int (*write)(struct inode*, char*, int);
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 };
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
27
mir3636
parents: 0
diff changeset
42 struct cbc_devsw {
33
7a63dacab7f8 fix cbc_read
mir3636
parents: 31
diff changeset
43 __code (*read) (struct inode*, char*, int, __code (*)(int));
29
mir3636
parents: 27
diff changeset
44 //__code (*write)(struct inode*, char*, int, __code (*)(int));
27
mir3636
parents: 0
diff changeset
45 };
mir3636
parents: 0
diff changeset
46
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 extern struct devsw devsw[];
27
mir3636
parents: 0
diff changeset
48 extern struct cbc_devsw cbc_devsw[];
0
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 #define CONSOLE 1