From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1MgPAb-0004qc-GB for garchives@archives.gentoo.org; Wed, 26 Aug 2009 20:32:38 +0000 Received: by pigeon.gentoo.org (Postfix, from userid 207) id 9CCE8E0A07; Thu, 27 Aug 2009 01:46:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A244DE0824; Thu, 27 Aug 2009 00:34:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4705CE0824 for ; Thu, 27 Aug 2009 00:34:28 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 6E5DC67B73 for ; Thu, 27 Aug 2009 00:34:29 +0000 (UTC) Received: from robbat2 by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1MgSwd-00069p-6r for gentoo-commits@lists.gentoo.org; Thu, 27 Aug 2009 00:34:27 +0000 From: "Robin H. Johnson (robbat2)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, robbat2@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in sys-fs/lvm2/files: lvm2-2.02.51-as-needed.patch lvm.conf-2.02.51.patch lvm2-2.02.51-device-mapper-export-format.patch X-VCS-Repository: gentoo-x86 X-VCS-Files: lvm2-2.02.51-as-needed.patch lvm.conf-2.02.51.patch lvm2-2.02.51-device-mapper-export-format.patch X-VCS-Directories: sys-fs/lvm2/files X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson Content-Type: text/plain; charset=utf8 Message-Id: Sender: "Robin H. Johnson" Date: Thu, 27 Aug 2009 00:34:27 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 1bb032e5-d488-4b65-ab71-09c9af6c8ea2 X-Archives-Hash: 90cd673ebfba87b0728b9e41493cdae8 robbat2 09/08/27 00:34:27 Added: lvm2-2.02.51-as-needed.patch lvm.conf-2.02.51.pat= ch lvm2-2.02.51-device-mapper-export-format.patch Log: Version bump. Change the pvmetadatacopies default back to 1 to cut down= on pvresize issues per ongoing bug #252144. (Portage version: 2.2_rc38/cvs/Linux x86_64) Revision Changes Path 1.1 sys-fs/lvm2/files/lvm2-2.02.51-as-needed.patch file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm2-2.02.51-as-needed.patch?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm2-2.02.51-as-needed.patch?rev=3D1.1&content-type=3Dtext/plain Index: lvm2-2.02.51-as-needed.patch =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Compile-fix with --as-needed. To ensure correct output when --as-needed are in the linker flags, the or= der of flags to the linker (directly or via the compiler) must explictly only in= clude libraries and objects AFTER all compiler flags, linker flags and linker directory arguments. X-Gentoo-Bug: #217644 Signed-off-by: Robin H. Johnson Ported-from: lvm2-2.02.48-as-needed.patch diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons= /clogd/Makefile LVM2.2.02.51/daemons/clogd/Makefile --- LVM2.2.02.51.orig/daemons/clogd/Makefile 2009-07-28 21:14:12.00000000= 0 +0000 +++ LVM2.2.02.51/daemons/clogd/Makefile 2009-08-27 00:09:53.215521890 +00= 00 @@ -45,12 +45,12 @@ else \ echo '-L/usr/lib/openais -L/usr/lib -L/lib'; \ fi) -LDFLAGS +=3D -lcpg -lSaCkpt -lext2fs -ldevmapper +LIBS +=3D -lcpg -lSaCkpt -lext2fs -ldevmapper =20 all: ${TARGET} =20 clogd: ${SOURCES} - ${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS} + ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LIBS} =20 no_clogd_kernel_headers: echo "Unable to find clogd kernel headers" diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons= /clvmd/Makefile.in LVM2.2.02.51/daemons/clvmd/Makefile.in --- LVM2.2.02.51.orig/daemons/clvmd/Makefile.in 2009-03-10 12:10:12.00000= 0000 +0000 +++ LVM2.2.02.51/daemons/clvmd/Makefile.in 2009-08-27 00:06:20.642231272 = +0000 @@ -101,7 +101,7 @@ install_clvmd =20 clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a - $(CC) -o clvmd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \ + $(CC) $(CFLAGS) $(LDFLAGS) -o clvmd $(OBJECTS) \ $(LVMLIBS) $(LMLIBS) $(LIBS) =20 .PHONY: install_clvmd diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons= /dmeventd/Makefile.in LVM2.2.02.51/daemons/dmeventd/Makefile.in --- LVM2.2.02.51.orig/daemons/dmeventd/Makefile.in 2009-08-27 00:04:46.80= 5552570 +0000 +++ LVM2.2.02.51/daemons/dmeventd/Makefile.in 2009-08-27 00:06:20.6422312= 72 +0000 @@ -41,12 +41,12 @@ all: dmeventd device-mapper: dmeventd $(LIB_STATIC) =20 -LDFLAGS +=3D -ldl -ldevmapper -lpthread -CLDFLAGS +=3D -ldl -ldevmapper -lpthread +LIBS +=3D -ldl -ldevmapper -lpthread =20 dmeventd: $(LIB_SHARED) $(LIB_STATIC) $(VERSIONED_SHLIB) dmeventd.o - $(CC) -o $@ dmeventd.o $(CFLAGS) $(LDFLAGS) \ - -L. -ldevmapper-event $(LIBS) -rdynamic + $(CC) $(CFLAGS) $(LDFLAGS) -L. \ + -o $@ dmeventd.o \ + -ldevmapper-event $(LIBS) -rdynamic =20 .PHONY: install_dynamic install_static install_include \ install_pkgconfig install_dmeventd diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons= /dmeventd/plugins/mirror/Makefile.in LVM2.2.02.51/daemons/dmeventd/plugin= s/mirror/Makefile.in --- LVM2.2.02.51.orig/daemons/dmeventd/plugins/mirror/Makefile.in 2009-05= -11 10:28:46.000000000 +0000 +++ LVM2.2.02.51/daemons/dmeventd/plugins/mirror/Makefile.in 2009-08-27 0= 0:06:20.642231272 +0000 @@ -17,7 +17,8 @@ VPATH =3D @srcdir@ =20 INCLUDES +=3D -I${top_srcdir}/tools -CLDFLAGS +=3D -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@ +CLDFLAGS +=3D -L${top_srcdir}/tools +LIBS +=3D -ldevmapper -lpthread @LVM2CMD_LIB@ =20 SOURCES =3D dmeventd_mirror.c =20 diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons= /dmeventd/plugins/snapshot/Makefile.in LVM2.2.02.51/daemons/dmeventd/plug= ins/snapshot/Makefile.in --- LVM2.2.02.51.orig/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-= 05-11 10:28:46.000000000 +0000 +++ LVM2.2.02.51/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-08-27= 00:06:20.642231272 +0000 @@ -17,7 +17,8 @@ VPATH =3D @srcdir@ =20 INCLUDES +=3D -I${top_srcdir}/tools -CLDFLAGS +=3D -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@ +CLDFLAGS +=3D -L${top_srcdir}/tools +LIBS +=3D -lpthread -ldevmapper @LVM2CMD_LIB@ =20 SOURCES =3D dmeventd_snapshot.c =20 diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/lib/Mak= efile.in LVM2.2.02.51/lib/Makefile.in --- LVM2.2.02.51.orig/lib/Makefile.in 2009-06-03 11:31:06.000000000 +0000 +++ LVM2.2.02.51/lib/Makefile.in 2009-08-27 00:06:20.642231272 +0000 @@ -137,7 +137,8 @@ endif =20 ifeq ("@DMEVENTD@", "yes") - CLDFLAGS +=3D -ldevmapper-event + CLDFLAGS +=3D -L../daemons/dmeventd + LIBS +=3D -ldevmapper-event endif =20 LIB_NAME =3D liblvm-internal diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/make.tm= pl.in LVM2.2.02.51/make.tmpl.in --- LVM2.2.02.51.orig/make.tmpl.in 2009-07-31 11:49:53.000000000 +0000 +++ LVM2.2.02.51/make.tmpl.in 2009-08-27 00:06:20.645583990 +0000 @@ -28,7 +28,7 @@ LN_S =3D @LN_S@ SED =3D @SED@ =20 -LIBS =3D @LIBS@ +LIBS +=3D @LIBS@ $(LVMLIBS) $(LMLIBS) DEFS +=3D @DEFS@ CFLAGS +=3D @CFLAGS@ CLDFLAGS +=3D @CLDFLAGS@ @@ -208,19 +208,19 @@ ifeq ("@LIB_SUFFIX@","so") $(LIB_SHARED): $(OBJECTS) $(LDDEPS) $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ - $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ + $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ endif =20 ifeq ("@LIB_SUFFIX@","dylib") $(LIB_SHARED): $(OBJECTS) $(LDDEPS) $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \ - $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ + $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@ endif =20 %.so: %.a $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ - $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \ - @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ + $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) -o $@ \ + @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ $(LIBS) =20 $(LIB_STATIC): $(OBJECTS) $(RM) $@ diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/test/ap= i/Makefile.in LVM2.2.02.51/test/api/Makefile.in --- LVM2.2.02.51.orig/test/api/Makefile.in 2009-07-21 13:51:05.000000000 = +0000 +++ LVM2.2.02.51/test/api/Makefile.in 2009-08-27 00:07:52.285533964 +0000 @@ -38,7 +38,7 @@ OBJECTS =3D $(test_OBJECTS) $(vgtest_OBJECTS) =20 test: $(test_OBJECTS) $(DEPLIBS) - $(CC) -o test $(test_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o test $(test_OBJECTS) $(LVMLIBS) $(LIBS) =20 vgtest: $(vgtest_OBJECTS) $(DEPLIBS) - $(CC) -o vgtest $(vgtest_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIB= S) + $(CC) $(CFLAGS) $(LDFLAGS) -o vgtest $(vgtest_OBJECTS) $(LVMLIBS) $(LIB= S) diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/tools/M= akefile.in LVM2.2.02.51/tools/Makefile.in --- LVM2.2.02.51.orig/tools/Makefile.in 2009-05-21 11:11:29.000000000 +00= 00 +++ LVM2.2.02.51/tools/Makefile.in 2009-08-27 00:06:20.645583990 +0000 @@ -106,24 +106,29 @@ device-mapper: $(TARGETS_DM) =20 dmsetup: dmsetup.o $(top_srcdir)/libdm/libdevmapper.$(LIB_SUFFIX) - $(CC) -o $@ dmsetup.o $(CFLAGS) $(LDFLAGS) \ - -L$(top_srcdir)/libdm -ldevmapper $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) \ + -L$(top_srcdir)/libdm \ + -o $@ dmsetup.o \ + -ldevmapper $(LIB_PTHREAD) =20 dmsetup.static: dmsetup.o $(interfacedir)/libdevmapper.a - $(CC) -o $@ dmsetup.o $(CFLAGS) $(LDFLAGS) -static \ - -L$(interfacedir) -ldevmapper $(LIBS) \ - $(LIB_PTHREAD) + $(CC) $(CFLAGS) $(LDFLAGS) -static \ + -L$(interfacedir) \ + -o $@ dmsetup.o \ + -ldevmapper $(LIB_PTHREAD) =20 all: device-mapper =20 lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm-internal.a - $(CC) -o $@ $(CFLAGS) $(OBJECTS) lvm.o \ - $(LDFLAGS) $(LVMLIBS) $(LIBS) -rdynamic + $(CC) $(CFLAGS) $(LDFLAGS) \ + -o $@ $(OBJECTS) lvm.o \ + $(LVMLIBS) $(LIBS) -rdynamic =20 LIB_PTHREAD =3D @LIB_PTHREAD@ lvm.static: $(OBJECTS) lvm-static.o $(top_srcdir)/lib/liblvm-internal.a = $(interfacedir)/libdevmapper.a - $(CC) -o $@ $(CFLAGS) $(OBJECTS) lvm-static.o -static \ - -L$(interfacedir) $(LDFLAGS) $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynam= ic + $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacedir) \ + -o $@ $(OBJECTS) lvm-static.o \ + $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic =20 liblvm2cmd.a: $(top_srcdir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o= lvm2cmd.o cat $(top_srcdir)/lib/liblvm-internal.a > $@ 1.1 sys-fs/lvm2/files/lvm.conf-2.02.51.patch file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm.conf-2.02.51.patch?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm.conf-2.02.51.patch?rev=3D1.1&content-type=3Dtext/plain Index: lvm.conf-2.02.51.patch =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- doc/example.conf.orig 2009-02-22 14:00:26.000000000 -0500 +++ doc/example.conf 2009-03-22 04:10:05.629026882 -0400 @@ -50,7 +50,9 @@ =20 =20 # By default we accept every block device: - filter =3D [ "a/.*/" ] + # Gentoo: we exclude /dev/nbd by default, because it makes a lot of = kernel + # noise when you probed while not available. + filter =3D [ "r|/dev/nbd.*|", "a/.*/" ] =20 # Exclude the cdrom drive # filter =3D [ "r|/dev/cdrom|" ] @@ -230,12 +232,14 @@ # e.g. vgscan.lvm1 and they will stop working after you start using # the new lvm2 on-disk metadata format. # The default value is set when the tools are built. - # fallback_to_lvm1 =3D 0 + # Gentoo: the LVM tools are a seperate package. + fallback_to_lvm1 =3D 0 =20 # The default metadata format that commands should use - "lvm1" or "= lvm2". # The command line override is -M1 or -M2. # Defaults to "lvm1" if compiled in, else "lvm2". - # format =3D "lvm1" + # Gentoo: default to LVM2 format + format =3D "lvm2" =20 # Location of proc filesystem proc =3D "/proc" @@ -364,12 +368,12 @@ =20 # Metadata settings # -# metadata { +metadata { # Default number of copies of metadata to hold on each PV. 0, 1 or = 2. # You might want to override it from the command line with 0=20 # when running pvcreate on new PVs which are to be added to large VG= s. - - # pvmetadatacopies =3D 1 + # Gentoo: enable for data safety, but PV resize is then disabled. + #pvmetadatacopies =3D 2 =20 # Approximate default size of on-disk metadata areas in sectors. # You should increase this if you have large volume groups or @@ -391,11 +395,11 @@ # the supplied toolset to make changes (e.g. vgcfgrestore). =20 # dirs =3D [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ] -#} +} =20 # Event daemon -# -# dmeventd { +# Gentoo: uncommented, since we provide the dmeventd init script +dmeventd { # mirror_library is the library used when monitoring a mirror device= . # # "libdevmapper-event-lvm2mirror.so" attempts to recover from @@ -403,7 +407,7 @@ # reconfigures a mirror as necessary. If no mirror library is # provided, mirrors are not monitored through dmeventd. =20 - # mirror_library =3D "libdevmapper-event-lvm2mirror.so" + mirror_library =3D "libdevmapper-event-lvm2mirror.so" =20 # snapshot_library is the library used when monitoring a snapshot de= vice. # @@ -412,6 +416,6 @@ # snapshot exceedes 80%. The warning is repeated when 85%, 90% and # 95% of the snapshot are filled. =20 - # snapshot_library =3D "libdevmapper-event-lvm2snapshot.so" -#} + snapshot_library =3D "libdevmapper-event-lvm2snapshot.so" +} =20 1.1 sys-fs/lvm2/files/lvm2-2.02.51-device-mapper-export-= format.patch file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm2-2.02.51-device-mapper-export-format.patch?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/= lvm2-2.02.51-device-mapper-export-format.patch?rev=3D1.1&content-type=3Dt= ext/plain Index: lvm2-2.02.51-device-mapper-export-format.patch =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Add support for exporting the device-mapper table to userspace. Original patch written by Matthias Schwarzott , in respo= nse to Gentoo bug #189404. This makes it possible to have udev rules based on the properties of the device-mapper node, such as target types, suspended status etc. Signed-off-by: Robin H. Johnson Ported-from: lvm2-2.02.48-device-mapper-export-format.patch diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/libdm/l= ibdevmapper.h LVM2.2.02.51/libdm/libdevmapper.h --- LVM2.2.02.51.orig/libdm/libdevmapper.h 2009-08-06 15:04:30.000000000 = +0000 +++ LVM2.2.02.51/libdm/libdevmapper.h 2009-08-26 23:59:20.109335044 +0000 @@ -972,6 +972,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 =20 struct dm_report *dm_report_init(uint32_t *report_types, const struct dm_report_object_type *types, diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/libdm/l= ibdm-report.c LVM2.2.02.51/libdm/libdm-report.c --- LVM2.2.02.51.orig/libdm/libdm-report.c 2009-02-09 09:45:49.000000000 = +0000 +++ LVM2.2.02.51/libdm/libdm-report.c 2009-08-26 23:59:20.112668654 +0000 @@ -891,6 +891,8 @@ uint32_t align; const char *repstr; char buf[4096]; + const char *fname; + char tmp_char; =20 if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) { if (!(field_id =3D strdup(rh->fields[field->props->field_num].id))) { @@ -921,6 +923,25 @@ return 0; } } + if (rh->flags & DM_REPORT_OUTPUT_EXPORT) { + fname =3D 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 =3D 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, "=3D", strlen("=3D"))) { + log_error("dm_report: Unable to extend output line"); + return 0; + } + } =20 repstr =3D field->report_string; width =3D field->props->width; diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/tools/d= msetup.c LVM2.2.02.51/tools/dmsetup.c --- LVM2.2.02.51.orig/tools/dmsetup.c 2009-08-06 15:56:50.000000000 +0000 +++ LVM2.2.02.51/tools/dmsetup.c 2009-08-27 00:01:10.332242296 +0000 @@ -114,6 +114,7 @@ enum { READ_ONLY =3D 0, COLS_ARG, + EXPORT_ARG, EXEC_ARG, FORCE_ARG, GID_ARG, @@ -150,7 +151,8 @@ DR_INFO =3D 2, DR_DEPS =3D 4, DR_TREE =3D 8, /* Complete dependency tree required */ - DR_NAME =3D 16 + DR_NAME =3D 16, + DR_TABLE =3D 0x20, /* table is required, not just info */ } report_type_t; =20 static int _switches[NUM_SWITCHES]; @@ -1383,8 +1385,13 @@ name =3D argv[1]; } =20 - if (!(dmt =3D dm_task_create(DM_DEVICE_INFO))) - return 0; + if (_report_type & DR_TABLE ) { + if (!(dmt =3D dm_task_create(DM_DEVICE_TABLE))) + return 0; + } else { + if (!(dmt =3D dm_task_create(DM_DEVICE_INFO))) + return 0; + } =20 if (!_set_task_device(dmt, name, 0)) goto out; @@ -1848,6 +1855,16 @@ return dm_report_field_uint32(rh, field, &value); } =20 +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 =3D *(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, @@ -1959,6 +1976,66 @@ } =20 =20 +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 =3D "NOTPRESENT"; + const struct dm_info *info =3D data; + + if (info->exists) { + if (info->suspended) + buf =3D "SUSPENDED"; + else + buf =3D info->read_only ? " READONLY" : "ACTIVE"; + } + =09 + 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 =3D buf; + int remains =3D sizeof(buf); + int written; + const char *s =3D buf; + struct dm_task *dmt =3D (struct dm_task *) data; + void *next =3D NULL; + uint64_t start, length; + char *target_type =3D NULL; + char *params; + + + buf[0] =3D '\0'; +=09 + next =3D dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + written =3D snprintf(dest, remains, "%s", target_type); + dest +=3D written; + remains -=3D written; + + while (remains > 0 && next) { + next =3D dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + written =3D snprintf(dest, remains, ",%s", target_type); + dest +=3D written; + remains -=3D written; + } + } + } + + buf[sizeof(buf)-1] =3D '\0'; +=09 + 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) @@ -2223,6 +2300,7 @@ { DR_DEPS, "Mapped Device Relationship Information", "", _deps_get_obj = }, { DR_TREE, "Mapped Device Relationship Information", "", _tree_get_obj = }, { DR_NAME, "Mapped Device Name Components", "", _split_name_get_obj }, + { DR_TABLE, "Mapped Device Table", "", _task_get_obj }, { 0, "", "", NULL }, }; =20 @@ -2242,6 +2320,7 @@ FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead= in sectors.") =20 FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "attr", "(L)ive, (I)nactiv= e, (s)uspended, (r)ead-only, read-(w)rite.") +FIELD_F(INFO, STR, "State", 1, dm_info_cleartext_status, "status", "Stat= e 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", "Whet= her the device is suspended.") FIELD_F(INFO, STR, "Read-only", 9, dm_info_read_only, "readonly", "Wheth= er the device is read-only or writeable.") @@ -2252,6 +2331,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", "Num= ber of most recent event.") =20 +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", "Sus= pended.") +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", "N= umber of devices used by this one.") FIELD_F(TREE, STR, "DevNames", 8, dm_deps_names, "devs_used", "List of n= ames 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.") @@ -2259,6 +2343,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_de= v", "List of names of mapped devices using this one.") FIELD_F(TREE, STR, "RefDevNos", 9, dm_tree_parents_devs, "devnos_using_d= ev", "List of device numbers of mapped devices using this one.") +FIELD_F(TABLE, STR, "Targettypes", 32, dm_info_target_types, "target_typ= es", "Used target types.") =20 FIELD_O(NAME, dm_split_name, STR, "Subsys", subsystem, 6, dm_subsystem, = "subsystem", "Userspace subsystem responsible for this device.") FIELD_O(NAME, dm_split_name, STR, "VG", vg_name, 4, dm_vg_name, "vg_name= ", "LVM Volume Group name.") @@ -2275,14 +2360,16 @@ #undef FIELD_F =20 static const char *default_report_options =3D "name,major,minor,attr,ope= n,segments,events,uuid"; +static const char *default_export_options =3D "name,major,minor,status,r= ead_only,exists,suspended,table_live,table_inactive,open,segments,events,= uuid,target_types"; static const char *splitname_report_options =3D "vg_name,lv_name,lv_laye= r"; =20 static int _report_init(struct command *c) { - char *options =3D (char *) default_report_options; + char *default_options =3D (char *) default_report_options; + char *options; const char *keys =3D ""; const char *separator =3D " "; - int aligned =3D 1, headings =3D 1, buffered =3D 1, field_prefixes =3D 0= ; + int aligned =3D 1, headings =3D 1, buffered =3D 1, field_prefixes =3D 0= , export =3D 0; int quoted =3D 1, columns_as_rows =3D 0; uint32_t flags =3D 0; size_t len =3D 0; @@ -2312,6 +2399,15 @@ field_prefixes =3D 1; } =20 + if (_switches[EXPORT_ARG]) { + default_options =3D (char *) default_export_options; + separator =3D "\n"; + aligned =3D 0; + headings =3D 0; + export =3D 1; + } + + options =3D default_options; if (_switches[OPTIONS_ARG] && _string_args[OPTIONS_ARG]) { if (*_string_args[OPTIONS_ARG] !=3D '+') options =3D _string_args[OPTIONS_ARG]; @@ -2363,6 +2459,9 @@ if (columns_as_rows) flags |=3D DM_REPORT_OUTPUT_COLUMNS_AS_ROWS; =20 + if (export) + flags |=3D DM_REPORT_OUTPUT_EXPORT; + if (!(_report =3D dm_report_init(&_report_type, _report_types, _report_fields, options, separator, flags, keys, NULL))) @@ -2446,7 +2545,9 @@ " [-r|--readonly] [--noopencount] [--nolockfs]\n" " [--noudevsync] [--readahead [+]|auto|none]\n" " [-c|-C|--columns] [-o ] [-O|--sort ]\n" - " [--nameprefixes] [--noheadings] [--separator ]\n\n= "); + " [--nameprefixes] [--noheadings] [--separator ]\n" + " [-e|--export]\n" + "\n"); for (i =3D 0; _commands[i].name; i++) fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); fprintf(out, "\n may be device name or -u or " @@ -2701,7 +2802,7 @@ show_all++; if (c =3D=3D 'd') delete++; - if (c =3D=3D 'e') + if (c =3D=3D 'E') encrypt_loop++; if (c =3D=3D 'f') find++; @@ -2796,6 +2897,7 @@ static struct option long_options[] =3D { {"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}, @@ -2879,12 +2981,16 @@ =20 optarg =3D 0; optind =3D OPTIND_INIT; - while ((ind =3D -1, c =3D GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:O:= ru:U:v", + while ((ind =3D -1, c =3D GETOPTLONG_FN(*argc, *argv, "cCefG:j:m:M:no:O= :ru:U:v", long_options, NULL)) !=3D -1) { if (c =3D=3D ':' || c =3D=3D '?') return 0; if (c =3D=3D 'c' || c =3D=3D 'C' || ind =3D=3D COLS_ARG) _switches[COLS_ARG]++; + if (c =3D=3D 'e' || ind =3D=3D EXPORT_ARG) { + _switches[EXPORT_ARG]++; + _switches[COLS_ARG]++; + } if (c =3D=3D 'f' || ind =3D=3D FORCE_ARG) _switches[FORCE_ARG]++; if (c =3D=3D 'r' || ind =3D=3D READ_ONLY)