[libmultipath] print dm-* sysfs device name in "show topo"
authorChristophe Varoqui <root@xa-s05.(none)>
Tue, 13 Jun 2006 08:55:02 +0000 (10:55 +0200)
committerChristophe Varoqui <root@xa-s05.(none)>
Tue, 13 Jun 2006 08:55:02 +0000 (10:55 +0200)
Useful info for admins.

Also fix a small bug in print_multipath() not reseting a buffer upon
iteration.

libmultipath/devmapper.c
libmultipath/print.c

index 4328036..0abdb88 100644 (file)
@@ -591,6 +591,7 @@ dm_get_maps (vector mp, char * type)
                                goto out1;
 
                        dm_get_uuid(names->name, mpp->wwid);
+                       dm_get_info(names->name, &mpp->dmi);
                }
 
                if (!vector_alloc_slot(mp))
index 82bcfd0..4856f79 100644 (file)
@@ -496,7 +496,7 @@ snprint_multipath (char * line, int len, char * format,
        char * f = format; /* format string cursor */
        int fwd;
        struct multipath_data * data;
-       char buff[MAX_FIELD_LEN];
+       char buff[MAX_FIELD_LEN] = {};
 
        do {
                if (!TAIL)
@@ -515,6 +515,7 @@ snprint_multipath (char * line, int len, char * format,
                data->snprint(buff, MAX_FIELD_LEN, mpp);
                PRINT(c, TAIL, buff);
                PAD(data->width);
+               buff[0] = '\0';
        } while (*f++);
 
        line[c - line - 1] = '\n';
@@ -664,6 +665,7 @@ snprint_multipath_topology (char * buff, int len, struct multipath * mpp,
        if (strncmp(mpp->alias, mpp->wwid, WWID_SIZE))
                c += sprintf(c, " (%%w) ");
 
+       c += sprintf(c, "%%d ");
        c += snprint_vpr(c, 24, first_path(mpp));
 
        fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp);