1.2.7.4.39 SYS_FS_DriveLabelGet Function

C

SYS_FS_RESULT SYS_FS_DriveLabelGet
(
    const char* drive,
    char *buff,
    uint32_t *sn
);

Summary

Gets the drive label.

Description

This function gets the label for the drive specified. If no drive is specified, the label for the current drive is obtained.

Precondition

At least one disk must be mounted.

Parameters

ParamDescription
drivePointer to buffer which will hold the name of drive being for which the label is requested. If this string is NULL, then then label of the current drive is obtained by using this function.
buffBuffer which will hold the string of label.
snSerial number of the drive. If this information is not needed, it can be set as NULL.

Returns

SYS_FS_RES_SUCCESS - Drive label information retrieval was successful.

SYS_FS_RES_FAILURE - Drive label information retrieval was unsucessful. The reason for the failure can be retrieved with SYS_FS_Error.

Example

SYS_FS_RESULT res;
char buffer[255];
uint32_t serialNo;

switch(appState)
{
    case TRY_MOUNT:
    {
        if(SYS_FS_Mount("/dev/mmcblka1", "/mnt/myDrive", FAT, 0, NULL) != SYS_FS_RES_SUCCESS)
        {
            // Failure, try mounting again
        }
        else
        {
            // Mount was successful. Get label now
            appState = GET_LABEL;
        }
        break;
    }
    
    case GET_LABEL:
    {
        res = SYS_FS_DriveLabelGet("/mnt/myDrive", buffer, &serialNo);
        
        if(res == SYS_FS_RES_FAILURE)
        {
            // Fetching drive label information failed
        }
        break;
    }
}

Remarks

None.