return NULL;
}
+struct multipath *
+find_mp_by_str (vector mpvec, char * str)
+{
+ int minor;
+
+ if (sscanf(str, "dm-%d", &minor) == 1)
+ return find_mp_by_minor(mpvec, minor);
+ else
+ return find_mp_by_alias(mpvec, str);
+}
+
struct path *
find_path_by_dev (vector pathvec, char * dev)
{
struct multipath * find_mp_by_alias (vector mp, char * alias);
struct multipath * find_mp_by_wwid (vector mp, char * wwid);
+struct multipath * find_mp_by_str (vector mp, char * wwid);
struct multipath * find_mp_by_minor (vector mp, int minor);
struct path * find_path_by_devt (vector pathvec, char * devt);
}
int
+show_map_topology (char ** r, int * len, struct multipath * mpp)
+{
+ char * c;
+ char * reply;
+ int maxlen = INITIAL_REPLY_LEN;
+ int again = 1;
+
+ reply = MALLOC(maxlen);
+
+ while (again) {
+ if (!reply)
+ return 1;
+
+ c = reply;
+
+ c += snprint_multipath_topology( c, reply + maxlen - c, mpp, 2);
+ again = ((c - reply) == (maxlen - 1));
+
+ if (again)
+ reply = REALLOC(reply, maxlen *= 2);
+
+ }
+ *r = reply;
+ *len = (int)(c - reply + 1);
+ return 0;
+}
+
+int
show_maps_topology (char ** r, int * len, struct vectors * vecs)
{
int i;
}
int
+cli_list_map_topology (void * v, char ** reply, int * len, void * data)
+{
+ struct multipath * mpp;
+ struct vectors * vecs = (struct vectors *)data;
+ char * param = get_keyparam(v, MAP);
+
+ mpp = find_mp_by_str(vecs->mpvec, param);
+
+ if (!mpp)
+ return 1;
+
+ condlog(3, "list multipath %s (operator)", param);
+
+ return show_map_topology(reply, len, mpp);
+}
+
+int
cli_list_maps_topology (void * v, char ** reply, int * len, void * data)
{
struct vectors * vecs = (struct vectors *)data;
int
ev_remove_map (char * devname, struct vectors * vecs)
{
- int minor;
struct multipath * mpp;
- if (sscanf(devname, "dm-%d", &minor) == 1)
- mpp = find_mp_by_minor(vecs->mpvec, minor);
- else
- mpp = find_mp_by_alias(vecs->mpvec, devname);
+ mpp = find_mp_by_str(vecs->mpvec, devname);
if (!mpp) {
condlog(3, "%s: devmap not registered, can't remove",
add_handler(LIST+MAPS, cli_list_maps);
add_handler(LIST+MAPS+STATS, cli_list_maps_stats);
add_handler(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
+ add_handler(LIST+MAP+TOPOLOGY, cli_list_map_topology);
add_handler(ADD+PATH, cli_add_path);
add_handler(DEL+PATH, cli_del_path);
add_handler(ADD+MAP, cli_add_map);