Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6467 → Rev 6468

/kernel/trunk/blkdev/disk.inc
1045,8 → 1045,7
; This function is called from file_system_lfn.
; This handler gets the control each time when fn 70 is called
; with unknown item of root subdirectory.
; in: esi -> name
; ebp = 0 or rest of name relative to esi
; in: esi = ebp -> path string
; out: if the handler processes path, it must not return in file_system_lfn,
; but instead pop return address and return directly to the caller
; otherwise simply return
1142,6 → 1141,25
@@:
; 11c. Let the procedure from fs_lfn.inc do the job.
jmp file_system_lfn.maindir_noesi
 
.access_denied:
mov dword [esp+32], ERROR_ACCESS_DENIED
mov esi, ecx ; disk*dereference assume that esi points to DISK
.cleanup_esi:
test edx, edx ; if there are no media, we didn't reference it
jz @f
call disk_media_dereference
@@:
call disk_dereference
stdcall kernel_free, ebp
ret
 
.dyndisk_cleanup:
pop esi
pop edx
mov dword [esp+32], ERROR_FILE_NOT_FOUND
jmp .cleanup_esi
 
.haspartition:
; 12. The fs operation has specified some partition.
push edx
1160,77 → 1178,6
jnz .dyndisk_cleanup
dec esi
@@:
cmp byte [esi], 0
jnz @f
test ebp, ebp
jz @f
mov esi, ebp
xor ebp, ebp
@@:
jmp fs_dyndisk
 
.dyndisk_cleanup:
pop esi
pop edx
mov dword [esp+32], ERROR_FILE_NOT_FOUND
jmp .cleanup_esi
 
.access_denied:
; 13. Fail the operation with the appropriate code.
mov dword [esp+32], ERROR_ACCESS_DENIED
.cleanup:
; 14. Cleanup.
mov esi, ecx ; disk*dereference assume that esi points to DISK
.cleanup_esi:
test edx, edx ; if there are no media, we didn't reference it
jz @f
call disk_media_dereference
@@:
call disk_dereference
; 15. Return.
ret
 
; This is a callback for enumerating partitions called from
; file_system_lfn.maindir in the case of inserted media.
; It just increments eax until DISK.NumPartitions reached and then
; cleans up.
fs_dyndisk_next:
mov ecx, [esp+8]
cmp eax, [ecx+DISK.NumPartitions]
jae .nomore
inc eax
clc
ret
.nomore:
pusha
mov esi, ecx
call disk_media_dereference
call disk_dereference
popa
stc
ret
 
; This is a callback for enumerating partitions called from
; file_system_lfn.maindir in the case of missing media.
; In this case we create one pseudo-partition.
fs_dyndisk_next_nomedia:
cmp eax, 1
jae .nomore
inc eax
clc
ret
.nomore:
mov ecx, [esp+8]
pusha
mov esi, ecx
call disk_dereference
popa
stc
ret
 
; esp -> {dd pointer to DISK, dd media object}
; ecx = partition number, esi+ebp = ASCIIZ name
fs_dyndisk:
dec ecx ; convert to zero-based partition index
pop edx ; edx = pointer to DISK, dword [esp] = NULL or edx
; If the driver does not support insert notifications and we are the only fs
1267,9 → 1214,8
pop eax
test eax, eax
jz .nomedia
.main:
cmp ecx, [edx+DISK.NumPartitions]
jae .notfound
jae .notfound2
mov eax, [edx+DISK.Partitions]
mov eax, [eax+ecx*4]
mov edi, [eax+PARTITION.FSUserFunctions]
1287,27 → 1233,67
.cleanup:
mov esi, edx
call disk_media_dereference
@@:
call disk_dereference
stdcall kernel_free, ebp
ret
.nofs:
 
.unsupported:
mov dword [esp+32], ERROR_UNKNOWN_FS
cmp edi, default_fs_functions
jz .cleanup
mov dword [esp+32], ERROR_UNSUPPORTED_FS
jmp .cleanup
.notfound:
 
.notfound2:
mov dword [esp+32], ERROR_FILE_NOT_FOUND
jmp .cleanup
.unsupported:
cmp edi, default_fs_functions
jz .nofs
mov dword [esp+32], ERROR_UNSUPPORTED_FS
jmp .cleanup
 
.nomedia:
test ecx, ecx
jnz .notfound
jnz .notfound2
mov dword [esp+32], ERROR_DEVICE
mov esi, edx
jmp @b
 
; This is a callback for enumerating partitions called from
; file_system_lfn.maindir in the case of inserted media.
; It just increments eax until DISK.NumPartitions reached and then
; cleans up.
fs_dyndisk_next:
mov ecx, [esp+8]
cmp eax, [ecx+DISK.NumPartitions]
jae .nomore
inc eax
clc
ret
.nomore:
pusha
mov esi, ecx
call disk_media_dereference
call disk_dereference
popa
stc
ret
 
; This is a callback for enumerating partitions called from
; file_system_lfn.maindir in the case of missing media.
; In this case we create one pseudo-partition.
fs_dyndisk_next_nomedia:
cmp eax, 1
jae .nomore
inc eax
clc
ret
.nomore:
mov ecx, [esp+8]
pusha
mov esi, ecx
call disk_dereference
popa
stc
ret
 
; This function is called from file_system_lfn.
; This handler is called when virtual root is enumerated
; and must return all items which can be handled by this.