Documentation

diskinfo

Type definition for file system disk information structure

Syntax

typedef struct {
   char         Label[12];
   char         DriveLetter;
   char         Reserved[3];
   unsigned int SerialNumber;
   unsigned int FirstPhysicalSector;
   unsigned int FATType;
   unsigned int FATCount;
   unsigned int MaxDirEntries;
   unsigned int BytesPerSector;
   unsigned int SectorsPerCluster;
   unsigned int TotalClusters;
   unsigned int BadClusters;
   unsigned int FreeClusters;
   unsigned int Files;
   unsigned int FileChains;
   unsigned int FreeChains;
   unsigned int LargestFreeChain;
   unsigned int DriveType;
} diskinfo; 

Fields

Label

This value contains the zero-terminated character string that contains the volume label. The character string is empty if the volume has no label.

DriveLetter

This value contains the drive letter, in uppercase.

Reserved

Reserved.

SerialNumber

This value contains the volume serial number.

FirstPhysicalSector

This value contains the logical block addressing (LBA) address of the logical drive boot record. For 3.5-inch disks, this value is 0.

FATType

This value contains the type of file system found. It contains 32, representing FAT-32 volumes.

The values 12 and 16, representing FAT-12 and FAT-16 volumes, are supported for backward compatibility only.

FATCount

This value contains the number of FAT partitions on the volume.

MaxDirEntries

This value contains the size of the root folder. For FAT-32 systems, this value is 0.

BytesPerSector

This value contains the sector size. This value is most likely to be 512.

SectorsPerCluster

This value contains, in sectors, the size of the smallest unit of storage that can be allocated to a file.

TotalClusters

This value contains the number of file storage clusters on the volume.

BadClusters

This value contains the number of clusters that have been marked as bad. These clusters are unavailable for file storage.

FreeClusters

This value contains the number of clusters that are currently available for storage.

Files

This value contains the number of files, including folders, on the volume. This number excludes the root folder and files that have an allocated file size of 0.

FileChains

This value contains the number of contiguous cluster chains. On a defragmented volume, this value is identical to the value of Files.

FreeChains

This value contains the number of contiguous cluster chains of free clusters. On a defragmented volume, this value is 1.

LargestFreeChain

This value contains the maximum allocated file size, in number of clusters, for a newly allocated contiguous file. On a defragmented volume, this value is identical to FreeClusters.

DriveType

This value contains a code for the type of permanent storage installed in the target computer. The values are:

  • 0 — Unknown drive

  • 1 — Drive with no root folder

  • 2 — Removable drive

  • 3 — Fixed (hard) drive

  • 4 — Remote drive (not supported)

  • 5 — CDROM drive (not supported)

  • 6 — RAM disk

Description

The diskinfo structure contains information for file system disks.

Introduced in R2012a

Was this topic helpful?