]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libblkid: fix build with blkid disabled
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Thu, 25 Sep 2025 07:39:56 +0000 (09:39 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 25 Sep 2025 09:03:24 +0000 (11:03 +0200)
Prompted by c349edfe49dc2c4b8a79e5d08ecf7c8e93c4c909, but it didn't work before.

src/home/homework-luks.c
src/repart/repart.c

index 06c1195eb2b0e4963a39f4f74f3163bde4af59f9..a0b4368a2aaf7d761f8bb5a0d18acdeae0a1f377 100644 (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) {
index 50254740930833aecea8f383793fe39b0b6fc1dd..6bd0c15715862be94f52a30446627d36fd572ef7 100644 (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(