1.2.7.4.40 SYS_FS_DriveLabelSet Function

C

SYS_FS_RESULT SYS_FS_DriveLabelSet
(
    const char* drive,
    const char *label
);

Summary

Sets the drive label

Description

This function sets the label for the drive specified. If no drive is specified, the label for the current drive is set.

Precondition

At least one disk must be mounted.

Parameters

ParamDescription
drivePointer to string that holds the name of drive being for which the label is to be set. If this string is NULL, the label of the current drive is set by using this function.
labelPointer to string which contains the label to be set.

Returns

SYS_FS_RES_SUCCESS - Drive label set operation was successful.

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

Example

SYS_FS_RESULT res;

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 = SET_LABEL;
        }
        break;
    }
    
    case SET_LABEL:
    {
        res = SYS_FS_DriveLabelSet("/mnt/myDrive", "MY_LABEL");
        if(res == SYS_FS_RES_FAILURE)
        {
            // Drive label get failed
        }
        break;
    }
}

Remarks

None.