API changes in libblockdev 3.0: libblockdev Reference Manual for libblockdev 3.1.0.

# API changes in libblockdev 3.0

This is a list of API changes in libblockdev 3.0 with suggested replacements.

## Library

`bd_switch_init_checks()` has been removed. Checks for runtime dependencies during libblockdev initialization are now disabled and plugins will be loaded even if a runtime dependency is missing.

`bd_"plugin"_check_deps` functions have been removed from all plugins. Use `bd_"plugin"_is_tech_avail` to check for plugin dependencies.

## LVM plugin

`bd_lvm_data_lv_name()` has been removed, use `data_lv` from BDLVMLVdata instead.

`bd_lvm_metadadata_lv_name()` has been removed, use `metadata_lv` from BDLVMLVdata instead.

`BD_LVM_MAX_LV_SIZE` constant has been removed, use `bd_lvm_get_max_lv_size()` instead.

Multiple thinpool and cache metadata size related constants have been removed without replacement. We recommend using functions like `bd_lvm_get_thpool_meta_size` instead. Removed constants: `BD_LVM_MIN_THPOOL_MD_SIZE`, `BD_LVM_MAX_THPOOL_MD_SIZE`, `BD_LVM_MIN_THPOOL_CHUNK_SIZE`, `BD_LVM_MIN_CACHE_MD_SIZE`, `BD_LVM_DEFAULT_CHUNK_SIZE`, `BD_LVM_MAX_PE_SIZE`, `BD_LVM_MIN_PE_SIZE`, `BD_LVM_DEFAULT_PE_START` and `BD_LVM_DEFAULT_PE_SIZE`.

`bd_lvm_lvactivate()` has a new parameter `shared`, use `FALSE` to preserve the original behaviour.

## VDO plugin

VDO plugin has been removed.

## Crypto plugin

`bd_crypto_luks_uuid()` has been removed, use `uuid` from BDCryptoLUKSInfo instead.

`bd_crypto_luks_get_metadata_size()` has been removed, use `metadata_size` from BDCryptoLUKSInfo instead.

LUKS2-specific functions were removed. The "generic" LUKS functions which now support both LUKSv1 and LUKSv2 should be used instead. Affected functions: `bd_crypto_luks_format_luks2` and `bd_crypto_luks_resize_luks2`.

`bd_crypto_luks_open_keyring` has been removed, `bd_crypto_luks_open` with the keyring context (see below) can be used instead.

`bd_crypto_tc_open_full` has been removed, `bd_crypto_tc_open` can be used instead. `bd_crypto_tc_open` arguments have been changed to match the "full" function.

Functions that allowed using arbitrary binary data for passphrases were removed. The "generic" functions should be used instead, see the key slot context information below. Affected functions: `bd_crypto_luks_format_blob`, `bd_crypto_luks_format_luks2_blob`, `bd_crypto_luks_open_blob`, `bd_crypto_luks_add_key_blob`, `bd_crypto_luks_remove_key_blob`, `bd_crypto_luks_change_key_blob`, `` and `bd_crypto_luks_resume_blob`.

All functions that require some type of passphrase or key as an input now expect `BDCryptoKeyslotContext` instead. This is a private opaque context that needs to be set by one of the `bd_crypto_keyslot_context_new_*` functions based on the type of the context required.

## NVDIMM plugin

`bd_nvdimm_namepace_get_supported_sector_sizes` has been removed, use `bd_nvdimm_namespace_get_supported_sector_sizes` instead.

## FS plugin

`bd_fs_clean` and `bd_fs_wipe` have new parameter `force` that allows controlling whether the signatures will be removed from a mounted device or not. Use `TRUE` to preserve the original behaviour.

Following functions have a new parameter `fstype` that allows to skip scanning the device for signature. Use `NULL` to preserve the original behaviour. Affected functions: `bd_fs_resize`, `bd_fs_repair`, `bd_fs_check`, `bd_fs_set_label`, `bd_fs_set_uuid`, `bd_fs_get_size` and `bd_fs_get_free_space`

Type-specific `bd_fs_..._wipe` functions have been removed. Use `bd_fs_wipe` or `bd_fs_clean` instead. Affected functions: `bd_fs_btrfs_wipe`, `bd_fs_ext2_wipe`, `bd_fs_ext3_wipe`, `bd_fs_ext4_wipe`, `bd_fs_exfat_wipe`, `bd_fs_f2fs_wipe`, `bd_fs_nilfs2_wipe`, `bd_fs_ntfs_wipe`, `bd_fs_vfat_wipe`, `bd_fs_udf_wipe`, `bd_fs_xfs_wipe`

`bd_fs_ntfs_check`, `bd_fs_ntfs_repair` and `bd_fs_xfs_check` have a new parameter `extra` that allows specifying extra options for the fsck tools. This makes the functionality consistent with the other filesystems.

`BDFsResizeFlags` enum was renamed to `BDFSResizeFlags`.

`BDFsError` enum was renamed to `BDFSError`.

## Part plugin

The part plugin has been rewritten to use libfdisk library instead of libparted. The following functions, enums and definitions related to partition and disk flags have been removed. `bd_part_set_part_flag`, `bd_part_get_flag_str`, `bd_part_set_disk_flag`, `bd_part_set_part_flags`, `BDPartFlag` and `BDPartDiskFlag`.

We recommend using the `bd_part_set_part_type` and `bd_part_set_part_id` functions to set partition GUID (GPT) or ID (MSDOS) to set the required type/id instead.

New functions `bd_part_set_part_bootable` and `bd_part_set_part_attributes` have been added to allow controlling the bootable flag (MSDOS) and partition attributes (GPT).

The `bd_part_get_part_id` function has been removed. The partition id parameter is now available in `BDPartSpec`.

## KBD plugin

KBD plugin (providing support for bcache and zRAM devices) has been removed.

## Loop plugin

`bd_loop_setup` and `bd_loop_setup_from_fd` has a new parameter `sector_size`. Use `0` to preserve the original behaviour.

`bd_loop_get_backing_file` and `bd_loop_get_autoclear` have been removed. Use `bd_loop_info` instead.

## DM plugin

Support for DM RAID (`BD_DM_TECH_RAID` technology) was removed from the plugin. Following functions were removed without replacement: `bd_dm_get_member_raid_sets`, `bd_dm_activate_raid_set`, `bd_dm_deactivate_raid_set` and `bd_dm_get_raid_set_type`.

## MDRAID plugin

The `bitmap` argument of the `bd_md_create` function now accepts arbitrary string instead of a boolean value. Previous value of `FALSE` is now represented by `NULL`, i.e. letting `mdadm` decide itself whether to create an internal bitmap or not.

## Swap plugin

`bd_swap_mkswap` has a new optional parameter `uuid`.