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

wirehaze git hosting

Completed FAT12 structures, added some for VFS.
[BOS.git] / kernel / vfs / vfs.asm
index ab2f0facc35e1f91f131447278be0a42b30a5cd4..30d5590c39e0f5c6f6593c9d2a8d4674ce44db6f 100644 (file)
@@ -6,6 +6,13 @@
 ;                                                          ;
 ;----------------------------------------------------------;
 
 ;                                                          ;
 ;----------------------------------------------------------;
 
+
+    ; file handles need to be dword, where the high
+    ; word contains drive number, and the low word
+    ; is the drive/FS specific handle. limits FS to
+    ; a max of 65535 opened files. should be alright. ;)
+
+
     ;---------------------------------------------;
     ;   VFS main structure                        ;
     ;---------------------------------------------;
     ;---------------------------------------------;
     ;   VFS main structure                        ;
     ;---------------------------------------------;
@@ -16,6 +23,8 @@
             times 255 * sizeof.VFS_storage     db 0   ; storage driver structure
         .filesystem:          
             times 255 * sizeof.VFS_filesystem  db 0   ; filesystem driver structure
             times 255 * sizeof.VFS_storage     db 0   ; storage driver structure
         .filesystem:          
             times 255 * sizeof.VFS_filesystem  db 0   ; filesystem driver structure
+        .mounted                               db 0   ; 1/0 switch if mounted
+        .current_path:          times 255      db 0   ; drive opened path (increase max path size?)
     }
 
     virtual at 0                                      ; could use "at esi" instead
     }
 
     virtual at 0                                      ; could use "at esi" instead
         sizeof.VFS_filesystem = $-$$
     end virtual
 
         sizeof.VFS_filesystem = $-$$
     end virtual
 
+    ;---------------------------------------------;
+    ;   VFS structure pointer                     ;
+    ;---------------------------------------------;
+    VFS_structure             dd 0
 
 
-VFS_structure VFS
 
 ;--------------------------------------------------------------;
 ;   init_vfs  -  detect connected drives                       ;
 ;--------------------------------------------------------------;
 ;                                                              ;
 
 ;--------------------------------------------------------------;
 ;   init_vfs  -  detect connected drives                       ;
 ;--------------------------------------------------------------;
 ;                                                              ;
+;       out:                    cf = set if failed             ;
+;                                                              ;
+;--------------------------------------------------------------;
+init_vfs:
+        push   eax
+        push   ebx
+
+        mov    ebx, sizeof.VFS                        ; allocate structure size
+        call   allocate_mem
+        cmp    eax, 0
+        jne    .ok
+        stc                                           ; if error, set carry
+        mov    ebx, 0
+
+    .ok:
+        mov    dword [VFS_structure], ebx
+
+        pop    ebx
+        pop    eax
+        ret
+
+;--------------------------------------------------------------;
+;   add_media  -  add media driver                             ;
+;--------------------------------------------------------------;
+;                                                              ;
 ;       in:  reg = pointer to VFS drive info                   ;
 ;                                                              ;
 ;       out: reg = pointer to struct(s) if FAT12 found         ;
 ;                                                              ;
 ;--------------------------------------------------------------;
 ;       in:  reg = pointer to VFS drive info                   ;
 ;                                                              ;
 ;       out: reg = pointer to struct(s) if FAT12 found         ;
 ;                                                              ;
 ;--------------------------------------------------------------;
-init_vfs:
+add_media:
+        push   eax
+        ;...
+        pop    eax
+        ret
+
+;--------------------------------------------------------------;
+;   add_fs  -  add filesystem driver                           ;
+;--------------------------------------------------------------;
+;                                                              ;
+;       in:  reg = pointer to VFS drive info                   ;
+;                                                              ;
+;       out: reg = pointer to struct(s) if FAT12 found         ;
+;                                                              ;
+;--------------------------------------------------------------;
+add_fs:
         push   eax
         push   eax
-        ; a bit more code here 
+        ;...
         pop    eax
         ret
\ No newline at end of file
         pop    eax
         ret
\ No newline at end of file