libblkid: fix build with blkid disabled

Prompted by c349edfe49, but it didn't work before.
This commit is contained in:
Antonio Alvarez Feijoo
2025-09-25 09:39:56 +02:00
committed by Daan De Meyer
parent ec3139db8b
commit e77566fbca
2 changed files with 18 additions and 0 deletions

View File

@@ -134,6 +134,7 @@ static int probe_file_system_by_fd(
char **ret_fstype,
sd_id128_t *ret_uuid) {
#if HAVE_BLKID
_cleanup_(blkid_free_probep) blkid_probe b = NULL;
const char *fstype = NULL;
sd_id128_t id;
@@ -183,6 +184,9 @@ static int probe_file_system_by_fd(
return r;
*ret_uuid = id;
return 0;
#else
return -EOPNOTSUPP;
#endif
}
static int probe_file_system_by_path(const char *path, char **ret_fstype, sd_id128_t *ret_uuid) {
@@ -663,6 +667,7 @@ static int luks_validate(
uint64_t *ret_offset,
uint64_t *ret_size) {
#if HAVE_BLKID
_cleanup_(blkid_free_probep) blkid_probe b = NULL;
sd_id128_t found_partition_uuid = SD_ID128_NULL;
const char *fstype = NULL, *pttype = NULL;
@@ -775,6 +780,9 @@ static int luks_validate(
*ret_partition_uuid = found_partition_uuid;
return 0;
#else
return -EOPNOTSUPP;
#endif
}
static int crypt_device_to_evp_cipher(struct crypt_device *cd, const EVP_CIPHER **ret) {

View File

@@ -4271,6 +4271,7 @@ static bool context_changed(const Context *context) {
}
static int context_wipe_range(Context *context, uint64_t offset, uint64_t size) {
#if HAVE_BLKID
_cleanup_(blkid_free_probep) blkid_probe probe = NULL;
int r;
@@ -4312,6 +4313,10 @@ static int context_wipe_range(Context *context, uint64_t offset, uint64_t size)
}
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Cannot wipe partition signatures, libblkid support is not compiled in.");
#endif
}
static int context_wipe_partition(Context *context, Partition *p) {
@@ -7361,6 +7366,7 @@ static int resolve_copy_blocks_auto_candidate(
dev_t restrict_devno,
sd_id128_t *ret_uuid) {
#if HAVE_BLKID
_cleanup_(blkid_free_probep) blkid_probe b = NULL;
_cleanup_close_ int fd = -EBADF;
_cleanup_free_ char *p = NULL;
@@ -7473,6 +7479,10 @@ static int resolve_copy_blocks_auto_candidate(
*ret_uuid = u;
return true;
#else
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Cannot check partition type UUID and device location, libblkid support is not compiled in.");
#endif
}
static int resolve_copy_blocks_auto_candidate_harder(