2
* Author: Kent Overstreet <kmo@daterainc.com>
7
#define _FILE_OFFSET_BITS 64
8
#define __USE_FILE_OFFSET64
9
#define _XOPEN_SOURCE 500
19
#include <sys/ioctl.h>
20
#include <sys/types.h>
23
#include <uuid/uuid.h>
27
int main(int argc, char **argv)
36
while ((o = getopt(argc, argv, "o:")) != EOF)
39
if (strcmp("udev", optarg)) {
40
printf("Invalid output format %s\n", optarg);
51
for (i = 0; i < argc; i++) {
52
int fd = open(argv[i], O_RDONLY);
56
if (!(pr = blkid_new_probe()))
58
if (blkid_probe_set_device(pr, fd, 0, 0))
60
/* probe partitions too */
61
if (blkid_probe_enable_partitions(pr, true))
63
/* bail if anything was found
64
* probe-bcache isn't needed once blkid recognizes bcache */
65
if (!blkid_do_probe(pr)) {
69
if (pread(fd, &sb, sizeof(sb), SB_START) != sizeof(sb))
72
if (memcmp(sb.magic, bcache_magic, 16))
75
uuid_unparse(sb.uuid, uuid);
78
printf("ID_FS_UUID=%s\n"
80
"ID_FS_TYPE=bcache\n",
83
printf("%s: UUID=\"\" TYPE=\"bcache\"\n", uuid);