FAT
FatRdLabel()
PROTOTYPE
#include <fsdriver.h>
int FatRdLabel(const char *name, char *label, size_t label_sz);
DESCRIPTION
FatRdLabel() reads the volume label of the mounted FAT volume specified by name. label points to a buffer the label is copied to. label_sz is the buffer’s size, in bytes.
The volume label is read from either the root directory, if it has a label entry, or the Volume Boot Record. FatRdLabel() copies at most 11 characters to the output buffer. The label characters are followed by a terminating null.
If successful, FatRdLabel() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EFAULT | Either name or label equals NULL. |
| EINVAL | Either label_sz is less than 2 or the specified volume is unmounted. |
| ENOENT | No attached volume matches the specified name. |
| ENOMEM | Failed to allocate memory for a temporary buffer. |
EXAMPLE
char buf[12];
/*---------------------------------------------------------------*/
/* Read and display the FAT volume label. */
/*---------------------------------------------------------------*/
if (FatRdLabel(vol_name, buf, 12))
return -1;
printf("The volume label is %s\n", buf);