All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 6/9] Udev integration: add lvmsplit command for dmsetup
Date: Mon, 25 May 2009 14:19:15 +0200	[thread overview]
Message-ID: <4A1A8CC3.2000809@redhat.com> (raw)

Adds lvmsplit command for dmsetup that can split-up given DM name into
its VG/LV/LAYER constituents. No change in here, too...

Peter


diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 8db38b0..f9551d9 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -746,6 +746,24 @@ static int _udevnotify(int argc, char **argv, void *data __attribute((unused)))
 	return dm_udev_notif_sem_dec(cookie);
 }
 
+static int _lvmsplit(int argc, char **argv, void *data __attribute((unused)))
+{
+	int r = 1;
+
+	struct dmsetup_report_obj obj;
+
+	obj.task = NULL;
+	obj.info = NULL;
+	obj.deps_task = NULL;
+	obj.tree_node = NULL;
+	obj.split_name = _get_split_name("LVM-", argv[1]);
+
+	r = dm_report_object(_report, &obj);
+	_destroy_split_name(obj.split_name);
+
+	return r;
+}
+
 static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
 {
 	char version[80];
@@ -2146,6 +2164,7 @@ FIELD_O(NAME, dm_split_name, STR, "LVLayer", lv_layer, 7, dm_lv_layer_name, "lv_
 #undef FIELD_F
 
 static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid";
+static const char *lvmsplit_report_options = "vg_name,lv_name,lv_layer";
 
 static int _report_init(struct command *c)
 {
@@ -2158,6 +2177,9 @@ static int _report_init(struct command *c)
 	size_t len = 0;
 	int r = 0;
 
+	if (!strcmp(c->name, "lvmsplit"))
+		options = (char *) lvmsplit_report_options;
+
 	/* emulate old dmsetup behaviour */
 	if (_switches[NOHEADINGS_ARG]) {
 		separator = ":";
@@ -2295,6 +2317,7 @@ static struct command _commands[] = {
 	{"wait", "<device> [<event_nr>]", 0, 2, _wait},
 	{"mknodes", "[<device>]", 0, 1, _mknodes},
 	{"udevnotify", "<cookie>", 1, 1, _udevnotify},
+	{"lvmsplit", "<dev_name>", 1, 1, _lvmsplit},
 	{"targets", "", 0, 0, _targets},
 	{"version", "", 0, 0, _version},
 	{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, _setgeometry},
@@ -2918,6 +2941,9 @@ int main(int argc, char **argv)
 		goto out;
 	}
 
+	if (!_switches[COLS_ARG] && !strcmp(c->name, "lvmsplit"))
+		_switches[COLS_ARG]++;
+
 	if (_switches[COLS_ARG] && !_report_init(c))
 		goto out;
 



             reply	other threads:[~2009-05-25 12:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25 12:19 Peter Rajnoha [this message]
2009-06-03 20:59 ` [PATCH 6/9] Udev integration: add lvmsplit command for dmsetup Alasdair G Kergon

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=4A1A8CC3.2000809@redhat.com \
    --to=prajnoha@redhat.com \
    --cc=lvm-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.