cryptsetup API
Public cryptsetup API
Macros | Enumerations | Functions
Function to wipe device

Macros

#define CRYPT_WIPE_NO_DIRECT_IO   (1 << 0)
 

Enumerations

enum  crypt_wipe_pattern { CRYPT_WIPE_ZERO , CRYPT_WIPE_RANDOM , CRYPT_WIPE_ENCRYPTED_ZERO , CRYPT_WIPE_SPECIAL }
 

Functions

int crypt_wipe (struct crypt_device *cd, const char *dev_path, crypt_wipe_pattern pattern, uint64_t offset, uint64_t length, size_t wipe_block_size, uint32_t flags, int(*progress)(uint64_t size, uint64_t offset, void *usrptr), void *usrptr)
 

Detailed Description

Macro Definition Documentation

◆ CRYPT_WIPE_NO_DIRECT_IO

#define CRYPT_WIPE_NO_DIRECT_IO   (1 << 0)

Use direct-io

Enumeration Type Documentation

◆ crypt_wipe_pattern

Wipe pattern

Enumerator
CRYPT_WIPE_ZERO 

Fill with zeroes

CRYPT_WIPE_RANDOM 

Use RNG to fill data

CRYPT_WIPE_ENCRYPTED_ZERO 

Add encryption and fill with zeroes as plaintext

CRYPT_WIPE_SPECIAL 

Compatibility only, do not use (Gutmann method)

Function Documentation

◆ crypt_wipe()

int crypt_wipe ( struct crypt_device *  cd,
const char *  dev_path,
crypt_wipe_pattern  pattern,
uint64_t  offset,
uint64_t  length,
size_t  wipe_block_size,
uint32_t  flags,
int(*)(uint64_t size, uint64_t offset, void *usrptr)  progress,
void *  usrptr 
)

Wipe/Fill (part of) a device with the selected pattern.

Parameters
cdcrypt device handle
dev_pathpath to device to wipe or NULL if data device should be used
patternselected wipe pattern
offsetoffset on device (in bytes)
lengthlength of area to be wiped (in bytes)
wipe_block_sizeused block for wiping (one step) (in bytes)
flagswipe flags
progresscallback function called after each wipe_block_size or NULL
usrptrprovided identification in callback
Returns
0 on success or negative errno value otherwise.
Note
A progress callback can interrupt wipe process by returning non-zero code.
If the error values is -EIO or -EINTR, some part of the device could be overwritten. Other error codes (-EINVAL, -ENOMEM) means that no IO was performed.