summaryrefslogtreecommitdiff
path: root/lib/device
diff options
context:
space:
mode:
Diffstat (limited to 'lib/device')
-rw-r--r--lib/device/dev-cache.c9
-rw-r--r--lib/device/dev-cache.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 85f9b499a..a8b132d41 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -52,6 +52,7 @@ static struct {
struct dm_regex *preferred_names_matcher;
const char *dev_dir;
+ int preferred_names_disabled;
int has_scanned;
long st_dev;
struct dm_list dirs;
@@ -166,11 +167,19 @@ void dev_set_preferred_name(struct dm_str_list *sl, struct device *dev)
if (_cache.preferred_names_matcher)
return;
+ if (_cache.preferred_names_disabled)
+ return;
+
log_debug_devs("%s: New preferred name", sl->str);
dm_list_del(&sl->list);
dm_list_add_h(&dev->aliases, &sl->list);
}
+void dev_cache_disable_preferred_names(void)
+{
+ _cache.preferred_names_disabled = 1;
+}
+
/*
* Check whether path0 or path1 contains the subpath. The path that
* *does not* contain the subpath wins (return 0 or 1). If both paths
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index 7ffe01152..cee893e6a 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -61,6 +61,8 @@ struct device *dev_hash_get(const char *name);
void dev_set_preferred_name(struct dm_str_list *sl, struct device *dev);
+void dev_cache_disable_preferred_names(void);
+
/*
* Object for iterating through the cache.
*/