Subversion Repositories Kolibri OS

Rev

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

Rev 3725 Rev 3908
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2013. 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
;;  FAT32.INC                                                      ;;
6
;;  FAT32.INC                                                      ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;  FAT16/32 functions for KolibriOS                               ;;
8
;;  FAT16/32 functions for KolibriOS                               ;;
Line 42... Line 42...
42
;;  20.5.2002  Hd status check - VT                                ;;
42
;;  20.5.2002  Hd status check - VT                                ;;
43
;;  29.6.2002  Improved fat32 verification - VT                    ;;
43
;;  29.6.2002  Improved fat32 verification - VT                    ;;
44
;;                                                                 ;;
44
;;                                                                 ;;
45
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 46... Line 46...
46
 
46
 
Line 47... Line 47...
47
$Revision: 3725 $
47
$Revision: 3908 $
Line 48... Line 48...
48
 
48
 
Line 56... Line 56...
56
PUSHAD_EBP equ [esp+8]
56
PUSHAD_EBP equ [esp+8]
57
PUSHAD_ESI equ [esp+4]
57
PUSHAD_ESI equ [esp+4]
58
PUSHAD_EDI equ [esp+0]
58
PUSHAD_EDI equ [esp+0]
Line 59... Line 59...
59
 
59
 
60
; Internal data for every FAT partition.
60
; Internal data for every FAT partition.
61
struct FAT
-
 
62
p       PARTITION       ; must be the first item
61
struct FAT PARTITION
63
fs_type              db ?
62
fs_type              db ?
64
fat16_root           db 0       ; flag for fat16 rootdir
63
fat16_root           db 0       ; flag for fat16 rootdir
65
fat_change           db 0       ; 1=fat has changed
64
fat_change           db 0       ; 1=fat has changed
66
                     db ?       ; alignment
65
                     db ?       ; alignment
Line 119... Line 118...
119
endg
118
endg
Line 120... Line 119...
120
 
119
 
121
iglobal
120
iglobal
122
align 4
121
align 4
-
 
122
fat_user_functions:
123
fat_user_functions:
123
        dd      free
124
        dd      (fat_user_functions_end - fat_user_functions - 4) / 4
124
        dd      (fat_user_functions_end - fat_user_functions - 4) / 4
125
        dd      fat_Read
125
        dd      fat_Read
126
        dd      fat_ReadFolder
126
        dd      fat_ReadFolder
127
        dd      fat_Rewrite
127
        dd      fat_Rewrite
Line 136... Line 136...
136
endg
136
endg
Line 137... Line 137...
137
 
137
 
138
; these labels are located before the main function to make
138
; these labels are located before the main function to make
139
; most of jumps to these be short
139
; most of jumps to these be short
140
fat_create_partition.free_return0:
-
 
141
        push    ebx
140
fat_create_partition.free_return0:
142
        mov     eax, ebp
141
        mov     eax, ebp
143
        call    free
-
 
144
        pop     ebx
142
        call    free
145
        pop     ebp
143
        pop     ebp
146
fat_create_partition.return0:
144
fat_create_partition.return0:
147
        xor     eax, eax
145
        xor     eax, eax
148
        ret
146
        ret
149
fat_create_partition:
147
fat_create_partition:
150
; bootsector must have been successfully read
148
; bootsector must have been successfully read
151
        cmp     dword [esp+4], 1
149
        cmp     dword [esp+4], 0
152
        jnz     .return0
150
        jnz     .return0
153
; bootsector signature must be correct
151
; bootsector signature must be correct
154
        cmp     word [ebx+0x1fe], 0xaa55
152
        cmp     word [ebx+0x1fe], 0xaa55
155
        jnz     .return0
153
        jnz     .return0
Line 168... Line 166...
168
; it will prove wrong, just deallocate it.
166
; it will prove wrong, just deallocate it.
169
        movi    eax, sizeof.FAT
167
        movi    eax, sizeof.FAT
170
        call    malloc
168
        call    malloc
171
        test    eax, eax
169
        test    eax, eax
172
        jz      .return0
170
        jz      .return0
173
        mov     ecx, [ebp+8]
171
        mov     ecx, dword [ebp+PARTITION.FirstSector]
174
        mov     dword [eax+FAT.p.FirstSector], ecx
172
        mov     dword [eax+FAT.FirstSector], ecx
175
        mov     ecx, [ebp+12]
173
        mov     ecx, dword [ebp+PARTITION.FirstSector+4]
176
        mov     dword [eax+FAT.p.FirstSector+4], ecx
174
        mov     dword [eax+FAT.FirstSector+4], ecx
177
        mov     ecx, [ebp+16]
175
        mov     ecx, dword [ebp+PARTITION.Length]
178
        mov     dword [eax+FAT.p.Length], ecx
176
        mov     dword [eax+FAT.Length], ecx
179
        mov     ecx, [ebp+20]
177
        mov     ecx, dword [ebp+PARTITION.Length+4]
180
        mov     dword [eax+FAT.p.Length+4], ecx
178
        mov     dword [eax+FAT.Length+4], ecx
-
 
179
        mov     ecx, [ebp+PARTITION.Disk]
181
        mov     [eax+FAT.p.Disk], esi
180
        mov     [eax+FAT.Disk], ecx
182
        mov     [eax+FAT.p.FSUserFunctions], fat_user_functions
181
        mov     [eax+FAT.FSUserFunctions], fat_user_functions
183
        or      [eax+FAT.fat_in_cache], -1
182
        or      [eax+FAT.fat_in_cache], -1
184
        mov     [eax+FAT.fat_change], 0
183
        mov     [eax+FAT.fat_change], 0
185
        push    ebp
184
        push    ebp
186
        mov     ebp, eax
185
        mov     ebp, eax
Line 224... Line 223...
224
        movzx   eax, word [ebx+0x13]    ; total sector count <65536
223
        movzx   eax, word [ebx+0x13]    ; total sector count <65536
225
        test    eax, eax
224
        test    eax, eax
226
        jnz     @f
225
        jnz     @f
227
        mov     eax, [ebx+0x20]         ; total sector count
226
        mov     eax, [ebx+0x20]         ; total sector count
228
@@:
227
@@:
229
        mov     dword [ebp+FAT.p.Length], eax
228
        mov     dword [ebp+FAT.Length], eax
230
        and     dword [ebp+FAT.p.Length+4], 0
229
        and     dword [ebp+FAT.Length+4], 0
231
        sub     eax, [ebp+FAT.DATA_START]       ; eax = count of data sectors
230
        sub     eax, [ebp+FAT.DATA_START]       ; eax = count of data sectors
232
        xor     edx, edx
231
        xor     edx, edx
233
        div     [ebp+FAT.SECTORS_PER_CLUSTER]
232
        div     [ebp+FAT.SECTORS_PER_CLUSTER]
234
        inc     eax
233
        inc     eax
235
        mov     [ebp+FAT.LAST_CLUSTER], eax
234
        mov     [ebp+FAT.LAST_CLUSTER], eax
Line 260... Line 259...
260
        mov     [ebp+FAT.fatRESERVED], 0x0FFFFFF6
259
        mov     [ebp+FAT.fatRESERVED], 0x0FFFFFF6
261
        mov     [ebp+FAT.fatBAD], 0x0FFFFFF7
260
        mov     [ebp+FAT.fatBAD], 0x0FFFFFF7
262
        mov     [ebp+FAT.fatEND], 0x0FFFFFF8
261
        mov     [ebp+FAT.fatEND], 0x0FFFFFF8
263
        mov     [ebp+FAT.fatMASK], 0x0FFFFFFF
262
        mov     [ebp+FAT.fatMASK], 0x0FFFFFFF
264
        mov     al, 32
263
        mov     al, 32
265
        mov     [fs_type], al
-
 
266
        mov     [ebp+FAT.fs_type], al
264
        mov     [ebp+FAT.fs_type], al
267
        mov     eax, ebp
265
        mov     eax, ebp
268
        pop     ebp
266
        pop     ebp
269
        ret
267
        ret
270
.fat16:
268
.fat16:
Line 272... Line 270...
272
        mov     [ebp+FAT.fatRESERVED], 0x0000FFF6
270
        mov     [ebp+FAT.fatRESERVED], 0x0000FFF6
273
        mov     [ebp+FAT.fatBAD], 0x0000FFF7
271
        mov     [ebp+FAT.fatBAD], 0x0000FFF7
274
        mov     [ebp+FAT.fatEND], 0x0000FFF8
272
        mov     [ebp+FAT.fatEND], 0x0000FFF8
275
        mov     [ebp+FAT.fatMASK], 0x0000FFFF
273
        mov     [ebp+FAT.fatMASK], 0x0000FFFF
276
        mov     al, 16
274
        mov     al, 16
277
        mov     [fs_type], al
-
 
278
        mov     [ebp+FAT.fs_type], al
275
        mov     [ebp+FAT.fs_type], al
279
        mov     eax, ebp
276
        mov     eax, ebp
280
        pop     ebp
277
        pop     ebp
281
        ret
278
        ret
Line 767... Line 764...
767
        add     esp, 20         ; CF=0
764
        add     esp, 20         ; CF=0
768
        pop     esi
765
        pop     esi
769
        ret     4
766
        ret     4
Line 770... Line 767...
770
 
767
 
771
;----------------------------------------------------------------
-
 
772
;
-
 
773
;  fs_HdRead - LFN variant for reading hard disk
-
 
774
;
-
 
775
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
776
;
-
 
777
;  esi  points to filename
-
 
778
;  ebx  pointer to 64-bit number = first wanted byte, 0+
-
 
779
;       may be ebx=0 - start from first byte
-
 
780
;  ecx  number of bytes to read, 0+
-
 
781
;  edx  mem location to return data
-
 
782
;
-
 
783
;  ret ebx = bytes read or 0xffffffff file not found
-
 
784
;      eax = 0 ok read or other = errormsg
-
 
785
;
-
 
786
;--------------------------------------------------------------
-
 
787
fs_HdRead:
-
 
788
        cmp     [fs_type], 16
-
 
789
        jz      @f
-
 
790
        cmp     [fs_type], 32
-
 
791
        jz      @f
-
 
792
        cmp     [fs_type], 1
-
 
793
        jz      ntfs_HdRead
-
 
794
        cmp     [fs_type], 2
-
 
795
        jz      ext2_HdRead
-
 
796
        or      ebx, -1
-
 
797
        mov     eax, ERROR_UNKNOWN_FS
-
 
798
        ret
-
 
799
@@:
-
 
800
        sub     ebx, 4
-
 
801
        push    ebp
-
 
802
        mov     ebp, [fs_dependent_data_start.partition]
-
 
803
        call    fat_Read
-
 
804
        pop     ebp
-
 
805
        ret
-
 
806
 
-
 
807
;----------------------------------------------------------------
768
;----------------------------------------------------------------
808
; fat_Read - FAT16/32 implementation of reading a file
769
; fat_Read - FAT16/32 implementation of reading a file
809
; in:  ebp = pointer to FAT structure
770
; in:  ebp = pointer to FAT structure
810
; in:  esi+[esp+4] = name
771
; in:  esi+[esp+4] = name
811
; in:  ebx = pointer to parameters from sysfunc 70
772
; in:  ebx = pointer to parameters from sysfunc 70
Line 942... Line 903...
942
        pop     eax edx
903
        pop     eax edx
943
        sub     ebx, edx
904
        sub     ebx, edx
944
        jmp     .reteof
905
        jmp     .reteof
Line 945... Line 906...
945
 
906
 
946
;----------------------------------------------------------------
-
 
947
;
-
 
948
;  fs_HdReadFolder - LFN variant for reading hard disk folder
-
 
949
;
-
 
950
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
951
;
-
 
952
;  esi  points to filename
-
 
953
;  ebx  pointer to structure 32-bit number = first wanted block, 0+
-
 
954
;                          & flags (bitfields)
-
 
955
; flags: bit 0: 0=ANSI names, 1=UNICODE names
-
 
956
;  ecx  number of blocks to read, 0+
-
 
957
;  edx  mem location to return data
-
 
958
;
-
 
959
;  ret ebx = blocks read or 0xffffffff folder not found
-
 
960
;      eax = 0 ok read or other = errormsg
-
 
961
;
-
 
962
;--------------------------------------------------------------
-
 
963
fs_HdReadFolder:
-
 
964
        cmp     [fs_type], 16
-
 
965
        jz      @f
-
 
966
        cmp     [fs_type], 32
-
 
967
        jz      @f
-
 
968
        cmp     [fs_type], 1
-
 
969
        jz      ntfs_HdReadFolder
-
 
970
        cmp     [fs_type], 2
-
 
971
        jz      ext2_HdReadFolder
-
 
972
        movi    eax, ERROR_UNSUPPORTED_FS
-
 
973
        or      ebx, -1
-
 
974
        ret
-
 
975
@@:
-
 
976
        sub     ebx, 4
-
 
977
        push    ebp
-
 
978
        mov     ebp, [fs_dependent_data_start.partition]
-
 
979
        call    fat_ReadFolder
-
 
980
        pop     ebp
-
 
981
        ret
-
 
982
 
-
 
983
;----------------------------------------------------------------
907
;----------------------------------------------------------------
984
; fat_ReadFolder - FAT16/32 implementation of reading a folder
908
; fat_ReadFolder - FAT16/32 implementation of reading a folder
985
; in:  ebp = pointer to FAT structure
909
; in:  ebp = pointer to FAT structure
986
; in:  esi+[esp+4] = name
910
; in:  esi+[esp+4] = name
987
; in:  ebx = pointer to parameters from sysfunc 70
911
; in:  ebx = pointer to parameters from sysfunc 70
Line 1375... Line 1299...
1375
        add     ecx, [eax+4]
1299
        add     ecx, [eax+4]
1376
        mov     eax, ecx
1300
        mov     eax, ecx
1377
        pop     ecx
1301
        pop     ecx
1378
        ret
1302
        ret
Line 1379... Line -...
1379
 
-
 
1380
;----------------------------------------------------------------
-
 
1381
;
-
 
1382
;  fs_HdRewrite - LFN variant for writing hard disk
-
 
1383
;
-
 
1384
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
1385
;
-
 
1386
;  esi  points to filename
-
 
1387
;  ebx  ignored (reserved)
-
 
1388
;  ecx  number of bytes to write, 0+
-
 
1389
;  edx  mem location to data
-
 
1390
;
-
 
1391
;  ret ebx = number of written bytes
-
 
1392
;      eax = 0 ok read or other = errormsg
-
 
1393
;
-
 
1394
;--------------------------------------------------------------
-
 
1395
fs_HdCreateFolder:
-
 
1396
        mov     al, 1
-
 
1397
        jmp     fs_HdRewrite.common
-
 
1398
 
-
 
1399
fs_HdRewrite:
-
 
1400
        xor     eax, eax
-
 
1401
.common:
-
 
1402
        cmp     [fs_type], 16
-
 
1403
        jz      @f
-
 
1404
        cmp     [fs_type], 32
-
 
1405
        jz      @f
-
 
1406
        cmp     [fs_type], 1
-
 
1407
        jz      ntfs_HdRewrite
-
 
1408
        cmp     [fs_type], 2
-
 
1409
        jz      ext2_HdRewrite
-
 
1410
        mov     eax, ERROR_UNKNOWN_FS
-
 
1411
        xor     ebx, ebx
-
 
1412
        ret
-
 
1413
@@:
-
 
1414
        sub     ebx, 4
-
 
1415
        push    ebp
-
 
1416
        mov     ebp, [fs_dependent_data_start.partition]
-
 
1417
        test    eax, eax
-
 
1418
        mov     eax, fat_CreateFolder
-
 
1419
        jnz     @f
-
 
1420
        mov     eax, fat_Rewrite
-
 
1421
@@:
-
 
1422
        call    eax
-
 
1423
        pop     ebp
-
 
1424
        ret
-
 
1425
 
1303
 
1426
fshrad:
1304
fshrad:
1427
        call    fat_unlock
1305
        call    fat_unlock
1428
        mov     eax, ERROR_ACCESS_DENIED
1306
        mov     eax, ERROR_ACCESS_DENIED
1429
        xor     ebx, ebx
1307
        xor     ebx, ebx
Line 1439... Line 1317...
1439
fat_CreateFolder:
1317
fat_CreateFolder:
1440
        push    1
1318
        push    1
1441
        jmp     fat_Rewrite.common
1319
        jmp     fat_Rewrite.common
Line 1442... Line 1320...
1442
 
1320
 
1443
;----------------------------------------------------------------
1321
;----------------------------------------------------------------
1444
; fat_HdRewrite - FAT16/32 implementation of creating a new file
1322
; fat_Rewrite - FAT16/32 implementation of creating a new file
1445
; in:  ebp = pointer to FAT structure
1323
; in:  ebp = pointer to FAT structure
1446
; in:  esi+[esp+4] = name
1324
; in:  esi+[esp+4] = name
1447
; in:  ebx = pointer to parameters from sysfunc 70
1325
; in:  ebx = pointer to parameters from sysfunc 70
1448
; out: eax, ebx = return values for sysfunc 70
1326
; out: eax, ebx = return values for sysfunc 70
Line 1986... Line 1864...
1986
        mov     word [edi-32+26], cx
1864
        mov     word [edi-32+26], cx
1987
        shr     ecx, 16
1865
        shr     ecx, 16
1988
        mov     [edi-32+20], cx
1866
        mov     [edi-32+20], cx
1989
        jmp     .writedircont
1867
        jmp     .writedircont
Line 1990... Line -...
1990
 
-
 
1991
;----------------------------------------------------------------
-
 
1992
;
-
 
1993
;  fs_HdWrite - LFN variant for writing to hard disk
-
 
1994
;
-
 
1995
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
1996
;
-
 
1997
;  esi  points to filename
-
 
1998
;  ebx  pointer to 64-bit number = first wanted byte, 0+
-
 
1999
;       may be ebx=0 - start from first byte
-
 
2000
;  ecx  number of bytes to write, 0+
-
 
2001
;  edx  mem location to data
-
 
2002
;
-
 
2003
;  ret ebx = bytes written (maybe 0)
-
 
2004
;      eax = 0 ok write or other = errormsg
-
 
2005
;
-
 
2006
;--------------------------------------------------------------
1868
 
2007
fat_Write.access_denied:
1869
fat_Write.access_denied:
2008
        push    ERROR_ACCESS_DENIED
1870
        push    ERROR_ACCESS_DENIED
2009
fs_HdWrite.ret0:
1871
fat_Write.ret0:
2010
        pop     eax
1872
        pop     eax
2011
        xor     ebx, ebx
1873
        xor     ebx, ebx
Line 2012... Line 1874...
2012
        ret
1874
        ret
2013
 
1875
 
2014
fs_HdWrite.ret11:
1876
fat_Write.ret11:
2015
        push    ERROR_DEVICE
-
 
2016
        jmp     fs_HdWrite.ret0
-
 
2017
 
-
 
2018
fs_HdWrite:
-
 
2019
        cmp     [fs_type], 16
-
 
2020
        jz      @f
-
 
2021
        cmp     [fs_type], 32
-
 
2022
        jz      @f
-
 
2023
        cmp     [fs_type], 1
-
 
2024
        jz      ntfs_HdWrite
-
 
2025
        cmp     [fs_type], 2
-
 
2026
        jz      ext2_HdWrite
-
 
2027
        push    ERROR_UNKNOWN_FS
-
 
2028
        jmp     .ret0
-
 
2029
@@:
-
 
2030
        sub     ebx, 4
-
 
2031
        push    ebp
-
 
2032
        mov     ebp, [fs_dependent_data_start.partition]
-
 
2033
        call    fat_Write
-
 
Line 2034... Line 1877...
2034
        pop     ebp
1877
        push    ERROR_DEVICE
2035
        ret
1878
        jmp     fat_Write.ret0
2036
 
1879
 
2037
;----------------------------------------------------------------
1880
;----------------------------------------------------------------
Line 2049... Line 1892...
2049
        stdcall hd_find_lfn, [esp+4+4]
1892
        stdcall hd_find_lfn, [esp+4+4]
2050
        jnc     .found
1893
        jnc     .found
2051
        pop     edi
1894
        pop     edi
2052
        push    eax
1895
        push    eax
2053
        call    fat_unlock
1896
        call    fat_unlock
2054
        jmp     fs_HdWrite.ret0
1897
        jmp     .ret0
2055
.found:
1898
.found:
2056
; FAT does not support files larger than 4GB
1899
; FAT does not support files larger than 4GB
2057
        cmp     dword [ebx+8], 0
1900
        cmp     dword [ebx+8], 0
2058
        jz      @f
1901
        jz      @f
2059
.eof:
1902
.eof:
2060
        pop     edi
1903
        pop     edi
2061
        push    ERROR_END_OF_FILE
1904
        push    ERROR_END_OF_FILE
2062
        call    fat_unlock
1905
        call    fat_unlock
2063
        jmp     fs_HdWrite.ret0
1906
        jmp     .ret0
2064
@@:
1907
@@:
2065
        mov     ecx, [ebx+12]
1908
        mov     ecx, [ebx+12]
2066
        mov     edx, [ebx+16]
1909
        mov     edx, [ebx+16]
2067
        mov     ebx, [ebx+4]
1910
        mov     ebx, [ebx+4]
2068
; now edi points to direntry, ebx=start byte to write,
1911
; now edi points to direntry, ebx=start byte to write,
Line 2360... Line 2203...
2360
        movi    eax, ERROR_DISK_FULL
2203
        movi    eax, ERROR_DISK_FULL
2361
        stc
2204
        stc
2362
        ret
2205
        ret
Line 2363... Line 2206...
2363
 
2206
 
2364
;----------------------------------------------------------------
-
 
2365
;
-
 
2366
;  fs_HdSetFileEnd - set end of file on hard disk
-
 
2367
;
-
 
2368
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
2369
;
-
 
2370
;  esi  points to filename
-
 
2371
;  ebx  points to 64-bit number = new file size
-
 
2372
;  ecx  ignored (reserved)
-
 
2373
;  edx  ignored (reserved)
-
 
2374
;
-
 
2375
;  ret eax = 0 ok or other = errormsg
-
 
2376
;
-
 
2377
;--------------------------------------------------------------
-
 
2378
fs_HdSetFileEnd:
-
 
2379
        cmp     [fs_type], 16
-
 
2380
        jz      @f
-
 
2381
        cmp     [fs_type], 32
-
 
2382
        jz      @f
-
 
2383
        cmp     [fs_type], 1
-
 
2384
        jz      ntfs_HdSetFileEnd
-
 
2385
        cmp     [fs_type], 2
-
 
2386
        jz      ext2_HdSetFileEnd
-
 
2387
        movi    eax, ERROR_UNKNOWN_FS
-
 
2388
        ret
-
 
2389
@@:
-
 
2390
        sub     ebx, 4
-
 
2391
        push    ebp
-
 
2392
        mov     ebp, [fs_dependent_data_start.partition]
-
 
2393
        call    fat_SetFileEnd
-
 
2394
        pop     ebp
-
 
2395
        ret
-
 
2396
 
-
 
2397
;----------------------------------------------------------------
2207
;----------------------------------------------------------------
2398
; fat_SetFileEnd - FAT16/32 implementation of setting end-of-file
2208
; fat_SetFileEnd - FAT16/32 implementation of setting end-of-file
2399
; in:  ebp = pointer to FAT structure
2209
; in:  ebp = pointer to FAT structure
2400
; in:  esi+[esp+4] = name
2210
; in:  esi+[esp+4] = name
2401
; in:  ebx = pointer to parameters from sysfunc 70
2211
; in:  ebx = pointer to parameters from sysfunc 70
Line 2632... Line 2442...
2632
        call    update_disk
2442
        call    update_disk
2633
        call    fat_unlock
2443
        call    fat_unlock
2634
        movi    eax, ERROR_FAT_TABLE
2444
        movi    eax, ERROR_FAT_TABLE
2635
        ret
2445
        ret
Line 2636... Line -...
2636
 
-
 
2637
fs_HdGetFileInfo:
-
 
2638
        cmp     [fs_type], 16
-
 
2639
        jz      @f
-
 
2640
        cmp     [fs_type], 32
-
 
2641
        jz      @f
-
 
2642
        cmp     [fs_type], 1
-
 
2643
        jz      ntfs_HdGetFileInfo
-
 
2644
        cmp     [fs_type], 2
-
 
2645
        jz      ext2_HdGetFileInfo
-
 
2646
        mov     eax, ERROR_UNKNOWN_FS
-
 
2647
        ret
-
 
2648
@@:
-
 
2649
        sub     ebx, 4
-
 
2650
        push    ebp
-
 
2651
        mov     ebp, [fs_dependent_data_start.partition]
-
 
2652
        call    fat_GetFileInfo
-
 
2653
        pop     ebp
-
 
2654
        ret
-
 
2655
 
2446
 
2656
;----------------------------------------------------------------
2447
;----------------------------------------------------------------
2657
; fat_GetFileInfo - FAT16/32 implementation of getting file info
2448
; fat_GetFileInfo - FAT16/32 implementation of getting file info
2658
; in:  ebp = pointer to FAT structure
2449
; in:  ebp = pointer to FAT structure
2659
; in:  esi+[esp+4] = name
2450
; in:  esi+[esp+4] = name
Line 2685... Line 2476...
2685
        call    fat_unlock
2476
        call    fat_unlock
2686
        pop     eax
2477
        pop     eax
2687
        pop     edi
2478
        pop     edi
2688
        ret
2479
        ret
Line 2689... Line -...
2689
 
-
 
2690
fs_HdSetFileInfo:
-
 
2691
        cmp     [fs_type], 16
-
 
2692
        jz      @f
-
 
2693
        cmp     [fs_type], 32
-
 
2694
        jz      @f
-
 
2695
        cmp     [fs_type], 1
-
 
2696
        jz      ntfs_HdSetFileInfo
-
 
2697
        cmp     [fs_type], 2
-
 
2698
        jz      ext2_HdSetFileInfo
-
 
2699
        mov     eax, ERROR_UNKNOWN_FS
-
 
2700
        ret
-
 
2701
@@:
-
 
2702
        sub     ebx, 4
-
 
2703
        push    ebp
-
 
2704
        mov     ebp, [fs_dependent_data_start.partition]
-
 
2705
        call    fat_SetFileInfo
-
 
2706
        pop     ebp
-
 
2707
        ret
-
 
2708
 
2480
 
2709
;----------------------------------------------------------------
2481
;----------------------------------------------------------------
2710
; fat_SetFileInfo - FAT16/32 implementation of setting file info
2482
; fat_SetFileInfo - FAT16/32 implementation of setting file info
2711
; in:  ebp = pointer to FAT structure
2483
; in:  ebp = pointer to FAT structure
2712
; in:  esi+[esp+4] = name
2484
; in:  esi+[esp+4] = name
Line 2740... Line 2512...
2740
        pop     eax
2512
        pop     eax
2741
        pop     edi
2513
        pop     edi
2742
        ret
2514
        ret
Line 2743... Line 2515...
2743
 
2515
 
2744
;----------------------------------------------------------------
-
 
2745
;
-
 
2746
;  fs_HdDelete - delete file or empty folder from hard disk
-
 
2747
;
-
 
2748
;  Obsolete, will be replaced with filesystem-specific functions.
-
 
2749
;
-
 
2750
;  esi  points to filename
-
 
2751
;
-
 
2752
;  ret  eax = 0 ok or other = errormsg
-
 
2753
;
-
 
2754
;--------------------------------------------------------------
-
 
2755
fs_HdDelete:
-
 
2756
        cmp     [fs_type], 16
-
 
2757
        jz      @f
-
 
2758
        cmp     [fs_type], 32
-
 
2759
        jz      @f
-
 
2760
        cmp     [fs_type], 1
-
 
2761
        jz      ntfs_HdDelete
-
 
2762
        cmp     [fs_type], 2
-
 
2763
        jz      ext2_HdDelete
-
 
2764
        movi    eax, ERROR_UNKNOWN_FS
-
 
2765
        ret
-
 
2766
@@:
-
 
2767
        sub     ebx, 4
-
 
2768
        push    ebp
-
 
2769
        mov     ebp, [fs_dependent_data_start.partition]
-
 
2770
        call    fat_Delete
-
 
2771
        pop     ebp
-
 
2772
        ret
-
 
2773
 
-
 
2774
;----------------------------------------------------------------
2516
;----------------------------------------------------------------
2775
; fat_Delete - FAT16/32 implementation of deleting a file/folder
2517
; fat_Delete - FAT16/32 implementation of deleting a file/folder
2776
; in:  ebp = pointer to FAT structure
2518
; in:  ebp = pointer to FAT structure
2777
; in:  esi+[esp+4] = name
2519
; in:  esi+[esp+4] = name
2778
; in:  ebx = pointer to parameters from sysfunc 70
2520
; in:  ebx = pointer to parameters from sysfunc 70