Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 87 → Rev 88

/kernel/trunk/fs/fat32.inc
2208,184 → 2208,6
ret
 
 
get_filesize:
;-----------------------------------------------------------
; input : eax = file name
; edx = path
; edi = if 0 - read rootdir else normal dir/file size
; output : eax = 0 - ok
; 3 - unknown FS
; 5 - file not found
; 10 - access denied
; ebx = file size
;-----------------------------------------------------------
cmp [fat_type],0
jnz get_filesize_fat_ok
xor ebx,ebx
mov eax,ERROR_UNKNOWN_FS
ret
 
get_filesize_fat_ok:
; call reserve_hd1
 
pushad
xor eax,eax
test edi,edi ; is read rootdir?
je get_filesize_dirsize ; yes
 
get_filesize_no_root:
mov ebx,edx
call get_cluster_of_a_path
jc get_filesize_not_found
 
mov ebx,PUSHAD_EAX ; file name
call analyze_directory
jc get_filesize_not_found
 
mov eax,[ebx+28] ; file size
test byte [ebx+11],0x10 ; is it directory?
jz get_filesize_set_size ; no
 
mov eax,[ebx+20-2] ; FAT entry
mov ax,[ebx+26]
and eax,[fatMASK]
 
get_filesize_dirsize:
call get_dir_size
cmp [hd_error],0
jne get_filesize_access_denied
 
get_filesize_set_size:
mov PUSHAD_EBX,eax
popad
mov [hd1_status],0
xor eax,eax
ret
 
get_filesize_not_found:
cmp [hd_error],0
jne get_filesize_access_denied
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_FILE_NOT_FOUND
ret
 
get_filesize_access_denied:
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_ACCESS_DENIED
ret
 
get_fileattr:
;-----------------------------------------------------------
; input : eax = file name
; edx = path
; output : eax = 0 - ok
; 3 - unknown FS
; 5 - file not found
; 10 - access denied
; ebx = file attribute
;-----------------------------------------------------------
cmp [fat_type],0
jnz get_fileattr_fat_ok
xor ebx,ebx
mov eax,ERROR_UNKNOWN_FS
ret
 
get_fileattr_fat_ok:
; call reserve_hd1
 
pushad
mov ebx,edx
call get_cluster_of_a_path
jc get_fileattr_not_found
 
mov ebx,PUSHAD_EAX ; file name
call analyze_directory
jc get_fileattr_not_found
 
movzx eax,byte [ebx+11] ; file attribute
mov PUSHAD_EBX,eax
popad
mov [hd1_status],0
xor eax,eax
ret
 
get_fileattr_not_found:
cmp [hd_error],0
jne get_fileattr_access_denied
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_FILE_NOT_FOUND
ret
 
get_fileattr_access_denied:
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_ACCESS_DENIED
ret
 
get_filedate:
;-----------------------------------------------------------
; input : eax = file name
; edx = path
; output : eax = 0 - ok
; 3 - unknown FS
; 5 - file not found
; 10 - access denied
; ebx = file date/time
; bits 31..25 = year-1980
; bits 24..21 = month
; bits 20..16 = day
; bits 15..11 = hour
; bits 10..5 = minute
; bits 4..0 = second/2
;-----------------------------------------------------------
cmp [fat_type],0
jnz get_filedate_fat_ok
xor ebx,ebx
mov eax,ERROR_UNKNOWN_FS
ret
 
get_filedate_fat_ok:
; call reserve_hd1
 
pushad
mov ebx,edx
call get_cluster_of_a_path
jc get_filedate_not_found
 
mov ebx,PUSHAD_EAX ; file name
call analyze_directory
jc get_filedate_not_found
 
mov eax,[ebx+22] ; file date/time
mov PUSHAD_EBX,eax
popad
mov [hd1_status],0
xor eax,eax
ret
 
get_filedate_not_found:
cmp [hd_error],0
jne get_filedate_access_denied
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_FILE_NOT_FOUND
ret
 
get_filedate_access_denied:
popad
mov [hd1_status],0
xor ebx,ebx
mov eax,ERROR_ACCESS_DENIED
ret
 
get_hd_info:
;-----------------------------------------------------------
; output : eax = 0 - ok
2953,7 → 2775,8
test byte [edi+11], 10h
jz .notfound
and dword [esp+12], 0
movzx eax, word [edi+26] ; cluster
mov eax, [edi+20-2]
mov ax, [edi+26] ; cluster
.fat32:
mov [esp+8], eax
mov dword [esp+4], fat_notroot_first
/kernel/trunk/fs/fs.inc
42,9 → 42,6
; eax = 4 ; makedir
; eax = 5 ; rename file/directory
; eax = 8 ; lba read
; eax = 12 ; get_filesize
; eax = 13 ; get_fileattr
; eax = 14 ; get_filedate
; eax = 15 ; get_disk_info
; eax = 16 ; start application
;
91,12 → 88,6
; Extract parameters
add eax, std_application_base_address ; abs start of info block
 
cmp dword [eax+0],12 ; Get file size
je fs_read
cmp dword [eax+0],13 ; Get file attribute
je fs_read
cmp dword [eax+0],14 ; Get file date/time
je fs_read
cmp dword [eax+0],15 ; GET_DISK_INFO
je fs_info
cmp dword [eax+0],16 ; RUN - dont care about read&write blocks
338,20 → 329,6
jmp file_system_return
 
fs_noramdisk_delete:
cmp dword [esp+20],12 ;GET TIME,DATE,SIZE AND ATTRS
jb fs_noramdisk_getinfo
cmp dword [esp+20],14
ja fs_noramdisk_getinfo
mov eax,[esp+4] ; fname
add eax,2*12+1
mov ebx,[esp+20]
mov ecx,[esp+0]
sub ecx,eax
add ecx,12+1 ; file name length
call rd_getfileinfo
jmp file_system_return
fs_noramdisk_getinfo: ;End of code - Mihasik
 
fs_noramdisk:
;********************************************************************
712,62 → 689,6
 
fs_noharddisk_rename:
 
cmp dword [esp+20],12 ; get FILESIZE
jne fs_noharddisk_get_filesize
 
mov eax,[esp+0] ; /fname
lea edi,[eax+12]
mov byte [eax],0 ; path to asciiz
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
sub edi,edx ; path length
 
call get_filesize
 
mov edi,[esp+0]
mov byte [edi],'/'
 
jmp file_system_return
 
fs_noharddisk_get_filesize:
 
cmp dword [esp+20],13 ; get FILEATTR
jne fs_noharddisk_get_fileattr
 
mov eax,[esp+0] ; /dirname
mov byte [eax],0 ; path to asciiz
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
 
call get_fileattr
 
mov edi,[esp+0]
mov byte [edi],'/'
 
jmp file_system_return
 
fs_noharddisk_get_fileattr:
 
cmp dword [esp+20],14 ; get FILEDATE
jne fs_noharddisk_get_filedate
 
mov eax,[esp+0] ; /dirname
mov byte [eax],0 ; path to asciiz
inc eax ; filename start
mov edx,[esp+4]
add edx,12*2 ; path start
 
call get_filedate
 
mov edi,[esp+0]
mov byte [edi],'/'
 
jmp file_system_return
 
fs_noharddisk_get_filedate:
 
cmp dword [esp+20],16 ; START APPLICATION
jne fs_noharddisk_start_application