@CHIP-RTOS - BIOS_ExecuteExt() CHKDSK Feedback
IPC@CHIP® Documentation Index
This data structure is defined in the Beck C-library BIOS_API.H header
typedef struct DiskStatT
unsigned dsStructSize ; // = sizeof(DiskStatS)
unsigned char dsPlpFormat ; // TRUE if drive has PLP format.
unsigned char dsParamErr ; // TRUE if had command line problems.
unsigned char dsDidCheck ; // FALSE if had resource problem.
unsigned char dsFaultDetected ; // TRUE if some fault detected.
unsigned char dsFatSize ; // Bits per FAT entry: 12, 16 or 32
unsigned char dsFatNum ; // Number of FAT drive has.
unsigned dsProgressTick ; // Upcounter to indicate activity.
unsigned dsClusterSize ; // [bytes]
unsigned dsSectorPerCluster ; // [sectors]
unsigned dsRootNodes ; // [Directory nodes]
unsigned long dsTotalClusters ; // [clusters]
// Remaining members are fault counters.
unsigned long dsLostClusters ; // Allocated, but in no file/dir chain.
unsigned long dsBadClusters ; // Bad cluster count.
unsigned long dsClustersNotAlloc ; // In use, but not allocated.
unsigned long dsCorruptLFN ; // Long file names bad
unsigned long dsCorruptLFNNodes ; // Long file names nodes bad
unsigned long dsBadDotRef ; // '.' or '..' dir reference wrong.
// End of errors fixed by "/F" option.
unsigned long dsMultiDots ; // '.' or '..' repeated.
unsigned long dsMultiUseCluster ; // Cluster appears in more than on chain.
unsigned long dsDirDepthExceeded ; // The CKDISK_MAX_DEPTH limit exceeded.
unsigned long dsInvalidClusterNo ; // In a file.
unsigned long dsInvalidClusterFix ; // END_OF_CHAIN set in a file.
unsigned long dsBlockFailCnt ; // Block writes failed at "fix"
unsigned long dsInfiniteLoop ; // File contains infinite loop.
unsigned long dsFatMismatch ; // Sectors diff between FAT0 & FAT1.
unsigned long dsFatFixFailCnt ; // Block writes failed at "fix"
unsigned long dsFileTooShort ; // Too few clusters in chain.
unsigned long dsFileTooLong ; // Too many cluster in chain
unsigned dsStatusFlags; // Discrete bits
} DiskStatS ;
- One of these DiskStatS
objects must be provided by the user.
reference this object in the user's memory space
when invoking the CHKDSK
The caller must set the first member of this structure,
, prior to
calling the BIOS_ExecuteExt()
API. The remainder of
the structure members are output parameters written by the
Optionally, the caller may want to initialize fields such as
to zero prior to calling. However
within the API, all output values will be initially reset.
For the Boolean flag values, a 1 output indicates TRUE and 0 indicates FALSE.
This member must be set by the user prior to calling
For a full CHKDSK report, it should be set to
. Another option would be to
set this to
in which case
CHKDSK will report only the
Boolean flags dsPlpFormat
. The time consuming CHKDSK action
is then skipped for this abbreviated report. In any event, no memory
beyond this number of bytes past the start of this data structure will
be written by the CHKDSK, thereby allowing future versions of CHKDSK to
offer extended data in future @CHIP-RTOS-x86
releases without requiring any
changes to your existing application programs.
This Boolean flag is set to TRUE if the referenced disk
drive is formatted with the PLP option.
Otherwise it is set to FALSE.
This Boolean flag is set to TRUE if there was some problem
with the command line parameters which prevented the CHKDSK operation
from proceeding. Further causes for this flag to be set are if
the file system sign in
for this task failed or if the drive specifier was invalid.
This Boolean flag is set to TRUE if there were no resource
problems to prevent the CHKDSK operation from proceeding.
For example, if the required memory allocation failed then this
flag will be set FALSE and the CHKDSK operation will have
not been performed. No further output parameters in this
data structure will have been set unless this flag is TRUE.
This Boolean flag is set to TRUE if the CHKDSK operation
was performed and some disk fault was detected. In this case,
one or more of the fault counters which follow at the lower end of this
data structure will be non-zero to indicate which problems were
This value is set to 12 for FAT12, 16 for FAT16 or 32 for a FAT32
drive. These counts are the number of bits per FAT entry in
the drive's File Allocation Table.
The number of File Allocation Table copies present. Typically
this value will be two.
This location will be up count, starting at zero as the
CHKDSK operation proceeds. The count advances by one tick
at each point where the CHKDSK outputs the dots to the console.
Unfortunately for progress bar implementations, there is no end count
value known in advance. This is due to that to determine the
end count would have required to much additional time and
effort (it is a function of directory depths and number
of directories on the drive).
Number of bytes per disk cluster.
Number of 512 byte sectors per disk cluster.
Number of directory nodes allocated in a
FAT16 or FAT12 root directory. This value has
no significance for FAT32 drives and it will be set to zero.
Total number of clusters on the drive.
The remaining members of this structure will be zero
unless some fault on the drive was found by CHKDSK
Boolean set TRUE).
Number of lost clusters detected. A "lost cluster" is one
which was marked allocated in the FAT but which appeared in no
file's or directory's cluster chain.
Number of clusters that were tagged in FAT as bad
(lower bits of FAT entry
0xFF7 with all upper bits set).
Number of clusters which were in use by some
file or directory's cluster chain, but which were not
allocated in the FAT.
Number of cases where corrupt long file names were
found in the directory nodes.
Number of directory nodes which contained invalid long
Number of cases where invalid . or .. directory entries
were found (self or parent references).
Number of cases where the . or .. directory entry
appeared more than once in a directory.
Number of cases where a clusters was linked into more
than a single cluster chain (multiple heads).
Number of cases where the directory depth limit was exceeded.
(This limit is imposed by the path length limit of 260
Number of cases where an invalid cluster number appeared
in a cluster chain.
Number of times cluster chains where terminated by CHKDSK
for the /f option service.
Number of block write failures which occurred either
a failed fix action for the CHKDSK /F option or
a PLP commit.
Number of cases where a file or directory cluster chain
looped onto itself.
For drives with more than a single FAT, this is the number of
FAT sectors which did not match when comparing the two FAT images.
Number of cases where disk sector writes for the CHKDSK /F option
Number of cases where a file's cluster chain was
too short for the file size stated in it's directory node.
Number of cases where a file's cluster chain was
too long for the file size stated in it's directory node.
Discrete status flags with following bit assignments. Note:
The SD card alignment indications require an EXTSD
supports the 0x3 service to report the sector number at which the
drive's partition starts.
- (=0x1) Bit set
if clusters on external SD card drive are aligned to the
device's flash pages.
- (=0x2) Bit set
if clusters on external SD card drive are misaligned to the
device's flash pages. In this case, a
FORMAT operation is
recommended to improve the disk write performance slightly, and to
reduce the wear on the device.
- CHKDSK - Check disk shell command
- BIOS_ExecuteExt() API
Top of list
End of document