Blame SOURCES/0037-devices-initial-use-of-existing-option.patch

ab86b0
From 7dc7ab8e99005da29aba22df2bb67e58e19a50f0 Mon Sep 17 00:00:00 2001
ab86b0
From: David Teigland <teigland@redhat.com>
ab86b0
Date: Thu, 24 Feb 2022 16:10:37 -0600
ab86b0
Subject: [PATCH 37/54] devices: initial use of existing option
ab86b0
ab86b0
Use dev_cache_get_existing() in a few common, high level
ab86b0
locations where it's obvious that only existing dev-cache
ab86b0
entries are wanted.  This can be expanded and used in more
ab86b0
locations (or dev_cache_get can stop creating new entries.)
ab86b0
---
ab86b0
 lib/device/device_id.c | 4 ++--
ab86b0
 tools/toollib.c        | 6 +++---
ab86b0
 2 files changed, 5 insertions(+), 5 deletions(-)
ab86b0
ab86b0
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
ab86b0
index 7fe581571..bcb2e6bcf 100644
ab86b0
--- a/lib/device/device_id.c
ab86b0
+++ b/lib/device/device_id.c
ab86b0
@@ -1565,7 +1565,7 @@ void device_ids_match(struct cmd_context *cmd)
ab86b0
 		dm_list_iterate_items(du, &cmd->use_devices) {
ab86b0
 			if (du->dev)
ab86b0
 				continue;
ab86b0
-			if (!(du->dev = dev_cache_get(cmd, du->devname, NULL))) {
ab86b0
+			if (!(du->dev = dev_cache_get_existing(cmd, du->devname, NULL))) {
ab86b0
 				log_warn("Device not found for %s.", du->devname);
ab86b0
 			} else {
ab86b0
 				/* Should we set dev->id?  Which idtype?  Use --deviceidtype? */
ab86b0
@@ -1603,7 +1603,7 @@ void device_ids_match(struct cmd_context *cmd)
ab86b0
 		 * the du/dev pairs in preparation for using the filters.
ab86b0
 		 */
ab86b0
 		if (du->devname &&
ab86b0
-		    (dev = dev_cache_get(cmd, du->devname, NULL))) {
ab86b0
+		    (dev = dev_cache_get_existing(cmd, du->devname, NULL))) {
ab86b0
 			/* On successful match, du, dev, and id are linked. */
ab86b0
 			if (_match_du_to_dev(cmd, du, dev))
ab86b0
 				continue;
ab86b0
diff --git a/tools/toollib.c b/tools/toollib.c
ab86b0
index d6f48aad2..16be336d4 100644
ab86b0
--- a/tools/toollib.c
ab86b0
+++ b/tools/toollib.c
ab86b0
@@ -1434,7 +1434,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
ab86b0
 				goto out;
ab86b0
 			}
ab86b0
 
ab86b0
-			if (!(dev = dev_cache_get(cmd, argv[opt], cmd->filter))) {
ab86b0
+			if (!(dev = dev_cache_get_existing(cmd, argv[opt], cmd->filter))) {
ab86b0
 				log_error("Failed to find device "
ab86b0
 					  "\"%s\".", argv[opt]);
ab86b0
 				ret_max = ECMD_FAILED;
ab86b0
@@ -3870,7 +3870,7 @@ static int _get_arg_devices(struct cmd_context *cmd,
ab86b0
 			return ECMD_FAILED;
ab86b0
 		}
ab86b0
 
ab86b0
-		if (!(dil->dev = dev_cache_get(cmd, sl->str, cmd->filter))) {
ab86b0
+		if (!(dil->dev = dev_cache_get_existing(cmd, sl->str, cmd->filter))) {
ab86b0
 			log_error("Cannot use %s: %s", sl->str, devname_error_reason(sl->str));
ab86b0
 			ret_max = EINIT_FAILED;
ab86b0
 		} else {
ab86b0
@@ -5206,7 +5206,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
ab86b0
 		struct device *dev;
ab86b0
 
ab86b0
 		/* No filter used here */
ab86b0
-		if (!(dev = dev_cache_get(cmd, pd->name, NULL))) {
ab86b0
+		if (!(dev = dev_cache_get_existing(cmd, pd->name, NULL))) {
ab86b0
 			log_error("No device found for %s.", pd->name);
ab86b0
 			dm_list_del(&pd->list);
ab86b0
 			dm_list_add(&pp->arg_fail, &pd->list);
ab86b0
-- 
ab86b0
2.34.3
ab86b0