From 48805d562ba48aa4a7c3e1a568a658df235d2620 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 16 Sep 2009 15:49:44 +0200 Subject: [PATCH] libblkid: add partitions filter routines Signed-off-by: Karel Zak --- shlibs/blkid/src/blkid.h | 5 +++ shlibs/blkid/src/blkid.sym | 3 ++ shlibs/blkid/src/partitions/partitions.c | 42 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/shlibs/blkid/src/blkid.h b/shlibs/blkid/src/blkid.h index 45e03b5b..c0cda634 100644 --- a/shlibs/blkid/src/blkid.h +++ b/shlibs/blkid/src/blkid.h @@ -213,6 +213,11 @@ extern unsigned long blkid_topology_get_optimal_io_size(blkid_topology tp); extern int blkid_known_pttype(const char *pttype); extern int blkid_probe_enable_partitions(blkid_probe pr, int enable); +extern int blkid_probe_reset_partitions_filter(blkid_probe pr); +extern int blkid_probe_invert_partitions_filter(blkid_probe pr); +extern int blkid_probe_filter_partitions_type(blkid_probe pr, int flag, char *names[]); + + /* partitions probing flags */ #define BLKID_PARTS_FORCE_GPT (1 << 1) extern int blkid_probe_set_partitions_flags(blkid_probe pr, int flags); diff --git a/shlibs/blkid/src/blkid.sym b/shlibs/blkid/src/blkid.sym index ac1b159f..89baf483 100644 --- a/shlibs/blkid/src/blkid.sym +++ b/shlibs/blkid/src/blkid.sym @@ -92,6 +92,7 @@ global: blkid_probe_enable_partitions; blkid_probe_enable_superblocks; blkid_probe_enable_topology; + blkid_probe_filter_partitions_type; blkid_probe_filter_superblocks_type; blkid_probe_filter_superblocks_usage; blkid_probe_get_devno; @@ -99,7 +100,9 @@ global: blkid_probe_get_sectorsize; blkid_probe_get_size; blkid_probe_get_topology; + blkid_probe_invert_partitions_filter; blkid_probe_invert_superblocks_filter; + blkid_probe_reset_partitions_filter; blkid_probe_reset_superblocks_filter; blkid_probe_set_partitions_flags; blkid_probe_set_superblocks_flags; diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c index 365e0f1f..16be7ed7 100644 --- a/shlibs/blkid/src/partitions/partitions.c +++ b/shlibs/blkid/src/partitions/partitions.c @@ -198,6 +198,48 @@ int blkid_probe_set_partitions_flags(blkid_probe pr, int flags) return 0; } +/** + * blkid_probe_reset_partitions_filter: + * @pr: prober + * + * Resets partitions probing filter + * + * Returns: 0 on success, or -1 in case of error. + */ +int blkid_probe_reset_partitions_filter(blkid_probe pr) +{ + return __blkid_probe_reset_filter(pr, BLKID_CHAIN_PARTS); +} + +/** + * blkid_probe_invert_partitions_filter: + * @pr: prober + * + * Inverts partitions probing filter + * + * Returns: 0 on success, or -1 in case of error. + */ +int blkid_probe_invert_partitions_filter(blkid_probe pr) +{ + return __blkid_probe_invert_filter(pr, BLKID_CHAIN_PARTS); +} + +/** + * blkid_probe_filter_partitions_type: + * @pr: prober + * @flag: filter BLKID_FLTR_{NOTIN,ONLYIN} flag + * @names: NULL terminated array of probing function names (e.g. "vfat"). + * + * BLKID_FLTR_NOTIN - probe for all items which are NOT IN @names + * BLKID_FLTR_ONLYIN - probe for items which are IN @names + * + * Returns: 0 on success, or -1 in case of error. + */ +int blkid_probe_filter_partitions_type(blkid_probe pr, int flag, char *names[]) +{ + return __blkid_probe_filter_types(pr, BLKID_CHAIN_PARTS, flag, names); +} + /** * blkid_probe_get_partitions: * @pr: probe -- 2.39.5