1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2012-2015. ;
3 ;----------------------------------------------------------;
5 ; VFS handling all devices and filesystems. ;
7 ;----------------------------------------------------------;
10 ;---------------------------------------------;
11 ; VFS main structure ;
12 ;---------------------------------------------;
15 .number: times 255 db 0 ; 00=FD, 0x10=HD, 0x60=CD, 0x80=VD, 90=RD, B0=ND
17 times 255 * sizeof
.VFS_storage
db 0 ; storage driver structure
19 times 255 * sizeof
.VFS_filesystem
db 0 ; filesystem driver structure
22 virtual at 0 ; could use "at esi" instead
27 ;---------------------------------------------;
28 ; VFS storage driver structure ;
29 ;---------------------------------------------;
32 .data_pointer dd 0 ; internal driver data
33 .init dd 0 ; pointer to init
34 .deinit dd 0 ; remove driver
35 .read dd 0 ; read device
36 .write dd 0 ; write device
37 .ioctl dd 0 ; handle device specific extras
41 VFS_storage VFS_storage
42 sizeof
.VFS_storage
= $-$$
45 ;---------------------------------------------;
46 ; VFS filesystem structure ;
47 ;---------------------------------------------;
50 .data_pointer dd 0 ; internal driver data
51 .init dd 0 ; pointer to init
52 .deinit dd 0 ; remove driver
53 .format dd 0 ; format drive
54 .mount dd 0 ; mount drive
55 .unmount dd 0 ; unmount drive
56 .find dd 0 ; find file
57 .findnext dd 0 ; get next match
58 .open dd 0 ; open file, get handle
59 .read dd 0 ; read file from handle
60 .write dd 0 ; write file from handle
61 .seek dd 0 ; seek from handle
62 .remove dd 0 ; remove file/dir
63 .create dd 0 ; create file/dir
64 .ioctl dd 0 ; extra calls if exists
68 VFS_filesystem VFS_filesystem
69 sizeof
.VFS_filesystem
= $-$$
72 ;---------------------------------------------;
73 ; VFS structure pointer ;
74 ;---------------------------------------------;
78 ;--------------------------------------------------------------;
79 ; init_vfs - detect connected drives ;
80 ;--------------------------------------------------------------;
82 ; out: cf = set if failed ;
84 ;--------------------------------------------------------------;
89 mov ebx, sizeof
.VFS
; allocate structure size
93 stc ; if error, set carry
97 mov dword [VFS_structure
], ebx
103 ;--------------------------------------------------------------;
104 ; add_media - add media driver ;
105 ;--------------------------------------------------------------;
107 ; in: reg = pointer to VFS drive info ;
109 ; out: reg = pointer to struct(s) if FAT12 found ;
111 ;--------------------------------------------------------------;
118 ;--------------------------------------------------------------;
119 ; add_fs - add filesystem driver ;
120 ;--------------------------------------------------------------;
122 ; in: reg = pointer to VFS drive info ;
124 ; out: reg = pointer to struct(s) if FAT12 found ;
126 ;--------------------------------------------------------------;