From b429107fec3755ec21a2713928725493a590549b Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Tue, 20 Jun 2006 12:13:17 +0000 Subject: [PATCH] File system: deleted 58.12,13,14; fixed small bug in fat32.inc git-svn-id: svn://kolibrios.org@88 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/rd.inc | 35 ------- kernel/trunk/fs/fat32.inc | 181 +------------------------------------ kernel/trunk/fs/fs.inc | 79 ---------------- 3 files changed, 2 insertions(+), 293 deletions(-) diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index ee17cdffd..4c97bf0f6 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -475,41 +475,6 @@ mov [edi+22],ax ; time rd_ff: ret - rd_getfileinfo: - ;get date, time, size or attributes of file - ;IN: eax - pointer to file, ebx - type of function: 12-get filesize, 13-get fileattr, 14-get filedate - ;ecx - filelengh 0=root - ;OUT: eax=0 - Ok or 5 - file not found ebx - date/time, size or attributes - test ecx,ecx - jnz no_getfinfo_root - mov eax,5 ;if root - fnf - xor ebx,ebx - dec ebx - ret - no_getfinfo_root: ;if not root - sub esp,32 - call expand_filename - call rd_findfile - je fifoundi - add esp,32 ;if file not found - ret - fifoundi: - cmp ebx,13 - jne no_rd_attr - movzx ebx,byte [edi] ;get attributes - jmp rd_getfileinfo_end - no_rd_attr: - cmp ebx,14 - jne no_rd_date - mov ebx,dword [edi+11] ;get date/time - jmp rd_getfileinfo_end - no_rd_date: - mov ebx,dword [edi+17] ;get size - rd_getfileinfo_end: - xor eax,eax - add esp,32 - ret - ; \begin{diamond} uni2ansi_str: diff --git a/kernel/trunk/fs/fat32.inc b/kernel/trunk/fs/fat32.inc index d50d22dac..d74ef2510 100644 --- a/kernel/trunk/fs/fat32.inc +++ b/kernel/trunk/fs/fat32.inc @@ -2208,184 +2208,6 @@ change_2dot_cluster: 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 @@ hd_find_lfn: 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 diff --git a/kernel/trunk/fs/fs.inc b/kernel/trunk/fs/fs.inc index 1f4ec1b9b..dc1eb8689 100644 --- a/kernel/trunk/fs/fs.inc +++ b/kernel/trunk/fs/fs.inc @@ -42,9 +42,6 @@ file_system: ; 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 @@ file_system: ; 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 @@ endg 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 @@ hd_err_return: 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