Reference
API Reference
Complete C API reference for libdriveinfo — the native backend library.
Device Enumeration
Discovers all physical storage devices connected to the system.
Populates an array of drive_info_t structs.
Parameters
Returns
DI_SUCCESS (0) on
success, negative error code on failure.
Frees memory allocated by di_enumerate_drives().
Device Details
Fills in detailed metadata for a drive: model, serial number, firmware version, capacity, and security state.
Populated Fields
Wipe Operations
Starts an asynchronous wipe operation in a new thread. Returns immediately.
Methods (di_wipe_method_t)
DI_WIPE_ZERO
DI_WIPE_ONE
DI_WIPE_RANDOM
DI_WIPE_DOD_3
DI_WIPE_DOD_7
DI_WIPE_GUTMANN
DI_WIPE_NIST_CLEAR
DI_WIPE_NIST_PURGE
Queries the current progress of a running wipe operation.
Progress Fields
Signals the wipe thread to stop. The thread will finish the current sector write and exit cleanly.
Purge Operations
Performs ATA Security Erase. Sets password, prepares drive, and sends SECURITY ERASE UNIT command.
Error Codes
Sends NVMe Sanitize command. Methods: DI_PURGE_NVME_SANITIZE_CRYPTO, DI_PURGE_NVME_SANITIZE_BLOCK.
Error Codes
| Code | Constant | Description |
|---|---|---|
| 0 | DI_SUCCESS | Operation completed successfully |
| -1 | DI_ERR_GENERAL | General / unspecified error |
| -2 | DI_ERR_PERMISSION | Insufficient permissions (not root) |
| -3 | DI_ERR_NOT_SUPPORTED | Feature not supported by device |
| -4 | DI_ERR_FROZEN | ATA security is frozen |
| -5 | DI_ERR_LOCKED | Drive is locked |
| -6 | DI_ERR_IO | I/O error during operation |
| -7 | DI_ERR_BUSY | Device is busy |