Rev 6468 | Rev 6522 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6468 | Rev 6471 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2013-2016. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2013-2016. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
4 | ;; Distributed under terms of the GNU General Public License. ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 6468 $ |
8 | $Revision: 6471 $ |
9 | 9 | ||
10 | ; EXT external functions |
10 | ; EXT external functions |
11 | ; in: |
11 | ; in: |
12 | ; ebx -> parameter structure of sysfunc 70 |
12 | ; ebx -> parameter structure of sysfunc 70 |
13 | ; ebp -> EXTFS structure |
13 | ; ebp -> EXTFS structure |
14 | ; esi -> path string |
14 | ; esi -> path string in UTF-8 |
15 | ; out: |
15 | ; out: |
16 | ; eax, ebx = return values for sysfunc 70 |
16 | ; eax, ebx = return values for sysfunc 70 |
17 | iglobal |
17 | iglobal |
Line 191... | Line 191... | ||
191 | test eax, eax |
191 | test eax, eax |
192 | jnz .fail |
192 | jnz .fail |
193 | cmp [ebx+SUPERBLOCK.magic], 0xEF53 |
193 | cmp [ebx+SUPERBLOCK.magic], 0xEF53 |
194 | jne .fail |
194 | jne .fail |
195 | cmp [ebx+SUPERBLOCK.state], 1 |
195 | cmp [ebx+SUPERBLOCK.state], 1 |
196 | jne .fail |
196 | ja .fail |
197 | test [ebx+SUPERBLOCK.incompatibleFlags], not INCOMPATIBLE_SUPPORT |
197 | test [ebx+SUPERBLOCK.incompatibleFlags], not INCOMPATIBLE_SUPPORT |
198 | jnz .fail |
198 | jnz .fail |
199 | cmp [ebx+SUPERBLOCK.sectorsPerBlockLog], 6 ; 64KB |
199 | cmp [ebx+SUPERBLOCK.sectorsPerBlockLog], 6 ; 64KB |
200 | ja .fail |
200 | ja .fail |
201 | cmp [ebx+SUPERBLOCK.inodeSize], 1024 |
201 | cmp [ebx+SUPERBLOCK.inodeSize], 1024 |
Line 1174... | Line 1174... | ||
1174 | 1174 | ||
1175 | linkInode: |
1175 | linkInode: |
1176 | ; in: |
1176 | ; in: |
1177 | ; eax = inode on which to link |
1177 | ; eax = inode on which to link |
1178 | ; ebx = inode to link |
1178 | ; ebx = inode to link |
1179 | ; esi -> name |
1179 | ; esi -> name in UTF-8 |
1180 | ; dl = file type |
1180 | ; dl = file type |
1181 | push esi edi ebx ecx eax edx |
1181 | push esi edi ebx ecx eax edx |
1182 | call strlen |
1182 | call strlen |
1183 | add ecx, 8 ; directory entry size |
1183 | add ecx, 8 ; directory entry size |
Line 1412... | Line 1412... | ||
1412 | @@: |
1412 | @@: |
1413 | pop ebx edi esi edx |
1413 | pop ebx edi esi edx |
1414 | ret |
1414 | ret |
Line 1415... | Line 1415... | ||
1415 | 1415 | ||
1416 | findInode_parent: |
1416 | findInode_parent: |
1417 | ; in: esi -> path |
1417 | ; in: esi -> path string in UTF-8 |
1418 | ; out: |
1418 | ; out: |
1419 | ; edi -> file name |
1419 | ; edi -> file name in UTF-8 |
1420 | ; esi = inode |
1420 | ; esi = inode |
1421 | push esi |
1421 | push esi |
1422 | xor edi, edi |
1422 | xor edi, edi |
1423 | .loop: |
1423 | .loop: |
Line 1447... | Line 1447... | ||
1447 | call findInode |
1447 | call findInode |
1448 | pop edx ebx |
1448 | pop edx ebx |
1449 | ret |
1449 | ret |
Line 1450... | Line 1450... | ||
1450 | 1450 | ||
1451 | findInode: |
1451 | findInode: |
1452 | ; in: esi -> path string |
1452 | ; in: esi -> path string in UTF-8 |
1453 | ; out: |
1453 | ; out: |
1454 | ; [ebp+EXTFS.mainInodeBuffer] = inode |
1454 | ; [ebp+EXTFS.mainInodeBuffer] = inode |
1455 | ; esi = inode number |
1455 | ; esi = inode number |
1456 | ; dl = first byte of file/folder name |
1456 | ; dl = first byte of file/folder name |
Line 1483... | Line 1483... | ||
1483 | mov eax, ecx |
1483 | mov eax, ecx |
1484 | mov ebx, [ebp+EXTFS.mainBlockBuffer] |
1484 | mov ebx, [ebp+EXTFS.mainBlockBuffer] |
1485 | call extfsReadBlock |
1485 | call extfsReadBlock |
1486 | jc .error_get_block |
1486 | jc .error_get_block |
1487 | push esi edx |
1487 | push esi edx |
1488 | sub esp, 256 |
- | |
1489 | mov edx, ebx |
1488 | mov edx, ebx |
1490 | add edx, [ebp+EXTFS.bytesPerBlock] |
1489 | add edx, [ebp+EXTFS.bytesPerBlock] |
1491 | .start_rec: |
1490 | .start_rec: |
1492 | cmp [ebx+DIRENTRY.inodeNumber], 0 |
1491 | cmp [ebx+DIRENTRY.inodeNumber], 0 |
1493 | jz .next_rec |
1492 | jz .next_rec |
1494 | mov edi, esp |
- | |
1495 | push esi |
1493 | push esi |
1496 | movzx ecx, [ebx+DIRENTRY.nameLength] |
1494 | movzx ecx, [ebx+DIRENTRY.nameLength] |
1497 | lea esi, [ebx+DIRENTRY.name] |
1495 | lea edi, [ebx+DIRENTRY.name] |
1498 | call utf8_to_cp866 |
- | |
1499 | mov ecx, edi |
1496 | repz cmpsb |
1500 | lea edi, [esp+4] |
- | |
1501 | sub ecx, edi ; number of bytes in resulting string |
- | |
1502 | mov esi, [esp] |
- | |
1503 | @@: ; edi -> converted string in stack, ecx = size, esi -> original file path |
- | |
1504 | jecxz .test_find |
1497 | jz .test_find |
1505 | dec ecx |
- | |
1506 | lodsb |
- | |
1507 | call char_toupper |
- | |
1508 | mov ah, [edi] |
- | |
1509 | inc edi |
- | |
1510 | xchg al, ah |
- | |
1511 | call char_toupper |
- | |
1512 | cmp al, ah |
- | |
1513 | je @b |
- | |
1514 | @@: ; doesn't match |
1498 | @@: ; doesn't match |
1515 | pop esi |
1499 | pop esi |
1516 | .next_rec: |
1500 | .next_rec: |
1517 | movzx eax, [ebx+DIRENTRY.entryLength] |
1501 | movzx eax, [ebx+DIRENTRY.entryLength] |
1518 | add ebx, eax |
1502 | add ebx, eax |
Line 1526... | Line 1510... | ||
1526 | je @f |
1510 | je @f |
1527 | cmp byte [esi], '/' |
1511 | cmp byte [esi], '/' |
1528 | jne @b |
1512 | jne @b |
1529 | inc esi |
1513 | inc esi |
1530 | @@: |
1514 | @@: |
1531 | add esp, 256+4 |
- | |
1532 | pop edx edi ecx |
1515 | pop edx edx edi ecx |
1533 | ; ebx -> matched directory entry, esi -> name without parent, or not changed |
1516 | ; ebx -> matched directory entry, esi -> name without parent, or not changed |
1534 | cmp edi, esi |
1517 | cmp edi, esi |
1535 | je .next_folder_block |
1518 | je .next_folder_block |
1536 | cmp byte [esi], 0 |
1519 | cmp byte [esi], 0 |
1537 | je .get_inode_ret |
1520 | je .get_inode_ret |
Line 1695... | Line 1678... | ||
1695 | cmp [ebx+DIRENTRY.inodeNumber], 0 |
1678 | cmp [ebx+DIRENTRY.inodeNumber], 0 |
1696 | jz .empty_rec |
1679 | jz .empty_rec |
1697 | inc dword [edi+8] |
1680 | inc dword [edi+8] |
1698 | inc dword [edi+4] |
1681 | inc dword [edi+4] |
1699 | push ebx edi ecx esi edx |
1682 | push ebx edi ecx esi edx |
- | 1683 | pushd [edi+12] |
|
1700 | mov edi, edx |
1684 | mov edi, edx |
1701 | xor eax, eax |
1685 | xor eax, eax |
1702 | mov ecx, 40 / 4 |
1686 | mov ecx, 40 / 4 |
1703 | rep stosd |
1687 | rep stosd |
- | 1688 | popd [edx+4] |
|
1704 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1689 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1705 | lea ebx, [ebp+EXTFS.tempInodeBuffer] |
1690 | lea ebx, [ebp+EXTFS.tempInodeBuffer] |
1706 | call readInode |
1691 | call readInode |
1707 | jc .error_read_subinode |
1692 | jc .error_read_subinode |
1708 | mov esi, ebx |
1693 | mov esi, ebx |
Line 1728... | Line 1713... | ||
1728 | mov eax, [esi+INODE.fileSizeHigh] |
1713 | mov eax, [esi+INODE.fileSizeHigh] |
1729 | stosd |
1714 | stosd |
1730 | @@: |
1715 | @@: |
1731 | mov esi, [esp+12] |
1716 | mov esi, [esp+12] |
1732 | movzx ecx, [esi+DIRENTRY.nameLength] |
1717 | movzx ecx, [esi+DIRENTRY.nameLength] |
1733 | lea edi, [edx+40] |
- | |
1734 | lea esi, [esi+DIRENTRY.name] |
1718 | lea esi, [esi+DIRENTRY.name] |
- | 1719 | add ecx, esi |
|
- | 1720 | cmp byte [esi], '.' |
|
- | 1721 | jnz @f |
|
- | 1722 | or byte [edx], KOS_HIDDEN |
|
- | 1723 | @@: |
|
- | 1724 | lea edi, [edx+40] |
|
- | 1725 | cmp byte [edx+4], 1 |
|
- | 1726 | jz .utf16 |
|
- | 1727 | @@: |
|
1735 | call utf8_to_cp866 |
1728 | call utf8to16 |
- | 1729 | call uni2ansi_char |
|
- | 1730 | stosb |
|
- | 1731 | cmp esi, ecx |
|
- | 1732 | jc @b |
|
1736 | and byte [edi], 0 |
1733 | and byte [edi], 0 |
1737 | pop esi ecx edi ebx |
1734 | add edx, 40+264 |
1738 | cmp byte [edx+40], '.' |
- | |
1739 | jne @f |
- | |
1740 | or dword [edx], KOS_HIDDEN |
- | |
1741 | @@: |
1735 | @@: |
1742 | add edx, 40+264 ; go to the next record |
1736 | pop esi ecx edi ebx |
1743 | dec ecx |
1737 | dec ecx |
1744 | .empty_rec: |
1738 | .empty_rec: |
1745 | movzx eax, [ebx+DIRENTRY.entryLength] |
1739 | movzx eax, [ebx+DIRENTRY.entryLength] |
1746 | cmp eax, 12 |
1740 | cmp eax, 12 |
1747 | jb .error_bad_len |
1741 | jb .error_bad_len |
Line 1752... | Line 1746... | ||
1752 | cmp ebx, [edi+24] |
1746 | cmp ebx, [edi+24] |
1753 | jb .wanted_start |
1747 | jb .wanted_start |
1754 | push .wanted_start |
1748 | push .wanted_start |
1755 | jmp .end_block |
1749 | jmp .end_block |
Line -... | Line 1750... | ||
- | 1750 | ||
- | 1751 | .utf16: |
|
- | 1752 | call utf8to16 |
|
- | 1753 | stosw |
|
- | 1754 | cmp esi, ecx |
|
- | 1755 | jc .utf16 |
|
- | 1756 | and word [edi], 0 |
|
- | 1757 | add edx, 40+520 |
|
- | 1758 | jmp @b |
|
1756 | 1759 | ||
1757 | .end_dir: |
1760 | .end_dir: |
1758 | call ext_unlock |
1761 | call ext_unlock |
1759 | mov edx, [edi+28] |
1762 | mov edx, [edi+28] |
1760 | mov ebx, [edi+8] |
1763 | mov ebx, [edi+8] |