Hello community, here is the log from the commit of package device-mapper checked in at Wed Aug 30 10:06:48 CEST 2006. -------- --- device-mapper/device-mapper.changes 2006-08-16 13:17:39.000000000 +0200 +++ device-mapper/device-mapper.changes 2006-08-30 09:11:20.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Aug 30 09:10:36 CEST 2006 - hare@suse.de + +- Add 'major', 'minor', and 'uuid' as valid fields for + 'dmsetup info -o XXX'. + +------------------------------------------------------------------- New: ---- device-mapper-option-values.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ device-mapper.spec ++++++ --- /var/tmp/diff_new_pack.I3BANc/_old 2006-08-30 10:04:50.000000000 +0200 +++ /var/tmp/diff_new_pack.I3BANc/_new 2006-08-30 10:04:50.000000000 +0200 @@ -14,11 +14,12 @@ Group: System/Base Autoreqprov: on Version: 1.02.09 -Release: 1 +Release: 3 Summary: Device Mapper Tools Source: device-mapper.%{version}.tar.bz2 Source1: boot.device-mapper Patch: k_dev_t.dif +Patch1: %{name}-option-values.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %insserv_prereq %fillup_prereq @@ -37,6 +38,7 @@ %if %suse_version >= 900 %patch %endif +%patch1 -p1 %build CFLAGS="$RPM_OPT_FLAGS" \ @@ -68,6 +70,9 @@ %{_mandir}/man8/dmsetup.8.gz %changelog -n device-mapper +* Wed Aug 30 2006 - hare@suse.de +- Add 'major', 'minor', and 'uuid' as valid fields for + 'dmsetup info -o XXX'. * Wed Aug 16 2006 - fehr@suse.de - update to new version 1.02.09 Add --table argument to dmsetup for a one-line table. ++++++ device-mapper-option-values.patch ++++++ diff -pur device-mapper.1.02.09.orig/dmsetup/dmsetup.c device-mapper.1.02.09/dmsetup/dmsetup.c --- device-mapper.1.02.09.orig/dmsetup/dmsetup.c 2006-08-10 22:53:21.000000000 +0200 +++ device-mapper.1.02.09/dmsetup/dmsetup.c 2006-08-30 08:34:53.000000000 +0200 @@ -108,6 +108,14 @@ enum { NUM_SWITCHES }; +enum { + NAME_FIELD = 1, + MAJOR_FIELD = 2, + MINOR_FIELD = 3, + UUID_FIELD = 4, + INVALID_FIELD = 5, +}; + static int _switches[NUM_SWITCHES]; static int _values[NUM_SWITCHES]; static int _num_devices; @@ -211,9 +219,35 @@ static void _display_info_cols_noheading uuid = dm_task_get_uuid(dmt); - if (_switches[OPTIONS_ARG]) - printf("%s\n", dm_task_get_name(dmt)); - else + if (_switches[OPTIONS_ARG]) { + int v = _values[OPTIONS_ARG]; + int shift = 0; + + while (v) { + if (v & 0x1) { + switch (shift) { + case NAME_FIELD: + printf("%s", + dm_task_get_name(dmt)); + break; + case MAJOR_FIELD: + printf("%d", info->major); + break; + case MINOR_FIELD: + printf("%d", info->minor); + break; + case UUID_FIELD: + printf("%s", uuid); + break; + } + } + v >>= 1; + shift++; + if (v) + printf(":"); + } + printf("\n"); + } else printf("%s:%d:%d:%s%s%s%s:%d:%d:%" PRIu32 ":%s\n", dm_task_get_name(dmt), info->major, info->minor, @@ -236,17 +270,65 @@ static void _display_info_cols(struct dm } if (!_headings) { - if (_switches[OPTIONS_ARG]) - printf("Name\n"); - else + if (_switches[OPTIONS_ARG]) { + int v = _values[OPTIONS_ARG]; + int shift = 0; + + while (v) { + if (v & 0x1) { + switch (shift) { + case NAME_FIELD: + printf("Name "); + break; + case MAJOR_FIELD: + printf("Maj "); + break; + case MINOR_FIELD: + printf("Min "); + break; + case UUID_FIELD: + printf("UUID"); + break; + } + } + v >>= 1; + shift++; + } + printf("\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 { + uuid = dm_task_get_uuid(dmt); + + if (_switches[OPTIONS_ARG]) { + int v = _values[OPTIONS_ARG]; + int shift = 0; + + while (v) { + if (v & 0x1) { + switch (shift) { + case NAME_FIELD: + printf("%-16s ", dm_task_get_name(dmt)); + break; + case MAJOR_FIELD: + printf("%3d ", info->major); + break; + case MINOR_FIELD: + printf("%3d ", info->minor); + break; + case UUID_FIELD: + printf("%s", uuid); + break; + } + } + v >>= 1; + shift++; + } + printf("\n"); + } else { printf("%-16s %3d %3d %s%s%s%s %4d %4d %6" PRIu32 " ", dm_task_get_name(dmt), info->major, info->minor, @@ -256,7 +338,7 @@ static void _display_info_cols(struct dm info->read_only ? "r" : "w", info->open_count, info->target_count, info->event_nr); - if ((uuid = dm_task_get_uuid(dmt)) && *uuid) + if (uuid && *uuid) printf("%s", uuid); printf("\n"); @@ -1606,6 +1688,35 @@ static int _process_tree_options(const c return 1; } +static int _process_fields(char *optarg) +{ + int flags = 0; + char *f, *e; + + f = optarg; + + while (f && *f) { + if (!strncmp("name", f, 4)) + flags |= 1 << NAME_FIELD; + else if (!strncmp("major", f, 5)) + flags |= 1 << MAJOR_FIELD; + else if (!strncmp("minor", f, 5)) + flags |= 1 << MINOR_FIELD; + else if (!strncmp("uuid", f, 4)) + flags |= 1 << UUID_FIELD; + else + flags |= 1 << INVALID_FIELD; + + e = strchr(f, ','); + if (e) + f = e + 1; + else + f = NULL; + } + + return flags; +} + static int _process_switches(int *argc, char ***argv) { char *base, *namebase; @@ -1656,7 +1767,7 @@ static int _process_switches(int *argc, _switches[OPTIONS_ARG]++; _switches[MAJOR_ARG]++; _switches[MINOR_ARG]++; - _fields = (char *) "name"; + _values[OPTIONS_ARG] = NAME_FIELD; if (*argc == 3) { _values[MAJOR_ARG] = atoi((*argv)[1]); @@ -1705,6 +1816,7 @@ static int _process_switches(int *argc, if (c == 'o' || ind == OPTIONS_ARG) { _switches[OPTIONS_ARG]++; _fields = optarg; + _values[OPTIONS_ARG] = _process_fields(optarg); } if (c == 'v' || ind == VERBOSE_ARG) _switches[VERBOSE_ARG]++; @@ -1760,8 +1872,9 @@ static int _process_switches(int *argc, } if (_switches[COLS_ARG] && _switches[OPTIONS_ARG] && - strcmp(_fields, "name")) { - fprintf(stderr, "Only -o name is supported so far.\n"); + (_values[OPTIONS_ARG] & (1 << INVALID_FIELD))) { + fprintf(stderr, "Only 'name', 'major', 'minor', and" + " 'uuid' are supported so far.\n"); return 0; } Nur in device-mapper.1.02.09/dmsetup: dmsetup.c~. diff -pur device-mapper.1.02.09.orig/man/dmsetup.8 device-mapper.1.02.09/man/dmsetup.8 --- device-mapper.1.02.09.orig/man/dmsetup.8 2006-08-10 16:11:03.000000000 +0200 +++ device-mapper.1.02.09/man/dmsetup.8 2006-08-30 08:39:43.000000000 +0200 @@ -35,7 +35,7 @@ dmsetup \- low level logical volume mana .B dmsetup info .I [device_name] .br -.B dmsetup info -c|-C|--columns [--noheadings] [-o name] +.B dmsetup info -c|-C|--columns [--noheadings] [-o fields] .I [device_name] .br .B dmsetup deps @@ -97,7 +97,8 @@ Tell the kernel not to supply the open r When creating a device, don't load any table. .IP \fB-o|--options .br -Specify which fields to display. Only \fB-o\ name\fP is supported. +Specify which fields to display. Only \fBname\fP, \fBmajor\fP, +\fBminor\fP, and \fBuuid\fP are supported. .IP \fB-r|--readonly .br Set the table being loaded read-only. Nur in device-mapper.1.02.09/man: dmsetup.8~. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org