}
/* run only once into a timeout for unreadable devices */
-static int device_is_readable(struct volume_id *id)
+static int device_is_readable(struct volume_id *id, uint64_t off)
{
- if (volume_id_get_buffer(id, 0x00, 0x200) != NULL)
+ if (volume_id_get_buffer(id, off, 0x200) != NULL)
return 1;
return 0;
}
if (id == NULL)
return -EINVAL;
- if (!device_is_readable(id))
+ if (!device_is_readable(id, off))
return -1;
info("probing at offset 0x%llx, size 0x%llx",
if (id == NULL)
return -EINVAL;
- if (!device_is_readable(id))
+ if (!device_is_readable(id, off))
return -1;
info("probing at offset 0x%llx, size 0x%llx",
if (id == NULL)
return -EINVAL;
- if (!device_is_readable(id))
+ if (!device_is_readable(id, off))
return -1;
/* probe for raid first, because fs probes may be successful on raid members */
{ "export", 0, NULL, 'x' },
{ "skip-raid", 0, NULL, 's' },
{ "probe-all", 0, NULL, 'a' },
+ { "offset", 1, NULL, 'o' },
{ "help", 0, NULL, 'h' },
{}
};
uint64_t size;
int skip_raid = 0;
int probe_all = 0;
+ uint64_t offset = 0;
const char *node;
int fd;
const char *label, *uuid, *type, *type_version, *usage;
while (1) {
int option;
- option = getopt_long(argc, argv, "lLutxsah", options, NULL);
+ option = getopt_long(argc, argv, "lLutxsaoh", options, NULL);
if (option == -1)
break;
case 'a':
probe_all = 1;
break;
+ case 'o':
+ offset = strtoull(optarg, NULL, 0);
+ break;
case 'h':
printf("Usage: vol_id [options] <device>\n"
" --export export key/value pairs\n"
" --uuid filesystem uuid\n"
" --skip-raid don't probe for raid\n"
" --probe-all find possibly conflicting signatures\n"
+ " --offset skip given number of bytes of input\n"
" --help\n\n");
goto exit;
default:
}
if (probe_all) {
- volume_id_all_probers(all_probers, vid, 0, size, NULL);
+ volume_id_all_probers(all_probers, vid, offset, size, NULL);
goto exit;
}
if (skip_raid)
- retval = volume_id_probe_filesystem(vid, 0, size);
+ retval = volume_id_probe_filesystem(vid, offset, size);
else
- retval = volume_id_probe_all(vid, 0, size);
+ retval = volume_id_probe_all(vid, offset, size);
if (retval != 0) {
fprintf(stderr, "%s: unknown volume type\n", node);
rc = 4;