[stgt] [PATCH] show bs and devtype in system info

Alexander Nezhinsky alexandern at mellanox.com
Mon Nov 7 16:48:50 CET 2011


show registered "Backing stores" and "Device types" in system info

Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
 usr/bs.c     |    2 +-
 usr/target.c |   10 ++++++++++
 usr/tgtd.h   |    1 +
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/usr/bs.c b/usr/bs.c
index 1a5ff8c..e56e450 100644
--- a/usr/bs.c
+++ b/usr/bs.c
@@ -39,7 +39,7 @@
 #include "util.h"
 #include "bs_thread.h"
 
-static LIST_HEAD(bst_list);
+LIST_HEAD(bst_list);
 
 static LIST_HEAD(finished_list);
 static pthread_mutex_t finished_lock;
diff --git a/usr/target.c b/usr/target.c
index 8c6472b..8dcf1f1 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -2101,6 +2101,8 @@ int system_set_state(char *str)
 int system_show(int mode, char *buf, int rest)
 {
 	int total = 0, max = rest;
+	struct backingstore_template *bst;
+	struct device_type_template *devt;
 	int i;
 
 	/* FIXME: too hacky */
@@ -2118,6 +2120,14 @@ int system_show(int mode, char *buf, int rest)
 			 driver_state_name(tgt_drivers[i]));
 	}
 
+	shprintf(total, buf, rest, "Backing stores:\n");
+	list_for_each_entry(bst, &bst_list, backingstore_siblings)
+		shprintf(total, buf, rest, _TAB1 "%s\n", bst->bs_name);
+
+	shprintf(total, buf, rest, "Device types:\n");
+	list_for_each_entry(devt, &device_type_list, device_type_siblings)
+		shprintf(total, buf, rest, _TAB1 "%s\n", print_type(devt->type));
+
 	if (global_target.account.nr_inaccount) {
 		int i, aid;
 		shprintf(total, buf, rest,
diff --git a/usr/tgtd.h b/usr/tgtd.h
index d5257f1..dfddca1 100644
--- a/usr/tgtd.h
+++ b/usr/tgtd.h
@@ -211,6 +211,7 @@ enum mgmt_req_result {
 extern int system_active;
 extern int is_debug;
 extern int nr_iothreads;
+extern struct list_head bst_list;
 
 extern int ipc_init(void);
 extern void ipc_exit(void);
--
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