extern char *blkid_evaluate_tag(const char *token, const char *value,
blkid_cache *cache)
__ul_attribute__((warn_unused_result));
+extern char *blkid_evaluate_tag2(const char *token, const char *value,
+ blkid_cache *cache, int flags)
+ __ul_attribute__((warn_unused_result));
extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache)
__ul_attribute__((warn_unused_result));
+#define BLKID_EVALUATE_NOPROBE (1 << 0) /* disable low-level device probing */
+
/* probe.c */
extern blkid_probe blkid_new_probe(void)
__ul_attribute__((warn_unused_result));
return res;
}
-/**
- * blkid_evaluate_tag:
- * @token: token name (e.g "LABEL" or "UUID") or unparsed tag (e.g. "LABEL=foo")
- * @value: token data (e.g. "foo")
- * @cache: pointer to cache (or NULL when you don't want to re-use the cache)
- *
-* If the @value is NULL and @token is not in the NAME=value format, then return
-* a copy of the @token.
- *
- * Returns: allocated string with a device name.
- */
-char *blkid_evaluate_tag(const char *token, const char *value, blkid_cache *cache)
+static char *evaluate_tag(const char *token, const char *value,
+ blkid_cache *cache, int flags)
{
struct blkid_config *conf = NULL;
char *t = NULL, *v = NULL;
for (i = 0; i < conf->nevals; i++) {
if (conf->eval[i] == BLKID_EVAL_UDEV)
ret = evaluate_by_udev(token, value, conf->uevent);
- else if (conf->eval[i] == BLKID_EVAL_SCAN)
+ else if (conf->eval[i] == BLKID_EVAL_SCAN
+ && !(flags & BLKID_EVALUATE_NOPROBE))
ret = evaluate_by_scan(token, value, cache, conf);
if (ret)
break;
return ret;
}
+/**
+ * blkid_evaluate_tag:
+ * @token: token name (e.g "LABEL" or "UUID") or unparsed tag (e.g. "LABEL=foo")
+ * @value: token data (e.g. "foo")
+ * @cache: pointer to cache (or NULL when you don't want to re-use the cache)
+ *
+ * If the @value is NULL and @token is not in the NAME=value format, then return
+ * a copy of the @token.
+ *
+ * Returns: allocated string with a device name.
+ */
+char *blkid_evaluate_tag(const char *token, const char *value, blkid_cache *cache)
+{
+ return evaluate_tag(token, value, cache, 0);
+}
+
+/**
+ * blkid_evaluate_tag2:
+ * @token: token name (e.g "LABEL" or "UUID") or unparsed tag (e.g. "LABEL=foo")
+ * @value: token data (e.g. "foo")
+ * @cache: pointer to cache (or NULL when you don't want to re-use the cache)
+ * @flags: BLKID_EVALUATE_* flags
+ *
+ * Same as blkid_evaluate_tag(), but with flags to control evaluation.
+ * The BLKID_EVALUATE_NOPROBE flag disables low-level device probing.
+ *
+ * Returns: allocated string with a device name.
+ */
+char *blkid_evaluate_tag2(const char *token, const char *value,
+ blkid_cache *cache, int flags)
+{
+ return evaluate_tag(token, value, cache, flags);
+}
+
/**
* blkid_evaluate_spec:
* @spec: unparsed tag (e.g. "LABEL=foo") or path (e.g. /dev/dm-0)