[stgt] [PATCH 2/3] add state to tgt_driver, show LLDs and their states in system info

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


Added "state" field to "struct tgt_driver".
This state is displayed using "-m system -o show" for every registered LLD.

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

diff --git a/usr/mgmt.c b/usr/mgmt.c
index d8c398e..26a360d 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -387,8 +387,12 @@ static int tgt_mgmt(struct mgmt_task *mtask)
  		lld_no = 0;
  	else {
  		lld_no = get_driver_index(req->lld);
-		if (lld_no < 0) {
-			eprintf("can't find the driver\n");
+		if (lld_no < 0 || tgt_drivers[lld_no]->drv_state != DRIVER_INIT) {
+			if (lld_no < 0)
+				eprintf("can't find the driver %s\n", req->lld);
+			else
+				eprintf("driver %s is in state: %s\n",
+					req->lld, driver_state_name(tgt_drivers[lld_no]));
  			rsp->err = TGTADM_NO_DRIVER;
  			rsp->len = sizeof(*rsp);
  			return 0;
--
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