mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add --target to dmsetup ls.
This commit is contained in:
parent
ebf21d3f93
commit
2272500bc8
@ -1,7 +1,7 @@
|
||||
Version 1.01.02 -
|
||||
=============================
|
||||
Call dm_lib_exit() and dm_lib_release() automatically now.
|
||||
Add --target <target_type> filter to dmsetup table/status.
|
||||
Add --target <target_type> filter to dmsetup table/status/ls.
|
||||
Fix dmsetup getopt_long usage.
|
||||
|
||||
Version 1.01.01 - 29 Mar 2005
|
||||
|
@ -29,7 +29,7 @@ dmsetup \- low level logical volume management
|
||||
.B dmsetup rename
|
||||
.I device_name new_name
|
||||
.br
|
||||
.B dmsetup ls
|
||||
.B dmsetup ls [--target target_type]
|
||||
.br
|
||||
.B dmsetup info
|
||||
.I [device_name]
|
||||
@ -145,8 +145,10 @@ Outputs some brief information about the device in the form:
|
||||
.br
|
||||
UUID
|
||||
.IP \fBls
|
||||
.I [--target target_type]
|
||||
.br
|
||||
List device names.
|
||||
List device names. Optionally only list devices that have at least
|
||||
one target of the specified type.
|
||||
.IP \fBload|reload
|
||||
.I device_name [table_file]
|
||||
.br
|
||||
|
@ -600,6 +600,14 @@ static int _process_all(int argc, char **argv,
|
||||
return r;
|
||||
}
|
||||
|
||||
static void _display_dev(struct dm_task *dmt, char *name)
|
||||
{
|
||||
struct dm_info info;
|
||||
|
||||
if (dm_task_get_info(dmt, &info))
|
||||
printf("%s\t(%u, %u)\n", name, info.major, info.minor);
|
||||
}
|
||||
|
||||
static int _status(int argc, char **argv, void *data)
|
||||
{
|
||||
int r = 0;
|
||||
@ -612,6 +620,7 @@ static int _status(int argc, char **argv, void *data)
|
||||
struct dm_names *names = (struct dm_names *) data;
|
||||
char *name = NULL;
|
||||
int matched = 0;
|
||||
int ls_only = 0;
|
||||
|
||||
if (data)
|
||||
name = names->name;
|
||||
@ -627,6 +636,9 @@ static int _status(int argc, char **argv, void *data)
|
||||
else
|
||||
cmd = DM_DEVICE_STATUS;
|
||||
|
||||
if (!strcmp(argv[0], "ls"))
|
||||
ls_only = 1;
|
||||
|
||||
if (!(dmt = dm_task_create(cmd)))
|
||||
return 0;
|
||||
|
||||
@ -647,19 +659,24 @@ static int _status(int argc, char **argv, void *data)
|
||||
if (_switches[TARGET_ARG] && target_type &&
|
||||
strcmp(target_type, _target))
|
||||
continue;
|
||||
if (!matched && _switches[VERBOSE_ARG])
|
||||
_display_info(dmt);
|
||||
if (data && !_switches[VERBOSE_ARG])
|
||||
printf("%s: ", name);
|
||||
if (target_type) {
|
||||
printf("%" PRIu64 " %" PRIu64 " %s %s",
|
||||
start, length, target_type, params);
|
||||
if (ls_only) {
|
||||
_display_dev(dmt, name);
|
||||
next = NULL;
|
||||
} else {
|
||||
if (!matched && _switches[VERBOSE_ARG])
|
||||
_display_info(dmt);
|
||||
if (data && !_switches[VERBOSE_ARG])
|
||||
printf("%s: ", name);
|
||||
if (target_type) {
|
||||
printf("%" PRIu64 " %" PRIu64 " %s %s",
|
||||
start, length, target_type, params);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
matched = 1;
|
||||
} while (next);
|
||||
|
||||
if (data && _switches[VERBOSE_ARG] && matched)
|
||||
if (data && _switches[VERBOSE_ARG] && matched && !ls_only)
|
||||
printf("\n");
|
||||
|
||||
r = 1;
|
||||
@ -842,7 +859,10 @@ static int _display_name(int argc, char **argv, void *data)
|
||||
|
||||
static int _ls(int argc, char **argv, void *data)
|
||||
{
|
||||
return _process_all(argc, argv, _display_name);
|
||||
if (_switches[TARGET_ARG] && _target)
|
||||
return _status(argc, argv, data);
|
||||
else
|
||||
return _process_all(argc, argv, _display_name);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -871,7 +891,7 @@ static struct command _commands[] = {
|
||||
{"reload", "<device> [<table_file>]", 0, 2, _load},
|
||||
{"rename", "<device> <new_name>", 1, 2, _rename},
|
||||
{"message", "<device> <sector> <message>", 2, -1, _message},
|
||||
{"ls", "", 0, 0, _ls},
|
||||
{"ls", "[--target <target_type>]", 0, 0, _ls},
|
||||
{"info", "[<device>]", 0, 1, _info},
|
||||
{"deps", "[<device>]", 0, 1, _deps},
|
||||
{"status", "[<device>] [--target <target_type>]", 0, 1, _status},
|
||||
|
Loading…
Reference in New Issue
Block a user