This new function can be use to enquiry what partition names libblkid is
aware of. First use of this information will be in partx(8) to make bash
completion to work without a magic list.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
blkid_probe_reset_partitions_filter
<SUBSECTION>
blkid_known_pttype
+blkid_partitions_get_name
<SUBSECTION>
blkid_partition_get_name
blkid_partition_get_flags
* partitions probing
*/
extern int blkid_known_pttype(const char *pttype);
+extern int blkid_partitions_get_name(const size_t idx, const char **name);
extern int blkid_probe_enable_partitions(blkid_probe pr, int enable)
__ul_attribute__((nonnull));
BLKID_2.30 {
blkid_probe_set_sectorsize;
+ blkid_partitions_get_name;
} BLKID_2.25;
return 0;
}
+/**
+ * blkid_partitions_get_name:
+ * @idx: number >= 0
+ * @name: returns name of a supported partition
+ *
+ * Returns: -1 if @idx is out of range, or 0 on success.
+ */
+int blkid_partitions_get_name(const size_t idx, const char **name)
+{
+ if (idx < ARRAY_SIZE(idinfos)) {
+ *name = idinfos[idx]->name;
+ return 0;
+ }
+ return -1;
+}
+
/**
* blkid_partlist_numof_partitions:
* @ls: partitions list