]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: guard loop device code with __linux__ in cache
authorKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 10:42:55 +0000 (11:42 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 3 Mar 2026 10:42:55 +0000 (11:42 +0100)
The is_loopdev() and loopdev_has_backing_file() functions from
loopdev.h are Linux-specific. Guard the loop device cache cleanup
in blkid_gc_cache() with __linux__ to allow compilation on
non-Linux systems like GNU/Hurd.

Co-authored-by: Samuel Thibault <samuel.thibault@aquilenet.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/cache.c

index 6a2cc342083253ec904ccfb8b3aab8d8fa9da057..d2fa077d4479c06da03ff8a3155035b9524e4491 100644 (file)
@@ -188,12 +188,15 @@ void blkid_gc_cache(blkid_cache cache)
                        DBG(CACHE, ul_debugobj(cache, "freeing non-existing %s", dev->bid_name));
                        blkid_free_dev(dev);
                        cache->bic_flags |= BLKID_BIC_FL_CHANGED;
+
+#ifdef __linux__
                } else if (is_loopdev(dev->bid_name)
                                        && !loopdev_has_backing_file(dev->bid_name)) {
                        /* remove empty loop device from cache */
                        DBG(CACHE, ul_debugobj(cache, "freeing empty loop device %s", dev->bid_name));
                        blkid_free_dev(dev);
                        cache->bic_flags |= BLKID_BIC_FL_CHANGED;
+#endif
                } else {
                        DBG(CACHE, ul_debug("Device %s exists", dev->bid_name));
                }