Skip to contentSkip to conversation

lvmdiskscan: improve the output of this command

PATCH New Lidong Zhong 2 participants 2 messages Dec 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lvmdiskscan: improve the output of this command

---
 tools/lvmdiskscan.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/lvmdiskscan.c +4 -4
index 0320a76..a3f83f7 100644
@@ -144,14 +144,14 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
 	/* Display totals */
 	if (!arg_count(cmd, lvmpartition_ARG)) {
 		log_print("%d disk%s",
-			  disks_found, disks_found == 1 ? "" : "s");
+			  disks_found, disks_found <= 1 ? "" : "s");
 		log_print("%d partition%s",
-			  parts_found, parts_found == 1 ? "" : "s");
+			  parts_found, parts_found <= 1 ? "" : "s");
 	}
 	log_print("%d LVM physical volume whole disk%s",
-		  pv_disks_found, pv_disks_found == 1 ? "" : "s");
+		  pv_disks_found, pv_disks_found <= 1 ? "" : "s");
 	log_print("%d LVM physical volume%s",
-		  pv_parts_found, pv_parts_found == 1 ? "" : "s");
+		  pv_parts_found, pv_parts_found <= 1 ? "" : "s");
 
 	return ECMD_PROCESSED;
 }
Signature · 1 line
2.1.2
#1 lore raw

PATCH 1/1 lvmdiskscan: improve the output of this command

tools/lvmdiskscan.c int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)), · line 147

Quoted 3 lines · Lidong Zhong
tools/lvmdiskscan.c +1 -1
 		log_print("%d disk%s",
-			  disks_found, disks_found == 1 ? "" : "s");
+			  disks_found, disks_found <= 1 ? "" : "s");

"No disks" is best. "0 disks" is a lazy alternative. "No disk" is also OK, but "0 disk" is wrong.

Alasdair