/* Clears out all files from the Fv buffer in memory */
EFI_STATUS FvBufClearAllFiles(IN OUT VOID *Fv)
/* Clears out all files from the Fv buffer in memory */
EFI_STATUS FvBufClearAllFiles(IN OUT VOID *Fv)
{
  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
  EFI_STATUS Status;
  UINTN size = 0;
  Status = FvBufGetSize (Fv, &size);
  if (EFI_ERROR (Status)) {
    return Status;
  }
  CommonLibBinderSetMem(
    (UINT8*)hdr + hdr->HeaderLength,
    size - hdr->HeaderLength,
    (hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0
    );
  return EFI_SUCCESS;
}