Subversion Repositories Kolibri OS

Rev

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

Rev 6464 Rev 6468
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2011-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2011-2015. 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: 6464 $
8
$Revision: 6468 $
9
 
9
 
10
; =============================================================================
10
; =============================================================================
11
; ================================= Constants =================================
11
; ================================= Constants =================================
Line 1043... Line 1043...
1043
endg
1043
endg
Line 1044... Line 1044...
1044
 
1044
 
1045
; This function is called from file_system_lfn.
1045
; This function is called from file_system_lfn.
1046
; This handler gets the control each time when fn 70 is called
1046
; This handler gets the control each time when fn 70 is called
1047
; with unknown item of root subdirectory.
1047
; with unknown item of root subdirectory.
1048
; in: esi -> name
-
 
1049
;     ebp = 0 or rest of name relative to esi
1048
; in: esi = ebp -> path string
1050
; out: if the handler processes path, it must not return in file_system_lfn,
1049
; out: if the handler processes path, it must not return in file_system_lfn,
1051
;      but instead pop return address and return directly to the caller
1050
;      but instead pop return address and return directly to the caller
1052
;      otherwise simply return
1051
;      otherwise simply return
1053
dyndisk_handler:
1052
dyndisk_handler:
Line 1140... Line 1139...
1140
        jz      @f
1139
        jz      @f
1141
        mov     esi, fs_dyndisk_next
1140
        mov     esi, fs_dyndisk_next
1142
@@:
1141
@@:
1143
; 11c. Let the procedure from fs_lfn.inc do the job.
1142
; 11c. Let the procedure from fs_lfn.inc do the job.
1144
        jmp     file_system_lfn.maindir_noesi
1143
        jmp     file_system_lfn.maindir_noesi
-
 
1144
 
-
 
1145
.access_denied:
-
 
1146
        mov     dword [esp+32], ERROR_ACCESS_DENIED
-
 
1147
        mov     esi, ecx        ; disk*dereference assume that esi points to DISK
-
 
1148
.cleanup_esi:
-
 
1149
        test    edx, edx        ; if there are no media, we didn't reference it
-
 
1150
        jz      @f
-
 
1151
        call    disk_media_dereference
-
 
1152
@@:
-
 
1153
        call    disk_dereference
-
 
1154
        stdcall kernel_free, ebp
-
 
1155
        ret
-
 
1156
 
-
 
1157
.dyndisk_cleanup:
-
 
1158
        pop     esi
-
 
1159
        pop     edx
-
 
1160
        mov     dword [esp+32], ERROR_FILE_NOT_FOUND
-
 
1161
        jmp     .cleanup_esi
-
 
1162
 
1145
.haspartition:
1163
.haspartition:
1146
; 12. The fs operation has specified some partition.
1164
; 12. The fs operation has specified some partition.
1147
        push    edx
1165
        push    edx
1148
        push    ecx
1166
        push    ecx
1149
        xor     eax, eax
1167
        xor     eax, eax
Line 1158... Line 1176...
1158
        jz      @f
1176
        jz      @f
1159
        test    eax, eax
1177
        test    eax, eax
1160
        jnz     .dyndisk_cleanup
1178
        jnz     .dyndisk_cleanup
1161
        dec     esi
1179
        dec     esi
1162
@@:
1180
@@:
1163
        cmp     byte [esi], 0
-
 
1164
        jnz     @f
-
 
1165
        test    ebp, ebp
-
 
1166
        jz      @f
-
 
1167
        mov     esi, ebp
-
 
1168
        xor     ebp, ebp
-
 
1169
@@:
-
 
1170
        jmp     fs_dyndisk
-
 
1171
 
-
 
1172
.dyndisk_cleanup:
-
 
1173
        pop     esi
-
 
1174
        pop     edx
-
 
1175
        mov     dword [esp+32], ERROR_FILE_NOT_FOUND
-
 
1176
        jmp     .cleanup_esi
-
 
1177
 
-
 
1178
.access_denied:
-
 
1179
; 13. Fail the operation with the appropriate code.
-
 
1180
        mov     dword [esp+32], ERROR_ACCESS_DENIED
-
 
1181
.cleanup:
-
 
1182
; 14. Cleanup.
-
 
1183
        mov     esi, ecx        ; disk*dereference assume that esi points to DISK
-
 
1184
.cleanup_esi:
-
 
1185
        test    edx, edx        ; if there are no media, we didn't reference it
-
 
1186
        jz      @f
-
 
1187
        call    disk_media_dereference
-
 
1188
@@:
-
 
1189
        call    disk_dereference
-
 
1190
; 15. Return.
-
 
1191
        ret
-
 
1192
 
-
 
1193
; This is a callback for enumerating partitions called from
-
 
1194
; file_system_lfn.maindir in the case of inserted media.
-
 
1195
; It just increments eax until DISK.NumPartitions reached and then
-
 
1196
; cleans up.
-
 
1197
fs_dyndisk_next:
-
 
1198
        mov     ecx, [esp+8]
-
 
1199
        cmp     eax, [ecx+DISK.NumPartitions]
-
 
1200
        jae     .nomore
-
 
1201
        inc     eax
-
 
1202
        clc
-
 
1203
        ret
-
 
1204
.nomore:
-
 
1205
        pusha
-
 
1206
        mov     esi, ecx
-
 
1207
        call    disk_media_dereference
-
 
1208
        call    disk_dereference
-
 
1209
        popa
-
 
1210
        stc
-
 
1211
        ret
-
 
1212
 
-
 
1213
; This is a callback for enumerating partitions called from
-
 
1214
; file_system_lfn.maindir in the case of missing media.
-
 
1215
; In this case we create one pseudo-partition.
-
 
1216
fs_dyndisk_next_nomedia:
-
 
1217
        cmp     eax, 1
-
 
1218
        jae     .nomore
-
 
1219
        inc     eax
-
 
1220
        clc
-
 
1221
        ret
-
 
1222
.nomore:
-
 
1223
        mov     ecx, [esp+8]
-
 
1224
        pusha
-
 
1225
        mov     esi, ecx
-
 
1226
        call    disk_dereference
-
 
1227
        popa
-
 
1228
        stc
-
 
1229
        ret
-
 
1230
 
-
 
1231
; esp -> {dd pointer to DISK, dd media object}
-
 
1232
; ecx = partition number, esi+ebp = ASCIIZ name
-
 
1233
fs_dyndisk:
-
 
1234
        dec     ecx     ; convert to zero-based partition index
1181
        dec     ecx     ; convert to zero-based partition index
1235
        pop     edx     ; edx = pointer to DISK, dword [esp] = NULL or edx
1182
        pop     edx     ; edx = pointer to DISK, dword [esp] = NULL or edx
1236
; If the driver does not support insert notifications and we are the only fs
1183
; If the driver does not support insert notifications and we are the only fs
1237
; operation with this disk, ask the driver whether the media
1184
; operation with this disk, ask the driver whether the media
1238
; was inserted/removed/changed. Otherwise, assume that media status is valid.
1185
; was inserted/removed/changed. Otherwise, assume that media status is valid.
Line 1265... Line 1212...
1265
        pop     esi ecx
1212
        pop     esi ecx
1266
.media_accurate:
1213
.media_accurate:
1267
        pop     eax
1214
        pop     eax
1268
        test    eax, eax
1215
        test    eax, eax
1269
        jz      .nomedia
1216
        jz      .nomedia
1270
.main:
-
 
1271
        cmp     ecx, [edx+DISK.NumPartitions]
1217
        cmp     ecx, [edx+DISK.NumPartitions]
1272
        jae     .notfound
1218
        jae     .notfound2
1273
        mov     eax, [edx+DISK.Partitions]
1219
        mov     eax, [edx+DISK.Partitions]
1274
        mov     eax, [eax+ecx*4]
1220
        mov     eax, [eax+ecx*4]
1275
        mov     edi, [eax+PARTITION.FSUserFunctions]
1221
        mov     edi, [eax+PARTITION.FSUserFunctions]
1276
        mov     ecx, [ebx]
1222
        mov     ecx, [ebx]
1277
        cmp     [edi+4], ecx
1223
        cmp     [edi+4], ecx
Line 1285... Line 1231...
1285
        mov     dword [esp+32], eax
1231
        mov     dword [esp+32], eax
1286
        mov     dword [esp+20], ebx
1232
        mov     dword [esp+20], ebx
1287
.cleanup:
1233
.cleanup:
1288
        mov     esi, edx
1234
        mov     esi, edx
1289
        call    disk_media_dereference
1235
        call    disk_media_dereference
-
 
1236
@@:
1290
        call    disk_dereference
1237
        call    disk_dereference
-
 
1238
        stdcall kernel_free, ebp
1291
        ret
1239
        ret
1292
.nofs:
1240
 
1293
        mov     dword [esp+32], ERROR_UNKNOWN_FS
-
 
1294
        jmp     .cleanup
-
 
1295
.notfound:
-
 
1296
        mov     dword [esp+32], ERROR_FILE_NOT_FOUND
-
 
1297
        jmp     .cleanup
-
 
1298
.unsupported:
1241
.unsupported:
-
 
1242
        mov     dword [esp+32], ERROR_UNKNOWN_FS
1299
        cmp     edi, default_fs_functions
1243
        cmp     edi, default_fs_functions
1300
        jz      .nofs
1244
        jz      .cleanup
1301
        mov     dword [esp+32], ERROR_UNSUPPORTED_FS
1245
        mov     dword [esp+32], ERROR_UNSUPPORTED_FS
1302
        jmp     .cleanup
1246
        jmp     .cleanup
-
 
1247
 
-
 
1248
.notfound2:
-
 
1249
        mov     dword [esp+32], ERROR_FILE_NOT_FOUND
-
 
1250
        jmp     .cleanup
-
 
1251
 
1303
.nomedia:
1252
.nomedia:
1304
        test    ecx, ecx
1253
        test    ecx, ecx
1305
        jnz     .notfound
1254
        jnz     .notfound2
1306
        mov     dword [esp+32], ERROR_DEVICE
1255
        mov     dword [esp+32], ERROR_DEVICE
1307
        mov     esi, edx
1256
        mov     esi, edx
-
 
1257
        jmp     @b
-
 
1258
 
-
 
1259
; This is a callback for enumerating partitions called from
-
 
1260
; file_system_lfn.maindir in the case of inserted media.
-
 
1261
; It just increments eax until DISK.NumPartitions reached and then
-
 
1262
; cleans up.
-
 
1263
fs_dyndisk_next:
-
 
1264
        mov     ecx, [esp+8]
-
 
1265
        cmp     eax, [ecx+DISK.NumPartitions]
-
 
1266
        jae     .nomore
-
 
1267
        inc     eax
-
 
1268
        clc
-
 
1269
        ret
-
 
1270
.nomore:
-
 
1271
        pusha
-
 
1272
        mov     esi, ecx
-
 
1273
        call    disk_media_dereference
-
 
1274
        call    disk_dereference
-
 
1275
        popa
-
 
1276
        stc
-
 
1277
        ret
-
 
1278
 
-
 
1279
; This is a callback for enumerating partitions called from
-
 
1280
; file_system_lfn.maindir in the case of missing media.
-
 
1281
; In this case we create one pseudo-partition.
-
 
1282
fs_dyndisk_next_nomedia:
-
 
1283
        cmp     eax, 1
-
 
1284
        jae     .nomore
-
 
1285
        inc     eax
-
 
1286
        clc
-
 
1287
        ret
-
 
1288
.nomore:
-
 
1289
        mov     ecx, [esp+8]
-
 
1290
        pusha
-
 
1291
        mov     esi, ecx
1308
        call    disk_dereference
1292
        call    disk_dereference
-
 
1293
        popa
-
 
1294
        stc
1309
        ret
1295
        ret
Line 1310... Line 1296...
1310
 
1296
 
1311
; This function is called from file_system_lfn.
1297
; This function is called from file_system_lfn.
1312
; This handler is called when virtual root is enumerated
1298
; This handler is called when virtual root is enumerated