From: Karel Zak Date: Tue, 3 Nov 2020 16:15:34 +0000 (+0100) Subject: blkid: add --hint =value X-Git-Tag: v2.37-rc1~266^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac3a0fd92e571ccc46919bc0a651d0647e7b5d36;p=thirdparty%2Futil-linux.git blkid: add --hint =value Signed-off-by: Karel Zak --- diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index dba3bb7d7b..4f23f09f66 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -659,7 +659,7 @@ int main(int argc, char **argv) blkid_cache cache = NULL; char **devices = NULL; char *search_type = NULL, *search_value = NULL; - char *read = NULL; + char *read = NULL, *hint = NULL; int fltr_usage = 0; char **fltr_type = NULL; int fltr_flag = BLKID_FLTR_ONLYIN; @@ -681,6 +681,7 @@ int main(int argc, char **argv) { "label", required_argument, NULL, 'L' }, { "uuid", required_argument, NULL, 'U' }, { "probe", no_argument, NULL, 'p' }, + { "hint", required_argument, NULL, 'H' }, { "info", no_argument, NULL, 'i' }, { "size", required_argument, NULL, 'S' }, { "offset", required_argument, NULL, 'O' }, @@ -705,7 +706,7 @@ int main(int argc, char **argv) strutils_set_exitcode(BLKID_EXIT_OTHER); while ((c = getopt_long (argc, argv, - "c:DdghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) { + "c:DdgH:hilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) { err_exclusive_options(c, NULL, excl, excl_st); @@ -719,6 +720,9 @@ int main(int argc, char **argv) case 'D': ctl.no_part_details = 1; break; + case 'H': + hint = optarg; + break; case 'L': ctl.eval = 1; search_value = xstrdup(optarg); @@ -869,6 +873,10 @@ int main(int argc, char **argv) pr = blkid_new_probe(); if (!pr) goto exit; + if (hint && blkid_probe_set_hint(pr, hint, 0) != 0) { + warn(_("Failed to use probing hint: %s"), hint); + goto exit; + } if (ctl.lowprobe_superblocks) { blkid_probe_set_superblocks_flags(pr,