Skip to contentSkip to conversation

srp_daemon: improve the debug message for is_enabled_by_rules_file

PATCH Applied Honggang Li 3 participants 3 messages Jul 15, 2019 – Jul 25, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 srp_daemon: improve the debug message for is_enabled_by_rules_file

If the target was disallowed by rule file, user can not distinguish that from the old debug message.

pr_debug("Found an SRP target with id_ext %s - check if it allowed by rules file\n", target->id_ext);

It implicitly implied by the message next to the old debug message.

pr_debug("Found an SRP target with id_ext %s - check if it is already connected\n", target->id_ext);

The improved debug message will feedback the check result of rule file, user no longer needs to wonder the target is allowed or not.

---
 srp_daemon/srp_daemon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
srp_daemon/srp_daemon.c +6 -2
index a004f6a4..e85b9668 100644
@@ -349,10 +349,11 @@ static int is_enabled_by_rules_file(struct target_details *target)
 	int rule;
 	struct config_t *conf = config;
 
-	if (NULL == conf->rules)
+	if (NULL == conf->rules) {
+		pr_debug("Allowing SRP target with id_ext %s because not using a rules file\n", target->id_ext);
 		return 1;
+	}
 
-	pr_debug("Found an SRP target with id_ext %s - check if it allowed by rules file\n", target->id_ext);
 	rule = -1;
 	do {
 		rule++;
@@ -392,6 +393,9 @@ static int is_enabled_by_rules_file(struct target_details *target)
 
 		target->options = conf->rules[rule].options;
 
+		pr_debug("SRP target with id_ext %s %s by rules file\n",
+				target->id_ext,
+				conf->rules[rule].allow ? "allowed" : "disallowed");
 		return conf->rules[rule].allow;
 
 	} while (1);
Signature · 1 line
2.20.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 11 lines · Honggang Li

If the target was disallowed by rule file, user can not distinguish that from the old debug message.

pr_debug("Found an SRP target with id_ext %s - check if it allowed by rules file\n", target->id_ext);

It implicitly implied by the message next to the old debug message.

pr_debug("Found an SRP target with id_ext %s - check if it is already connected\n", target->id_ext);

The improved debug message will feedback the check result of rule file, user no longer needs to wonder the target is allowed or not.

#2 lore raw
In reply to Honggang Li
Quoted 7 lines · Honggang Li

If the target was disallowed by rule file, user can not distinguish that from the old debug message.

pr_debug("Found an SRP target with id_ext %s - check if it allowed by rules file\n", target->id_ext);

It implicitly implied by the message next to the old debug message.

Quoted 8 lines

pr_debug("Found an SRP target with id_ext %s - check if it is already connected\n", target->id_ext);

The improved debug message will feedback the check result of rule file, user no longer needs to wonder the target is allowed or not.

 srp_daemon/srp_daemon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason