[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH] (3/4) Remove old codes for "info -c" from dmsetup



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
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;
 }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]