All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: device-mapper development <dm-devel@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: [PATCH] libdevmapper: (5/6) Add '--filter' option to dmsetup
Date: Wed, 18 Apr 2007 12:47:47 -0400	[thread overview]
Message-ID: <46264BB3.2030101@ce.jp.nec.com> (raw)
In-Reply-To: <46264A57.1020800@ce.jp.nec.com>

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

Hi,

This patch adds '--filter' option to dmsetup, so that it can
use the filtering feature of dm_report.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

[-- Attachment #2: dmsetup-info-add-filter-option.patch --]
[-- Type: text/x-patch, Size: 2289 bytes --]

Add --filter (-F) option to dmsetup for filtering report output.

---
 dmsetup/dmsetup.c |   15 ++++++++++++++-
 man/dmsetup.8     |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

Index: device-mapper.work/dmsetup/dmsetup.c
===================================================================
--- device-mapper.work.orig/dmsetup/dmsetup.c
+++ device-mapper.work/dmsetup/dmsetup.c
@@ -104,6 +104,7 @@ enum {
 	COLS_ARG,
 	EXEC_ARG,
 	FORCE_ARG,
+	FILTER_ARG,
 	GID_ARG,
 	MAJOR_ARG,
 	MINOR_ARG,
@@ -1650,6 +1651,13 @@ static int _report_init(struct command *
 					options, separator, flags, keys, NULL)))
 		goto out;
 
+	if (_string_args[FILTER_ARG] &&
+	    !dm_report_set_filter(_report, _string_args[FILTER_ARG], 0)) {
+		dm_report_free(_report);
+		_report = NULL;
+		goto out;
+	}
+
 	r = 1;
 
 out:
@@ -2059,6 +2067,7 @@ static int _process_switches(int *argc, 
 		{"columns", 0, &ind, COLS_ARG},
 		{"exec", 1, &ind, EXEC_ARG},
 		{"force", 0, &ind, FORCE_ARG},
+		{"filter", 1, &ind, FILTER_ARG},
 		{"gid", 1, &ind, GID_ARG},
 		{"major", 1, &ind, MAJOR_ARG},
 		{"minor", 1, &ind, MINOR_ARG},
@@ -2133,7 +2142,7 @@ static int _process_switches(int *argc, 
 
 	optarg = 0;
 	optind = OPTIND_INIT;
-	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv",
+	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfF:Gj:m:Mno:O:ru:Uv",
 					    long_options, NULL)) != -1) {
 		if (c == ':' || c == '?')
 			return 0;
@@ -2141,6 +2150,10 @@ static int _process_switches(int *argc, 
 			_switches[COLS_ARG]++;
 		if (c == 'f' || ind == FORCE_ARG)
 			_switches[FORCE_ARG]++;
+		if (c == 'F' || ind == FILTER_ARG) {
+			_switches[FILTER_ARG]++;
+			_string_args[FILTER_ARG] = optarg;
+		}
 		if (c == 'r' || ind == READ_ONLY)
 			_switches[READ_ONLY]++;
 		if (c == 'j' || ind == MAJOR_ARG) {
Index: device-mapper.work/man/dmsetup.8
===================================================================
--- device-mapper.work.orig/man/dmsetup.8
+++ device-mapper.work/man/dmsetup.8
@@ -44,7 +44,7 @@ dmsetup \- low level logical volume mana
 .br
 .B dmsetup info -c|-C|--columns
 .I [--noheadings] [--separator separator] [-o fields] [-O|--sort sort_fields]
-.I [device_name]
+.I [--filter expression] [device_name]
 .br
 .B dmsetup deps
 .I [device_name]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2007-04-18 16:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 16:41 [PATCH] libdevmapper: (0/6) Filtering feature in dm_report Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (1/6) Tidy up _field_match() and _key_match() Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (2/6) Fix trailing separator Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (3/6) Move lib/regex from LVM2 Jun'ichi Nomura
2007-04-18 19:23   ` [PATCH] LVM2: (1/2) Use dm_regex Jun'ichi Nomura
2007-04-18 16:47 ` [PATCH] libdevmapper: (4/6) Add filtering feature to dm_report Jun'ichi Nomura
2007-04-18 19:32   ` [PATCH] LVM2: (2/2) Use dm_report filter Jun'ichi Nomura
2007-04-18 16:47 ` Jun'ichi Nomura [this message]
2007-04-18 16:47 ` [PATCH] libdevmapper: (6/6) Add deps and treenode fields for dmsetup info -c Jun'ichi Nomura
2007-04-18 19:23 ` [PATCH] libdevmapper: (7/6) Add dm_report_get_report_types() Jun'ichi Nomura

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=46264BB3.2030101@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.