mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Add suport for filtering only LUKS signatures.
This commit is contained in:
committed by
Milan Broz
parent
8c350b65a3
commit
412de7dc25
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -135,16 +136,34 @@ int blk_init_by_fd(struct blkid_handle **h, int fd)
|
||||
return r;
|
||||
}
|
||||
|
||||
int blk_superblocks_filter_luks(struct blkid_handle *h)
|
||||
{
|
||||
int r = -ENOTSUP;
|
||||
#ifdef HAVE_BLKID
|
||||
static int blk_superblocks_luks(struct blkid_handle *h, bool enable)
|
||||
{
|
||||
char luks[] = "crypto_LUKS";
|
||||
char *luks_filter[] = {
|
||||
luks,
|
||||
NULL
|
||||
};
|
||||
r = blkid_probe_filter_superblocks_type(h->pr, BLKID_FLTR_NOTIN, luks_filter);
|
||||
return blkid_probe_filter_superblocks_type(h->pr,
|
||||
enable ? BLKID_FLTR_ONLYIN : BLKID_FLTR_NOTIN,
|
||||
luks_filter);
|
||||
}
|
||||
#endif
|
||||
|
||||
int blk_superblocks_filter_luks(struct blkid_handle *h)
|
||||
{
|
||||
int r = -ENOTSUP;
|
||||
#ifdef HAVE_BLKID
|
||||
r = blk_superblocks_luks(h, false);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
int blk_superblocks_only_luks(struct blkid_handle *h)
|
||||
{
|
||||
int r = -ENOTSUP;
|
||||
#ifdef HAVE_BLKID
|
||||
r = blk_superblocks_luks(h, true);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ void blk_set_chains_for_full_print(struct blkid_handle *h);
|
||||
void blk_set_chains_for_fast_detection(struct blkid_handle *h);
|
||||
|
||||
int blk_superblocks_filter_luks(struct blkid_handle *h);
|
||||
int blk_superblocks_only_luks(struct blkid_handle *h);
|
||||
|
||||
blk_probe_status blk_safeprobe(struct blkid_handle *h);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user