Skip to contentSkip to conversation

main - devices: use dev-cache aliases handling from label scan functions

PATCH David Teigland 1 participant 1 message Mar 1, 2022

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7b1a857d5ac480b789af07d85e55bc87c6a76934
Commit:        7b1a857d5ac480b789af07d85e55bc87c6a76934
Parent:        4eb04c8c05e52776891f62863375ceacf866de77
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Feb 28 17:37:12 2022 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Feb 28 17:37:12 2022 -0600

devices: use dev-cache aliases handling from label scan functions

The label scan functions where doing some device alias validation which is now better handled by the dev-cache layer, so just use that.

---
 lib/device/dev-cache.c |   4 +-
 lib/device/dev-cache.h |   1 +
 lib/label/label.c      | 143 ++++++++++++-------------------------------------
 3 files changed, 36 insertions(+), 112 deletions(-)
lib/device/dev-cache.c +2 -2
index 8db28bd84..5607beefc 100644
@@ -1410,7 +1410,7 @@ static void _remove_alias(struct device *dev, const char *name)
  * deactivated LV.  Those old paths are all invalid and are dropped here.
  */
 
-static void _verify_aliases(struct device *dev)
+void dev_cache_verify_aliases(struct device *dev)
 {
 	struct dm_str_list *strl, *strl2;
 	struct stat st;
@@ -1459,7 +1459,7 @@ static struct device *_dev_cache_get(struct cmd_context *cmd, const char *name,
 			_remove_alias(dev, name);
 
 			/* Remove any other names in dev->aliases that are incorrect. */
-			_verify_aliases(dev);
+			dev_cache_verify_aliases(dev);
 		}
 		return NULL;
 	}
lib/device/dev-cache.h +1 -0
index 622335982..46b1da72c 100644
@@ -55,6 +55,7 @@ int dev_cache_add_dir(const char *path);
 struct device *dev_cache_get(struct cmd_context *cmd, const char *name, struct dev_filter *f);
 struct device *dev_cache_get_existing(struct cmd_context *cmd, const char *name, struct dev_filter *f);
 struct device *dev_cache_get_by_devt(struct cmd_context *cmd, dev_t devt);
+void dev_cache_verify_aliases(struct device *dev);
 
 struct device *dev_hash_get(const char *name);
 
lib/label/label.c +33 -110

208 lines not on this page · raw message