forked from KolibriOS/kolibrios
Minor changes to English comments - grammatical, etc.
git-svn-id: svn://kolibrios.org@2257 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
582bf6a0ea
commit
02004e9c11
@ -21,10 +21,10 @@ DISK_NO_INSERT_NOTIFICATION = 1
|
|||||||
; Media flags. Represent bits in DISKMEDIAINFO.Flags.
|
; Media flags. Represent bits in DISKMEDIAINFO.Flags.
|
||||||
DISK_MEDIA_READONLY = 1
|
DISK_MEDIA_READONLY = 1
|
||||||
|
|
||||||
; If we see too many partitions, probably there is some error on the disk.
|
; If too many partitions are detected,there is probably an error on the disk.
|
||||||
; 256 partitions should be enough for any reasonable use.
|
; 256 partitions should be enough for any reasonable use.
|
||||||
; Also, the same number is limiting the number of MBRs to process; if we see
|
; Also, the same number is limiting the number of MBRs to process; if
|
||||||
; too many MBRs, probably there is a loop in the MBR structure.
|
; too many MBRs are visible,there probably is a loop in the MBR structure.
|
||||||
MAX_NUM_PARTITIONS = 256
|
MAX_NUM_PARTITIONS = 256
|
||||||
|
|
||||||
; =============================================================================
|
; =============================================================================
|
||||||
@ -85,9 +85,9 @@ struct DISKFUNC
|
|||||||
; Return value: 0 = disable cache, otherwise = used cache size in bytes.
|
; Return value: 0 = disable cache, otherwise = used cache size in bytes.
|
||||||
ends
|
ends
|
||||||
|
|
||||||
; This structure holds an information about a media.
|
; This structure holds information on a medium.
|
||||||
; Objects with this structure are allocated by the kernel as a part of DISK
|
; Objects with this structure are allocated by the kernel as a part of the DISK
|
||||||
; structure and filled by a driver in the 'querymedia' callback.
|
; structure and are filled by a driver in the 'querymedia' callback.
|
||||||
struct DISKMEDIAINFO
|
struct DISKMEDIAINFO
|
||||||
.Flags dd ?
|
.Flags dd ?
|
||||||
; Combination of DISK_MEDIA_* bits.
|
; Combination of DISK_MEDIA_* bits.
|
||||||
@ -97,8 +97,8 @@ struct DISKMEDIAINFO
|
|||||||
; Size of the media in sectors.
|
; Size of the media in sectors.
|
||||||
ends
|
ends
|
||||||
|
|
||||||
; This structure represents disk cache. To follow the old implementation,
|
; This structure represents the disk cache. To follow the old implementation,
|
||||||
; there are two distinct caches for a disk, one for "system" data, other
|
; there are two distinct caches for a disk, one for "system" data,and the other
|
||||||
; for "application" data.
|
; for "application" data.
|
||||||
struct DISKCACHE
|
struct DISKCACHE
|
||||||
.Lock MUTEX
|
.Lock MUTEX
|
||||||
@ -160,9 +160,9 @@ struct DISK
|
|||||||
; Another reference is taken during any filesystem operation for this media.
|
; Another reference is taken during any filesystem operation for this media.
|
||||||
; The callback 'closemedia' is called when the reference count decrements to
|
; The callback 'closemedia' is called when the reference count decrements to
|
||||||
; zero: this usually occurs in 'disk_media_changed', but can be delayed to the
|
; zero: this usually occurs in 'disk_media_changed', but can be delayed to the
|
||||||
; end of last filesystem operation, if one is active.
|
; end of the last filesystem operation, if one is active.
|
||||||
.MediaInfo DISKMEDIAINFO
|
.MediaInfo DISKMEDIAINFO
|
||||||
; This field keeps an information about the current media.
|
; This field keeps information on the current media.
|
||||||
.NumPartitions dd ?
|
.NumPartitions dd ?
|
||||||
; Number of partitions on this media.
|
; Number of partitions on this media.
|
||||||
.Partitions dd ?
|
.Partitions dd ?
|
||||||
@ -227,9 +227,9 @@ endg
|
|||||||
uglobal
|
uglobal
|
||||||
; This mutex guards all operations with the global list of DISK structures.
|
; This mutex guards all operations with the global list of DISK structures.
|
||||||
disk_list_mutex MUTEX
|
disk_list_mutex MUTEX
|
||||||
; * There are two dependent objects, a disk and a media. In the simplest case
|
; * There are two dependent objects, a disk and a media. In the simplest case,
|
||||||
; disk and media are both non-removable. However, in the general case both
|
; disk and media are both non-removable. However, in the general case both
|
||||||
; can be removed at any time, simultaneously or only media, this makes things
|
; can be removed at any time, simultaneously or only media,and this makes things
|
||||||
; complicated.
|
; complicated.
|
||||||
; * For efficiency, both disk and media objects are located in the one
|
; * For efficiency, both disk and media objects are located in the one
|
||||||
; structure named DISK. However, logically they are different.
|
; structure named DISK. However, logically they are different.
|
||||||
@ -341,7 +341,7 @@ disk_add:
|
|||||||
; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0.
|
; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0.
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .nothing
|
jz .nothing
|
||||||
; 2. Copy disk name to the DISK structure.
|
; 2. Copy the disk name to the DISK structure.
|
||||||
; 2a. Get length of the name, including the terminating zero.
|
; 2a. Get length of the name, including the terminating zero.
|
||||||
mov ebx, [esp+8+8] ; ebx = pointer to name
|
mov ebx, [esp+8+8] ; ebx = pointer to name
|
||||||
push eax ; save allocated pointer to DISK
|
push eax ; save allocated pointer to DISK
|
||||||
@ -627,7 +627,7 @@ disk_default_adjust_cache_size:
|
|||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
ret 4
|
ret 4
|
||||||
|
|
||||||
; This is an internal function called from 'disk_media_changed' when new media
|
; This is an internal function called from 'disk_media_changed' when a new media
|
||||||
; is detected. It creates the list of partitions for the media.
|
; is detected. It creates the list of partitions for the media.
|
||||||
; If media is not partitioned, then the list consists of one partition which
|
; If media is not partitioned, then the list consists of one partition which
|
||||||
; covers all the media.
|
; covers all the media.
|
||||||
@ -688,17 +688,17 @@ lock dec [partition_buffer_users] ; no, we must allocate
|
|||||||
; execute step 9 and possibly step 10.
|
; execute step 9 and possibly step 10.
|
||||||
test ebp, ebp
|
test ebp, ebp
|
||||||
jnz .mbr
|
jnz .mbr
|
||||||
; Partition table can be present or not present. In the first case, we just
|
; The partition table can be present or not present. In the first case, we just
|
||||||
; read the MBR. In the second case, we just read the bootsector for some
|
; read the MBR. In the second case, we just read the bootsector for a
|
||||||
; filesystem.
|
; filesystem.
|
||||||
; We use the following algorithm to distinguish between these cases.
|
; The following algorithm is used to distinguish between these cases.
|
||||||
; A. If at least one entry of the partition table is invalid, this is
|
; A. If at least one entry of the partition table is invalid, this is
|
||||||
; a bootsector. See the description of 'is_partition_table_entry' for
|
; a bootsector. See the description of 'is_partition_table_entry' for
|
||||||
; definition of validity.
|
; definition of validity.
|
||||||
; B. If all entries are empty (filesystem type field is zero) and the first
|
; B. If all entries are empty (filesystem type field is zero) and the first
|
||||||
; byte is jmp opcode (0EBh or 0E9h), this is a bootsector which happens to
|
; byte is jmp opcode (0EBh or 0E9h), this is a bootsector which happens to
|
||||||
; have zeros in the place of partition table.
|
; have zeros in the place of partition table.
|
||||||
; C. Otherwise, this is a MBR.
|
; C. Otherwise, this is an MBR.
|
||||||
; 9. Test for MBR vs bootsector.
|
; 9. Test for MBR vs bootsector.
|
||||||
; 9a. Check entries. If any is invalid, go to 10 (rule A).
|
; 9a. Check entries. If any is invalid, go to 10 (rule A).
|
||||||
call is_partition_table_entry
|
call is_partition_table_entry
|
||||||
@ -724,7 +724,7 @@ lock dec [partition_buffer_users] ; no, we must allocate
|
|||||||
cmp byte [ebx], 0E9h
|
cmp byte [ebx], 0E9h
|
||||||
jnz .mbr
|
jnz .mbr
|
||||||
.notmbr:
|
.notmbr:
|
||||||
; 10. This is not MBR. The media is not partitioned. Create one partition
|
; 10. This is not an MBR. The media is not partitioned. Create one partition
|
||||||
; which covers all the media and abort the loop.
|
; which covers all the media and abort the loop.
|
||||||
stdcall disk_add_partition, 0, 0, \
|
stdcall disk_add_partition, 0, 0, \
|
||||||
dword [esi+DISK.MediaInfo.Capacity], dword [esi+DISK.MediaInfo.Capacity+4]
|
dword [esi+DISK.MediaInfo.Capacity], dword [esi+DISK.MediaInfo.Capacity+4]
|
||||||
|
Loading…
Reference in New Issue
Block a user