Use #if for HAVE_BLKID_* defines.

This commit is contained in:
Milan Broz
2025-01-16 12:49:46 +01:00
parent e5405f2fd8
commit d9404821a6
3 changed files with 8 additions and 8 deletions

View File

@@ -15,7 +15,7 @@
#include "utils_blkid.h" #include "utils_blkid.h"
#include "utils_io.h" #include "utils_io.h"
#ifdef HAVE_BLKID #if HAVE_BLKID
#include <blkid/blkid.h> #include <blkid/blkid.h>
/* make bad checksums flag optional */ /* make bad checksums flag optional */
@@ -26,7 +26,7 @@ struct blkid_handle {
int fd; int fd;
blkid_probe pr; blkid_probe pr;
}; };
#ifndef HAVE_BLKID_WIPE #if !HAVE_BLKID_WIPE
static size_t crypt_getpagesize(void) static size_t crypt_getpagesize(void)
{ {
long r = sysconf(_SC_PAGESIZE); long r = sysconf(_SC_PAGESIZE);
@@ -38,7 +38,7 @@ void blk_set_chains_for_wipes(struct blkid_handle *h)
{ {
blkid_probe_enable_partitions(h->pr, 1); blkid_probe_enable_partitions(h->pr, 1);
blkid_probe_set_partitions_flags(h->pr, 0 blkid_probe_set_partitions_flags(h->pr, 0
#ifdef HAVE_BLKID_WIPE #if HAVE_BLKID_WIPE
| BLKID_PARTS_MAGIC | BLKID_PARTS_MAGIC
#endif #endif
); );
@@ -198,10 +198,10 @@ void blk_free(struct blkid_handle *h)
free(h); free(h);
} }
#ifndef HAVE_BLKID_WIPE #if !HAVE_BLKID_WIPE
static int blk_step_back(struct blkid_handle *h) static int blk_step_back(struct blkid_handle *h)
{ {
#ifdef HAVE_BLKID_STEP_BACK #if HAVE_BLKID_STEP_BACK
return blkid_probe_step_back(h->pr); return blkid_probe_step_back(h->pr);
#else #else
blkid_reset_probe(h->pr); blkid_reset_probe(h->pr);
@@ -213,7 +213,7 @@ static int blk_step_back(struct blkid_handle *h)
int blk_do_wipe(struct blkid_handle *h) int blk_do_wipe(struct blkid_handle *h)
{ {
#ifdef HAVE_BLKID_WIPE #if HAVE_BLKID_WIPE
return blkid_do_wipe(h->pr, 0); return blkid_do_wipe(h->pr, 0);
#else #else
const char *offset; const char *offset;

View File

@@ -428,7 +428,7 @@ void tools_package_version(const char *name, bool use_pwlibs)
#if USE_UDEV #if USE_UDEV
udev = true; udev = true;
#endif #endif
#ifdef HAVE_BLKID #if HAVE_BLKID
blkid = true; blkid = true;
#endif #endif
#if KERNEL_KEYRING #if KERNEL_KEYRING

View File

@@ -5924,7 +5924,7 @@ static void KeyslotContextAndKeyringLink(void)
static int _crypt_load_check(struct crypt_device *_cd) static int _crypt_load_check(struct crypt_device *_cd)
{ {
#ifdef HAVE_BLKID #if HAVE_BLKID
return crypt_load(_cd, CRYPT_LUKS, NULL); return crypt_load(_cd, CRYPT_LUKS, NULL);
#else #else
return -ENOTSUP; return -ENOTSUP;