diff options
author | 2013-04-09 09:50:27 +0000 | |
---|---|---|
committer | 2013-04-09 09:50:27 +0000 | |
commit | c441790a3873936d6eee6f568ccbd1a691db047e (patch) | |
tree | 03462b774c1a380ac351213ff171c2dd38aa733b /sys-fs/device-mapper/files | |
parent | migration revbump (diff) | |
download | gentoo-2-c441790a3873936d6eee6f568ccbd1a691db047e.tar.gz gentoo-2-c441790a3873936d6eee6f568ccbd1a691db047e.tar.bz2 gentoo-2-c441790a3873936d6eee6f568ccbd1a691db047e.zip |
Punt the old separate device-mapper in favour of the device-mapper now installed from sys-fs/lvm2. It's nearly impossible to emerge this version of device-mapper due to the rest of base system being incompabile with it, shown an as massive amount of blockers. Remove for clarity. Bug 461382
Diffstat (limited to 'sys-fs/device-mapper/files')
15 files changed, 0 insertions, 1751 deletions
diff --git a/sys-fs/device-mapper/files/1.02.22-dmeventd.initd b/sys-fs/device-mapper/files/1.02.22-dmeventd.initd deleted file mode 100644 index 335a72c402d6..000000000000 --- a/sys-fs/device-mapper/files/1.02.22-dmeventd.initd +++ /dev/null @@ -1,21 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/1.02.22-dmeventd.initd,v 1.1 2007/10/02 08:12:28 robbat2 Exp $ - -depend() { - before device-mapper -} - -start() { - ebegin "Starting dmeventd" - start-stop-daemon --start --exec /sbin/dmeventd --pidfile /var/run/dmeventd.pid - eend $? -} - -stop() { - ebegin "Stopping dmeventd" - start-stop-daemon --stop --exec /sbin/dmeventd --pidfile /var/run/dmeventd.pid - eend $? -} - diff --git a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.19 b/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.19 deleted file mode 100644 index ace522ba10f5..000000000000 --- a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.19 +++ /dev/null @@ -1,33 +0,0 @@ -# device mapper links hook into "change" events, when the dm table -# becomes available; some table-types must be ignored - -KERNEL=="device-mapper", NAME="mapper/control" - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" - -# lookup device name -# use dmsetup, until devmap_name is provided by sys-fs/device-mapper -PROGRAM=="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", - ENV{DM_NAME}="%c" - -# do not do anything if dmsetup does not provide a name -ENV{DM_NAME}=="", NAME="", OPTIONS="ignore_device" - -# ignore luks crypt devices while not fully up -ENV{DM_NAME}=="temporary-cryptsetup-*", NAME="", OPTIONS="ignore_device" - -# use queried name -ENV{DM_NAME}=="?*", NAME="mapper/$env{DM_NAME}" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" - -PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" -RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=50" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="device_mapper_end" diff --git a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22 b/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22 deleted file mode 100644 index a0087e057f97..000000000000 --- a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22 +++ /dev/null @@ -1,25 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="device-mapper", SYMLINK+="mapper/control" - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/dmsetup info --export -j%M -m%m" -ENV{DM_NAME}!="?*", GOTO="device_mapper_end" -SYMLINK+="mapper/$env{DM_NAME}" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" -ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" - -ENV{DM_SUSPENDED}=="1", GOTO="device_mapper_end" -ENV{DM_EXISTS}=="0", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=-100" -ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="device_mapper_end" diff --git a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22-r5 b/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22-r5 deleted file mode 100644 index 36c085b56b97..000000000000 --- a/sys-fs/device-mapper/files/64-device-mapper.rules-1.02.22-r5 +++ /dev/null @@ -1,25 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="device-mapper", SYMLINK+="mapper/control" - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/dmsetup info --export -j%M -m%m" -ENV{DM_NAME}!="?*", GOTO="device_mapper_end" -NAME="mapper/$env{DM_NAME}", SYMLINK+="%k" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" -ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" - -ENV{DM_SUSPENDED}=="1", GOTO="device_mapper_end" -ENV{DM_EXISTS}=="0", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=-100" -ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="device_mapper_end" diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format-r1.diff b/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format-r1.diff deleted file mode 100644 index 0fef5a2558f6..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format-r1.diff +++ /dev/null @@ -1,300 +0,0 @@ -diff -Nur device-mapper.1.02.22.orig/dmsetup/dmsetup.c device-mapper.1.02.22/dmsetup/dmsetup.c ---- device-mapper.1.02.22.orig/dmsetup/dmsetup.c 2007-10-09 09:51:48.000000000 -0400 -+++ device-mapper.1.02.22/dmsetup/dmsetup.c 2007-10-09 09:52:02.000000000 -0400 -@@ -107,6 +107,7 @@ - enum { - READ_ONLY = 0, - COLS_ARG, -+ EXPORT_ARG, - EXEC_ARG, - FORCE_ARG, - GID_ARG, -@@ -137,7 +138,8 @@ - DR_TASK = 1, - DR_INFO = 2, - DR_DEPS = 4, -- DR_TREE = 8 /* Complete dependency tree required */ -+ DR_TREE = 8, /* Complete dependency tree required */ -+ DR_TABLE = 0x10, /* table is required, not just info */ - } report_type_t; - - static int _switches[NUM_SWITCHES]; -@@ -1105,8 +1107,13 @@ - name = argv[1]; - } - -- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -- return 0; -+ if (_report_type & DR_TABLE ) { -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ return 0; -+ } else { -+ if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -+ return 0; -+ } - - if (!_set_task_device(dmt, name, 0)) - goto out; -@@ -1570,6 +1577,16 @@ - return dm_report_field_uint32(rh, field, &value); - } - -+static int _int_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const int value = *(const int *)data; -+ -+ return dm_report_field_int(rh, field, &value); -+} -+ - static int _dm_name_disp(struct dm_report *rh, - struct dm_pool *mem __attribute((unused)), - struct dm_report_field *field, const void *data, -@@ -1611,6 +1628,66 @@ - return dm_report_field_string(rh, field, &s); - } - -+static int _dm_info_cleartext_status_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const char *buf = "NOTPRESENT"; -+ const struct dm_info *info = data; -+ -+ if (info->exists) { -+ if (info->suspended) -+ buf = "SUSPENDED"; -+ else -+ buf = info->read_only ? " READONLY" : "ACTIVE"; -+ } -+ -+ return dm_report_field_string(rh, field, &buf); -+} -+ -+static int _dm_info_target_types_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ char buf[1024]; -+ char *dest = buf; -+ int remains = sizeof(buf); -+ int written; -+ const char *s = buf; -+ struct dm_task *dmt = (struct dm_task *) data; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ -+ -+ buf[0] = '\0'; -+ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, "%s", target_type); -+ dest += written; -+ remains -= written; -+ -+ while (remains > 0 && next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, ",%s", target_type); -+ dest += written; -+ remains -= written; -+ } -+ } -+ } -+ -+ buf[sizeof(buf)-1] = '\0'; -+ -+ return dm_report_field_string(rh, field, &s); -+} -+ - static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem, - struct dm_report_field *field, const void *data, - void *private) -@@ -1834,11 +1911,12 @@ - { DR_INFO, "Mapped Device Information", "", _info_get_obj }, - { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj }, - { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj }, -+ { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, - { 0, "", "", NULL }, - }; - - /* Column definitions */ --#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field) -+#define OFFSET_OF(strct, field) ((unsigned long) &((struct strct *)NULL)->field) - #define STR (DM_REPORT_FIELD_TYPE_STRING) - #define NUM (DM_REPORT_FIELD_TYPE_NUMBER) - #define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc}, -@@ -1849,6 +1927,7 @@ - FIELD_F(TASK, STR, "Name", 16, dm_name, "name", "Name of mapped device.") - FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid", "Unique (optional) identifier for mapped device.") - FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.") -+FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "State as cleartext.") - FIELD_F(INFO, STR, "DevNo", 5, dm_info_devno, "devno", "Device major and minor numbers") - FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major", "Block device major number.") - FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor", "Block device minor number.") -@@ -1856,6 +1935,11 @@ - FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "segments", "Number of segments in live table, if present.") - FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "events", "Number of most recent event.") - -+FIELD_O(INFO, dm_info, NUM, "RO", read_only, 2, int, "read_only", "Read only.") -+FIELD_O(INFO, dm_info, NUM, "Ex", exists, 2, int, "exists", "Exists.") -+FIELD_O(INFO, dm_info, NUM, "Susp", suspended, 4, int, "suspended", "Suspended.") -+FIELD_O(INFO, dm_info, NUM, "tab_live", live_table, 8, int, "table_live", "Live table.") -+FIELD_O(INFO, dm_info, NUM, "tab_inact", inactive_table, 9, int, "table_inactive", "Inactive table.") - FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.") - FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.") - FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.") -@@ -1863,6 +1947,7 @@ - FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.") - FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.") - FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_dev", "List of device numbers of mapped devices using this one.") -+FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_types", "Used target types.") - {0, 0, 0, 0, "", "", NULL, NULL}, - /* *INDENT-ON* */ - }; -@@ -1873,13 +1958,15 @@ - #undef FIELD_F - - static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid"; -+static const char *default_export_options = "name,major,minor,status,read_only,exists,suspended,table_live,table_inactive,open,segments,events,uuid,target_types"; - - static int _report_init(struct command *c) - { -- char *options = (char *) default_report_options; -+ char *default_options = (char *) default_report_options; -+ char *options; - const char *keys = ""; - const char *separator = " "; -- int aligned = 1, headings = 1, buffered = 1; -+ int aligned = 1, headings = 1, buffered = 1, export = 0; - uint32_t flags = 0; - size_t len = 0; - int r = 0; -@@ -1894,6 +1981,15 @@ - if (_switches[UNBUFFERED_ARG]) - buffered = 0; - -+ if (_switches[EXPORT_ARG]) { -+ default_options = (char *) default_export_options; -+ separator = "\n"; -+ aligned = 0; -+ headings = 0; -+ export = 1; -+ } -+ -+ options = default_options; - if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { - if (*_string_args[OPTIONS_ARG] != '+') - options = _string_args[OPTIONS_ARG]; -@@ -1936,6 +2032,9 @@ - if (headings) - flags |= DM_REPORT_OUTPUT_HEADINGS; - -+ if (export) -+ flags |= DM_REPORT_OUTPUT_EXPORT; -+ - if (!(_report = dm_report_init(&_report_type, - _report_types, _report_fields, - options, separator, flags, keys, NULL))) -@@ -2010,7 +2109,8 @@ - fprintf(out, "Usage:\n\n"); - fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" -- " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n" -+ " [-c|-C|--columns] [-e|--export]\n" -+ " [-o <fields>] [-O|--sort <sort_fields>]\n" - " [--noheadings] [--separator <separator>]\n\n"); - for (i = 0; _commands[i].name; i++) - fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); -@@ -2354,6 +2454,7 @@ - static struct option long_options[] = { - {"readonly", 0, &ind, READ_ONLY}, - {"columns", 0, &ind, COLS_ARG}, -+ {"export", 0, &ind, EXPORT_ARG}, - {"exec", 1, &ind, EXEC_ARG}, - {"force", 0, &ind, FORCE_ARG}, - {"gid", 1, &ind, GID_ARG}, -@@ -2431,12 +2532,16 @@ - - optarg = 0; - optind = OPTIND_INIT; -- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv", -+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefGj:m:Mno:O:ru:Uv", - long_options, NULL)) != -1) { - if (c == ':' || c == '?') - return 0; - if (c == 'c' || c == 'C' || ind == COLS_ARG) - _switches[COLS_ARG]++; -+ if (c == 'e' || ind == EXPORT_ARG) { -+ _switches[EXPORT_ARG]++; -+ _switches[COLS_ARG]++; -+ } - if (c == 'f' || ind == FORCE_ARG) - _switches[FORCE_ARG]++; - if (c == 'r' || ind == READ_ONLY) -diff -Nur device-mapper.1.02.22.orig/lib/libdevmapper.h device-mapper.1.02.22/lib/libdevmapper.h ---- device-mapper.1.02.22.orig/lib/libdevmapper.h 2007-10-09 09:51:48.000000000 -0400 -+++ device-mapper.1.02.22/lib/libdevmapper.h 2007-10-09 09:52:02.000000000 -0400 -@@ -715,6 +715,7 @@ - #define DM_REPORT_OUTPUT_ALIGNED 0x00000001 - #define DM_REPORT_OUTPUT_BUFFERED 0x00000002 - #define DM_REPORT_OUTPUT_HEADINGS 0x00000004 -+#define DM_REPORT_OUTPUT_EXPORT 0x00000008 - - struct dm_report *dm_report_init(uint32_t *report_types, - const struct dm_report_object_type *types, -diff -Nur device-mapper.1.02.22.orig/lib/libdm-report.c device-mapper.1.02.22/lib/libdm-report.c ---- device-mapper.1.02.22.orig/lib/libdm-report.c 2007-10-09 09:51:48.000000000 -0400 -+++ device-mapper.1.02.22/lib/libdm-report.c 2007-10-09 09:52:24.000000000 -0400 -@@ -13,6 +13,7 @@ - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#include <ctype.h> - #include "libdevmapper.h" - #include "list.h" - #include "log.h" -@@ -776,6 +777,8 @@ - char buf[4096]; - int32_t width; - uint32_t align; -+ const char *fname; -+ char tmp_char; - - if (list_empty(&rh->rows)) - return 1; -@@ -800,6 +803,25 @@ - if (field->props->flags & FLD_HIDDEN) - continue; - -+ if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { -+ fname = rh->fields[field->props->field_num].id; -+ if (!dm_pool_grow_object(rh->mem, "DM_", strlen("DM_"))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ while (fname && fname[0]) { -+ tmp_char = toupper(fname[0]); -+ if (!dm_pool_grow_object(rh->mem, &tmp_char, 1)) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ fname++; -+ } -+ if (!dm_pool_grow_object(rh->mem, "=", strlen("="))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ } - repstr = field->report_string; - width = field->props->width; - if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) { diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format.diff b/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format.diff deleted file mode 100644 index 5291120f3986..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.22-export-format.diff +++ /dev/null @@ -1,295 +0,0 @@ -Index: device-mapper.1.02.22/lib/libdm-report.c -=================================================================== ---- device-mapper.1.02.22.orig/lib/libdm-report.c -+++ device-mapper.1.02.22/lib/libdm-report.c -@@ -776,6 +776,8 @@ int dm_report_output(struct dm_report *r - char buf[4096]; - int32_t width; - uint32_t align; -+ const char *fname; -+ char tmp_char; - - if (list_empty(&rh->rows)) - return 1; -@@ -800,6 +802,25 @@ int dm_report_output(struct dm_report *r - if (field->props->flags & FLD_HIDDEN) - continue; - -+ if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { -+ fname = rh->fields[field->props->field_num].id; -+ if (!dm_pool_grow_object(rh->mem, "DM_", strlen("DM_"))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ while (fname && fname[0]) { -+ tmp_char = toupper(fname[0]); -+ if (!dm_pool_grow_object(rh->mem, &tmp_char, 1)) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ fname++; -+ } -+ if (!dm_pool_grow_object(rh->mem, "=", strlen("="))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ } - repstr = field->report_string; - width = field->props->width; - if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) { -Index: device-mapper.1.02.22/dmsetup/dmsetup.c -=================================================================== ---- device-mapper.1.02.22.orig/dmsetup/dmsetup.c -+++ device-mapper.1.02.22/dmsetup/dmsetup.c -@@ -107,6 +107,7 @@ extern char *optarg; - enum { - READ_ONLY = 0, - COLS_ARG, -+ EXPORT_ARG, - EXEC_ARG, - FORCE_ARG, - GID_ARG, -@@ -137,7 +138,8 @@ typedef enum { - DR_TASK = 1, - DR_INFO = 2, - DR_DEPS = 4, -- DR_TREE = 8 /* Complete dependency tree required */ -+ DR_TREE = 8, /* Complete dependency tree required */ -+ DR_TABLE = 0x10, /* table is required, not just info */ - } report_type_t; - - static int _switches[NUM_SWITCHES]; -@@ -1105,8 +1107,13 @@ static int _info(int argc, char **argv, - name = argv[1]; - } - -- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -- return 0; -+ if (_report_type & DR_TABLE ) { -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ return 0; -+ } else { -+ if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -+ return 0; -+ } - - if (!_set_task_device(dmt, name, 0)) - goto out; -@@ -1570,6 +1577,16 @@ static int _uint32_disp(struct dm_report - return dm_report_field_uint32(rh, field, &value); - } - -+static int _int_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const int value = *(const int *)data; -+ -+ return dm_report_field_int(rh, field, &value); -+} -+ - static int _dm_name_disp(struct dm_report *rh, - struct dm_pool *mem __attribute((unused)), - struct dm_report_field *field, const void *data, -@@ -1611,6 +1628,66 @@ static int _dm_info_status_disp(struct d - return dm_report_field_string(rh, field, &s); - } - -+static int _dm_info_cleartext_status_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const char *buf = "NOTPRESENT"; -+ const struct dm_info *info = data; -+ -+ if (info->exists) { -+ if (info->suspended) -+ buf = "SUSPENDED"; -+ else -+ buf = info->read_only ? " READONLY" : "ACTIVE"; -+ } -+ -+ return dm_report_field_string(rh, field, &buf); -+} -+ -+static int _dm_info_target_types_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ char buf[1024]; -+ char *dest = buf; -+ int remains = sizeof(buf); -+ int written; -+ const char *s = buf; -+ struct dm_task *dmt = (struct dm_task *) data; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ -+ -+ buf[0] = '\0'; -+ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, "%s", target_type); -+ dest += written; -+ remains -= written; -+ -+ while (remains > 0 && next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, ",%s", target_type); -+ dest += written; -+ remains -= written; -+ } -+ } -+ } -+ -+ buf[sizeof(buf)-1] = '\0'; -+ -+ return dm_report_field_string(rh, field, &s); -+} -+ - static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem, - struct dm_report_field *field, const void *data, - void *private) -@@ -1834,11 +1911,12 @@ static const struct dm_report_object_typ - { DR_INFO, "Mapped Device Information", "", _info_get_obj }, - { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj }, - { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj }, -+ { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, - { 0, "", "", NULL }, - }; - - /* Column definitions */ --#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field) -+#define OFFSET_OF(strct, field) ((unsigned long) &((struct strct *)NULL)->field) - #define STR (DM_REPORT_FIELD_TYPE_STRING) - #define NUM (DM_REPORT_FIELD_TYPE_NUMBER) - #define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc}, -@@ -1849,6 +1927,7 @@ static const struct dm_report_field_type - FIELD_F(TASK, STR, "Name", 16, dm_name, "name", "Name of mapped device.") - FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid", "Unique (optional) identifier for mapped device.") - FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.") -+FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "State as cleartext.") - FIELD_F(INFO, STR, "DevNo", 5, dm_info_devno, "devno", "Device major and minor numbers") - FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major", "Block device major number.") - FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor", "Block device minor number.") -@@ -1856,6 +1935,11 @@ FIELD_O(INFO, dm_info, NUM, "Open", open - FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "segments", "Number of segments in live table, if present.") - FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "events", "Number of most recent event.") - -+FIELD_O(INFO, dm_info, NUM, "RO", read_only, 2, int, "read_only", "Read only.") -+FIELD_O(INFO, dm_info, NUM, "Ex", exists, 2, int, "exists", "Exists.") -+FIELD_O(INFO, dm_info, NUM, "Susp", suspended, 4, int, "suspended", "Suspended.") -+FIELD_O(INFO, dm_info, NUM, "tab_live", live_table, 8, int, "table_live", "Live table.") -+FIELD_O(INFO, dm_info, NUM, "tab_inact", inactive_table, 9, int, "table_inactive", "Inactive table.") - FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.") - FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.") - FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.") -@@ -1863,6 +1947,7 @@ FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, - FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.") - FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.") - FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_dev", "List of device numbers of mapped devices using this one.") -+FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_types", "Used target types.") - {0, 0, 0, 0, "", "", NULL, NULL}, - /* *INDENT-ON* */ - }; -@@ -1873,13 +1958,15 @@ FIELD_F(TREE, STR, "RefDevNos", 9, dm_tr - #undef FIELD_F - - static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid"; -+static const char *default_export_options = "name,major,minor,status,read_only,exists,suspended,table_live,table_inactive,open,segments,events,uuid,target_types"; - - static int _report_init(struct command *c) - { -- char *options = (char *) default_report_options; -+ char *default_options = (char *) default_report_options; -+ char *options; - const char *keys = ""; - const char *separator = " "; -- int aligned = 1, headings = 1, buffered = 1; -+ int aligned = 1, headings = 1, buffered = 1, export = 0; - uint32_t flags = 0; - size_t len = 0; - int r = 0; -@@ -1894,6 +1981,15 @@ static int _report_init(struct command * - if (_switches[UNBUFFERED_ARG]) - buffered = 0; - -+ if (_switches[EXPORT_ARG]) { -+ default_options = (char *) default_export_options; -+ separator = "\n"; -+ aligned = 0; -+ headings = 0; -+ export = 1; -+ } -+ -+ options = default_options; - if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { - if (*_string_args[OPTIONS_ARG] != '+') - options = _string_args[OPTIONS_ARG]; -@@ -1936,6 +2032,9 @@ static int _report_init(struct command * - if (headings) - flags |= DM_REPORT_OUTPUT_HEADINGS; - -+ if (export) -+ flags |= DM_REPORT_OUTPUT_EXPORT; -+ - if (!(_report = dm_report_init(&_report_type, - _report_types, _report_fields, - options, separator, flags, keys, NULL))) -@@ -2010,7 +2109,8 @@ static void _usage(FILE *out) - fprintf(out, "Usage:\n\n"); - fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" -- " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n" -+ " [-c|-C|--columns] [-e|--export]\n" -+ " [-o <fields>] [-O|--sort <sort_fields>]\n" - " [--noheadings] [--separator <separator>]\n\n"); - for (i = 0; _commands[i].name; i++) - fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); -@@ -2354,6 +2454,7 @@ static int _process_switches(int *argc, - static struct option long_options[] = { - {"readonly", 0, &ind, READ_ONLY}, - {"columns", 0, &ind, COLS_ARG}, -+ {"export", 0, &ind, EXPORT_ARG}, - {"exec", 1, &ind, EXEC_ARG}, - {"force", 0, &ind, FORCE_ARG}, - {"gid", 1, &ind, GID_ARG}, -@@ -2431,12 +2532,16 @@ static int _process_switches(int *argc, - - optarg = 0; - optind = OPTIND_INIT; -- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv", -+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefGj:m:Mno:O:ru:Uv", - long_options, NULL)) != -1) { - if (c == ':' || c == '?') - return 0; - if (c == 'c' || c == 'C' || ind == COLS_ARG) - _switches[COLS_ARG]++; -+ if (c == 'e' || ind == EXPORT_ARG) { -+ _switches[EXPORT_ARG]++; -+ _switches[COLS_ARG]++; -+ } - if (c == 'f' || ind == FORCE_ARG) - _switches[FORCE_ARG]++; - if (c == 'r' || ind == READ_ONLY) -Index: device-mapper.1.02.22/lib/libdevmapper.h -=================================================================== ---- device-mapper.1.02.22.orig/lib/libdevmapper.h -+++ device-mapper.1.02.22/lib/libdevmapper.h -@@ -715,6 +715,7 @@ struct dm_report_field_type { - #define DM_REPORT_OUTPUT_ALIGNED 0x00000001 - #define DM_REPORT_OUTPUT_BUFFERED 0x00000002 - #define DM_REPORT_OUTPUT_HEADINGS 0x00000004 -+#define DM_REPORT_OUTPUT_EXPORT 0x00000008 - - struct dm_report *dm_report_init(uint32_t *report_types, - const struct dm_report_object_type *types, diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.24-export-format.diff b/sys-fs/device-mapper/files/device-mapper-1.02.24-export-format.diff deleted file mode 100644 index c92b0c5a943b..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.24-export-format.diff +++ /dev/null @@ -1,300 +0,0 @@ -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.24.orig/dmsetup/dmsetup.c device-mapper.1.02.24/dmsetup/dmsetup.c ---- device-mapper.1.02.24.orig/dmsetup/dmsetup.c 2007-12-05 09:05:04.000000000 -0800 -+++ device-mapper.1.02.24/dmsetup/dmsetup.c 2008-02-06 17:49:04.670645367 -0800 -@@ -108,6 +108,7 @@ - enum { - READ_ONLY = 0, - COLS_ARG, -+ EXPORT_ARG, - EXEC_ARG, - FORCE_ARG, - GID_ARG, -@@ -139,7 +140,8 @@ - DR_TASK = 1, - DR_INFO = 2, - DR_DEPS = 4, -- DR_TREE = 8 /* Complete dependency tree required */ -+ DR_TREE = 8, /* Complete dependency tree required */ -+ DR_TABLE = 0x10, /* table is required, not just info */ - } report_type_t; - - static int _switches[NUM_SWITCHES]; -@@ -1123,8 +1125,13 @@ - name = argv[1]; - } - -- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -- return 0; -+ if (_report_type & DR_TABLE ) { -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ return 0; -+ } else { -+ if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -+ return 0; -+ } - - if (!_set_task_device(dmt, name, 0)) - goto out; -@@ -1588,6 +1595,16 @@ - return dm_report_field_uint32(rh, field, &value); - } - -+static int _int_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const int value = *(const int *)data; -+ -+ return dm_report_field_int(rh, field, &value); -+} -+ - static int _dm_name_disp(struct dm_report *rh, - struct dm_pool *mem __attribute((unused)), - struct dm_report_field *field, const void *data, -@@ -1642,6 +1659,66 @@ - return dm_report_field_string(rh, field, &s); - } - -+static int _dm_info_cleartext_status_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const char *buf = "NOTPRESENT"; -+ const struct dm_info *info = data; -+ -+ if (info->exists) { -+ if (info->suspended) -+ buf = "SUSPENDED"; -+ else -+ buf = info->read_only ? " READONLY" : "ACTIVE"; -+ } -+ -+ return dm_report_field_string(rh, field, &buf); -+} -+ -+static int _dm_info_target_types_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ char buf[1024]; -+ char *dest = buf; -+ int remains = sizeof(buf); -+ int written; -+ const char *s = buf; -+ struct dm_task *dmt = (struct dm_task *) data; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ -+ -+ buf[0] = '\0'; -+ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, "%s", target_type); -+ dest += written; -+ remains -= written; -+ -+ while (remains > 0 && next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, ",%s", target_type); -+ dest += written; -+ remains -= written; -+ } -+ } -+ } -+ -+ buf[sizeof(buf)-1] = '\0'; -+ -+ return dm_report_field_string(rh, field, &s); -+} -+ - static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem, - struct dm_report_field *field, const void *data, - void *private) -@@ -1865,11 +1942,12 @@ - { DR_INFO, "Mapped Device Information", "", _info_get_obj }, - { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj }, - { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj }, -+ { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, - { 0, "", "", NULL }, - }; - - /* Column definitions */ --#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field) -+#define OFFSET_OF(strct, field) ((unsigned long) &((struct strct *)NULL)->field) - #define STR (DM_REPORT_FIELD_TYPE_STRING) - #define NUM (DM_REPORT_FIELD_TYPE_NUMBER) - #define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc}, -@@ -1884,6 +1962,7 @@ - FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead in sectors.") - - FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.") -+FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "State as cleartext.") - FIELD_F(INFO, STR, "DevNo", 5, dm_info_devno, "devno", "Device major and minor numbers") - FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major", "Block device major number.") - FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor", "Block device minor number.") -@@ -1891,6 +1970,11 @@ - FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "segments", "Number of segments in live table, if present.") - FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "events", "Number of most recent event.") - -+FIELD_O(INFO, dm_info, NUM, "RO", read_only, 2, int, "read_only", "Read only.") -+FIELD_O(INFO, dm_info, NUM, "Ex", exists, 2, int, "exists", "Exists.") -+FIELD_O(INFO, dm_info, NUM, "Susp", suspended, 4, int, "suspended", "Suspended.") -+FIELD_O(INFO, dm_info, NUM, "tab_live", live_table, 8, int, "table_live", "Live table.") -+FIELD_O(INFO, dm_info, NUM, "tab_inact", inactive_table, 9, int, "table_inactive", "Inactive table.") - FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.") - FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.") - FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.") -@@ -1898,6 +1982,7 @@ - FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.") - FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.") - FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_dev", "List of device numbers of mapped devices using this one.") -+FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_types", "Used target types.") - {0, 0, 0, 0, "", "", NULL, NULL}, - /* *INDENT-ON* */ - }; -@@ -1908,13 +1993,15 @@ - #undef FIELD_F - - static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid"; -+static const char *default_export_options = "name,major,minor,status,read_only,exists,suspended,table_live,table_inactive,open,segments,events,uuid,target_types"; - - static int _report_init(struct command *c) - { -- char *options = (char *) default_report_options; -+ char *default_options = (char *) default_report_options; -+ char *options; - const char *keys = ""; - const char *separator = " "; -- int aligned = 1, headings = 1, buffered = 1; -+ int aligned = 1, headings = 1, buffered = 1, export = 0; - uint32_t flags = 0; - size_t len = 0; - int r = 0; -@@ -1929,6 +2016,15 @@ - if (_switches[UNBUFFERED_ARG]) - buffered = 0; - -+ if (_switches[EXPORT_ARG]) { -+ default_options = (char *) default_export_options; -+ separator = "\n"; -+ aligned = 0; -+ headings = 0; -+ export = 1; -+ } -+ -+ options = default_options; - if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { - if (*_string_args[OPTIONS_ARG] != '+') - options = _string_args[OPTIONS_ARG]; -@@ -1971,6 +2067,9 @@ - if (headings) - flags |= DM_REPORT_OUTPUT_HEADINGS; - -+ if (export) -+ flags |= DM_REPORT_OUTPUT_EXPORT; -+ - if (!(_report = dm_report_init(&_report_type, - _report_types, _report_fields, - options, separator, flags, keys, NULL))) -@@ -2046,7 +2145,8 @@ - fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" - " [--readahead [+]<sectors>|auto|none]\n" -- " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n" -+ " [-c|-C|--columns] [-e|--export]\n" -+ " [-o <fields>] [-O|--sort <sort_fields>]\n" - " [--noheadings] [--separator <separator>]\n\n"); - for (i = 0; _commands[i].name; i++) - fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); -@@ -2397,6 +2497,7 @@ - static struct option long_options[] = { - {"readonly", 0, &ind, READ_ONLY}, - {"columns", 0, &ind, COLS_ARG}, -+ {"export", 0, &ind, EXPORT_ARG}, - {"exec", 1, &ind, EXEC_ARG}, - {"force", 0, &ind, FORCE_ARG}, - {"gid", 1, &ind, GID_ARG}, -@@ -2476,12 +2577,16 @@ - - optarg = 0; - optind = OPTIND_INIT; -- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv", -+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefGj:m:Mno:O:ru:Uv", - long_options, NULL)) != -1) { - if (c == ':' || c == '?') - return 0; - if (c == 'c' || c == 'C' || ind == COLS_ARG) - _switches[COLS_ARG]++; -+ if (c == 'e' || ind == EXPORT_ARG) { -+ _switches[EXPORT_ARG]++; -+ _switches[COLS_ARG]++; -+ } - if (c == 'f' || ind == FORCE_ARG) - _switches[FORCE_ARG]++; - if (c == 'r' || ind == READ_ONLY) -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.24.orig/lib/libdevmapper.h device-mapper.1.02.24/lib/libdevmapper.h ---- device-mapper.1.02.24.orig/lib/libdevmapper.h 2007-12-05 08:28:19.000000000 -0800 -+++ device-mapper.1.02.24/lib/libdevmapper.h 2008-02-06 17:48:06.670426177 -0800 -@@ -738,6 +738,7 @@ - #define DM_REPORT_OUTPUT_ALIGNED 0x00000001 - #define DM_REPORT_OUTPUT_BUFFERED 0x00000002 - #define DM_REPORT_OUTPUT_HEADINGS 0x00000004 -+#define DM_REPORT_OUTPUT_EXPORT 0x00000008 - - struct dm_report *dm_report_init(uint32_t *report_types, - const struct dm_report_object_type *types, -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.24.orig/lib/libdm-report.c device-mapper.1.02.24/lib/libdm-report.c ---- device-mapper.1.02.24.orig/lib/libdm-report.c 2007-08-21 09:26:06.000000000 -0700 -+++ device-mapper.1.02.24/lib/libdm-report.c 2008-02-06 17:48:06.670426177 -0800 -@@ -13,6 +13,7 @@ - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#include <ctype.h> - #include "libdevmapper.h" - #include "list.h" - #include "log.h" -@@ -776,6 +777,8 @@ - char buf[4096]; - int32_t width; - uint32_t align; -+ const char *fname; -+ char tmp_char; - - if (list_empty(&rh->rows)) - return 1; -@@ -800,6 +803,25 @@ - if (field->props->flags & FLD_HIDDEN) - continue; - -+ if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { -+ fname = rh->fields[field->props->field_num].id; -+ if (!dm_pool_grow_object(rh->mem, "DM_", strlen("DM_"))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ while (fname && fname[0]) { -+ tmp_char = toupper(fname[0]); -+ if (!dm_pool_grow_object(rh->mem, &tmp_char, 1)) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ fname++; -+ } -+ if (!dm_pool_grow_object(rh->mem, "=", strlen("="))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ } - repstr = field->report_string; - width = field->props->width; - if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) { diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.26-export-format.diff b/sys-fs/device-mapper/files/device-mapper-1.02.26-export-format.diff deleted file mode 100644 index 2d4861229599..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.26-export-format.diff +++ /dev/null @@ -1,300 +0,0 @@ -diff -Nuar --exclude '*.orig' device-mapper.1.02.26.orig/dmsetup/dmsetup.c device-mapper.1.02.26/dmsetup/dmsetup.c ---- device-mapper.1.02.26.orig/dmsetup/dmsetup.c 2008-06-06 11:53:08.000000000 -0700 -+++ device-mapper.1.02.26/dmsetup/dmsetup.c 2008-06-08 11:57:58.491838798 -0700 -@@ -108,6 +108,7 @@ - enum { - READ_ONLY = 0, - COLS_ARG, -+ EXPORT_ARG, - EXEC_ARG, - FORCE_ARG, - GID_ARG, -@@ -140,7 +141,8 @@ - DR_TASK = 1, - DR_INFO = 2, - DR_DEPS = 4, -- DR_TREE = 8 /* Complete dependency tree required */ -+ DR_TREE = 8, /* Complete dependency tree required */ -+ DR_TABLE = 0x10, /* table is required, not just info */ - } report_type_t; - - static int _switches[NUM_SWITCHES]; -@@ -1124,8 +1126,13 @@ - name = argv[1]; - } - -- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -- return 0; -+ if (_report_type & DR_TABLE ) { -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ return 0; -+ } else { -+ if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -+ return 0; -+ } - - if (!_set_task_device(dmt, name, 0)) - goto out; -@@ -1589,6 +1596,16 @@ - return dm_report_field_uint32(rh, field, &value); - } - -+static int _int_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const int value = *(const int *)data; -+ -+ return dm_report_field_int(rh, field, &value); -+} -+ - static int _dm_name_disp(struct dm_report *rh, - struct dm_pool *mem __attribute((unused)), - struct dm_report_field *field, const void *data, -@@ -1700,6 +1717,66 @@ - } - - -+static int _dm_info_cleartext_status_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const char *buf = "NOTPRESENT"; -+ const struct dm_info *info = data; -+ -+ if (info->exists) { -+ if (info->suspended) -+ buf = "SUSPENDED"; -+ else -+ buf = info->read_only ? " READONLY" : "ACTIVE"; -+ } -+ -+ return dm_report_field_string(rh, field, &buf); -+} -+ -+static int _dm_info_target_types_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ char buf[1024]; -+ char *dest = buf; -+ int remains = sizeof(buf); -+ int written; -+ const char *s = buf; -+ struct dm_task *dmt = (struct dm_task *) data; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ -+ -+ buf[0] = '\0'; -+ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, "%s", target_type); -+ dest += written; -+ remains -= written; -+ -+ while (remains > 0 && next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, ",%s", target_type); -+ dest += written; -+ remains -= written; -+ } -+ } -+ } -+ -+ buf[sizeof(buf)-1] = '\0'; -+ -+ return dm_report_field_string(rh, field, &s); -+} -+ - static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem, - struct dm_report_field *field, const void *data, - void *private) -@@ -1923,11 +2000,12 @@ - { DR_INFO, "Mapped Device Information", "", _info_get_obj }, - { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj }, - { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj }, -+ { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, - { 0, "", "", NULL }, - }; - - /* Column definitions */ --#define OFFSET_OF(strct, field) ((unsigned int) &((struct strct *)NULL)->field) -+#define OFFSET_OF(strct, field) ((unsigned long) &((struct strct *)NULL)->field) - #define STR (DM_REPORT_FIELD_TYPE_STRING) - #define NUM (DM_REPORT_FIELD_TYPE_NUMBER) - #define FIELD_O(type, strct, sorttype, head, field, width, func, id, desc) {DR_ ## type, sorttype, OFFSET_OF(strct, field), width, id, head, &_ ## func ## _disp, desc}, -@@ -1942,6 +2020,7 @@ - FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead in sectors.") - - FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.") -+FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "State as cleartext.") - FIELD_F(INFO, STR, "Tables", 6, dm_info_table_loaded, "tables_loaded", "Which of the live and inactive table slots are filled.") - FIELD_F(INFO, STR, "Suspended", 9, dm_info_suspended, "suspended", "Whether the device is suspended.") - FIELD_F(INFO, STR, "Read-only", 9, dm_info_read_only, "readonly", "Whether the device is read-only or writeable.") -@@ -1952,6 +2031,11 @@ - FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "segments", "Number of segments in live table, if present.") - FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "events", "Number of most recent event.") - -+FIELD_O(INFO, dm_info, NUM, "RO", read_only, 2, int, "read_only", "Read only.") -+FIELD_O(INFO, dm_info, NUM, "Ex", exists, 2, int, "exists", "Exists.") -+FIELD_O(INFO, dm_info, NUM, "Susp", suspended, 4, int, "suspended", "Suspended.") -+FIELD_O(INFO, dm_info, NUM, "tab_live", live_table, 8, int, "table_live", "Live table.") -+FIELD_O(INFO, dm_info, NUM, "tab_inact", inactive_table, 9, int, "table_inactive", "Inactive table.") - FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.") - FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.") - FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.") -@@ -1959,6 +2043,7 @@ - FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.") - FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.") - FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_dev", "List of device numbers of mapped devices using this one.") -+FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_types", "Used target types.") - {0, 0, 0, 0, "", "", NULL, NULL}, - /* *INDENT-ON* */ - }; -@@ -1969,13 +2054,15 @@ - #undef FIELD_F - - static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid"; -+static const char *default_export_options = "name,major,minor,status,read_only,exists,suspended,table_live,table_inactive,open,segments,events,uuid,target_types"; - - static int _report_init(struct command *c) - { -- char *options = (char *) default_report_options; -+ char *default_options = (char *) default_report_options; -+ char *options; - const char *keys = ""; - const char *separator = " "; -- int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0; -+ int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0, export = 0; - uint32_t flags = 0; - size_t len = 0; - int r = 0; -@@ -1995,6 +2082,15 @@ - field_prefixes = 1; - } - -+ if (_switches[EXPORT_ARG]) { -+ default_options = (char *) default_export_options; -+ separator = "\n"; -+ aligned = 0; -+ headings = 0; -+ export = 1; -+ } -+ -+ options = default_options; - if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { - if (*_string_args[OPTIONS_ARG] != '+') - options = _string_args[OPTIONS_ARG]; -@@ -2040,6 +2136,9 @@ - if (field_prefixes) - flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX; - -+ if (export) -+ flags |= DM_REPORT_OUTPUT_EXPORT; -+ - if (!(_report = dm_report_init(&_report_type, - _report_types, _report_fields, - options, separator, flags, keys, NULL))) -@@ -2118,7 +2217,8 @@ - fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" - " [--readahead [+]<sectors>|auto|none]\n" -- " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n" -+ " [-c|-C|--columns] [-e|--export]\n" -+ " [-o <fields>] [-O|--sort <sort_fields>]\n" - " [--nameprefixes] [--noheadings] [--separator <separator>]\n\n"); - for (i = 0; _commands[i].name; i++) - fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); -@@ -2469,6 +2569,7 @@ - static struct option long_options[] = { - {"readonly", 0, &ind, READ_ONLY}, - {"columns", 0, &ind, COLS_ARG}, -+ {"export", 0, &ind, EXPORT_ARG}, - {"exec", 1, &ind, EXEC_ARG}, - {"force", 0, &ind, FORCE_ARG}, - {"gid", 1, &ind, GID_ARG}, -@@ -2549,12 +2650,16 @@ - - optarg = 0; - optind = OPTIND_INIT; -- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv", -+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefGj:m:Mno:O:ru:Uv", - long_options, NULL)) != -1) { - if (c == ':' || c == '?') - return 0; - if (c == 'c' || c == 'C' || ind == COLS_ARG) - _switches[COLS_ARG]++; -+ if (c == 'e' || ind == EXPORT_ARG) { -+ _switches[EXPORT_ARG]++; -+ _switches[COLS_ARG]++; -+ } - if (c == 'f' || ind == FORCE_ARG) - _switches[FORCE_ARG]++; - if (c == 'r' || ind == READ_ONLY) -diff -Nuar --exclude '*.orig' device-mapper.1.02.26.orig/lib/libdevmapper.h device-mapper.1.02.26/lib/libdevmapper.h ---- device-mapper.1.02.26.orig/lib/libdevmapper.h 2008-04-19 17:11:08.000000000 -0700 -+++ device-mapper.1.02.26/lib/libdevmapper.h 2008-06-08 11:55:22.039615314 -0700 -@@ -740,6 +740,7 @@ - #define DM_REPORT_OUTPUT_BUFFERED 0x00000002 - #define DM_REPORT_OUTPUT_HEADINGS 0x00000004 - #define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX 0x00000008 -+#define DM_REPORT_OUTPUT_EXPORT 0x00000010 - - struct dm_report *dm_report_init(uint32_t *report_types, - const struct dm_report_object_type *types, -diff -Nuar --exclude '*.orig' device-mapper.1.02.26.orig/lib/libdm-report.c device-mapper.1.02.26/lib/libdm-report.c ---- device-mapper.1.02.26.orig/lib/libdm-report.c 2008-06-06 12:07:47.000000000 -0700 -+++ device-mapper.1.02.26/lib/libdm-report.c 2008-06-08 11:54:39.618236313 -0700 -@@ -13,6 +13,7 @@ - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#include <ctype.h> - #include "libdevmapper.h" - #include "list.h" - #include "log.h" -@@ -803,6 +804,8 @@ - char buf[4096]; - int32_t width; - uint32_t align; -+ const char *fname; -+ char tmp_char; - - if (list_empty(&rh->rows)) - return 1; -@@ -851,6 +854,25 @@ - } - } - -+ if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { -+ fname = rh->fields[field->props->field_num].id; -+ if (!dm_pool_grow_object(rh->mem, "DM_", strlen("DM_"))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ while (fname && fname[0]) { -+ tmp_char = toupper(fname[0]); -+ if (!dm_pool_grow_object(rh->mem, &tmp_char, 1)) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ fname++; -+ } -+ if (!dm_pool_grow_object(rh->mem, "=", strlen("="))) { -+ log_error("dm_report: Unable to extend output line"); -+ goto bad; -+ } -+ } - repstr = field->report_string; - width = field->props->width; - if (!(rh->flags & DM_REPORT_OUTPUT_ALIGNED)) { diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.27-export-format.diff b/sys-fs/device-mapper/files/device-mapper-1.02.27-export-format.diff deleted file mode 100644 index 9b1580a87e4f..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.27-export-format.diff +++ /dev/null @@ -1,294 +0,0 @@ -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.27.orig/dmsetup/dmsetup.c device-mapper.1.02.27/dmsetup/dmsetup.c ---- device-mapper.1.02.27.orig/dmsetup/dmsetup.c 2008-06-24 15:53:47.000000000 -0700 -+++ device-mapper.1.02.27/dmsetup/dmsetup.c 2008-06-28 01:53:56.048598048 -0700 -@@ -108,6 +108,7 @@ - enum { - READ_ONLY = 0, - COLS_ARG, -+ EXPORT_ARG, - EXEC_ARG, - FORCE_ARG, - GID_ARG, -@@ -142,7 +143,8 @@ - DR_TASK = 1, - DR_INFO = 2, - DR_DEPS = 4, -- DR_TREE = 8 /* Complete dependency tree required */ -+ DR_TREE = 8, /* Complete dependency tree required */ -+ DR_TABLE = 0x10, /* table is required, not just info */ - } report_type_t; - - static int _switches[NUM_SWITCHES]; -@@ -1126,8 +1128,13 @@ - name = argv[1]; - } - -- if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -- return 0; -+ if (_report_type & DR_TABLE ) { -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ return 0; -+ } else { -+ if (!(dmt = dm_task_create(DM_DEVICE_INFO))) -+ return 0; -+ } - - if (!_set_task_device(dmt, name, 0)) - goto out; -@@ -1591,6 +1598,16 @@ - return dm_report_field_uint32(rh, field, &value); - } - -+static int _int_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const int value = *(const int *)data; -+ -+ return dm_report_field_int(rh, field, &value); -+} -+ - static int _dm_name_disp(struct dm_report *rh, - struct dm_pool *mem __attribute((unused)), - struct dm_report_field *field, const void *data, -@@ -1702,6 +1719,66 @@ - } - - -+static int _dm_info_cleartext_status_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ const char *buf = "NOTPRESENT"; -+ const struct dm_info *info = data; -+ -+ if (info->exists) { -+ if (info->suspended) -+ buf = "SUSPENDED"; -+ else -+ buf = info->read_only ? " READONLY" : "ACTIVE"; -+ } -+ -+ return dm_report_field_string(rh, field, &buf); -+} -+ -+static int _dm_info_target_types_disp(struct dm_report *rh, -+ struct dm_pool *mem __attribute((unused)), -+ struct dm_report_field *field, const void *data, -+ void *private __attribute((unused))) -+{ -+ char buf[1024]; -+ char *dest = buf; -+ int remains = sizeof(buf); -+ int written; -+ const char *s = buf; -+ struct dm_task *dmt = (struct dm_task *) data; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ -+ -+ buf[0] = '\0'; -+ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, "%s", target_type); -+ dest += written; -+ remains -= written; -+ -+ while (remains > 0 && next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ written = snprintf(dest, remains, ",%s", target_type); -+ dest += written; -+ remains -= written; -+ } -+ } -+ } -+ -+ buf[sizeof(buf)-1] = '\0'; -+ -+ return dm_report_field_string(rh, field, &s); -+} -+ - static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem, - struct dm_report_field *field, const void *data, - void *private) -@@ -1925,6 +2002,7 @@ - { DR_INFO, "Mapped Device Information", "", _info_get_obj }, - { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj }, - { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj }, -+ { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, - { 0, "", "", NULL }, - }; - -@@ -1944,6 +2022,7 @@ - FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead in sectors.") - - FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.") -+FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "State as cleartext.") - FIELD_F(INFO, STR, "Tables", 6, dm_info_table_loaded, "tables_loaded", "Which of the live and inactive table slots are filled.") - FIELD_F(INFO, STR, "Suspended", 9, dm_info_suspended, "suspended", "Whether the device is suspended.") - FIELD_F(INFO, STR, "Read-only", 9, dm_info_read_only, "readonly", "Whether the device is read-only or writeable.") -@@ -1954,6 +2033,11 @@ - FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "segments", "Number of segments in live table, if present.") - FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "events", "Number of most recent event.") - -+FIELD_O(INFO, dm_info, NUM, "RO", read_only, 2, int, "read_only", "Read only.") -+FIELD_O(INFO, dm_info, NUM, "Ex", exists, 2, int, "exists", "Exists.") -+FIELD_O(INFO, dm_info, NUM, "Susp", suspended, 4, int, "suspended", "Suspended.") -+FIELD_O(INFO, dm_info, NUM, "tab_live", live_table, 8, int, "table_live", "Live table.") -+FIELD_O(INFO, dm_info, NUM, "tab_inact", inactive_table, 9, int, "table_inactive", "Inactive table.") - FIELD_O(DEPS, dm_deps, NUM, "#Devs", count, 5, int32, "device_count", "Number of devices used by this one.") - FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of names of mapped devices used by this one.") - FIELD_F(DEPS, STR, "DevNos", 6, dm_deps, "devnos_used", "List of device numbers of devices used by this one.") -@@ -1961,6 +2045,7 @@ - FIELD_F(TREE, NUM, "#Refs", 5, dm_tree_parents_count, "device_ref_count", "Number of mapped devices referencing this one.") - FIELD_F(TREE, STR, "RefNames", 8, dm_tree_parents_names, "names_using_dev", "List of names of mapped devices using this one.") - FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_dev", "List of device numbers of mapped devices using this one.") -+FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_types", "Used target types.") - {0, 0, 0, 0, "", "", NULL, NULL}, - /* *INDENT-ON* */ - }; -@@ -1971,13 +2056,15 @@ - #undef FIELD_F - - static const char *default_report_options = "name,major,minor,attr,open,segments,events,uuid"; -+static const char *default_export_options = "name,major,minor,status,read_only,exists,suspended,table_live,table_inactive,open,segments,events,uuid,target_types"; - - static int _report_init(struct command *c) - { -- char *options = (char *) default_report_options; -+ char *default_options = (char *) default_report_options; -+ char *options; - const char *keys = ""; - const char *separator = " "; -- int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0; -+ int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0, export = 0; - int quoted = 1, columns_as_rows = 0; - uint32_t flags = 0; - size_t len = 0; -@@ -2004,6 +2091,15 @@ - field_prefixes = 1; - } - -+ if (_switches[EXPORT_ARG]) { -+ default_options = (char *) default_export_options; -+ separator = "\n"; -+ aligned = 0; -+ headings = 0; -+ export = 1; -+ } -+ -+ options = default_options; - if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { - if (*_string_args[OPTIONS_ARG] != '+') - options = _string_args[OPTIONS_ARG]; -@@ -2055,6 +2151,9 @@ - if (columns_as_rows) - flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS; - -+ if (export) -+ flags |= DM_REPORT_OUTPUT_EXPORT; -+ - if (!(_report = dm_report_init(&_report_type, - _report_types, _report_fields, - options, separator, flags, keys, NULL))) -@@ -2133,7 +2232,8 @@ - fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" - " [-r|--readonly] [--noopencount] [--nolockfs]\n" - " [--readahead [+]<sectors>|auto|none]\n" -- " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n" -+ " [-c|-C|--columns] [-e|--export]\n" -+ " [-o <fields>] [-O|--sort <sort_fields>]\n" - " [--nameprefixes] [--noheadings] [--separator <separator>]\n\n"); - for (i = 0; _commands[i].name; i++) - fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); -@@ -2484,6 +2584,7 @@ - static struct option long_options[] = { - {"readonly", 0, &ind, READ_ONLY}, - {"columns", 0, &ind, COLS_ARG}, -+ {"export", 0, &ind, EXPORT_ARG}, - {"exec", 1, &ind, EXEC_ARG}, - {"force", 0, &ind, FORCE_ARG}, - {"gid", 1, &ind, GID_ARG}, -@@ -2566,12 +2667,16 @@ - - optarg = 0; - optind = OPTIND_INIT; -- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv", -+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefGj:m:Mno:O:ru:Uv", - long_options, NULL)) != -1) { - if (c == ':' || c == '?') - return 0; - if (c == 'c' || c == 'C' || ind == COLS_ARG) - _switches[COLS_ARG]++; -+ if (c == 'e' || ind == EXPORT_ARG) { -+ _switches[EXPORT_ARG]++; -+ _switches[COLS_ARG]++; -+ } - if (c == 'f' || ind == FORCE_ARG) - _switches[FORCE_ARG]++; - if (c == 'r' || ind == READ_ONLY) -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.27.orig/lib/libdevmapper.h device-mapper.1.02.27/lib/libdevmapper.h ---- device-mapper.1.02.27.orig/lib/libdevmapper.h 2008-06-24 15:53:48.000000000 -0700 -+++ device-mapper.1.02.27/lib/libdevmapper.h 2008-06-28 01:54:55.588111461 -0700 -@@ -742,6 +742,7 @@ - #define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX 0x00000008 - #define DM_REPORT_OUTPUT_FIELD_UNQUOTED 0x00000010 - #define DM_REPORT_OUTPUT_COLUMNS_AS_ROWS 0x00000020 -+#define DM_REPORT_OUTPUT_EXPORT 0x00000040 - - struct dm_report *dm_report_init(uint32_t *report_types, - const struct dm_report_object_type *types, -diff -Nuar --exclude '*.rej' --exclude '*.orig' device-mapper.1.02.27.orig/lib/libdm-report.c device-mapper.1.02.27/lib/libdm-report.c ---- device-mapper.1.02.27.orig/lib/libdm-report.c 2008-06-24 17:10:36.000000000 -0700 -+++ device-mapper.1.02.27/lib/libdm-report.c 2008-06-28 01:56:39.778466634 -0700 -@@ -13,6 +13,7 @@ - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -+#include <ctype.h> - #include "libdevmapper.h" - #include "list.h" - #include "log.h" -@@ -808,6 +809,8 @@ - uint32_t align; - const char *repstr; - char buf[4096]; -+ const char *fname; -+ char tmp_char; - - if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) { - if (!(field_id = strdup(rh->fields[field->props->field_num].id))) { -@@ -838,6 +841,25 @@ - return 0; - } - } -+ if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { -+ fname = rh->fields[field->props->field_num].id; -+ if (!dm_pool_grow_object(rh->mem, "DM_", strlen("DM_"))) { -+ log_error("dm_report: Unable to extend output line"); -+ return 0; -+ } -+ while (fname && fname[0]) { -+ tmp_char = toupper(fname[0]); -+ if (!dm_pool_grow_object(rh->mem, &tmp_char, 1)) { -+ log_error("dm_report: Unable to extend output line"); -+ return 0; -+ } -+ fname++; -+ } -+ if (!dm_pool_grow_object(rh->mem, "=", strlen("="))) { -+ log_error("dm_report: Unable to extend output line"); -+ return 0; -+ } -+ } - - repstr = field->report_string; - width = field->props->width; diff --git a/sys-fs/device-mapper/files/device-mapper-1.02.28-asneeded.patch b/sys-fs/device-mapper/files/device-mapper-1.02.28-asneeded.patch deleted file mode 100644 index c5615eaf68ed..000000000000 --- a/sys-fs/device-mapper/files/device-mapper-1.02.28-asneeded.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- device-mapper.1.02.28.orig/dmeventd/Makefile.in 2008-06-27 09:36:51.000000000 -0600 -+++ device-mapper.1.02.28/dmeventd/Makefile.in 2009-02-19 00:21:18.000000000 -0700 -@@ -31,8 +31,7 @@ - - include ../make.tmpl - --LDFLAGS += -ldl -ldevmapper -lpthread --CLDFLAGS += -ldl -ldevmapper -lpthread -+LIBS += -ldl -ldevmapper -lpthread - - dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o - $(CC) -o $@ dmeventd.o $(CFLAGS) $(LDFLAGS) \ diff --git a/sys-fs/device-mapper/files/device-mapper.conf-1.02.22-r3 b/sys-fs/device-mapper/files/device-mapper.conf-1.02.22-r3 deleted file mode 100644 index bc7a25158635..000000000000 --- a/sys-fs/device-mapper/files/device-mapper.conf-1.02.22-r3 +++ /dev/null @@ -1 +0,0 @@ -RC_AFTER="lvm" diff --git a/sys-fs/device-mapper/files/device-mapper.rc b/sys-fs/device-mapper/files/device-mapper.rc deleted file mode 100644 index 1b40ee51b7c3..000000000000 --- a/sys-fs/device-mapper/files/device-mapper.rc +++ /dev/null @@ -1,23 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/device-mapper.rc,v 1.3 2008/02/01 12:39:47 flameeyes Exp $ - -depend() { - if [ -e /lib/librc.so ]; then - # on baselayout-1 this causes - # a dependency loop with checkroot (before *) - before checkroot root - fi -} - -start() { - if [ ! -e /lib/librc.so ]; then - eerror "The ${SVCNAME} init script is written for baselayout-2" - eerror "Please do not use it with baselayout-1" - return 1 - fi - - . /lib/rcscripts/addons/dm-start.sh -} - diff --git a/sys-fs/device-mapper/files/device-mapper.rc-1.02.22-r3 b/sys-fs/device-mapper/files/device-mapper.rc-1.02.22-r3 deleted file mode 100644 index 63b4eee6516c..000000000000 --- a/sys-fs/device-mapper/files/device-mapper.rc-1.02.22-r3 +++ /dev/null @@ -1,24 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2008 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/device-mapper.rc-1.02.22-r3,v 1.8 2008/12/18 21:52:25 cardoe Exp $ - -depend() { - # necessary for services when using baselayout-2 - # but conflict for baselayout-1 - if [ -e /etc/init.d/root ] ; then - after modules - before checkfs fsck - fi -} - -start() { - if [ ! -e /etc/init.d/root ] ; then - eerror "The ${SVCNAME} init script is written for baselayout-2" - eerror "Please do not use it with baselayout-1" - return 1 - fi - - start_addon dm -} - diff --git a/sys-fs/device-mapper/files/dm-start.sh b/sys-fs/device-mapper/files/dm-start.sh deleted file mode 100644 index d3d0287b2f58..000000000000 --- a/sys-fs/device-mapper/files/dm-start.sh +++ /dev/null @@ -1,86 +0,0 @@ -# /lib/rcscripts/addons/dm-start.sh: Setup DM volumes at boot -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/dm-start.sh,v 1.4 2007/05/21 14:05:37 cardoe Exp $ - -# char **get_new_dm_volumes(void) -# -# Return dmsetup commands to setup volumes -get_new_dm_volumes() { - local volume params - - # Filter comments and blank lines - grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ - while read volume params ; do - # If it exists, skip it - dmvolume_exists "${volume%:}" && continue - # Assemble the command to run to create volume - echo "echo ${params} | /sbin/dmsetup create ${volume%:}" - done - - return 0 -} - -# int dmvolume_exists(volume) -# -# Return true if volume exists in DM table -dmvolume_exists() { - local x line volume=$1 - - [ -z "${volume}" ] && return 1 - - /sbin/dmsetup ls 2>/dev/null | \ - while read line ; do - for x in ${line} ; do - # the following conditonal return only breaks out - # of the while loop, as it is running in a pipe. - [ "${x}" = "${volume}" ] && return 1 - # We only want to check the volume name - break - done - done - - # if 1 was returned from the above loop, then indicate that - # volume exists - [ $? = 1 ] && return 0 - - # otherwise the loop exited normally and the volume does not - # exist - return 1 -} - -# int is_empty_dm_volume(volume) -# -# Return true if the volume exists in DM table, but is empty/non-valid -is_empty_dm_volume() { - local table volume=$1 - - set -- $(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:") - [ "${volume}" = "$1" -a -z "$2" ] -} - -local x volume - -if [ -x /sbin/dmsetup -a -c /dev/mapper/control -a -f /etc/dmtab ] ; then - [ -n "$(get_new_dm_volumes)" ] && \ - einfo " Setting up device-mapper volumes:" - - get_new_dm_volumes | \ - while read x ; do - [ -n "${x}" ] || continue - - volume="${x##* }" - - ebegin " Creating volume: ${volume}" - if ! eval "${x}" >/dev/null 2>/dev/null ; then - eend 1 " Error creating volume: ${volume}" - # dmsetup still adds an empty volume in some cases, - # so lets remove it - is_empty_dm_volume "${volume}" && \ - /sbin/dmsetup remove "${volume}" 2>/dev/null - else - eend 0 - fi - done -fi - - -# vim:ts=4 diff --git a/sys-fs/device-mapper/files/dmtab b/sys-fs/device-mapper/files/dmtab deleted file mode 100644 index 96c6640675a7..000000000000 --- a/sys-fs/device-mapper/files/dmtab +++ /dev/null @@ -1,12 +0,0 @@ -#/etc/dmraid: config file for adding device-mapper volumes at boot -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/dmtab,v 1.1 2005/03/01 22:45:26 vapier Exp $ - -# Format: <volume name>: <table> -# Example: isw0: 0 312602976 striped 2 128 /dev/sda 0 /dev/sdb 0 -# -# Alternatively you can create all your volumes the first time, and just run: -# -# dmsetup table >> /etc/dmtab -# -# and verify that they are correct. - |