- struct udev *udev = udev_device_get_udev(dev);
- int64_t offset = 0;
- bool noraid = false;
- int fd = -1;
- blkid_probe pr;
- const char *data;
- const char *name;
- int nvals;
- int i;
- size_t len;
- int err = 0;
-
- static const struct option options[] = {
- { "offset", optional_argument, NULL, 'o' },
- { "noraid", no_argument, NULL, 'R' },
- {}
- };
-
- for (;;) {
- int option;
-
- option = getopt_long(argc, argv, "oR", options, NULL);
- if (option == -1)
- break;
-
- switch (option) {
- case 'o':
- offset = strtoull(optarg, NULL, 0);
- break;
- case 'R':
- noraid = true;
- break;
- }
- }
-
- pr = blkid_new_probe();
- if (!pr) {
- err = -ENOMEM;
- return EXIT_FAILURE;
- }
-
- blkid_probe_set_superblocks_flags(pr,
- BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |
- BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
- BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION);
-
- if (noraid)
- blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID);
-
- fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC);
- if (fd < 0) {
- fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev));
- goto out;
- }
-
- err = blkid_probe_set_device(pr, fd, offset, 0);
- if (err < 0)
- goto out;
-
- info(udev, "probe %s %sraid offset=%llu\n",
- udev_device_get_devnode(dev),
- noraid ? "no" : "", (unsigned long long) offset);
-
- err = probe_superblocks(pr);
- if (err < 0)
- goto out;
-
- nvals = blkid_probe_numof_values(pr);
- for (i = 0; i < nvals; i++) {
- if (blkid_probe_get_value(pr, i, &name, &data, &len))
- continue;
- len = strnlen((char *) data, len);
- print_property(dev, test, name, (char *) data);
- }
-
- blkid_free_probe(pr);
+ struct udev *udev = udev_device_get_udev(dev);
+ int64_t offset = 0;
+ bool noraid = false;
+ int fd = -1;
+ blkid_probe pr;
+ const char *data;
+ const char *name;
+ int nvals;
+ int i;
+ size_t len;
+ int err = 0;
+
+ static const struct option options[] = {
+ { "offset", optional_argument, NULL, 'o' },
+ { "noraid", no_argument, NULL, 'R' },
+ {}
+ };
+
+ for (;;) {
+ int option;
+
+ option = getopt_long(argc, argv, "oR", options, NULL);
+ if (option == -1)
+ break;
+
+ switch (option) {
+ case 'o':
+ offset = strtoull(optarg, NULL, 0);
+ break;
+ case 'R':
+ noraid = true;
+ break;
+ }
+ }
+
+ pr = blkid_new_probe();
+ if (!pr) {
+ err = -ENOMEM;
+ return EXIT_FAILURE;
+ }
+
+ blkid_probe_set_superblocks_flags(pr,
+ BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |
+ BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
+ BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION);
+
+ if (noraid)
+ blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID);
+
+ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC);
+ if (fd < 0) {
+ fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev));
+ goto out;
+ }
+
+ err = blkid_probe_set_device(pr, fd, offset, 0);
+ if (err < 0)
+ goto out;
+
+ info(udev, "probe %s %sraid offset=%llu\n",
+ udev_device_get_devnode(dev),
+ noraid ? "no" : "", (unsigned long long) offset);
+
+ err = probe_superblocks(pr);
+ if (err < 0)
+ goto out;
+
+ nvals = blkid_probe_numof_values(pr);
+ for (i = 0; i < nvals; i++) {
+ if (blkid_probe_get_value(pr, i, &name, &data, &len))
+ continue;
+ len = strnlen((char *) data, len);
+ print_property(dev, test, name, (char *) data);
+ }
+
+ blkid_free_probe(pr);