FAT

FatWrLabel()

PROTOTYPE

#include <fsdriver.h>

int FatWrLabel(const char *name, const char *label);

DESCRIPTION

FatWrLabel() writes a volume label for the mounted FAT volume specified by name, either creating a root directory label entry, if none exists, or updating an existing entry. label points to a null-terminated string. At most 11 characters are copied from it to the label entry.

The label string is invalid if it starts with a blank or a zero, is longer than 11 characters, has any character whose value is less than 0x20, or contains any one of these characters *?.,;:/\|+=<>[]\”

If the label field in the Volume Boot Record is not the eleven characters “NO NAME “, that value is written to it.

If successful, FatWrLabel() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

EFAULT Either name or label equals NULL.
EINVAL The specified volume is unmounted or label is invalid.
ENOENT No attached volume matches the specified name.
EROFS The volume is read-only.

EXAMPLE

  /*---------------------------------------------------------------*/
  /* Write the FAT volume label.                                   */
  /*---------------------------------------------------------------*/
  if (FatWrLabel(vol_name, "NO NAME"))
    error("FatWrLabel() failed");