Subversion Repositories Kolibri OS

Rev

Rev 5363 | Rev 9888 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5363 Rev 6462
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2013-2015. 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 -... Line 8...
-
 
8
$Revision: 6462 $
-
 
9
 
-
 
10
; XFS external functions
-
 
11
;   in:
-
 
12
; ebx -> parameter structure of sysfunc 70
-
 
13
; ebp -> XFS structure
-
 
14
; [esi]+[[esp+4]] = name
-
 
15
;   out:
-
 
16
; eax, ebx = return values for sysfunc 70
-
 
17
iglobal
-
 
18
align 4
-
 
19
xfs_user_functions:
-
 
20
        dd      xfs_free
-
 
21
        dd      (xfs_user_functions_end - xfs_user_functions - 4) / 4
-
 
22
        dd      xfs_ReadFile
-
 
23
        dd      xfs_ReadFolder
-
 
24
        dd      0;xfs_CreateFile
-
 
25
        dd      0;xfs_WriteFile
-
 
26
        dd      0;xfs_SetFileEnd
-
 
27
        dd      xfs_GetFileInfo
-
 
28
        dd      0;xfs_SetFileInfo
-
 
29
        dd      0
-
 
30
        dd      0;xfs_Delete
-
 
31
        dd      0;xfs_CreateFolder
Line 8... Line 32...
8
$Revision: 5363 $
32
xfs_user_functions_end:
Line 9... Line -...
9
 
-
 
10
 
-
 
11
include 'xfs.inc'
-
 
12
 
-
 
13
;
-
 
14
; This file contains XFS related code.
-
 
15
; For more information on XFS check sources below.
-
 
16
;
-
 
17
; 1. XFS Filesystem Structure, 2nd Edition, Revision 1. Silicon Graphics Inc. 2006
-
 
18
; 2. Linux source http://kernel.org
-
 
19
;
-
 
20
 
33
endg
21
 
-
 
22
; test partition type (valid XFS one?)
34
 
-
 
35
include 'xfs.inc'
-
 
36
 
-
 
37
; Mount if it's a valid XFS partition.
-
 
38
xfs_create_partition:
-
 
39
;   in:
23
; alloc and fill XFS (see xfs.inc) structure
40
; ebp -> PARTITION structure
24
; this function is called for each partition
41
; ebx -> boot sector
25
; returns 0 (not XFS or invalid) / pointer to partition structure
42
;   out:
26
xfs_create_partition:
43
; eax -> XFS structure, 0 = not XFS
27
        push    ebx ecx edx esi edi
44
        push    ebx ecx edx esi edi
Line 209... Line 226...
209
        xor     eax, eax
226
        xor     eax, eax
210
        pop     edi esi edx ecx ebx
227
        pop     edi esi edx ecx ebx
211
        ret
228
        ret
Line 212... Line -...
212
 
-
 
213
 
-
 
214
iglobal
-
 
215
align 4
-
 
216
xfs_user_functions:
-
 
217
        dd      xfs_free
-
 
218
        dd      (xfs_user_functions_end - xfs_user_functions - 4) / 4
-
 
219
        dd      xfs_Read
-
 
220
        dd      xfs_ReadFolder
-
 
221
        dd      0;xfs_Rewrite
-
 
222
        dd      0;xfs_Write
-
 
223
        dd      0;xfs_SetFileEnd
-
 
224
        dd      xfs_GetFileInfo
-
 
225
        dd      0;xfs_SetFileInfo
-
 
226
        dd      0
-
 
227
        dd      0;xfs_Delete
-
 
228
        dd      0;xfs_CreateFolder
-
 
229
xfs_user_functions_end:
-
 
230
endg
-
 
231
 
229
 
232
 
230
 
233
; lock partition access mutex
231
; lock partition access mutex
234
proc xfs_lock
232
proc xfs_lock
235
;DEBUGF 1,"xfs_lock\n"
233
;DEBUGF 1,"xfs_lock\n"
Line 1737... Line 1735...
1737
 
1735
 
1738
        add     edi, 8
1736
        add     edi, 8
1739
        mov     eax, [edx + xfs_inode.di_core.di_ctime.t_sec]
1737
        mov     eax, [edx + xfs_inode.di_core.di_ctime.t_sec]
1740
        bswap   eax
1738
        bswap   eax
1741
        push    edx
-
 
1742
        xor     edx, edx
1739
        push    edx
1743
        add     eax, 3054539008                                     ;(369 * 365 + 89) * 24 * 3600
-
 
1744
        adc     edx, 2
1740
        sub     eax, 978307200  ; 01.01.1970-01.01.2001 = (365*31+8)*24*60*60
1745
        call    ntfs_datetime_to_bdfe.sec
1741
        call    fsTime2bdfe
Line 1746... Line 1742...
1746
        pop     edx
1742
        pop     edx
1747
 
1743
 
1748
        mov     eax, [edx + xfs_inode.di_core.di_atime.t_sec]
1744
        mov     eax, [edx + xfs_inode.di_core.di_atime.t_sec]
1749
        bswap   eax
-
 
1750
        push    edx
-
 
1751
        xor     edx, edx
1745
        bswap   eax
1752
        add     eax, 3054539008                                     ;(369 * 365 + 89) * 24 * 3600
1746
        push    edx
1753
        adc     edx, 2
1747
        sub     eax, 978307200
Line 1754... Line 1748...
1754
        call    ntfs_datetime_to_bdfe.sec
1748
        call    fsTime2bdfe
1755
        pop     edx
1749
        pop     edx
1756
 
1750
 
1757
        mov     eax, [edx + xfs_inode.di_core.di_mtime.t_sec]
-
 
1758
        bswap   eax
-
 
1759
        push    edx
1751
        mov     eax, [edx + xfs_inode.di_core.di_mtime.t_sec]
1760
        xor     edx, edx
1752
        bswap   eax
1761
        add     eax, 3054539008                                     ;(369 * 365 + 89) * 24 * 3600
1753
        push    edx
Line 1762... Line 1754...
1762
        adc     edx, 2
1754
        sub     eax, 978307200
1763
        call    ntfs_datetime_to_bdfe.sec
1755
        call    fsTime2bdfe
1764
        pop     edx
1756
        pop     edx
Line 1945... Line 1937...
1945
;DEBUGF 1,"error\n\n"
1937
;DEBUGF 1,"error\n\n"
1946
        ret
1938
        ret
Line 1947... Line 1939...
1947
 
1939
 
1948
 
1940
 
1949
;----------------------------------------------------------------
1941
;----------------------------------------------------------------
1950
; xfs_Read - XFS implementation of reading a file
1942
; xfs_ReadFile - XFS implementation of reading a file
1951
; in:  ebp = pointer to XFS structure
1943
; in:  ebp = pointer to XFS structure
1952
; in:  esi+[esp+4] = name
1944
; in:  esi+[esp+4] = name
1953
; in:  ebx = pointer to parameters from sysfunc 70
1945
; in:  ebx = pointer to parameters from sysfunc 70
1954
; out: eax, ebx = return values for sysfunc 70
1946
; out: eax, ebx = return values for sysfunc 70
1955
;----------------------------------------------------------------
1947
;----------------------------------------------------------------
1956
xfs_Read:
1948
xfs_ReadFile:
1957
        push    ebx ecx edx esi edi
-
 
1958
        call    xfs_lock
1949
        push    ebx ecx edx esi edi
1959
 
-
 
1960
        add     esi, [esp + 24]
1950
        call    xfs_lock
1961
;DEBUGF 1,"xfs_Read: %d %d |%s|\n",[ebx+4],[ebx+12],esi
1951
        add     esi, [esp + 24]
1962
        stdcall xfs_get_inode, esi
1952
        stdcall xfs_get_inode, esi
1963
        mov     ecx, edx
1953
        mov     ecx, edx
1964
        or      ecx, eax
1954
        or      ecx, eax