public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/report/report.c
Date: Mon, 02 Oct 2006 16:46:00 -0000	[thread overview]
Message-ID: <20061002164628.671.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-02 16:46:27

Modified files:
	.              : WHATS_NEW 
	lib/report     : report.c 

Log message:
	Show available fields if report given invalid field. (e.g. lvs -o list)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.446&r2=1.447
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48

--- LVM2/WHATS_NEW	2006/09/30 20:02:02	1.446
+++ LVM2/WHATS_NEW	2006/10/02 16:46:27	1.447
@@ -1,5 +1,6 @@
 Version 2.02.11 - 
 =====================================
+  Show available fields if report given invalid field. (e.g. lvs -o list)
   Add timestamp functions with --disable-realtime configure option.
   Add %VG, %LV and %FREE suffices to lvcreate/lvresize --extents arg.
   Fix two potential NULL pointer derefs in error cases in vg_read().
--- LVM2/lib/report/report.c	2006/08/21 12:54:53	1.47
+++ LVM2/lib/report/report.c	2006/10/02 16:46:27	1.48
@@ -948,6 +948,44 @@
 
 const unsigned int _num_fields = sizeof(_fields) / sizeof(_fields[0]);
 
+static void _display_fields(void)
+{
+	uint32_t f;
+	const char *type, *last_type = "";
+
+	for (f = 0; f < _num_fields; f++) {
+		switch (_fields[f].type) {
+		case PVS:
+			type = "Physical Volume";
+			break;
+		case LVS:
+			type = "Logical Volume";
+			break;
+		case VGS:
+			type = "Volume Group";
+			break;
+		case SEGS:
+			type = "Logical Volume Segment";
+			break;
+		case PVSEGS:
+			type = "Physical Volume Segment";
+			break;
+		default:
+			type = " ";
+		}
+
+		if (type != last_type) {
+			if (*last_type)
+				log_print(" ");
+			log_print("%s Fields", type);
+		}
+
+		log_print("- %s", _fields[f].id);
+
+		last_type = type;
+	}
+}
+
 /*
  * Initialise report handle
  */
@@ -1080,6 +1118,8 @@
 		while (*we && *we != ',')
 			we++;
 		if (!_field_match(rh, ws, (size_t) (we - ws))) {
+			_display_fields();
+			log_print(" ");
 			log_error("Unrecognised field: %.*s", (int) (we - ws),
 				  ws);
 			return 0;


             reply	other threads:[~2006-10-02 16:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-02 16:46 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-05-20 22:24 agk
2010-01-07 14:37 zkabelac
2009-02-06 12:41 mbroz
2009-01-10 17:09 agk
2009-01-10 15:04 wysochanski
2008-12-15 13:30 wysochanski
2007-01-22 15:07 agk
2007-01-18 17:48 agk
2004-05-05 18:23 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061002164628.671.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).