public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW_DM tools/dmsetup.c
Date: Wed, 03 Jun 2009 20:44:00 -0000	[thread overview]
Message-ID: <20090603204453.19665.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-06-03 20:44:50

Modified files:
	.              : WHATS_NEW_DM 
	tools          : dmsetup.c 

Log message:
	Add splitname.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.271&r2=1.272
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.115&r2=1.116

--- LVM2/WHATS_NEW_DM	2009/06/03 18:35:39	1.271
+++ LVM2/WHATS_NEW_DM	2009/06/03 20:44:42	1.272
@@ -1,5 +1,6 @@
 Version 1.02.33 - 
 ===============================
+  Add splitname command to dmsetup.
   Add subsystem, vg_name, lv_name, lv_layer fields to dmsetup reports.
   Make mempool optional in dm_split_lvm_name().
 
--- LVM2/tools/dmsetup.c	2009/06/03 18:35:39	1.115
+++ LVM2/tools/dmsetup.c	2009/06/03 20:44:49	1.116
@@ -303,14 +303,14 @@
 	return NULL;
 }
 
-static char *_extract_uuid_prefix(const char *uuid)
+static char *_extract_uuid_prefix(const char *uuid, const int separator)
 {
 	char *ptr = NULL;
 	char *uuid_prefix = NULL;
 	size_t len;
 
 	if (uuid)
-		ptr = strchr(uuid, '-');
+		ptr = strchr(uuid, separator);
 
 	len = ptr ? ptr - uuid : 0;
 	if (!(uuid_prefix = dm_malloc(len + 1))) {
@@ -324,7 +324,8 @@
 	return uuid_prefix;
 }
 
-static struct dm_split_name *_get_split_name(const char *uuid, const char *name)
+static struct dm_split_name *_get_split_name(const char *uuid, const char *name,
+					     int separator)
 {
 	struct dm_split_name *split_name;
 
@@ -334,7 +335,7 @@
 		return NULL;
 	}
 
-	split_name->subsystem = _extract_uuid_prefix(uuid);
+	split_name->subsystem = _extract_uuid_prefix(uuid, separator);
 	split_name->vg_name = split_name->lv_name =
 	    split_name->lv_layer = (char *) "";
 
@@ -383,7 +384,7 @@
 		obj.deps_task = _get_deps_task(info->major, info->minor);
 
 	if (_report_type & DR_NAME)
-		obj.split_name = _get_split_name(dm_task_get_uuid(dmt), dm_task_get_name(dmt));
+		obj.split_name = _get_split_name(dm_task_get_uuid(dmt), dm_task_get_name(dmt), '-');
 
 	if (!dm_report_object(_report, &obj))
 		goto out;
@@ -721,6 +722,24 @@
 	return r;
 }
 
+static int _splitname(int argc, char **argv, void *data __attribute((unused)))
+{
+	struct dmsetup_report_obj obj;
+	int r = 1;
+
+	obj.task = NULL;
+	obj.info = NULL;
+	obj.deps_task = NULL;
+	obj.tree_node = NULL;
+	obj.split_name = _get_split_name((argc == 3) ? argv[2] : "LVM",
+					 argv[1], '\0');
+
+	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];
@@ -2090,6 +2109,7 @@
 #undef FIELD_F
 
 static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid";
+static const char *splitname_report_options = "vg_name,lv_name,lv_layer";
 
 static int _report_init(struct command *c)
 {
@@ -2102,6 +2122,9 @@
 	size_t len = 0;
 	int r = 0;
 
+	if (!strcmp(c->name, "splitname"))
+		options = (char *) splitname_report_options;
+
 	/* emulate old dmsetup behaviour */
 	if (_switches[NOHEADINGS_ARG]) {
 		separator = ":";
@@ -2241,6 +2264,7 @@
 	{"targets", "", 0, 0, _targets},
 	{"version", "", 0, 0, _version},
 	{"setgeometry", "<device> <cyl> <head> <sect> <start>", 5, 5, _setgeometry},
+	{"splitname", "<device> [<subsystem>]", 1, 2, _splitname},
 	{NULL, NULL, 0, 0, NULL}
 };
 
@@ -2858,6 +2882,9 @@
 		goto out;
 	}
 
+	if (!_switches[COLS_ARG] && !strcmp(c->name, "splitname"))
+		_switches[COLS_ARG]++;
+
 	if (_switches[COLS_ARG] && !_report_init(c))
 		goto out;
 


             reply	other threads:[~2009-06-03 20:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03 20:44 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-04-24  8:24 prajnoha
2012-04-24  8:00 prajnoha
2012-03-01 21:56 zkabelac
2012-02-15 12:08 prajnoha
2012-02-15 12:06 prajnoha
2012-02-15 12:03 prajnoha
2012-02-13 12:06 zkabelac
2011-08-11 17:06 mbroz
2011-07-08 17:08 agk
2011-06-17 14:55 prajnoha
2011-03-29 21:49 zkabelac
2011-03-02  2:44 agk
2010-08-03 13:04 zkabelac
2010-08-03 12:56 zkabelac
2010-07-08 14:29 zkabelac
2009-06-03 18:35 agk
2009-04-24 11:30 prajnoha

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=20090603204453.19665.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --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).