NeilBrown: Detail: use meaningful names with --scan.

Martin F. Krafft madduck at alioth.debian.org
Thu May 7 12:11:34 UTC 2009


Module: mdadm
Branch: debian/experimental
Commit: 3590496027119a99b4c36d4e22813d12474041c7
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=3590496027119a99b4c36d4e22813d12474041c7

Author: NeilBrown <neilb at suse.de>
Date:   Mon Apr  6 15:54:51 2009 +1000

Detail: use meaningful names with --scan.

When reporting "--detail --scan", use names like /dev/md/foo where
available rather than /dev/md/127

This is particularly needed for containers where the member arrays
will report "container=/dev/md/foo" and we want the container to have
the same name.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 mdadm.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/mdadm.c b/mdadm.c
index 1fef4b9..4402eba 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
 				shortopt, long_options,
 				&option_index)) != -1) {
 		int newmode = mode;
-		/* firstly, some mode-independant options */
+		/* firstly, some mode-independent options */
 		switch(opt) {
 		case 'h':
 			if (option_index > 0 &&
@@ -1231,10 +1231,17 @@ int main(int argc, char *argv[])
 					 */
 					struct mdstat_ent *ms = mdstat_read(0, 1);
 					struct mdstat_ent *e;
+					struct map_ent *map = NULL;
 					int v = verbose>1?0:verbose+1;
 
 					for (e=ms ; e ; e=e->next) {
-						char *name = get_md_name(e->devnum);
+						char *name;
+						struct map_ent *me;
+						me = map_by_devnum(&map, e->devnum);
+						if (me && me->path)
+							name = me->path;
+						else
+							name = get_md_name(e->devnum);
 
 						if (!name) {
 							fprintf(stderr, Name ": cannot find device file for %s\n",




More information about the pkg-mdadm-commits mailing list