* superblocks probing
*/
extern int blkid_known_fstype(const char *fstype);
+extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage);
+
extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable);
#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
BLKID_2.20 {
global:
blkid_evaluate_spec;
+ blkid_superblocks_get_name;
} BLKID_2.18;
return 0;
}
+/**
+ * blkid_superblocks_get_name:
+ * @idx: number >= 0
+ * @name: returns name of supported filesystem/raid (optional)
+ * @usage: returns BLKID_USAGE_* flags, (optional)
+ *
+ * Returns: -1 if @idx is out of range, or 0 on success.
+ */
+int blkid_superblocks_get_name(size_t idx, const char **name, int *usage)
+{
+ if (idx >= 0 && idx < ARRAY_SIZE(idinfos)) {
+ if (name)
+ *name = idinfos[idx]->name;
+ if (usage)
+ *usage = idinfos[idx]->usage;
+ return 0;
+ }
+ return -1;
+}
+
/*
* The blkid_do_probe() backend.
*/
.TP
.B \-l
Look up only one device that matches the search parameter specified with the
+.TP
+.B \-k
+List all known filesystems and RAIDs and exit.
+.TP
.B \-t
option. If there are multiple devices that match the specified search
parameter, then the device with the highest priority is returned, and/or
" -g garbage collect the blkid cache\n"
" -o <format> output format; can be one of:\n"
" value, device, list, udev, export or full; (default: full)\n"
+ " -k list all known filesystems/RAIDs and exit\n"
" -s <tag> show specified tag(s) (default show all tags)\n"
" -t <token> find device with a specific token (NAME=value pair)\n"
" -l look up only first device with token specified by -t\n"
show[0] = NULL;
- while ((c = getopt (argc, argv, "c:df:ghilL:n:o:O:ps:S:t:u:U:w:v")) != EOF)
+ while ((c = getopt (argc, argv, "c:df:ghilL:n:ko:O:ps:S:t:u:U:w:v")) != EOF)
switch (c) {
case 'c':
if (optarg && !*optarg)
case 'g':
gc = 1;
break;
+ case 'k':
+ {
+ size_t idx = 0;
+ const char *name = NULL;
+
+ while (blkid_superblocks_get_name(idx++, &name, NULL) == 0)
+ printf("%s\n", name);
+ exit(0);
+ }
case 'o':
if (!strcmp(optarg, "value"))
output_format = OUTPUT_VALUE_ONLY;