www.beck-ipc.com

@CHIP-RTOS - BIOS_ExecuteExt() CHKDSK Feedback


    IPC@CHIP® Documentation Index

Data Structure

This data structure is defined in the Beck C-library BIOS_API.H header file.


DiskStatS


            
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 ;

Comments

One of these DiskStatS objects must be provided by the user.   The report parameter to BIOS_ExecuteExt() must reference this object in the user's memory space when invoking the CHKDSK command.

The caller must set the first member of this structure, dsStructSize , prior to calling the BIOS_ExecuteExt() API.   The remainder of the structure members are output parameters written by the CHKDSK command.   Optionally, the caller may want to initialize fields such as dsProgressTick 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.

dsStructSize

    This member must be set by the user prior to calling BIOS_ExecuteExt().   For a full CHKDSK report, it should be set to sizeof(DiskStatS) .   Another option would be to set this to

                 offsetof(DiskStatS, dsDidCheck)

    in which case CHKDSK will report only the Boolean flags dsPlpFormat and dsParamErr .   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.

dsPlpFormat
    This Boolean flag is set to TRUE if the referenced disk drive is formatted with the PLP option. Otherwise it is set to FALSE.

dsParamErr
    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.

dsDidCheck
    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.

dsFaultDetected
    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 detected.

dsFatSize
    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.

dsFatNum
    The number of File Allocation Table copies present.   Typically this value will be two.

dsProgressTick
    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).

dsClusterSize
    Number of bytes per disk cluster.

dsSectorPerCluster
    Number of 512 byte sectors per disk cluster.

dsRootNodes
    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.

dsTotalClusters
    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 (dsFaultDetected Boolean set TRUE).

dsLostClusters
    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.

dsBadClusters
    Number of clusters that were tagged in FAT as bad (lower bits of FAT entry 0xFF7 with all upper bits set).

dsClustersNotAlloc
    Number of clusters which were in use by some file or directory's cluster chain, but which were not allocated in the FAT.

dsCorruptLFN
    Number of cases where corrupt long file names were found in the directory nodes.

dsCorruptLFNNodes
    Number of directory nodes which contained invalid long file names.

dsBadDotRef
    Number of cases where invalid . or .. directory entries were found (self or parent references).

dsMultiDots
    Number of cases where the . or .. directory entry appeared more than once in a directory.

dsMultiUseCluster
    Number of cases where a clusters was linked into more than a single cluster chain (multiple heads).

dsDirDepthExceeded
    Number of cases where the directory depth limit was exceeded.   (This limit is imposed by the path length limit of 260 characters.)

dsInvalidClusterNo
    Number of cases where an invalid cluster number appeared in a cluster chain.

dsInvalidClusterFix
    Number of times cluster chains where terminated by CHKDSK for the /f option service.

dsBlockFailCnt
    Number of block write failures which occurred either due to a failed fix action for the CHKDSK /F option or a PLP commit.

dsInfiniteLoop
    Number of cases where a file or directory cluster chain looped onto itself.

dsFatMismatch
    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.

dsFatFixFailCnt
    Number of cases where disk sector writes for the CHKDSK /F option have failed.

dsFileTooShort
    Number of cases where a file's cluster chain was too short for the file size stated in it's directory node.

dsFileTooLong
    Number of cases where a file's cluster chain was too long for the file size stated in it's directory node.

dsStatusFlags
    Discrete status flags with following bit assignments. Note: The SD card alignment indications require an EXTSD driver which supports the 0x3 service to report the sector number at which the drive's partition starts.

    • DS_CLUSTERS_ALIGNED - (=0x1) Bit set if clusters on external SD card drive are aligned to the device's flash pages.

    • DS_CLUSTERS_MISALIGNED - (=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.


Related Topics

CHKDSK - Check disk shell command
BIOS_ExecuteExt() API

Top of list
Index page


End of document