Rev 9734 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9734 | Rev 9894 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 9734 $ |
8 | $Revision: 9894 $ |
9 | 9 | ||
10 | ERROR_SUCCESS = 0 |
10 | ERROR_SUCCESS = 0 |
11 | ERROR_DISK_BASE = 1 |
11 | ERROR_DISK_BASE = 1 |
Line 23... | Line 23... | ||
23 | maxPathLength = 1000h |
23 | maxPathLength = 1000h |
Line 24... | Line 24... | ||
24 | 24 | ||
25 | image_of_eax EQU esp+32 |
25 | image_of_eax EQU esp+32 |
Line -... | Line 26... | ||
- | 26 | image_of_ebx EQU esp+20 |
|
- | 27 | ||
- | 28 | ; fs api for drivers |
|
- | 29 | struct FileSystem |
|
- | 30 | Next dd ? |
|
- | 31 | Prev dd ? |
|
- | 32 | Creat_part dd ? ; %FSNAME%_create_partition |
|
- | 33 | UserFuncs dd ? ; for fs_del |
|
- | 34 | Name rd 16 ;ascii string + \n |
|
- | 35 | ends |
|
- | 36 | ||
- | 37 | ||
- | 38 | fs_list: |
|
- | 39 | dd fs_list |
|
- | 40 | dd fs_list |
|
- | 41 | ;.look: dd 0 |
|
- | 42 | ||
- | 43 | ; IN: ecx = %FSNAME%_create_partition |
|
- | 44 | ; edx = ptr to UserFuncs |
|
- | 45 | ; [esp] = fs name |
|
- | 46 | ;OUT: eax = list item |
|
- | 47 | fs_add: |
|
- | 48 | push ecx edx |
|
- | 49 | ; add in fs_list |
|
- | 50 | mov eax, sizeof.FileSystem |
|
- | 51 | call malloc |
|
- | 52 | pop edx ecx |
|
- | 53 | test eax, eax |
|
- | 54 | jz .err |
|
- | 55 | ||
- | 56 | mov [eax + FileSystem.Creat_part], ecx |
|
- | 57 | mov [eax + FileSystem.UserFuncs], edx |
|
- | 58 | mov edx, [esp + 4] |
|
- | 59 | mov [eax + FileSystem.Name], edx |
|
- | 60 | mov edx, eax |
|
- | 61 | ||
- | 62 | cli ; DELETE |
|
- | 63 | list_add_tail edx, fs_list |
|
- | 64 | sti ; DELETE |
|
- | 65 | mov edx, ecx ; save function |
|
- | 66 | ||
- | 67 | ;DEBUGF 1, 'K : FS: find partition\n' |
|
- | 68 | ; check all disks |
|
- | 69 | mov esi, [disk_list] |
|
- | 70 | .new_disk: |
|
- | 71 | cmp dword[esi], disk_list |
|
- | 72 | jz .end |
|
- | 73 | ||
- | 74 | push edx |
|
- | 75 | mov eax, [esi + DISK.MediaInfo.SectorSize] |
|
- | 76 | shl eax, 2 |
|
- | 77 | stdcall kernel_alloc, eax ;get buffer |
|
- | 78 | test eax, eax |
|
- | 79 | pop edx |
|
- | 80 | jz .end ; no memory |
|
- | 81 | mov ebx, eax |
|
- | 82 | ||
- | 83 | mov ecx, [esi + DISK.NumPartitions] |
|
- | 84 | dec ecx |
|
- | 85 | shl ecx, 2 ; to dword |
|
- | 86 | add ecx, [esi + DISK.Partitions] |
|
- | 87 | @@: |
|
- | 88 | mov ebp, [ecx] |
|
- | 89 | cmp [ebp + PARTITION.FSUserFunctions], default_fs_functions |
|
- | 90 | jnz .no_fs |
|
- | 91 | ||
- | 92 | ;DEBUGF 1, 'K : FS: found partition\n' |
|
- | 93 | push ecx edx |
|
- | 94 | ||
- | 95 | xor eax, eax ; first sector of the partition |
|
- | 96 | call fs_read32_sys |
|
- | 97 | push eax |
|
- | 98 | ;DEBUGF 1, 'K : FS: call driver func = %x\n', edx |
|
- | 99 | ||
- | 100 | call edx ; creat_partition |
|
- | 101 | add esp, 4 |
|
- | 102 | ;DEBUGF 1, 'K : FS: end call\n' |
|
- | 103 | pop edx ecx |
|
- | 104 | ||
- | 105 | test eax, eax |
|
- | 106 | jz .no_fs |
|
- | 107 | ; save and delete old struct |
|
- | 108 | xchg [ecx], eax |
|
- | 109 | push ecx edx |
|
- | 110 | call free |
|
- | 111 | pop edx ecx |
|
- | 112 | ;DEBUGF 1, 'K : FS: set fs for partition\n' |
|
- | 113 | .no_fs: |
|
- | 114 | ;sub ecx, 4 |
|
- | 115 | cmp ecx, [esi + DISK.Partitions] |
|
- | 116 | lea ecx, [ecx - 4] |
|
- | 117 | jnz @b |
|
- | 118 | ||
- | 119 | push edx |
|
- | 120 | stdcall kernel_free, ebx |
|
- | 121 | pop edx |
|
- | 122 | ||
- | 123 | mov esi, [esi] |
|
- | 124 | jmp .new_disk |
|
- | 125 | .end: |
|
- | 126 | .err: |
|
- | 127 | ret |
|
- | 128 | ; IN: ecx = list item |
|
- | 129 | ;OUT: - |
|
- | 130 | ;fs_del: |
|
- | 131 | ; |
|
- | 132 | ; ret |
|
- | 133 | ||
26 | image_of_ebx EQU esp+20 |
134 | |
27 | 135 | ||
28 | ; System function 70 security check |
136 | ; System function 70 security check |
29 | align 4 |
137 | align 4 |
30 | proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword |
138 | proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword |