Rev 6462 | Rev 6471 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6462 | Rev 6468 | ||
---|---|---|---|
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: 6462 $ |
8 | $Revision: 6468 $ |
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]+[[esp+4]] = name |
14 | ; esi -> path string |
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 1442... | Line 1442... | ||
1442 | mov byte [edi], 0 |
1442 | mov byte [edi], 0 |
1443 | inc edi |
1443 | inc edi |
1444 | pop esi |
1444 | pop esi |
1445 | .get_inode: |
1445 | .get_inode: |
1446 | push ebx edx |
1446 | push ebx edx |
1447 | stdcall findInode, 0 |
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]+[[esp+4]] = name |
1452 | ; in: esi -> path string |
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 1467... | Line 1467... | ||
1467 | rep movsb |
1467 | rep movsb |
1468 | pop ecx edi |
1468 | pop ecx edi |
1469 | xor eax, eax |
1469 | xor eax, eax |
1470 | xor dl, dl |
1470 | xor dl, dl |
1471 | mov esi, ROOT_INODE |
1471 | mov esi, ROOT_INODE |
1472 | ret 4 |
1472 | ret |
Line 1473... | Line 1473... | ||
1473 | 1473 | ||
1474 | .next_path_part: |
1474 | .next_path_part: |
1475 | push [edx+INODE.sectorsUsed] |
1475 | push [edx+INODE.sectorsUsed] |
1476 | xor ecx, ecx |
1476 | xor ecx, ecx |
Line 1532... | Line 1532... | ||
1532 | pop edx edi ecx |
1532 | pop edx edi ecx |
1533 | ; ebx -> matched directory entry, esi -> name without parent, or not changed |
1533 | ; ebx -> matched directory entry, esi -> name without parent, or not changed |
1534 | cmp edi, esi |
1534 | cmp edi, esi |
1535 | je .next_folder_block |
1535 | je .next_folder_block |
1536 | cmp byte [esi], 0 |
1536 | cmp byte [esi], 0 |
1537 | jnz @f |
- | |
1538 | cmp dword[esp+8], 0 |
- | |
1539 | je .get_inode_ret |
1537 | je .get_inode_ret |
1540 | mov esi, [esp+8] |
- | |
1541 | mov dword[esp+8], 0 |
- | |
1542 | @@: |
- | |
1543 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1538 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1544 | lea ebx, [ebp+EXTFS.mainInodeBuffer] |
1539 | lea ebx, [ebp+EXTFS.mainInodeBuffer] |
1545 | call readInode |
1540 | call readInode |
1546 | jc .error_get_inode |
1541 | jc .error_get_inode |
1547 | movzx eax, [ebx+INODE.accessMode] |
1542 | movzx eax, [ebx+INODE.accessMode] |
Line 1565... | Line 1560... | ||
1565 | mov dl, [ebx+DIRENTRY.name] |
1560 | mov dl, [ebx+DIRENTRY.name] |
1566 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1561 | mov eax, [ebx+DIRENTRY.inodeNumber] |
1567 | lea ebx, [ebp+EXTFS.mainInodeBuffer] |
1562 | lea ebx, [ebp+EXTFS.mainInodeBuffer] |
1568 | mov esi, eax |
1563 | mov esi, eax |
1569 | call readInode |
1564 | call readInode |
1570 | ret 4 |
1565 | ret |
Line 1571... | Line 1566... | ||
1571 | 1566 | ||
1572 | .not_found: |
1567 | .not_found: |
1573 | movi eax, ERROR_FILE_NOT_FOUND |
1568 | movi eax, ERROR_FILE_NOT_FOUND |
1574 | stc |
1569 | stc |
Line 1575... | Line 1570... | ||
1575 | ret 4 |
1570 | ret |
1576 | 1571 | ||
1577 | .error_get_block: |
1572 | .error_get_block: |
1578 | pop ebx |
1573 | pop ebx |
1579 | .error_get_inode: |
1574 | .error_get_inode: |
Line 1580... | Line 1575... | ||
1580 | pop ebx |
1575 | pop ebx |
1581 | ret 4 |
1576 | ret |
1582 | 1577 | ||
1583 | writeSuperblock: |
1578 | writeSuperblock: |
Line 1612... | Line 1607... | ||
1612 | ext_ReadFolder: |
1607 | ext_ReadFolder: |
1613 | call ext_lock |
1608 | call ext_lock |
1614 | cmp byte [esi], 0 |
1609 | cmp byte [esi], 0 |
1615 | jz .root_folder |
1610 | jz .root_folder |
1616 | push ebx |
1611 | push ebx |
1617 | stdcall findInode, [esp+4+4] |
1612 | call findInode |
1618 | pop ebx |
1613 | pop ebx |
1619 | jc .error_ret |
1614 | jc .error_ret |
1620 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1615 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1621 | test [esi+INODE.accessMode], DIRECTORY |
1616 | test [esi+INODE.accessMode], DIRECTORY |
1622 | jz .error_not_found |
1617 | jz .error_not_found |
Line 1799... | Line 1794... | ||
1799 | call ext_lock |
1794 | call ext_lock |
1800 | push ERROR_ACCESS_DENIED |
1795 | push ERROR_ACCESS_DENIED |
1801 | cmp byte [esi], 0 |
1796 | cmp byte [esi], 0 |
1802 | jz .error ; root |
1797 | jz .error ; root |
1803 | mov [esp], ebx |
1798 | mov [esp], ebx |
1804 | stdcall findInode, [esp+4+4] |
1799 | call findInode |
1805 | pop ebx |
1800 | pop ebx |
1806 | jc .error_eax |
1801 | jc .error_eax |
1807 | push ERROR_ACCESS_DENIED |
1802 | push ERROR_ACCESS_DENIED |
1808 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1803 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1809 | mov ax, [esi+INODE.accessMode] |
1804 | mov ax, [esi+INODE.accessMode] |
Line 1929... | Line 1924... | ||
1929 | call ext_lock |
1924 | call ext_lock |
1930 | mov edx, [ebx+16] |
1925 | mov edx, [ebx+16] |
1931 | cmp byte [esi], 0 |
1926 | cmp byte [esi], 0 |
1932 | jz .is_root |
1927 | jz .is_root |
1933 | push edx |
1928 | push edx |
1934 | stdcall findInode, [esp+4+4] |
1929 | call findInode |
1935 | mov ebx, edx |
1930 | mov ebx, edx |
1936 | pop edx |
1931 | pop edx |
1937 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1932 | lea esi, [ebp+EXTFS.mainInodeBuffer] |
1938 | jnc @f |
1933 | jnc @f |
1939 | push eax |
1934 | push eax |
Line 1980... | Line 1975... | ||
1980 | 1975 | ||
1981 | ;---------------------------------------------------------------- |
1976 | ;---------------------------------------------------------------- |
1982 | ext_SetFileInfo: |
1977 | ext_SetFileInfo: |
1983 | call extfsWritingInit |
1978 | call extfsWritingInit |
1984 | pushd [ebx+16] |
1979 | pushd [ebx+16] |
1985 | stdcall findInode, [esp+4+4] |
1980 | call findInode |
1986 | pop edx |
1981 | pop edx |
1987 | jc @f |
1982 | jc @f |
1988 | push esi ; inode number |
1983 | push esi ; inode number |
1989 | lea esi, [edx+16] |
1984 | lea esi, [edx+16] |
Line 2012... | Line 2007... | ||
2012 | 2007 | ||
2013 | ;---------------------------------------------------------------- |
2008 | ;---------------------------------------------------------------- |
2014 | ext_Delete: |
2009 | ext_Delete: |
2015 | call extfsWritingInit |
2010 | call extfsWritingInit |
2016 | push esi |
2011 | push esi |
2017 | stdcall findInode, [esp+4+4] |
2012 | call findInode |
2018 | mov ebx, esi |
2013 | mov ebx, esi |
2019 | pop esi |
2014 | pop esi |
2020 | push eax |
2015 | push eax |
2021 | jc .ret |
2016 | jc .ret |
Line 2214... | Line 2209... | ||
2214 | 2209 | ||
2215 | ;---------------------------------------------------------------- |
2210 | ;---------------------------------------------------------------- |
2216 | ext_CreateFolder: |
2211 | ext_CreateFolder: |
2217 | call extfsWritingInit |
2212 | call extfsWritingInit |
2218 | push esi |
2213 | push esi |
2219 | stdcall findInode, [esp+4+4] |
2214 | call findInode |
2220 | pop esi |
2215 | pop esi |
2221 | jnc .success ; exist |
2216 | jnc .success ; exist |
2222 | call findInode_parent |
2217 | call findInode_parent |
2223 | jc .error |
2218 | jc .error |
Line 2298... | Line 2293... | ||
2298 | 2293 | ||
2299 | ;---------------------------------------------------------------- |
2294 | ;---------------------------------------------------------------- |
2300 | ext_CreateFile: |
2295 | ext_CreateFile: |
2301 | call extfsWritingInit |
2296 | call extfsWritingInit |
2302 | push ebx esi |
2297 | push ebx esi |
2303 | stdcall findInode, [esp+8+4] |
2298 | call findInode |
2304 | mov esi, [esp] |
2299 | mov esi, [esp] |
2305 | jc @f |
2300 | jc @f |
2306 | call ext_unlock |
2301 | call ext_unlock |
2307 | stdcall ext_Delete, [esp+8+4] |
2302 | call ext_Delete |
2308 | mov [esp], eax |
2303 | push eax |
2309 | call ext_lock |
2304 | call ext_lock |
2310 | pop eax |
2305 | pop eax |
2311 | test eax, eax |
2306 | test eax, eax |
2312 | jnz .error |
2307 | jnz .error |
Line 2357... | Line 2352... | ||
2357 | 2352 | ||
2358 | ;---------------------------------------------------------------- |
2353 | ;---------------------------------------------------------------- |
2359 | ext_WriteFile: |
2354 | ext_WriteFile: |
2360 | call extfsWritingInit |
2355 | call extfsWritingInit |
2361 | push 0 ebx |
2356 | push 0 ebx |
2362 | stdcall findInode, [esp+8+4] |
2357 | call findInode |
2363 | jc .error |
2358 | jc .error |
2364 | lea edx, [ebp+EXTFS.mainInodeBuffer] |
2359 | lea edx, [ebp+EXTFS.mainInodeBuffer] |
2365 | movi eax, ERROR_ACCESS_DENIED |
2360 | movi eax, ERROR_ACCESS_DENIED |
2366 | test [edx+INODE.accessMode], FLAG_FILE |
2361 | test [edx+INODE.accessMode], FLAG_FILE |
Line 2480... | Line 2475... | ||
2480 | 2475 | ||
2481 | ;---------------------------------------------------------------- |
2476 | ;---------------------------------------------------------------- |
2482 | ext_SetFileEnd: |
2477 | ext_SetFileEnd: |
2483 | call extfsWritingInit |
2478 | call extfsWritingInit |
2484 | pushd [ebx+4] |
2479 | pushd [ebx+4] |
2485 | stdcall findInode, [esp+4+4] |
2480 | call findInode |
2486 | pop ecx |
2481 | pop ecx |
2487 | jc @f |
2482 | jc @f |
2488 | lea edx, [ebp+EXTFS.mainInodeBuffer] |
2483 | lea edx, [ebp+EXTFS.mainInodeBuffer] |
2489 | movi eax, ERROR_ACCESS_DENIED |
2484 | movi eax, ERROR_ACCESS_DENIED |