Rev 6880 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6880 | Rev 6933 | ||
---|---|---|---|
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: 6880 $ |
8 | $Revision: 6933 $ |
9 | 9 | ||
10 | ; EXT external functions |
10 | ; EXT external functions |
11 | ; in: |
11 | ; in: |
Line 27... | Line 27... | ||
27 | dd ext_GetFileInfo |
27 | dd ext_GetFileInfo |
28 | dd ext_SetFileInfo |
28 | dd ext_SetFileInfo |
29 | dd 0 |
29 | dd 0 |
30 | dd ext_Delete |
30 | dd ext_Delete |
31 | dd ext_CreateFolder |
31 | dd ext_CreateFolder |
- | 32 | dd ext_Rename |
|
32 | ext_user_functions_end: |
33 | ext_user_functions_end: |
33 | endg |
34 | endg |
Line 34... | Line 35... | ||
34 | 35 | ||
35 | struct DIRENTRY |
36 | struct DIRENTRY |
Line 1512... | Line 1513... | ||
1512 | test [ebp+EXTFS.superblock.incompatibleFlags], 2 |
1513 | test [ebp+EXTFS.superblock.incompatibleFlags], 2 |
1513 | jz @f |
1514 | jz @f |
1514 | mov eax, [esp] |
1515 | mov eax, [esp] |
1515 | mov [edi+DIRENTRY.fileType], al |
1516 | mov [edi+DIRENTRY.fileType], al |
1516 | @@: |
1517 | @@: |
1517 | push ebx |
- | |
1518 | add edi, 8 |
1518 | add edi, 8 |
1519 | rep movsb |
1519 | rep movsb |
1520 | mov eax, edx |
1520 | mov eax, edx |
1521 | mov ebx, [ebp+EXTFS.tempBlockBuffer] |
1521 | mov ebx, [ebp+EXTFS.tempBlockBuffer] |
1522 | call extfsWriteBlock |
1522 | call extfsWriteBlock |
1523 | mov eax, [esp] |
- | |
1524 | lea ebx, [ebp+EXTFS.inodeBuffer] |
- | |
1525 | call readInode |
- | |
1526 | jc .error_block_write |
- | |
1527 | pop eax |
- | |
1528 | inc [ebx+INODE.linksCount] |
- | |
1529 | call writeInode |
- | |
1530 | jc @f |
- | |
1531 | xor eax, eax |
- | |
1532 | @@: |
1523 | @@: |
1533 | pop edx ecx ecx ebx edi esi |
1524 | pop edx ecx ecx ebx edi esi |
1534 | ret |
1525 | ret |
Line 1535... | Line 1526... | ||
1535 | 1526 | ||
1536 | .error_block_read: |
1527 | .error_block_read: |
1537 | pop ebx |
1528 | pop ebx |
1538 | .error_get_inode_block: |
1529 | .error_get_inode_block: |
1539 | pop ebx ebx |
1530 | pop ebx ebx |
1540 | .error_inode_read: |
1531 | .error_inode_read: |
1541 | pop ebx ebx |
- | |
1542 | .error_block_write: |
- | |
1543 | pop ebx |
1532 | pop ebx ebx ebx |
Line 1544... | Line 1533... | ||
1544 | jmp @b |
1533 | jmp @b |
1545 | 1534 | ||
1546 | unlinkInode: |
1535 | unlinkInode: |
Line 2338... | Line 2327... | ||
2338 | mov [ebx+INODE.accessedTime], eax |
2327 | mov [ebx+INODE.accessedTime], eax |
2339 | mov [ebx+INODE.dataModified], eax |
2328 | mov [ebx+INODE.dataModified], eax |
2340 | pop edi esi edx |
2329 | pop edi esi edx |
2341 | ; edx = allocated inode number, edi -> filename, esi = parent inode number |
2330 | ; edx = allocated inode number, edi -> filename, esi = parent inode number |
2342 | mov [ebx+INODE.accessMode], DIRECTORY or 511 |
2331 | mov [ebx+INODE.accessMode], DIRECTORY or 511 |
- | 2332 | mov byte [ebx+INODE.linksCount], 2 |
|
2343 | mov eax, edx |
2333 | mov eax, edx |
2344 | call writeInode |
2334 | call writeInode |
2345 | jc .error |
2335 | jc .error |
2346 | ; link to self |
2336 | ; link to self |
2347 | push edx esi |
2337 | push edx esi |
Line 2360... | Line 2350... | ||
2360 | mov esi, parent_link |
2350 | mov esi, parent_link |
2361 | call linkInode |
2351 | call linkInode |
2362 | pop esi edx |
2352 | pop esi edx |
2363 | jc .error |
2353 | jc .error |
2364 | ; link parent to child |
2354 | ; link parent to child |
- | 2355 | push esi |
|
2365 | mov eax, esi |
2356 | mov eax, esi |
2366 | mov ebx, edx |
2357 | mov ebx, edx |
2367 | mov esi, edi |
2358 | mov esi, edi |
2368 | mov dl, DIR_DIRECTORY |
2359 | mov dl, DIR_DIRECTORY |
2369 | call linkInode |
2360 | call linkInode |
- | 2361 | pop edx |
|
- | 2362 | jc .error |
|
- | 2363 | push ebx |
|
- | 2364 | lea ebx, [ebp+EXTFS.inodeBuffer] |
|
- | 2365 | inc [ebx+INODE.linksCount] |
|
- | 2366 | mov eax, edx |
|
- | 2367 | call writeInode |
|
- | 2368 | pop ebx |
|
2370 | jc .error |
2369 | jc .error |
2371 | mov eax, ebx |
2370 | mov eax, ebx |
2372 | dec eax |
2371 | dec eax |
2373 | xor edx, edx |
2372 | xor edx, edx |
2374 | div [ebp+EXTFS.superblock.inodesPerGroup] |
2373 | div [ebp+EXTFS.superblock.inodesPerGroup] |
Line 2412... | Line 2411... | ||
2412 | mov [ebx+INODE.accessedTime], eax |
2411 | mov [ebx+INODE.accessedTime], eax |
2413 | mov [ebx+INODE.dataModified], eax |
2412 | mov [ebx+INODE.dataModified], eax |
2414 | pop edi esi edx |
2413 | pop edi esi edx |
2415 | ; edx = allocated inode number, edi -> filename, esi = parent inode number |
2414 | ; edx = allocated inode number, edi -> filename, esi = parent inode number |
2416 | mov [ebx+INODE.accessMode], FLAG_FILE or 110110110b |
2415 | mov [ebx+INODE.accessMode], FLAG_FILE or 110110110b |
- | 2416 | mov byte [ebx+INODE.linksCount], 1 |
|
2417 | mov eax, edx |
2417 | mov eax, edx |
2418 | call writeInode |
2418 | call writeInode |
2419 | jc .error2 |
2419 | jc .error2 |
2420 | ; link parent to child |
2420 | ; link parent to child |
2421 | mov eax, esi |
2421 | mov eax, esi |
2422 | mov ebx, edx |
2422 | mov ebx, edx |
2423 | mov esi, edi |
2423 | mov esi, edi |
2424 | mov dl, DIR_FLAG_FILE |
2424 | mov dl, DIR_FLAG_FILE |
2425 | call linkInode |
2425 | call linkInode |
2426 | jc .error2 |
2426 | jc .error2 |
- | 2427 | mov eax, ebx |
|
- | 2428 | lea ebx, [ebp+EXTFS.inodeBuffer] |
|
- | 2429 | call readInode |
|
- | 2430 | jc .error2 |
|
2427 | pop esi ebx |
2431 | pop esi ebx |
2428 | mov eax, [ebx+12] |
2432 | mov eax, [ebx+12] |
2429 | xor edx, edx |
2433 | xor edx, edx |
2430 | jmp ext_WriteFile.start |
2434 | jmp ext_WriteFile.start |
Line 2640... | Line 2644... | ||
2640 | .error2: |
2644 | .error2: |
2641 | push eax |
2645 | push eax |
2642 | call ext_unlock |
2646 | call ext_unlock |
2643 | pop eax |
2647 | pop eax |
2644 | ret |
2648 | ret |
- | 2649 | ||
- | 2650 | ;---------------------------------------------------------------- |
|
- | 2651 | ext_Rename: |
|
- | 2652 | call extfsWritingInit |
|
- | 2653 | push esi |
|
- | 2654 | mov esi, edi |
|
- | 2655 | call findInode |
|
- | 2656 | jnc .error |
|
- | 2657 | test edi, edi |
|
- | 2658 | jz .error |
|
- | 2659 | xchg [esp], esi |
|
- | 2660 | push edi |
|
- | 2661 | call findInode |
|
- | 2662 | pop edi |
|
- | 2663 | jc .error |
|
- | 2664 | xor edx, edx |
|
- | 2665 | inc edx |
|
- | 2666 | test [ebp+EXTFS.inodeBuffer.accessMode], DIRECTORY |
|
- | 2667 | jz @f |
|
- | 2668 | inc edx |
|
- | 2669 | @@: |
|
- | 2670 | mov eax, ecx |
|
- | 2671 | push ecx edx |
|
- | 2672 | call unlinkInode |
|
- | 2673 | pop edx ecx |
|
- | 2674 | jc .error |
|
- | 2675 | cmp edx, 1 |
|
- | 2676 | jz @f |
|
- | 2677 | lea ebx, [ebp+EXTFS.inodeBuffer] |
|
- | 2678 | dec [ebx+INODE.linksCount] |
|
- | 2679 | mov eax, ecx |
|
- | 2680 | call writeInode |
|
- | 2681 | jc .error |
|
- | 2682 | @@: |
|
- | 2683 | mov ebx, esi |
|
- | 2684 | mov esi, edi |
|
- | 2685 | pop eax |
|
- | 2686 | push eax edx |
|
- | 2687 | call linkInode |
|
- | 2688 | pop edx |
|
- | 2689 | jc .error |
|
- | 2690 | pop eax |
|
- | 2691 | cmp edx, 1 |
|
- | 2692 | jz @f |
|
- | 2693 | lea ebx, [ebp+EXTFS.inodeBuffer] |
|
- | 2694 | inc [ebx+INODE.linksCount] |
|
- | 2695 | call writeInode |
|
- | 2696 | @@: |
|
- | 2697 | call writeSuperblock |
|
- | 2698 | mov esi, [ebp+PARTITION.Disk] |
|
- | 2699 | call disk_sync |
|
- | 2700 | call ext_unlock |
|
- | 2701 | xor eax, eax |
|
- | 2702 | ret |
|
- | 2703 | ||
- | 2704 | .error: |
|
- | 2705 | push eax |
|
- | 2706 | call ext_unlock |
|
- | 2707 | pop eax ebx |
|
- | 2708 | ret |