2 * Copyright (C) 2009 Karel Zak <kzak@redhat.com>
4 * This file may be redistributed under the terms of the
5 * GNU Lesser General Public License.
10 #include <sys/types.h>
19 int main(int argc
, char *argv
[])
26 fprintf(stderr
, "usage: %s <device> "
27 "-- prints superblocks details about the device\n",
28 program_invocation_short_name
);
33 pr
= blkid_new_probe_from_filename(devname
);
35 err(EXIT_FAILURE
, "%s: faild to create a new libblkid probe",
38 /* enable topology probing */
39 blkid_probe_enable_superblocks(pr
, TRUE
);
42 blkid_probe_set_superblocks_flags(pr
,
43 BLKID_SUBLKS_LABEL
| BLKID_SUBLKS_LABELRAW
|
44 BLKID_SUBLKS_UUID
| BLKID_SUBLKS_UUIDRAW
|
45 BLKID_SUBLKS_TYPE
| BLKID_SUBLKS_SECTYPE
|
46 BLKID_SUBLKS_USAGE
| BLKID_SUBLKS_VERSION
|
49 rc
= blkid_do_safeprobe(pr
);
51 errx(EXIT_FAILURE
, "%s: blkid_do_safeprobe() failed", devname
);
53 warnx("%s: cannot gather information about superblocks", devname
);
55 int i
, nvals
= blkid_probe_numof_values(pr
);
57 for (i
= 0; i
< nvals
; i
++) {
58 const char *name
, *data
;
60 blkid_probe_get_value(pr
, i
, &name
, &data
, NULL
);
61 printf("\t%s = %s\n", name
, data
);