From 6a21f456f78ae4d69736e89d2839949e9c5e7e7b Mon Sep 17 00:00:00 2001 From: Brian Meagher Date: Thu, 25 Apr 2024 17:25:08 -0700 Subject: [PATCH] iscsi-scst: Add mechanism to restore target parameter to default Writing the string :default: to the /sys entry will restore local_def --- iscsi-scst/usr/param.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iscsi-scst/usr/param.c b/iscsi-scst/usr/param.c index acdcd248e..0d3ef2aa7 100644 --- a/iscsi-scst/usr/param.c +++ b/iscsi-scst/usr/param.c @@ -279,7 +279,10 @@ int params_val_to_str(const struct iscsi_key *keys, int idx, unsigned int val, int params_str_to_val(const struct iscsi_key *keys, int idx, const char *str, unsigned int *val) { - if (keys[idx].ops->str_to_val) + if (!strcmp(":default:", str)) { + *val = keys[idx].local_def; + return 0; + } else if (keys[idx].ops->str_to_val) return keys[idx].ops->str_to_val(str, val); else return 0;