Dan Williams: Examine: fixup output in the presence of containers with spares

Martin F. Krafft madduck at alioth.debian.org
Tue Oct 27 19:21:47 UTC 2009


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

Author: Dan Williams <dan.j.williams at intel.com>
Date:   Tue Sep 15 11:34:20 2009 -0700

Examine: fixup output in the presence of containers with spares

If we dump any 'spare' or 'device' information for a container in the
'brief' case then we need a newline before printing member array info.

Signed-off-by: Dan Williams <dan.j.williams at intel.com>

---

 Examine.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Examine.c b/Examine.c
index c79a701..d4904bc 100644
--- a/Examine.c
+++ b/Examine.c
@@ -136,17 +136,23 @@ int Examine(mddev_dev_t devlist, int brief, int export, int scan,
 		for (ap=arrays; ap; ap=ap->next) {
 			char sep='=';
 			char *d;
+			int newline = 0;
+
 			ap->st->ss->brief_examine_super(ap->st, brief > 1);
-			if (ap->spares) printf("   spares=%d", ap->spares);
+			if (ap->spares)
+				newline += printf("   spares=%d", ap->spares);
 			if (brief > 1) {
-				printf("   devices");
+				newline += printf("   devices");
 				for (d=dl_next(ap->devs); d!= ap->devs; d=dl_next(d)) {
 					printf("%c%s", sep, d);
 					sep=',';
 				}
 			}
-			if (ap->st->ss->brief_examine_subarrays)
+			if (ap->st->ss->brief_examine_subarrays) {
+				if (newline)
+					printf("\n");
 				ap->st->ss->brief_examine_subarrays(ap->st, brief > 1);
+			}
 			ap->st->ss->free_super(ap->st);
 			/* FIXME free ap */
 			if (ap->spares || brief > 1)




More information about the pkg-mdadm-commits mailing list