fixes for ext fs

git-svn-id: svn://kolibrios.org@6852 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2017-02-02 05:47:15 +00:00
parent 88bb295c51
commit f1c9b0ad0f

View File

@ -157,7 +157,6 @@ READ_ONLY_SUPPORT = 3
struct EXTFS PARTITION struct EXTFS PARTITION
Lock MUTEX Lock MUTEX
mountType dd ? mountType dd ?
sectorsPerBlockLog dd ? ; shift for 512
bytesPerBlock dd ? bytesPerBlock dd ?
sectorsPerBlock dd ? sectorsPerBlock dd ?
dwordsPerBlock dd ? dwordsPerBlock dd ?
@ -199,7 +198,7 @@ ext2_create_partition:
jnz .fail jnz .fail
cmp [ebx+SUPERBLOCK.sectorsPerBlockLog], 6 ; 64KB cmp [ebx+SUPERBLOCK.sectorsPerBlockLog], 6 ; 64KB
ja .fail ja .fail
cmp [ebx+SUPERBLOCK.inodeSize], 1024 cmp [ebx+SUPERBLOCK.inodeSize], 512
ja .fail ja .fail
cmp [ebx+SUPERBLOCK.blocksPerGroup], 0 cmp [ebx+SUPERBLOCK.blocksPerGroup], 0
je .fail je .fail
@ -231,7 +230,6 @@ ext2_create_partition:
rep movsd ; copy superblock rep movsd ; copy superblock
mov ecx, [ebx+SUPERBLOCK.sectorsPerBlockLog] mov ecx, [ebx+SUPERBLOCK.sectorsPerBlockLog]
inc ecx inc ecx
mov [ebp+EXTFS.sectorsPerBlockLog], ecx
mov eax, 1 mov eax, 1
shl eax, cl shl eax, cl
mov [ebp+EXTFS.sectorsPerBlock], eax mov [ebp+EXTFS.sectorsPerBlock], eax
@ -818,11 +816,10 @@ writeInode:
jnz @f jnz @f
movzx ecx, [ebp+EXTFS.superblock.inodeSize] movzx ecx, [ebp+EXTFS.superblock.inodeSize]
mov esi, edi mov esi, edi
mov edi, [ebp+EXTFS.rootInodeBuffer] lea edi, [ebp+EXTFS.rootInodeBuffer]
rep movsb rep movsb
@@: @@:
call getInodeLocation call getInodeLocation
jc .ret
mov ebx, [ebp+EXTFS.tempBlockBuffer] mov ebx, [ebp+EXTFS.tempBlockBuffer]
mov ecx, eax mov ecx, eax
call fs_read32_sys call fs_read32_sys
@ -849,7 +846,6 @@ readInode:
push edx edi esi ecx ebx push edx edi esi ecx ebx
mov edi, ebx mov edi, ebx
call getInodeLocation call getInodeLocation
jc @f
mov ebx, [ebp+EXTFS.tempBlockBuffer] mov ebx, [ebp+EXTFS.tempBlockBuffer]
call fs_read32_sys call fs_read32_sys
test eax, eax test eax, eax
@ -859,7 +855,6 @@ readInode:
add esi, ebx add esi, ebx
rep movsb rep movsb
xor eax, eax xor eax, eax
@@:
pop ebx ecx esi edi edx pop ebx ecx esi edi edx
ret ret
@ -1424,10 +1419,9 @@ linkInode:
mov ebx, esi mov ebx, esi
call readInode call readInode
jc .error_inode_read jc .error_inode_read
mov ecx, [ebp+EXTFS.sectorsPerBlockLog]
add ecx, 9
mov eax, [esi+INODE.fileSize] mov eax, [esi+INODE.fileSize]
shr eax, cl xor edx, edx
div [ebp+EXTFS.bytesPerBlock]
xor ecx, ecx xor ecx, ecx
.searchBlock: .searchBlock:
push eax ; blocks total push eax ; blocks total
@ -2312,16 +2306,15 @@ ext_CreateFolder:
call extfsInodeAlloc call extfsInodeAlloc
jc .error jc .error
push ebx esi edi push ebx esi edi
xor al, al
lea edi, [ebp+EXTFS.inodeBuffer] lea edi, [ebp+EXTFS.inodeBuffer]
movzx ecx, [ebp+EXTFS.superblock.inodeSize] movzx ecx, [ebp+EXTFS.superblock.inodeSize]
xor eax, eax
rep stosb rep stosb
lea edi, [ebp+EXTFS.inodeBuffer]
call fsGetTime call fsGetTime
add eax, 978307200 add eax, 978307200
mov [edi+INODE.accessedTime], eax lea ebx, [ebp+EXTFS.inodeBuffer]
mov [edi+INODE.dataModified], eax mov [ebx+INODE.accessedTime], eax
mov ebx, edi mov [ebx+INODE.dataModified], eax
pop edi esi edx pop edi esi edx
; edx = allocated inode number, edi -> filename, esi = parent inode number ; edx = allocated inode number, edi -> filename, esi = parent inode number
mov [ebx+INODE.accessMode], DIRECTORY or PERMISSIONS mov [ebx+INODE.accessMode], DIRECTORY or PERMISSIONS
@ -2387,16 +2380,15 @@ ext_CreateFile:
call extfsInodeAlloc call extfsInodeAlloc
jc .error jc .error
push ebx ebx esi edi push ebx ebx esi edi
xor al, al
lea edi, [ebp+EXTFS.inodeBuffer] lea edi, [ebp+EXTFS.inodeBuffer]
movzx ecx, [ebp+EXTFS.superblock.inodeSize] movzx ecx, [ebp+EXTFS.superblock.inodeSize]
xor eax, eax
rep stosb rep stosb
lea edi, [ebp+EXTFS.inodeBuffer]
call fsGetTime call fsGetTime
add eax, 978307200 add eax, 978307200
mov [edi+INODE.accessedTime], eax lea ebx, [ebp+EXTFS.inodeBuffer]
mov [edi+INODE.dataModified], eax mov [ebx+INODE.accessedTime], eax
mov ebx, edi mov [ebx+INODE.dataModified], eax
pop edi esi edx pop edi esi edx
; edx = allocated inode number, edi -> filename, esi = parent inode number ; edx = allocated inode number, edi -> filename, esi = parent inode number
mov [ebx+INODE.accessMode], FLAG_FILE or PERMISSIONS mov [ebx+INODE.accessMode], FLAG_FILE or PERMISSIONS