1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2012-2015. ;
3 ;----------------------------------------------------------;
5 ; VFS handling all devices and filesystems. ;
7 ;----------------------------------------------------------;
9 ;---------------------------------------------;
10 ; VFS main structure ;
11 ;---------------------------------------------;
14 .number: times 255 db 0 ; 00=FD, 0x10=HD, 0x60=CD, 0x80=VD, 90=RD, B0=ND
16 times 255 * sizeof
.VFS_storage
db 0 ; storage driver structure
18 times 255 * sizeof
.VFS_filesystem
db 0 ; filesystem driver structure
21 virtual at 0 ; could use "at esi" instead
26 ;---------------------------------------------;
27 ; VFS storage driver structure ;
28 ;---------------------------------------------;
31 .data_pointer dd 0 ; internal driver data
32 .init dd 0 ; pointer to init
33 .deinit dd 0 ; remove driver
34 .read dd 0 ; read device
35 .write dd 0 ; write device
36 .ioctl dd 0 ; handle device specific extras
40 VFS_storage VFS_storage
41 sizeof
.VFS_storage
= $-$$
44 ;---------------------------------------------;
45 ; VFS filesystem structure ;
46 ;---------------------------------------------;
49 .data_pointer dd 0 ; internal driver data
50 .init dd 0 ; pointer to init
51 .deinit dd 0 ; remove driver
52 .format dd 0 ; format drive
53 .mount dd 0 ; mount drive
54 .unmount dd 0 ; unmount drive
55 .find dd 0 ; find file
56 .findnext dd 0 ; get next match
57 .open dd 0 ; open file, get handle
58 .read dd 0 ; read file from handle
59 .write dd 0 ; write file from handle
60 .seek dd 0 ; seek from handle
61 .remove dd 0 ; remove file/dir
62 .create dd 0 ; create file/dir
63 .ioctl dd 0 ; extra calls if exists
67 VFS_filesystem VFS_filesystem
68 sizeof
.VFS_filesystem
= $-$$
74 ;--------------------------------------------------------------;
75 ; init_vfs - detect connected drives ;
76 ;--------------------------------------------------------------;
78 ; in: reg = pointer to VFS drive info ;
80 ; out: reg = pointer to struct(s) if FAT12 found ;
82 ;--------------------------------------------------------------;
87 mov ebx, sizeof
.VFS
; allocate structure size
91 stc ; if error, set carry
95 mov dword [VFS_structure
], ebx
101 ;--------------------------------------------------------------;
102 ; add_media - add media driver ;
103 ;--------------------------------------------------------------;
105 ; in: reg = pointer to VFS drive info ;
107 ; out: reg = pointer to struct(s) if FAT12 found ;
109 ;--------------------------------------------------------------;
116 ;--------------------------------------------------------------;
117 ; add_fs - add filesystem driver ;
118 ;--------------------------------------------------------------;
120 ; in: reg = pointer to VFS drive info ;
122 ; out: reg = pointer to struct(s) if FAT12 found ;
124 ;--------------------------------------------------------------;