Skip to contentSkip to conversation

srp_daemon: improve the debug message for is_enabled_by_rules_file

PATCH Superseded Honggang Li 2 participants 2 messages Jul 11, 2019 InfiniBand

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

---
 srp_daemon/srp_daemon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
srp_daemon/srp_daemon.c +6 -2
index a004f6a4..f27dd569 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("SRP target with id_ext %s allowed by 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 == 1 ? "allowed" : "disallowed");
 		return conf->rules[rule].allow;
 
 	} while (1);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Honggang Li
---
 srp_daemon/srp_daemon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
srp_daemon/srp_daemon.c +0 -0
index a004f6a4..f27dd569 100644

srp_daemon/srp_daemon.c static int is_enabled_by_rules_file(struct target_details *target) · line 355

Quoted 8 lines
srp_daemon/srp_daemon.c +3 -1
@@ -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("SRP target with id_ext %s allowed by rules file\n", target->id_ext);
 		return 1;
+	}

How about changing that message into e.g. "Allowing SRP target with id_ext %s because not using a rules file"?

srp_daemon/srp_daemon.c static int is_enabled_by_rules_file(struct target_details *target) · line 399

Quoted 4 lines
srp_daemon/srp_daemon.c +3 -0
+		pr_debug("SRP target with id_ext %s %s by rules file\n",
+				target->id_ext,
+				conf->rules[rule].allow == 1 ? "allowed" : "disallowed");
 		return conf->rules[rule].allow;

Is the "== 1" part necessary?

Otherwise this patch looks good to me.

Thanks,

Bart.