f20720
---
f20720
 libmultipath/print.c      |  222 ++++++++++++++++++++++++++++++++++++++++++++++
f20720
 libmultipath/print.h      |   61 ++++++++++++
f20720
 multipathd/cli.c          |    3 
f20720
 multipathd/cli.h          |    2 
f20720
 multipathd/cli_handlers.c |   93 +++++++++++++++++++
f20720
 multipathd/cli_handlers.h |    2 
f20720
 multipathd/main.c         |    2 
f20720
 multipathd/multipathd.8   |    9 +
f20720
 8 files changed, 393 insertions(+), 1 deletion(-)
f20720
f20720
Index: multipath-tools-130222/libmultipath/print.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/print.c
f20720
+++ multipath-tools-130222/libmultipath/print.c
f20720
@@ -269,6 +269,61 @@ snprint_multipath_vpr (char * buff, size
f20720
 			pp->vendor_id, pp->product_id);
f20720
 }
f20720
 
f20720
+
f20720
+static int
f20720
+snprint_multipath_vend (char * buff, size_t len, struct multipath * mpp)
f20720
+{
f20720
+	struct pathgroup * pgp;
f20720
+	struct path * pp;
f20720
+	int i, j;
f20720
+
f20720
+	vector_foreach_slot(mpp->pg, pgp, i) {
f20720
+		if (!pgp)
f20720
+			continue;
f20720
+		vector_foreach_slot(pgp->paths, pp, j) {
f20720
+			if (strlen(pp->vendor_id))
f20720
+				return snprintf(buff, len, "%s", pp->vendor_id);
f20720
+		}
f20720
+	}
f20720
+	return snprintf(buff, len, "##");
f20720
+}
f20720
+
f20720
+static int
f20720
+snprint_multipath_prod (char * buff, size_t len, struct multipath * mpp)
f20720
+{
f20720
+	struct pathgroup * pgp;
f20720
+	struct path * pp;
f20720
+	int i, j;
f20720
+
f20720
+	vector_foreach_slot(mpp->pg, pgp, i) {
f20720
+		if (!pgp)
f20720
+			continue;
f20720
+		vector_foreach_slot(pgp->paths, pp, j) {
f20720
+			if (strlen(pp->product_id))
f20720
+				return snprintf(buff, len, "%s", pp->product_id);
f20720
+		}
f20720
+	}
f20720
+	return snprintf(buff, len, "##");
f20720
+}
f20720
+
f20720
+static int
f20720
+snprint_multipath_rev (char * buff, size_t len, struct multipath * mpp)
f20720
+{
f20720
+	struct pathgroup * pgp;
f20720
+	struct path * pp;
f20720
+	int i, j;
f20720
+
f20720
+	vector_foreach_slot(mpp->pg, pgp, i) {
f20720
+		if (!pgp)
f20720
+			continue;
f20720
+		vector_foreach_slot(pgp->paths, pp, j) {
f20720
+			if (strlen(pp->rev))
f20720
+				return snprintf(buff, len, "%s", pp->rev);
f20720
+		}
f20720
+	}
f20720
+	return snprintf(buff, len, "##");
f20720
+}
f20720
+
f20720
 static int
f20720
 snprint_action (char * buff, size_t len, struct multipath * mpp)
f20720
 {
f20720
@@ -561,6 +616,9 @@ struct multipath_data mpd[] = {
f20720
 	{'3', "total_q_time",  0, snprint_total_q_time},
f20720
 	{'4', "q_timeouts",    0, snprint_q_timeouts},
f20720
 	{'s', "vend/prod/rev", 0, snprint_multipath_vpr},
f20720
+	{'v', "vend",          0, snprint_multipath_vend},
f20720
+	{'p', "prod",          0, snprint_multipath_prod},
f20720
+	{'e', "rev",           0, snprint_multipath_rev},
f20720
 	{0, NULL, 0 , NULL}
f20720
 };
f20720
 
f20720
@@ -983,6 +1041,170 @@ snprint_multipath_topology (char * buff,
f20720
 	return fwd;
f20720
 }
f20720
 
f20720
+static int
f20720
+snprint_json (char * buff, int len, int indent, char *json_str)
f20720
+{
f20720
+	int fwd = 0, i;
f20720
+
f20720
+	for (i = 0; i < indent; i++) {
f20720
+		fwd += snprintf(buff + fwd, len - fwd, PRINT_JSON_INDENT);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+	}
f20720
+
f20720
+	fwd += snprintf(buff + fwd, len - fwd, "%s", json_str);
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
+static int
f20720
+snprint_json_header (char * buff, int len)
f20720
+{
f20720
+	int fwd = 0;
f20720
+
f20720
+	fwd +=  snprint_json(buff, len, 0, PRINT_JSON_START_ELEM);
f20720
+	if (fwd > len)
f20720
+		return fwd;
f20720
+
f20720
+	fwd +=  snprintf(buff + fwd, len  - fwd, PRINT_JSON_START_VERSION,
f20720
+			PRINT_JSON_MAJOR_VERSION, PRINT_JSON_MINOR_VERSION);
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
+static int
f20720
+snprint_json_elem_footer (char * buff, int len, int indent, int last)
f20720
+{
f20720
+	int fwd = 0, i;
f20720
+
f20720
+	for (i = 0; i < indent; i++) {
f20720
+		fwd += snprintf(buff + fwd, len - fwd, PRINT_JSON_INDENT);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+	}
f20720
+
f20720
+	if (last == 1)
f20720
+		fwd += snprintf(buff + fwd, len - fwd, "%s", PRINT_JSON_END_LAST_ELEM);
f20720
+	else
f20720
+		fwd += snprintf(buff + fwd, len - fwd, "%s", PRINT_JSON_END_ELEM);
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
+static int
f20720
+snprint_multipath_fields_json (char * buff, int len,
f20720
+		struct multipath * mpp, int last)
f20720
+{
f20720
+	int i, j, fwd = 0;
f20720
+	struct path *pp;
f20720
+	struct pathgroup *pgp;
f20720
+
f20720
+	fwd += snprint_multipath(buff, len, PRINT_JSON_MAP, mpp, 0);
f20720
+	if (fwd > len)
f20720
+		return fwd;
f20720
+
f20720
+	fwd += snprint_json(buff + fwd, len - fwd, 2, PRINT_JSON_START_GROUPS);
f20720
+	if (fwd > len)
f20720
+		return fwd;
f20720
+
f20720
+	vector_foreach_slot (mpp->pg, pgp, i) {
f20720
+
f20720
+		pgp->selector = mpp->selector;
f20720
+		fwd += snprint_pathgroup(buff + fwd, len - fwd, PRINT_JSON_GROUP, pgp);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+
f20720
+		fwd += snprintf(buff + fwd, len - fwd, PRINT_JSON_GROUP_NUM, i + 1);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+
f20720
+		fwd += snprint_json(buff + fwd, len - fwd, 3, PRINT_JSON_START_PATHS);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+
f20720
+		vector_foreach_slot (pgp->paths, pp, j) {
f20720
+			fwd += snprint_path(buff + fwd, len - fwd, PRINT_JSON_PATH, pp, 0);
f20720
+			if (fwd > len)
f20720
+				return fwd;
f20720
+
f20720
+			fwd += snprint_json_elem_footer(buff + fwd,
f20720
+					len - fwd, 3, j + 1 == VECTOR_SIZE(pgp->paths));
f20720
+			if (fwd > len)
f20720
+				return fwd;
f20720
+		}
f20720
+		fwd += snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_END_ARRAY);
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+
f20720
+		fwd +=  snprint_json_elem_footer(buff + fwd,
f20720
+				len - fwd, 2, i + 1 == VECTOR_SIZE(mpp->pg));
f20720
+		if (fwd > len)
f20720
+			return fwd;
f20720
+	}
f20720
+
f20720
+	fwd += snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_END_ARRAY);
f20720
+	if (fwd > len)
f20720
+		return fwd;
f20720
+
f20720
+	fwd += snprint_json_elem_footer(buff + fwd, len - fwd, 1, last);
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
+int
f20720
+snprint_multipath_map_json (char * buff, int len,
f20720
+		struct multipath * mpp, int last){
f20720
+	int fwd = 0;
f20720
+
f20720
+	fwd +=  snprint_json_header(buff, len);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_START_MAP);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd += snprint_multipath_fields_json(buff + fwd, len - fwd, mpp, 1);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len - fwd, 0, "\n");
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_END_LAST);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
+int
f20720
+snprint_multipath_topology_json (char * buff, int len, struct vectors * vecs)
f20720
+{
f20720
+	int i, fwd = 0;
f20720
+	struct multipath * mpp;
f20720
+
f20720
+	fwd +=  snprint_json_header(buff, len);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len  - fwd, 1, PRINT_JSON_START_MAPS);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
f20720
+		fwd += snprint_multipath_fields_json(buff + fwd, len - fwd,
f20720
+				mpp, i + 1 == VECTOR_SIZE(vecs->mpvec));
f20720
+		if (fwd > len)
f20720
+			return len;
f20720
+	}
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_END_ARRAY);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+
f20720
+	fwd +=  snprint_json(buff + fwd, len - fwd, 0, PRINT_JSON_END_LAST);
f20720
+	if (fwd > len)
f20720
+		return len;
f20720
+	return fwd;
f20720
+}
f20720
+
f20720
 static int
f20720
 snprint_hwentry (char * buff, int len, struct hwentry * hwe)
f20720
 {
f20720
Index: multipath-tools-130222/libmultipath/print.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/print.h
f20720
+++ multipath-tools-130222/libmultipath/print.h
f20720
@@ -7,6 +7,63 @@
f20720
 #define PRINT_MAP_PROPS      "size=%S features='%f' hwhandler='%h' wp=%r"
f20720
 #define PRINT_PG_INDENT      "policy='%s' prio=%p status=%t"
f20720
 
f20720
+#define PRINT_JSON_MULTIPLIER     5
f20720
+#define PRINT_JSON_MAJOR_VERSION  0
f20720
+#define PRINT_JSON_MINOR_VERSION  1
f20720
+#define PRINT_JSON_START_VERSION  "   \"major_version\": %d,\n" \
f20720
+                                  "   \"minor_version\": %d,\n"
f20720
+#define PRINT_JSON_START_ELEM     "{\n"
f20720
+#define PRINT_JSON_START_MAP      "   \"map\":"
f20720
+#define PRINT_JSON_START_MAPS     "\"maps\": ["
f20720
+#define PRINT_JSON_START_PATHS    "\"paths\": ["
f20720
+#define PRINT_JSON_START_GROUPS   "\"path_groups\": ["
f20720
+#define PRINT_JSON_END_ELEM       "},"
f20720
+#define PRINT_JSON_END_LAST_ELEM  "}"
f20720
+#define PRINT_JSON_END_LAST       "}\n"
f20720
+#define PRINT_JSON_END_ARRAY      "]\n"
f20720
+#define PRINT_JSON_INDENT    "   "
f20720
+#define PRINT_JSON_MAP       "{\n" \
f20720
+                             "      \"name\" : \"%n\",\n" \
f20720
+                             "      \"uuid\" : \"%w\",\n" \
f20720
+                             "      \"sysfs\" : \"%d\",\n" \
f20720
+                             "      \"failback\" : \"%F\",\n" \
f20720
+                             "      \"queueing\" : \"%Q\",\n" \
f20720
+                             "      \"paths\" : %N,\n" \
f20720
+                             "      \"write_prot\" : \"%r\",\n" \
f20720
+                             "      \"dm_st\" : \"%t\",\n" \
f20720
+                             "      \"features\" : \"%f\",\n" \
f20720
+                             "      \"hwhandler\" : \"%h\",\n" \
f20720
+                             "      \"action\" : \"%A\",\n" \
f20720
+                             "      \"path_faults\" : %0,\n" \
f20720
+                             "      \"vend\" : \"%v\",\n" \
f20720
+                             "      \"prod\" : \"%p\",\n" \
f20720
+                             "      \"rev\" : \"%e\",\n" \
f20720
+                             "      \"switch_grp\" : %1,\n" \
f20720
+                             "      \"map_loads\" : %2,\n" \
f20720
+                             "      \"total_q_time\" : %3,\n" \
f20720
+                             "      \"q_timeouts\" : %4,"
f20720
+
f20720
+#define PRINT_JSON_GROUP     "{\n" \
f20720
+                             "         \"selector\" : \"%s\",\n" \
f20720
+                             "         \"pri\" : %p,\n" \
f20720
+                             "         \"dm_st\" : \"%t\","
f20720
+
f20720
+#define PRINT_JSON_GROUP_NUM "         \"group\" : %d,\n"
f20720
+
f20720
+#define PRINT_JSON_PATH      "{\n" \
f20720
+                             "            \"dev\" : \"%d\",\n"\
f20720
+                             "            \"dev_t\" : \"%D\",\n" \
f20720
+                             "            \"dm_st\" : \"%t\",\n" \
f20720
+                             "            \"dev_st\" : \"%o\",\n" \
f20720
+                             "            \"chk_st\" : \"%T\",\n" \
f20720
+                             "            \"checker\" : \"%c\",\n" \
f20720
+                             "            \"pri\" : %p,\n" \
f20720
+                             "            \"host_wwnn\" : \"%N\",\n" \
f20720
+                             "            \"target_wwnn\" : \"%n\",\n" \
f20720
+                             "            \"host_wwpn\" : \"%R\",\n" \
f20720
+                             "            \"target_wwpn\" : \"%r\",\n" \
f20720
+                             "            \"host_adapter\" : \"%a\""
f20720
+
f20720
 #define MAX_LINE_LEN  80
f20720
 #define MAX_LINES     64
f20720
 #define MAX_FIELD_LEN 64
f20720
@@ -41,6 +98,10 @@ int snprint_path (char *, int, char *, s
f20720
 int snprint_multipath (char *, int, char *, struct multipath *, int);
f20720
 int snprint_multipath_topology (char *, int, struct multipath * mpp,
f20720
 				int verbosity);
f20720
+int snprint_multipath_topology_json (char * buff, int len,
f20720
+				struct vectors * vecs);
f20720
+int snprint_multipath_map_json (char * buff, int len,
f20720
+				struct multipath * mpp, int last);
f20720
 int snprint_defaults (char *, int);
f20720
 int snprint_blacklist (char *, int);
f20720
 int snprint_blacklist_except (char *, int);
f20720
Index: multipath-tools-130222/multipathd/cli.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/cli.c
f20720
+++ multipath-tools-130222/multipathd/cli.c
f20720
@@ -189,6 +189,7 @@ load_keys (void)
f20720
 	r += add_key(keys, "setprstatus", SETPRSTATUS, 0);
f20720
 	r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0);
f20720
 	r += add_key(keys, "format", FMT, 1);
f20720
+	r += add_key(keys, "json", JSON, 0);
f20720
 
f20720
 	if (r) {
f20720
 		free_keys(keys);
f20720
@@ -473,8 +474,10 @@ cli_init (void) {
f20720
 	add_handler(LIST+MAPS+FMT, NULL);
f20720
 	add_handler(LIST+MAPS+RAW+FMT, NULL);
f20720
 	add_handler(LIST+MAPS+TOPOLOGY, NULL);
f20720
+	add_handler(LIST+MAPS+JSON, NULL);
f20720
 	add_handler(LIST+TOPOLOGY, NULL);
f20720
 	add_handler(LIST+MAP+TOPOLOGY, NULL);
f20720
+	add_handler(LIST+MAP+JSON, NULL);
f20720
 	add_handler(LIST+CONFIG, NULL);
f20720
 	add_handler(LIST+BLACKLIST, NULL);
f20720
 	add_handler(LIST+DEVICES, NULL);
f20720
Index: multipath-tools-130222/multipathd/cli.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/cli.h
f20720
+++ multipath-tools-130222/multipathd/cli.h
f20720
@@ -36,6 +36,7 @@ enum {
f20720
 	__SETPRSTATUS,
f20720
 	__UNSETPRSTATUS,
f20720
 	__FMT,
f20720
+	__JSON,
f20720
 };
f20720
 
f20720
 #define LIST		(1 << __LIST)
f20720
@@ -74,6 +75,7 @@ enum {
f20720
 #define SETPRSTATUS	(1ULL << __SETPRSTATUS)
f20720
 #define UNSETPRSTATUS	(1ULL << __UNSETPRSTATUS)
f20720
 #define FMT		(1ULL << __FMT)
f20720
+#define JSON		(1ULL << __JSON)
f20720
 
f20720
 #define INITIAL_REPLY_LEN	1200
f20720
 
f20720
Index: multipath-tools-130222/multipathd/cli_handlers.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
f20720
+++ multipath-tools-130222/multipathd/cli_handlers.c
f20720
@@ -127,6 +127,70 @@ show_maps_topology (char ** r, int * len
f20720
 }
f20720
 
f20720
 int
f20720
+show_maps_json (char ** r, int * len, struct vectors * vecs)
f20720
+{
f20720
+	int i;
f20720
+	struct multipath * mpp;
f20720
+	char * c;
f20720
+	char * reply;
f20720
+	unsigned int maxlen = INITIAL_REPLY_LEN *
f20720
+			PRINT_JSON_MULTIPLIER * VECTOR_SIZE(vecs->mpvec);
f20720
+	int again = 1;
f20720
+
f20720
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
f20720
+		if (update_multipath(vecs, mpp->alias, 0)) {
f20720
+			return 1;
f20720
+		}
f20720
+	}
f20720
+
f20720
+	reply = MALLOC(maxlen);
f20720
+
f20720
+	while (again) {
f20720
+		if (!reply)
f20720
+			return 1;
f20720
+
f20720
+		c = reply;
f20720
+
f20720
+		c += snprint_multipath_topology_json(c, maxlen, vecs);
f20720
+		again = ((c - reply) == maxlen);
f20720
+
f20720
+		REALLOC_REPLY(reply, again, maxlen);
f20720
+	}
f20720
+	*r = reply;
f20720
+	*len = (int)(c - reply);
f20720
+	return 0;
f20720
+}
f20720
+
f20720
+int
f20720
+show_map_json (char ** r, int * len, struct multipath * mpp,
f20720
+		   struct vectors * vecs)
f20720
+{
f20720
+	char * c;
f20720
+	char * reply;
f20720
+	unsigned int maxlen = INITIAL_REPLY_LEN;
f20720
+	int again = 1;
f20720
+
f20720
+	if (update_multipath(vecs, mpp->alias, 0))
f20720
+		return 1;
f20720
+	reply = MALLOC(maxlen);
f20720
+
f20720
+	while (again) {
f20720
+		if (!reply)
f20720
+			return 1;
f20720
+
f20720
+		c = reply;
f20720
+
f20720
+		c += snprint_multipath_map_json(c, maxlen, mpp, 1);
f20720
+		again = ((c - reply) == maxlen);
f20720
+
f20720
+		REALLOC_REPLY(reply, again, maxlen);
f20720
+	}
f20720
+	*r = reply;
f20720
+	*len = (int)(c - reply);
f20720
+	return 0;
f20720
+}
f20720
+
f20720
+int
f20720
 show_config (char ** r, int * len)
f20720
 {
f20720
 	char * c;
f20720
@@ -239,6 +303,35 @@ cli_list_maps_topology (void * v, char *
f20720
 }
f20720
 
f20720
 int
f20720
+cli_list_map_json (void * v, char ** reply, int * len, void * data)
f20720
+{
f20720
+	struct multipath * mpp;
f20720
+	struct vectors * vecs = (struct vectors *)data;
f20720
+	char * param = get_keyparam(v, MAP);
f20720
+
f20720
+	param = convert_dev(param, 0);
f20720
+	get_path_layout(vecs->pathvec, 0);
f20720
+	mpp = find_mp_by_str(vecs->mpvec, param);
f20720
+
f20720
+	if (!mpp)
f20720
+		return 1;
f20720
+
f20720
+	condlog(3, "list multipath json %s (operator)", param);
f20720
+
f20720
+	return show_map_json(reply, len, mpp, vecs);
f20720
+}
f20720
+
f20720
+int
f20720
+cli_list_maps_json (void * v, char ** reply, int * len, void * data)
f20720
+{
f20720
+	struct vectors * vecs = (struct vectors *)data;
f20720
+
f20720
+	condlog(3, "list multipaths json (operator)");
f20720
+
f20720
+	return show_maps_json(reply, len, vecs);
f20720
+}
f20720
+
f20720
+int
f20720
 cli_list_wildcards (void * v, char ** reply, int * len, void * data)
f20720
 {
f20720
 	char * c;
f20720
Index: multipath-tools-130222/multipathd/cli_handlers.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
f20720
+++ multipath-tools-130222/multipathd/cli_handlers.h
f20720
@@ -10,6 +10,8 @@ int cli_list_maps_status (void * v, char
f20720
 int cli_list_maps_stats (void * v, char ** reply, int * len, void * data);
f20720
 int cli_list_map_topology (void * v, char ** reply, int * len, void * data);
f20720
 int cli_list_maps_topology (void * v, char ** reply, int * len, void * data);
f20720
+int cli_list_map_json (void * v, char ** reply, int * len, void * data);
f20720
+int cli_list_maps_json (void * v, char ** reply, int * len, void * data);
f20720
 int cli_list_config (void * v, char ** reply, int * len, void * data);
f20720
 int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
f20720
 int cli_list_devices (void * v, char ** reply, int * len, void * data);
f20720
Index: multipath-tools-130222/multipathd/main.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/main.c
f20720
+++ multipath-tools-130222/multipathd/main.c
f20720
@@ -981,7 +981,9 @@ uxlsnrloop (void * ap)
f20720
 	set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
f20720
 	set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
f20720
 	set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
f20720
+	set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json);
f20720
 	set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
f20720
+	set_handler_callback(LIST+MAP+JSON, cli_list_map_json);
f20720
 	set_handler_callback(LIST+CONFIG, cli_list_config);
f20720
 	set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
f20720
 	set_handler_callback(LIST+DEVICES, cli_list_devices);
f20720
Index: multipath-tools-130222/multipathd/multipathd.8
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipathd/multipathd.8
f20720
+++ multipath-tools-130222/multipathd/multipathd.8
f20720
@@ -53,11 +53,15 @@ using a format string with multipath for
f20720
 Show the status of all multipath devices that the multipathd is monitoring.
f20720
 .TP
f20720
 .B list|show maps|multipaths stats
f20720
-Show some statistics of all multipath devices that the multipathd is monitoring.
f20720
+Show some statistics of all multipath devices that multipathd is monitoring.
f20720
 .TP
f20720
 .B list|show maps|multipaths topology
f20720
 Show the current multipath topology. Same as "multipath \-ll".
f20720
 .TP
f20720
+.B list|show maps|multipaths json
f20720
+Show the multipath devices that multipathd is monitoring, using JSON
f20720
+formatted output.
f20720
+.TP
f20720
 .B list|show topology
f20720
 Show the current multipath topology. Same as "multipath \-ll".
f20720
 .TP
f20720
@@ -65,6 +69,9 @@ Show the current multipath topology. Sam
f20720
 Show topology of a single multipath device specified by $map, e.g. 36005076303ffc56200000000000010aa.
f20720
 This map could be obtained from "list maps".
f20720
 .TP
f20720
+.B list|show map|multipath $map json
f20720
+Show a single multipath device specified by $map, using JSON formatted output.
f20720
+.TP
f20720
 .B list|show wildcards
f20720
 Show the format wildcards used in interactive commands taking $format
f20720
 .TP