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>,
	LVM2 development <lvm-devel@redhat.com>
Subject: [PATCH] (3/4) Remove old codes for "info -c" from dmsetup
Date: Fri, 12 Jan 2007 18:31:58 -0500	[thread overview]
Message-ID: <45A81A6E.9070309@ce.jp.nec.com> (raw)
In-Reply-To: <45A81618.2080608@ce.jp.nec.com>

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

Hi,

This patch removes _display_info_cols*() functions used
for "dmsetup info -c" implementation.
These can be replaced by the new code using dm_report.

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

[-- Attachment #2: 03-dmsetup-remove-old-info-cols.patch --]
[-- Type: text/x-patch, Size: 3171 bytes --]

Replace old _display_info_cols{_noheadings} by _report()

Slight incompatibility is introduced:
  Output of verbose + column is changed.
  e.g. dmsetup table -v -c

    # dmsetup.old table -c -v
    Name             Maj Min Stat Open Targ Event  UUID
    d4               254   6 L--w    0    1      0 
    0 409600 linear 7:0 1638400

    d3               254   5 L--w    0    1      0 
    0 409600 linear 7:0 1228800
    ...

    # dmsetup.new table -c -v
    Name             Maj Min Stat Open Targ Event  UUID
    d4               254   6 L--w    0    1      0
    0 409600 linear 7:0 1638400

    Name             Maj Min Stat Open Targ Event  UUID
    d3               254   5 L--w    0    1      0
    0 409600 linear 7:0 1228800
    ...

  Field head used to be displayed only once but now it's displayed
  for every tables.
Index: device-mapper/dmsetup/dmsetup.c
===================================================================
--- device-mapper.orig/dmsetup/dmsetup.c	2007-01-12 16:54:45.000000000 -0500
+++ device-mapper/dmsetup/dmsetup.c	2007-01-12 16:55:14.000000000 -0500
@@ -225,68 +225,6 @@ static int _parse_file(struct dm_task *d
 	return r;
 }
 
-static void _display_info_cols_noheadings(struct dm_task *dmt,
-					  struct dm_info *info)
-{
-	const char *uuid;
-
-	if (!info->exists)
-		return;
-
-	uuid = dm_task_get_uuid(dmt);
-
-	if (_switches[OPTIONS_ARG])
-		printf("%s\n", dm_task_get_name(dmt));
-	else
-		printf("%s:%d:%d:%s%s%s%s:%d:%d:%" PRIu32 ":%s\n",
-		       dm_task_get_name(dmt),
-		       info->major, info->minor,
-		       info->live_table ? "L" : "-",
-		       info->inactive_table ? "I" : "-",
-		       info->suspended ? "s" : "-",
-		       info->read_only ? "r" : "w",
-		       info->open_count, info->target_count, info->event_nr,
-		       uuid && *uuid ? uuid : "");
-}
-
-static void _display_info_cols(struct dm_task *dmt, struct dm_info *info)
-{
-	static int _headings = 0;
-	const char *uuid;
-
-	if (!info->exists) {
-		printf("Device does not exist.\n");
-		return;
-	}
-
-	if (!_headings) {
-		if (_switches[OPTIONS_ARG])
-			printf("Name\n");
-		else
-			printf("Name             Maj Min Stat Open Targ "
-			       "Event  UUID\n");
-		_headings = 1;
-	}
-
-	if (_switches[OPTIONS_ARG])
-		printf("%s\n", dm_task_get_name(dmt));
-	else {
-		printf("%-16s %3d %3d %s%s%s%s %4d %4d %6" PRIu32 " ",
-		       dm_task_get_name(dmt),
-		       info->major, info->minor,
-		       info->live_table ? "L" : "-",
-		       info->inactive_table ? "I" : "-",
-		       info->suspended ? "s" : "-",
-		       info->read_only ? "r" : "w",
-		       info->open_count, info->target_count, info->event_nr);
-
-		if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
-			printf("%s", uuid);
-
-		printf("\n");
-	}
-}
-
 static void _display_info_long(struct dm_task *dmt, struct dm_info *info)
 {
 	const char *uuid;
@@ -336,10 +274,8 @@ static int _display_info(struct dm_task 
 
 	if (!_switches[COLS_ARG])
 		_display_info_long(dmt, &info);
-	else if (_switches[NOHEADINGS_ARG])
-		_display_info_cols_noheadings(dmt, &info);
 	else
-		_display_info_cols(dmt, &info);
+		_report(0, NULL, dmt);
 
 	return info.exists ? 1 : 0;
 }

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



WARNING: multiple messages have this Message-ID (diff)
From: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
To: lvm-devel@redhat.com
Subject: [PATCH] (3/4) Remove old codes for "info -c" from dmsetup
Date: Fri, 12 Jan 2007 18:31:58 -0500	[thread overview]
Message-ID: <45A81A6E.9070309@ce.jp.nec.com> (raw)
In-Reply-To: <45A81618.2080608@ce.jp.nec.com>

Hi,

This patch removes _display_info_cols*() functions used
for "dmsetup info -c" implementation.
These can be replaced by the new code using dm_report.

Thanks,
--
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03-dmsetup-remove-old-info-cols.patch
Type: text/x-patch
Size: 3171 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070112/9672438d/attachment.bin>

  parent reply	other threads:[~2007-01-12 23:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12 23:13 [PATCH] (1/4) dm_report support in libdevmapper Jun'ichi Nomura
2007-01-12 23:13 ` Jun'ichi Nomura
2007-01-12 23:31 ` [PATCH] (2/4) dmsetup info to use dm_report Jun'ichi Nomura
2007-01-12 23:31   ` Jun'ichi Nomura
2007-01-12 23:31 ` Jun'ichi Nomura [this message]
2007-01-12 23:31   ` [PATCH] (3/4) Remove old codes for "info -c" from dmsetup Jun'ichi Nomura
2007-01-12 23:32 ` [PATCH] (4/4) LVM2 to use dm_report Jun'ichi Nomura
2007-01-12 23:32   ` 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=45A81A6E.9070309@ce.jp.nec.com \
    --to=j-nomura@ce.jp.nec.com \
    --cc=dm-devel@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.