[stgt] [PATCH 3/3] add state to tgt_driver, prevent mgt ops for uninitialized LLDs

Alexander Nezhinsky alexandern at mellanox.com
Wed Oct 26 20:00:38 CEST 2011


Added "state" field to "struct tgt_driver".
Management operations are allowed only for LLDs that have
passed initialization successfully.

Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
  usr/target.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/usr/target.c b/usr/target.c
index e621b59..8c6472b 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -2101,6 +2101,7 @@ int system_set_state(char *str)
  int system_show(int mode, char *buf, int rest)
  {
  	int total = 0, max = rest;
+	int i;
  
  	/* FIXME: too hacky */
  	if (mode != MODE_SYSTEM)
@@ -2110,6 +2111,13 @@ int system_show(int mode, char *buf, int rest)
  	shprintf(total, buf, rest, _TAB1 "State: %s\n",
  		 system_state_name(sys_state));
  
+	shprintf(total, buf, rest, "LLDs:\n");
+	for (i = 0; tgt_drivers[i]; i++) {
+		shprintf(total, buf, rest, _TAB1 "%s: %s\n",
+			 tgt_drivers[i]->name,
+			 driver_state_name(tgt_drivers[i]));
+	}
+
  	if (global_target.account.nr_inaccount) {
  		int i, aid;
  		shprintf(total, buf, rest,
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list