diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-08 19:10:22 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2008-06-08 19:10:22 +0000 |
commit | 485a96606bec21f9afd16400e5ba14ff736aa988 (patch) | |
tree | 9014781a06cf8dd88a51fc5659dffda4df323fbb /sys-fs/device-mapper | |
parent | version bump (diff) | |
download | gentoo-2-485a96606bec21f9afd16400e5ba14ff736aa988.tar.gz gentoo-2-485a96606bec21f9afd16400e5ba14ff736aa988.tar.bz2 gentoo-2-485a96606bec21f9afd16400e5ba14ff736aa988.zip |
Version bump, with new output-field-name prefix support.
(Portage version: 2.1.5.4)
Diffstat (limited to 'sys-fs/device-mapper')
-rw-r--r-- | sys-fs/device-mapper/ChangeLog | 9 | ||||
-rw-r--r-- | sys-fs/device-mapper/device-mapper-1.02.26.ebuild | 74 | ||||
-rw-r--r-- | sys-fs/device-mapper/files/device-mapper-1.02.26-export-format.diff | 300 |
3 files changed, 382 insertions, 1 deletions
diff --git a/sys-fs/device-mapper/ChangeLog b/sys-fs/device-mapper/ChangeLog index 8a04dd103f8f..f2079740d81f 100644 --- a/sys-fs/device-mapper/ChangeLog +++ b/sys-fs/device-mapper/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-fs/device-mapper # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/ChangeLog,v 1.113 2008/04/21 18:22:12 jer Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/ChangeLog,v 1.114 2008/06/08 19:10:22 robbat2 Exp $ + +*device-mapper-1.02.26 (08 Jun 2008) + + 08 Jun 2008; Robin H. Johnson <robbat2@gentoo.org> + +files/device-mapper-1.02.26-export-format.diff, + +device-mapper-1.02.26.ebuild: + Version bump, with new output-field-name prefix support. 21 Apr 2008; Jeroen Roovers <jer@gentoo.org> device-mapper-1.02.24-r1.ebuild: diff --git a/sys-fs/device-mapper/device-mapper-1.02.26.ebuild b/sys-fs/device-mapper/device-mapper-1.02.26.ebuild new file mode 100644 index 000000000000..4966914a72ec --- /dev/null +++ b/sys-fs/device-mapper/device-mapper-1.02.26.ebuild @@ -0,0 +1,74 @@ +# 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/device-mapper-1.02.26.ebuild,v 1.1 2008/06/08 19:10:22 robbat2 Exp $ + +inherit eutils multilib toolchain-funcs + +DESCRIPTION="Device mapper ioctl library for use with LVM2 utilities" +HOMEPAGE="http://sources.redhat.com/dm/" +SRC_URI="ftp://sources.redhat.com/pub/dm/${PN}.${PV}.tgz + ftp://sources.redhat.com/pub/dm/old/${PN}.${PV}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="selinux" + +DEPEND="selinux? ( sys-libs/libselinux )" +RDEPEND="!<sys-fs/udev-115-r1 + ${DEPEND}" + +S="${WORKDIR}/${PN}.${PV}" + +src_unpack() { + unpack ${A} + EPATCH_OPTS="-p1 -d${S}" epatch "${FILESDIR}"/device-mapper-1.02.26-export-format.diff +} + +src_compile() { + econf \ + --sbindir=/sbin \ + --enable-dmeventd \ + $(use_enable selinux) \ + CLDFLAGS="${LDFLAGS}" || die "econf failed" + emake || die "compile problem" +} + +src_install() { + emake install DESTDIR="${D}" || die + + # move shared libs to / + mv "${D}"/usr/$(get_libdir) "${D}"/ || die "move libdir" + dolib.a lib/ioctl/libdevmapper.a || die "dolib.a" + gen_usr_ldscript libdevmapper.so + + insinto /etc + doins "${FILESDIR}"/dmtab + insinto /lib/rcscripts/addons + doins "${FILESDIR}"/dm-start.sh + + newinitd "${FILESDIR}"/device-mapper.rc-1.02.22-r3 device-mapper || die + newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die + + newinitd "${FILESDIR}"/1.02.22-dmeventd.initd dmeventd || die + dolib.a dmeventd/libdevmapper-event.a || die + gen_usr_ldscript libdevmapper-event.so + + insinto /etc/udev/rules.d/ + newins "${FILESDIR}"/64-device-mapper.rules-1.02.22-r5 64-device-mapper.rules + + dodoc INSTALL INTRO README VERSION WHATS_NEW +} + +pkg_preinst() { + local l="${ROOT}"/$(get_libdir)/libdevmapper.so.1.01 + [[ -e ${l} ]] && cp "${l}" "${D}"/$(get_libdir)/ +} + +pkg_postinst() { + preserve_old_lib_notify /$(get_libdir)/libdevmapper.so.1.01 + + elog "device-mapper volumes are no longer automatically created for" + elog "baselayout-2 users. If you are using baselayout-2, be sure to" + elog "run: # rc-update add device-mapper boot" +} 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 new file mode 100644 index 000000000000..2d4861229599 --- /dev/null +++ b/sys-fs/device-mapper/files/device-mapper-1.02.26-export-format.diff @@ -0,0 +1,300 @@ +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)) { |