ext fs: sysfunction 70.10 support

git-svn-id: svn://kolibrios.org@6933 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2017-07-09 08:28:00 +00:00
parent 64b9d3d941
commit ed0c1f6d3a

View File

@ -29,6 +29,7 @@ ext_user_functions:
dd 0 dd 0
dd ext_Delete dd ext_Delete
dd ext_CreateFolder dd ext_CreateFolder
dd ext_Rename
ext_user_functions_end: ext_user_functions_end:
endg endg
@ -1514,21 +1515,11 @@ linkInode:
mov eax, [esp] mov eax, [esp]
mov [edi+DIRENTRY.fileType], al mov [edi+DIRENTRY.fileType], al
@@: @@:
push ebx
add edi, 8 add edi, 8
rep movsb rep movsb
mov eax, edx mov eax, edx
mov ebx, [ebp+EXTFS.tempBlockBuffer] mov ebx, [ebp+EXTFS.tempBlockBuffer]
call extfsWriteBlock call extfsWriteBlock
mov eax, [esp]
lea ebx, [ebp+EXTFS.inodeBuffer]
call readInode
jc .error_block_write
pop eax
inc [ebx+INODE.linksCount]
call writeInode
jc @f
xor eax, eax
@@: @@:
pop edx ecx ecx ebx edi esi pop edx ecx ecx ebx edi esi
ret ret
@ -1538,9 +1529,7 @@ linkInode:
.error_get_inode_block: .error_get_inode_block:
pop ebx ebx pop ebx ebx
.error_inode_read: .error_inode_read:
pop ebx ebx pop ebx ebx ebx
.error_block_write:
pop ebx
jmp @b jmp @b
unlinkInode: unlinkInode:
@ -2340,6 +2329,7 @@ ext_CreateFolder:
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 511 mov [ebx+INODE.accessMode], DIRECTORY or 511
mov byte [ebx+INODE.linksCount], 2
mov eax, edx mov eax, edx
call writeInode call writeInode
jc .error jc .error
@ -2362,11 +2352,20 @@ ext_CreateFolder:
pop esi edx pop esi edx
jc .error jc .error
; link parent to child ; link parent to child
push esi
mov eax, esi mov eax, esi
mov ebx, edx mov ebx, edx
mov esi, edi mov esi, edi
mov dl, DIR_DIRECTORY mov dl, DIR_DIRECTORY
call linkInode call linkInode
pop edx
jc .error
push ebx
lea ebx, [ebp+EXTFS.inodeBuffer]
inc [ebx+INODE.linksCount]
mov eax, edx
call writeInode
pop ebx
jc .error jc .error
mov eax, ebx mov eax, ebx
dec eax dec eax
@ -2414,6 +2413,7 @@ ext_CreateFile:
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 110110110b mov [ebx+INODE.accessMode], FLAG_FILE or 110110110b
mov byte [ebx+INODE.linksCount], 1
mov eax, edx mov eax, edx
call writeInode call writeInode
jc .error2 jc .error2
@ -2424,6 +2424,10 @@ ext_CreateFile:
mov dl, DIR_FLAG_FILE mov dl, DIR_FLAG_FILE
call linkInode call linkInode
jc .error2 jc .error2
mov eax, ebx
lea ebx, [ebp+EXTFS.inodeBuffer]
call readInode
jc .error2
pop esi ebx pop esi ebx
mov eax, [ebx+12] mov eax, [ebx+12]
xor edx, edx xor edx, edx
@ -2642,3 +2646,63 @@ ext_SetFileEnd:
call ext_unlock call ext_unlock
pop eax pop eax
ret ret
;----------------------------------------------------------------
ext_Rename:
call extfsWritingInit
push esi
mov esi, edi
call findInode
jnc .error
test edi, edi
jz .error
xchg [esp], esi
push edi
call findInode
pop edi
jc .error
xor edx, edx
inc edx
test [ebp+EXTFS.inodeBuffer.accessMode], DIRECTORY
jz @f
inc edx
@@:
mov eax, ecx
push ecx edx
call unlinkInode
pop edx ecx
jc .error
cmp edx, 1
jz @f
lea ebx, [ebp+EXTFS.inodeBuffer]
dec [ebx+INODE.linksCount]
mov eax, ecx
call writeInode
jc .error
@@:
mov ebx, esi
mov esi, edi
pop eax
push eax edx
call linkInode
pop edx
jc .error
pop eax
cmp edx, 1
jz @f
lea ebx, [ebp+EXTFS.inodeBuffer]
inc [ebx+INODE.linksCount]
call writeInode
@@:
call writeSuperblock
mov esi, [ebp+PARTITION.Disk]
call disk_sync
call ext_unlock
xor eax, eax
ret
.error:
push eax
call ext_unlock
pop eax ebx
ret