]> wirehaze git hosting - BOS.git/blob - kernel/vfs/vfs.asm

wirehaze git hosting

VFS structures in place, minor typos fixed
[BOS.git] / kernel / vfs / vfs.asm
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2012-2015. ;
3 ;----------------------------------------------------------;
4 ; ;
5 ; VFS handling all devices and filesystems. ;
6 ; ;
7 ;----------------------------------------------------------;
8
9 ;---------------------------------------------;
10 ; VFS main structure ;
11 ;---------------------------------------------;
12 struc VFS
13 {
14 .number: times 255 db 0 ; 00=FD, 0x10=HD, 0x60=CD, 0x80=VD, 90=RD, B0=ND
15 .storage:
16 times 255 * sizeof.VFS_storage db 0 ; storage driver structure
17 .filesystem:
18 times 255 * sizeof.VFS_filesystem db 0 ; filesystem driver structure
19 }
20
21 virtual at 0 ; could use "at esi" instead
22 VFS VFS
23 sizeof.VFS = $-$$
24 end virtual
25
26 ;---------------------------------------------;
27 ; VFS storage driver structure ;
28 ;---------------------------------------------;
29 struc VFS_storage
30 {
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
37 }
38
39 virtual at 0
40 VFS_storage VFS_storage
41 sizeof.VFS_storage = $-$$
42 end virtual
43
44 ;---------------------------------------------;
45 ; VFS filesystem structure ;
46 ;---------------------------------------------;
47 struc VFS_filesystem
48 {
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
64 }
65
66 virtual at 0
67 VFS_filesystem VFS_filesystem
68 sizeof.VFS_filesystem = $-$$
69 end virtual
70
71
72 VFS_structure VFS
73
74 ;--------------------------------------------------------------;
75 ; init_vfs - detect connected drives ;
76 ;--------------------------------------------------------------;
77 ; ;
78 ; in: reg = pointer to VFS drive info ;
79 ; ;
80 ; out: reg = pointer to struct(s) if FAT12 found ;
81 ; ;
82 ;--------------------------------------------------------------;
83 init_vfs:
84 push eax
85 ; a bit more code here
86 pop eax
87 ret