From 6beb99fc30bfe82115a35b82a61f3c2943d99962 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Fri, 9 Jul 2021 03:20:12 +0000 Subject: [PATCH] kernel: Implement sf70.5 for default FS stub Only get partition size, not its label. Information of a block device and FS on it should be reported by different system calls. git-svn-id: svn://kolibrios.org@9043 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/disk.inc | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/kernel/trunk/blkdev/disk.inc b/kernel/trunk/blkdev/disk.inc index 03bccc899b..5771eab7eb 100644 --- a/kernel/trunk/blkdev/disk.inc +++ b/kernel/trunk/blkdev/disk.inc @@ -1288,9 +1288,48 @@ iglobal align 4 default_fs_functions: dd free - dd 0 ; no user functions + dd (default_fs_functions_end - default_fs_functions - 4) / 4 + dd 0 + dd 0 + dd 0 + dd 0 + dd 0 + dd default_fs_get_file_info +default_fs_functions_end: endg +proc default_fs_get_file_info uses edi + movi eax, ERROR_UNSUPPORTED_FS + cmp byte[esi], 0 + jnz .done + movi ecx, 40 ; len of BDFE without filename + cmp [ebx+f70s5arg.xflags], 0 + jz @f + add ecx, 2 ; volume label requested, space for utf16 terminator +@@: + mov ebx, [ebx+f70s5arg.buf] + stdcall is_region_userspace, ebx, ecx + movi eax, ERROR_MEMORY_POINTER + jz .done + mov edi, ebx + xor eax, eax + rep stosb + mov [ebx+bdfe.attr], 0x10 ; directory flag + mov word[ebx+bdfe.name], 0 ; word because of possible utf16 + mov eax, dword[ebp+PARTITION.Length+DQ.lo] + mov edx, dword[ebp+PARTITION.Length+DQ.hi] + mov ecx, [ebp+PARTITION.Disk] + mov ecx, [ecx+DISK.MediaInfo.SectorSize] + bsf ecx, ecx + shld edx, eax, cl + shl eax, cl + mov [ebx+bdfe.size.lo], eax + mov [ebx+bdfe.size.hi], edx + xor eax, eax +.done: + ret +endp + ; 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. @@ -1476,6 +1515,8 @@ dyndisk_handler: mov ecx, [ebx] cmp [edi+4], ecx jbe .unsupported + cmp dword[edi+8+ecx*4], 0 ; user function not implemented + jz .unsupported pushd edx ebp eax [edi+8+ecx*4] cmp ecx, 10 jnz .callFS