From: Antonio Alvarez Feijoo Date: Thu, 25 Sep 2025 07:39:56 +0000 (+0200) Subject: libblkid: fix build with blkid disabled X-Git-Tag: v259-rc1~448 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e77566fbca2a3bcdfb79a0cc166e952a66fe7419;p=thirdparty%2Fsystemd.git libblkid: fix build with blkid disabled Prompted by c349edfe49dc2c4b8a79e5d08ecf7c8e93c4c909, but it didn't work before. --- diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 06c1195eb2b..a0b4368a2aa 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -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) { diff --git a/src/repart/repart.c b/src/repart/repart.c index 50254740930..6bd0c157158 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -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(