summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--profiles/package.mask6
-rw-r--r--sys-fs/lvm2/Manifest40
-rw-r--r--sys-fs/lvm2/files/1.02.22-dmeventd.initd21
-rw-r--r--sys-fs/lvm2/files/64-device-mapper.rules-1.02.22-r525
-rw-r--r--sys-fs/lvm2/files/64-device-mapper.rules-1.02.49-r226
-rw-r--r--sys-fs/lvm2/files/clvmd.confd-2.02.399
-rwxr-xr-xsys-fs/lvm2/files/clvmd.rc-2.02.28-r3126
-rwxr-xr-xsys-fs/lvm2/files/clvmd.rc-2.02.39147
-rw-r--r--sys-fs/lvm2/files/device-mapper.conf-1.02.22-r31
-rw-r--r--sys-fs/lvm2/files/device-mapper.rc-1.02.22-r324
-rw-r--r--sys-fs/lvm2/files/device-mapper.rc-1.02.51-r227
-rw-r--r--sys-fs/lvm2/files/dm-start.sh86
-rw-r--r--sys-fs/lvm2/files/dmtab12
-rw-r--r--sys-fs/lvm2/files/lvm.conf-2.02.33.patch89
-rw-r--r--sys-fs/lvm2/files/lvm.conf-2.02.36.patch89
-rw-r--r--sys-fs/lvm2/files/lvm.conf-2.02.45.patch79
-rw-r--r--sys-fs/lvm2/files/lvm.conf-2.02.51.patch79
-rw-r--r--sys-fs/lvm2/files/lvm.confd-2.02.28-r25
-rw-r--r--sys-fs/lvm2/files/lvm.rc-2.02.28-r229
-rw-r--r--sys-fs/lvm2/files/lvm.rc-2.02.51-r236
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.45-device-mapper-export-format.patch285
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.45-dmeventd.patch11
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.48-as-needed.patch188
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.48-device-mapper-export-format.patch306
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.48-fix-pkgconfig.patch45
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch386
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.51-as-needed.patch191
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.51-device-mapper-export-format.patch308
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.51-dmeventd-logfunc-fixes.patch33
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.51-dmsetup-selinux-linking-fix.patch19
-rw-r--r--sys-fs/lvm2/files/lvm2-2.02.51-fix-pvcreate.patch98
-rwxr-xr-xsys-fs/lvm2/files/lvm2-start.sh37
-rwxr-xr-xsys-fs/lvm2/files/lvm2-start.sh-2.02.28-r240
-rwxr-xr-xsys-fs/lvm2/files/lvm2-start.sh-2.02.49-r142
-rwxr-xr-xsys-fs/lvm2/files/lvm2-start.sh-2.02.49-r342
-rwxr-xr-xsys-fs/lvm2/files/lvm2-stop.sh61
-rwxr-xr-xsys-fs/lvm2/files/lvm2-stop.sh-2.02.28-r565
-rwxr-xr-xsys-fs/lvm2/files/lvm2-stop.sh-2.02.3765
-rwxr-xr-xsys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r167
-rwxr-xr-xsys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r367
-rw-r--r--sys-fs/lvm2/lvm2-2.02.51-r3.ebuild223
-rw-r--r--sys-fs/lvm2/metadata.xml24
42 files changed, 3538 insertions, 21 deletions
diff --git a/profiles/package.mask b/profiles/package.mask
index 01cc5d4..a43f633 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -1,4 +1,8 @@
->=sys-fs/lvm2-2.02.49
+=sys-fs/lvm2-2.02.49*
+=sys-fs/lvm2-2.02.50*
+=sys-fs/lvm2-2.02.51
+=sys-fs/lvm2-2.02.51-r1
+=sys-fs/lvm2-2.02.51-r2
=media-tv/mythtv-0.22_p22778
=media-tv/mythtv-0.22_p22772
diff --git a/sys-fs/lvm2/Manifest b/sys-fs/lvm2/Manifest
index ece5268..f6a0c11 100644
--- a/sys-fs/lvm2/Manifest
+++ b/sys-fs/lvm2/Manifest
@@ -1,21 +1,21 @@
-AUX 1.02.22-dmeventd.initd 536 RMD160 2f65a288b735035e6b2451c71ab432a525b19b3a SHA1 5413ad7eaf63a5e7c52f1b21138422f9e4fd6186 SHA256 c9dcee15ce55961e5df7928c350ae1c6db6e78c30d87f7fafa6ba4b016dd9191
+AUX 1.02.22-dmeventd.initd 534 RMD160 c1c4462c8bd3250b6cde672c1a5cb48abf58c79e SHA1 e205fae586728515ec3f94da6ec6195106ae8b99 SHA256 3b7d994a3c9497b93032d9502facb452dd956a5d27dc9bbbbe3481841c222e0d
AUX 64-device-mapper.rules-1.02.22-r5 1010 RMD160 3dbb70b60b0c86a77fb9d0e8a0a9cd16a7dd03cc SHA1 fec62b9d4357fe4160e3d017c103767b6c9bf232 SHA256 7c92c2ff3c8dee6588ac51f8367a7b4bcb31d42f2d306ed08ce01be809b9ffcd
AUX 64-device-mapper.rules-1.02.49-r2 1104 RMD160 61acc7a3f39313df82a82fd4062e8eb10ee384cf SHA1 c6c6fa203982fcfaf11b4c9e4e79c5dd19dda6c3 SHA256 8fb11cac5757f16f67a62e3ee6ec7d986ee77fa020da7589142ac7efd6d24ac2
AUX clvmd.confd-2.02.39 213 RMD160 d23f8acd6a844e05a3e0da83939513ef0dfab0d8 SHA1 546bfd48a7cfd7e7ffff07861f90e2b8ee29d436 SHA256 68442d5c9da81bad79fa6b1beaede290f24ea6a4e4415f3d9f4e37ccca6c524a
-AUX clvmd.rc-2.02.28-r3 3367 RMD160 eb09f9ef6d9402c9a22ab145ebb64db5f279adc7 SHA1 f15770f0919402f2fbbc7d8441ef3239e6178d0b SHA256 14c1c738b26869877a2bc74f0f8dd0ae4a764976823443db6f5575556285b519
-AUX clvmd.rc-2.02.39 3678 RMD160 50b5ffbf50486a4ca5640344f72e8814c47878db SHA1 7e9e933212e716869e4ba58880bdc526f577cd9b SHA256 9e5ee139b04fd7a691759b84e4d2986752259a4670f1c2f16acb013bf5713b44
+AUX clvmd.rc-2.02.28-r3 3363 RMD160 aba3400c9b41ff911e7372fef5637edd4269433e SHA1 4ecd2a0c654dd294a00183ad6d5c9056be9f0904 SHA256 48cd18b85c3acebb7efbbf1cc0c0d48cdb8ee9a208dd69fe4873f5c20e6b7e98
+AUX clvmd.rc-2.02.39 3674 RMD160 e9b145fbc2f8a57a57cc02a8b30520084d560a4e SHA1 4d6c52e996b17e75b86a35396ee039d22506f5be SHA256 814f24392696a8ed1656e093d78de18d47bbb0367b27c2a82982fdd0d8c19523
AUX device-mapper.conf-1.02.22-r3 15 RMD160 1954cbfeea6eeed764a6344039d9c1eb58f7b00a SHA1 0dd47dfb811946a11fbde987e2ce1e105ed7fafb SHA256 57777904f12a35617e5a4193c964ebb32396452487fd02353e71e16e7b46bc22
-AUX device-mapper.rc-1.02.22-r3 618 RMD160 c6d4c405ce381cc4c86c8e838ba25ddb64f4ac75 SHA1 92486f5a6f77b220e3d11589f12c458eaeeda0b1 SHA256 c682cfa6da469eed055bf6e6a88e2d48ecfa12be406cd857965ef08bb1ecdaf8
-AUX device-mapper.rc-1.02.51-r2 682 RMD160 bb8c80342447a30d29e79f890d1e0d4b56113cbf SHA1 834c89246dd0cf0fb70c09585106c14c71e730a1 SHA256 a5f635565aca8b0e4ebb02d987a8b75a85c1fe8068832ec88abbeb6afba8987f
-AUX dm-start.sh 2114 RMD160 96a6b824e22d5c04f2710f98cda5361bde6a265c SHA1 b18c79802ab8bac9befe4a32cce6fe13beb3134c SHA256 c064c3e2a1d128a6326b539a675f1a6cf88b75f5526222e232d53ea1468a9bcf
-AUX dmtab 416 RMD160 d5da257f9ac48af9e831dbd6591e608577d87717 SHA1 f37631cb644b8a242a0426375b1b6acee0bde399 SHA256 e2e22bbe13fb97ec9a68659daa275b1d22fd0a3fd21e76b1f4bfba504a8bd7b5
+AUX device-mapper.rc-1.02.22-r3 616 RMD160 be4634df5ff457638afe3bbe95025b0de9621708 SHA1 94157800949a0a5d2deac5a4f852c9fd51e4d846 SHA256 118470a37b2ffa11f49fee3fba6666e05610f6211e90add2366c87c6f4395114
+AUX device-mapper.rc-1.02.51-r2 681 RMD160 4cf33c5fca35dfda5fa345d4abb6d1582c6f7a7d SHA1 e9ae886d54df9933474c3f62d7c5322633f1d4db SHA256 fb90554e006e0e7172e45cda52105fb37dd113dcb074f66d85a4f371ad3abb82
+AUX dm-start.sh 2112 RMD160 1c035e04a5c279762f1df1ae4a34ed48c6e40ca8 SHA1 0844ef3f70196d0fb3cc22e5571e1bf47e7788ce SHA256 f69b21907797dd20af337b65d229fd1dd29ceb1ce4c67e2bc70f9ff0172b5923
+AUX dmtab 414 RMD160 ff82bb62673c997e2a0a7b0bccd40e256d993856 SHA1 575b64b516441d7384c53c13cb0df080607bc8fe SHA256 51a80c11a1692e290b60f8d9a9b1566df7a168b82de83a8c0fbccd50507bdc13
AUX lvm.conf-2.02.33.patch 3136 RMD160 c0292c39db064f0a4151ffccdc441be2fa78f8cf SHA1 8dbcbf66a841cc8acd889e174095df9932813a3e SHA256 63a8c21186f47979cb628970dca12df2a9f319745488a4d8a1e01f238a7fc711
AUX lvm.conf-2.02.36.patch 3118 RMD160 b19039d550cd81d46f77d493cb6c5507a3fd66ee SHA1 dd4f4892c4b423348a764c1373ed81959ca0772b SHA256 85abba15c2dc52af9d518140e210abba852df83deb7740a19be3987a64f677f9
AUX lvm.conf-2.02.45.patch 2657 RMD160 9f74ca92257162c978a690209878691fe13456b5 SHA1 9beccaa7933b9e53651b155bf6262229306e010f SHA256 f45a4ea427c38ca001ffd83eb73008b486d87ad8bf409d1e102a1eac386148d1
AUX lvm.conf-2.02.51.patch 2690 RMD160 1aa597d10ee928d4c209fe5beb01dd1ab4b99b35 SHA1 697407509b408d91af2dc3f98a9d9dcc82abe81d SHA256 c163e64d1b0914154b72730f67b1face04802e6e89534766eb79d72a34ef5e67
AUX lvm.confd-2.02.28-r2 173 RMD160 cf554372fa11df056e3757e5139fad6c7606a696 SHA1 e8186ebb91d12247d0865285dc62346d1cbc207a SHA256 28370c089c39c248d7ded0960b8d8a9256bada44d44c22ce3cec87d512ef6844
-AUX lvm.rc-2.02.28-r2 661 RMD160 3b267ab500785de249101548a15792708d3adc55 SHA1 b014a0d4344c58c963db20cefeb726dfd66d1b1a SHA256 962d9e8baa06a617671701d21f8a2849b45ab9baa6684b2e99b2b03192c9e66a
-AUX lvm.rc-2.02.51-r2 759 RMD160 23d931309ed71df30f17f0656c4d3ea5fd3f5564 SHA1 bd4a7e91e900715f5046669a7622925ad1556bc8 SHA256 d1ed3ffd62aca317608e15f25b6d4cc0fee61a880d61f7933aa9d5c46ce551fd
+AUX lvm.rc-2.02.28-r2 657 RMD160 eb5280023afa0db7f790222c90e3869d252db3ef SHA1 6082bc247d7fda09be6852411ea2ae027a69c834 SHA256 f64ae6195af1c20e559e94a576ca87c9ea4f98c74716d8078a770ad5deb05a7f
+AUX lvm.rc-2.02.51-r2 758 RMD160 23426aff60c57faba0b8c13b458004b37e594f30 SHA1 452f77996fc0c618bf5ccdb1eb76fb5323d9724b SHA256 8bb7c9e3c5458b557b5b47dc7902ef78aa72346940f365a57a537e50e1949c2b
AUX lvm2-2.02.45-device-mapper-export-format.patch 10323 RMD160 d36a0d80add1ea812cc7f4828aa4a71b0accff78 SHA1 29e5b230ce7562dee59cd61068a8faa6684518fe SHA256 563103fc0fa4c2a35a9adf94332f0502f36fd85e408916b7be7e3503121cc1d0
AUX lvm2-2.02.45-dmeventd.patch 457 RMD160 280708918c33db4614d825e6c9f1909aa3f52a62 SHA1 3c3e17919d369457947944d428508a94049d3787 SHA256 1b275c4321c20227af6a758f962dfd2f14d2f25a65f9b74e9d43f93d3a6bf37e
AUX lvm2-2.02.48-as-needed.patch 7894 RMD160 d44bc76d5f83249af6401c81d7a21082022446c8 SHA1 07b850f41425cd1505259d54de3daf9cdb3cf259 SHA256 8e23f75f9e51f1c94bcba4a4a87534146baa6e992f38f86552e8688091cfbc09
@@ -27,16 +27,16 @@ AUX lvm2-2.02.51-device-mapper-export-format.patch 11318 RMD160 f194ef2dd9105ba3
AUX lvm2-2.02.51-dmeventd-logfunc-fixes.patch 1472 RMD160 b2331c6ce870f638412bd1f18e1ebd9178ac6a6c SHA1 e7009876c554a3dc58affe4048cc27c84821f9e1 SHA256 5e285de865090085e6b6216a32f7e5c3d321d54e3781fcc18f59de046efee85f
AUX lvm2-2.02.51-dmsetup-selinux-linking-fix.patch 651 RMD160 34198b5959435ff37e6e0971737ee3e07a8b73b5 SHA1 ef46356219a4cc5d650846a45402b2dbf67d80a7 SHA256 5644b786cda599da2b3522d95d476ab105cee37e9418e43fbeb6dc029b300e9b
AUX lvm2-2.02.51-fix-pvcreate.patch 3140 RMD160 c707cc280a893350a90c1258b0d73c154283738c SHA1 34c16b3a930ae2ab66ca3ea5b47ce19317de51d7 SHA256 7564a9ac374f53e3991f76967f1462709afa9661de4d2c6ff232f71d3d7b446f
-AUX lvm2-start.sh 1025 RMD160 fa27385e4640d59c33f2ca42db9d38f80def3977 SHA1 83a86ff292192b3f62e4686b70bbbfcc39158b53 SHA256 8c7da13b6326a383888110b25f53a4902cbec7d0dace274b9c5f1d6b0a775039
-AUX lvm2-start.sh-2.02.28-r2 1180 RMD160 3ec85899a19c56d4d49e4654e1b05f53bc7d9c93 SHA1 80fce53cc1925990fbb103e57314b3c1740de6ed SHA256 a891855ed04d4c59f17fc0b19dc61813a4ca3cc183166867606d92cb58498460
-AUX lvm2-start.sh-2.02.49-r1 1200 RMD160 b88e37e7e228fecdedf359c1132723077a3d4c94 SHA1 85eb83a83c598b3ea405ec4c597a9c77364e7fb4 SHA256 94d15b5dbeabb275b4d91b284b3113cd812b7e7c90ec3018693803b3e91d9535
-AUX lvm2-start.sh-2.02.49-r3 1244 RMD160 26916bf97b553ee19ebb5bacf2ee754cc5695ea7 SHA1 c5d9fa10089efd28e0dc0fb101ed90f0e6124f0a SHA256 e9c72d8500294301131183b37a7060dbcbd1d01b2a3e8425cf644e07652fae87
-AUX lvm2-stop.sh 1939 RMD160 52d1adbf4bdbe6e75e9ff2e91c809b6eed5839d5 SHA1 8ccf316b02fb5f79bb6c0464cc3c1606704cec7b SHA256 94a34e0b149ac43f5f1042c45ebdbaa69ac83bcbea7f894c15ab59aad65cb22c
-AUX lvm2-stop.sh-2.02.28-r5 2055 RMD160 54ad47b7e48b651f1909df5e5b68440ebeb6d9f2 SHA1 07a85433d5a5d7295e781a8261f9265d050fe963 SHA256 3dd704eef9f7bd0cd97fc0afdb384c1d6e6163144c6c79b00f2dd8d27877f574
-AUX lvm2-stop.sh-2.02.37 2060 RMD160 1cd419f466c58382c852257878ab6bbbdd0061f9 SHA1 b487acbf219171afee029562f3b71188ca876dfc SHA256 e295acf3b53e00d6e868607ac422bbb196843165885a8f37323bfff4d147fa42
-AUX lvm2-stop.sh-2.02.49-r1 2169 RMD160 81048d1db521e8660bbbddbf43d72f572fb8cb7f SHA1 0684c7bb7b6f26eda9cf79b01869e380c0b66ae6 SHA256 6d60daab486896cbf6f52b4f792717bcc8418d3fd9b3335e4cb2e28a888c02d6
-AUX lvm2-stop.sh-2.02.49-r3 2253 RMD160 7b00d83fb35125f73349c49af765c1e7409de35a SHA1 e4f61120506e11f4a063ccf10bab2e495194d379 SHA256 dea23f37d232437b15c743ca23af3d7baa95f2b7c71ac1e47ae5289bdcfe0a56
+AUX lvm2-start.sh 1022 RMD160 f6e8ed2e19f00c23e6b02e33f743c30f7b3a353d SHA1 6b5aecf3e3a8b828c6718a794cca7eca21a744f8 SHA256 82f0e548f1ede226cced60e288b16ed6fade2f63184a4804b01d8b66df7af136
+AUX lvm2-start.sh-2.02.28-r2 1176 RMD160 e567e03f4d6e42e27dec01400b0a64d76a25dcf2 SHA1 551590f4726e14a6be283717d6a94bb923c1bc34 SHA256 f32f984770d11dd6b8e1a86e2463e6dd4d1002efac2862d1aac5a90f543f59b5
+AUX lvm2-start.sh-2.02.49-r1 1196 RMD160 aa7e21a975f771b89e5fae760096babd6b5026e6 SHA1 0208f0c6db524f3f9a8017114170f8523f1ef0d6 SHA256 aa27baab0a8cef45c9c864db6c36af0db280ab02d16d7a3e659cf9590307fbc1
+AUX lvm2-start.sh-2.02.49-r3 1240 RMD160 8d63871f8fc0fa600f2ec44778565374e323b79e SHA1 6dd5bebe631aaa646fdb5034cbb18b277e81a3d9 SHA256 16f21d0322d7dc87d1caaa0ade47a2223c627a04e65f869434912ce9bac2e016
+AUX lvm2-stop.sh 1936 RMD160 1b6e782adbb5e725b5bfc0f7a41f7b8c22838acf SHA1 bf1aba7bc8067f35ad98477965fa6b4446bf5163 SHA256 25d64a21f8b252a88118dc62c5822d03e4bb6286999021d4ed75b2bd85cd3cdd
+AUX lvm2-stop.sh-2.02.28-r5 2052 RMD160 c162619aeefbe9c3f57ebd7b8acdf8c3b1b45028 SHA1 0d9d8abd88b800f96d489d7b84448e84e9dea5a8 SHA256 68d0f530a988a832406ebc22879ce63bb18e7f34567aedfb5ad97f2f1e1b1efe
+AUX lvm2-stop.sh-2.02.37 2056 RMD160 143fd66f8a6e8342b7fa3c793b4c9cbcc18330ac SHA1 49bde4e6c3e59bbaa2263b125f546af061d08ffc SHA256 aa1bcd9b89691a3d70c2d673f381a146dc2210e10f59731ebc0acee9b66930f8
+AUX lvm2-stop.sh-2.02.49-r1 2165 RMD160 323dbe6c273bd53c44a0a75821d206bc7cc9802c SHA1 6c9ed02b59db5e5b854ede3bca3c9ad136f7c782 SHA256 720620ab6c0407f31d919bbc2637af61ca8237413f29a7234c2401a776288b90
+AUX lvm2-stop.sh-2.02.49-r3 2249 RMD160 65a59d208d78096799c7c44b5cc8709ae4cfb512 SHA1 97165b8e9ca21e1f8060cdb587c6b0cfa687bbfc SHA256 5f432de075367d80cbdde22b8ca06bd86468a9a047611a1165bd15d331a68f99
DIST LVM2.2.02.51.tgz 790458 RMD160 7ca55e29c6d780b4b052b07eeabbd731a034721f SHA1 307281dfced6b5ab5904761a41c6a6775a511172 SHA256 7d88ebb1e74e46617f226c1ca987e337aa30c3f637c7a502e8f355096f36a4df
-EBUILD lvm2-2.02.51-r3.ebuild 6684 RMD160 2729f3bfa74e262a8449ed3caed199604573d047 SHA1 9644fd14bf9a551bcaa53cd01239c72e12c020c9 SHA256 b51980d1d313e2a699291b5a921399150e195af2af570fab3988caae7dee42c2
-MISC ChangeLog 31137 RMD160 fcc6f23ff68c3d795b865b3fafe653acfc8192df SHA1 4943587402bb49e162ce1febdd821f80ae6396b7 SHA256 0e89d5b85e40b12ef995f21bdff011fe44765c143148cb692c31575d5e32bb17
+EBUILD lvm2-2.02.51-r3.ebuild 6680 RMD160 06cd95ac3583506c4e269a1e17b2d1cfe13cac81 SHA1 2e188a427674be99f3ac738d785bfe799b11249b SHA256 c2930f20782eee000a9c774dda3d8b39eebaddca22b456d57112bf0647c25b8f
+MISC ChangeLog 31131 RMD160 39558b4db988edd6d33e7ed1b67365b1058d4a80 SHA1 844e103dc2d303a97693c0328c62a62c0f53fbf5 SHA256 6218e6dd11a4f68775e594d66cd17409b4e1fb1123b292f4cee10c143a2f2fd7
MISC metadata.xml 792 RMD160 f60db9169ee273ca2f97fa5e69d4e5329e988164 SHA1 42f85f30477c65a164a11e172db7e250f442dca5 SHA256 87ced5a3a6102985f7c2a619dd52f65e62ae916f8921c8e7115a25452cd44b7f
diff --git a/sys-fs/lvm2/files/1.02.22-dmeventd.initd b/sys-fs/lvm2/files/1.02.22-dmeventd.initd
new file mode 100644
index 0000000..de33ec3
--- /dev/null
+++ b/sys-fs/lvm2/files/1.02.22-dmeventd.initd
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/1.02.22-dmeventd.initd,v 1.1 2009-11-17 21:23:15 randomdan 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/lvm2/files/64-device-mapper.rules-1.02.22-r5 b/sys-fs/lvm2/files/64-device-mapper.rules-1.02.22-r5
new file mode 100644
index 0000000..36c085b
--- /dev/null
+++ b/sys-fs/lvm2/files/64-device-mapper.rules-1.02.22-r5
@@ -0,0 +1,25 @@
+# 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/lvm2/files/64-device-mapper.rules-1.02.49-r2 b/sys-fs/lvm2/files/64-device-mapper.rules-1.02.49-r2
new file mode 100644
index 0000000..b6b2c88
--- /dev/null
+++ b/sys-fs/lvm2/files/64-device-mapper.rules-1.02.49-r2
@@ -0,0 +1,26 @@
+# 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}", OPTIONS+="string_escape=replace"
+ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace"
+
+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}="/sbin/blkid -o udev -p $tempnode"
+OPTIONS+="link_priority=-100"
+OPTIONS+="watch"
+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/lvm2/files/clvmd.confd-2.02.39 b/sys-fs/lvm2/files/clvmd.confd-2.02.39
new file mode 100644
index 0000000..5782170
--- /dev/null
+++ b/sys-fs/lvm2/files/clvmd.confd-2.02.39
@@ -0,0 +1,9 @@
+# CLVMD_CLUSTER_TIMEOUT -- amount of time to wait for cluster quorum.
+
+CLVMD_CLUSTER_TIMEOUT=30
+
+
+# CLVMD_NODES_TIMEOUT -- amount of time to wait for the other nodes to
+# join the cluster.
+
+CLVMD_NODES_TIMEOUT=60
diff --git a/sys-fs/lvm2/files/clvmd.rc-2.02.28-r3 b/sys-fs/lvm2/files/clvmd.rc-2.02.28-r3
new file mode 100755
index 0000000..3e55102
--- /dev/null
+++ b/sys-fs/lvm2/files/clvmd.rc-2.02.28-r3
@@ -0,0 +1,126 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/clvmd.rc-2.02.28-r3,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+depend() {
+ use dns logger
+ use net
+ need cluster-manager cluster-locking-manager fenced
+}
+
+exefile=/sbin/clvmd
+
+umount_gfs_filesystems() {
+ local sig retry
+ local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
+
+ if [ -n "${remaining}" ]
+ then
+ sig=
+ retry=3
+ while [ -n "${remaining}" -a "${retry}" -gt 0 ]
+ do
+ if [ "${retry}" -lt 3 ]
+ then
+ ebegin "Unmounting GFS filesystems (retry)"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems this retry"
+ else
+ ebegin "Unmounting GFS filesystems"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems"
+ fi
+ remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
+ [ -z "${remaining}" ] && break
+ /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
+ sleep 5
+ retry=$((${retry} -1))
+ sig=-9
+ done
+ fi
+}
+
+
+
+start() {
+ if [ -e /proc/modules -a ! -e /dev/device-mapper ] ; then
+ ebegin "Loading device-mapper module"
+ modprobe -q dm-mod
+ eend $?
+ fi
+ if [ ! -e /dev/device-mapper ]; then
+ eerror "device-mapper not available!"
+ exit 1
+ fi
+
+ ebegin "Starting clvmd"
+ start-stop-daemon --start --quiet --exec ${exefile}
+ rc=$?
+ eend $rc
+
+ ebegin "Scanning LVM volumes"
+ /sbin/vgscan &>/dev/null
+ rc=$?
+ eend $rc
+
+ if [ "$rc" -eq 0 ] && [ -x /sbin/vgchange ] && [ -d /etc/lvm ]
+ then
+ ebegin "Setting up the Logical Volume Manager"
+ /sbin/vgchange -aly >/dev/null
+ eend $? "Failed to setup the LVM"
+ fi
+
+}
+
+stop() {
+ # umount GFS filesystems
+ umount_gfs_filesystems
+
+ # This sucks majorly. We need to find a way to only take out the CLUSTER
+ # VGs and LVs, and never the local ones.
+ einfo "Shutting down the Logical Volume Manager"
+
+ LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|awk '{print $3}'|sort|xargs echo`
+ VOLUME_GROUPS=`vgdisplay |grep "VG Name"|awk '{print $3}'|sort|xargs echo`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ lvchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|awk '{print $3}'|xargs echo`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ vgchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+
+ ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'`
+ if [ ! ${ROOT_DEVICE} = ${x} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+
+ ebegin "Stopping clvmd"
+ start-stop-daemon --stop --quiet --exec ${exefile}
+ eend $?
+}
diff --git a/sys-fs/lvm2/files/clvmd.rc-2.02.39 b/sys-fs/lvm2/files/clvmd.rc-2.02.39
new file mode 100755
index 0000000..e911a8c
--- /dev/null
+++ b/sys-fs/lvm2/files/clvmd.rc-2.02.39
@@ -0,0 +1,147 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/clvmd.rc-2.02.39,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+[ -x /usr/sbin/clvmd ] && CLVMD_BIN="/usr/sbin/clvmd" || CLVMD_BIN="/sbin/clvmd"
+
+[ -z "$CLVMD_CLUSTER_TIMEOUT" ] && CLVMD_CLUSTER_TIMEOUT=30
+[ -n "$CLVMD_NODES_TIMEOUT" ] || CLVMD_NODES_TIMEOUT=60
+
+VGCHANGE="/sbin/vgchange"
+VGSCAN="/sbin/vgscan"
+VGDISPLAY="/sbin/vgdisplay"
+CLVMD_PIDFILE="/var/run/clvmd.pid"
+
+depend() {
+ use dns logger
+ use net
+ need cman
+}
+
+load_modules() {
+ local module modules
+ modules=$1
+
+ for module in ${modules}; do
+ ebegin "Loading ${module} kernel module"
+ modprobe ${module}
+ eend $? "Failed to load ${module} kernel module"
+ done
+}
+
+unload_modules() {
+ local module modules
+ modules=$1
+
+ for module in ${modules}; do
+ ebegin "Unloading ${module} kernel module"
+ modprobe -r ${module}
+ eend $? "Failed to unload ${module} kernel module"
+ done
+}
+
+umount_gfs_filesystems() {
+ local sig retry
+ local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
+
+ if [ -n "${remaining}" ]
+ then
+ sig=
+ retry=3
+ while [ -n "${remaining}" -a "${retry}" -gt 0 ]
+ do
+ if [ "${retry}" -lt 3 ]
+ then
+ ebegin "Unmounting GFS filesystems (retry)"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems this retry"
+ else
+ ebegin "Unmounting GFS filesystems"
+ umount ${remaining} &>/dev/null
+ eend $? "Failed to unmount GFS filesystems"
+ fi
+ remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
+ [ -z "${remaining}" ] && break
+ /bin/fuser -k -m ${sig} ${remaining} &>/dev/null
+ sleep 5
+ retry=$((${retry} -1))
+ sig=-9
+ done
+ fi
+}
+
+
+start_volumes() {
+ ebegin "Scanning LVM volumes"
+ $VGSCAN > /dev/null 2>&1
+ eend $?
+
+ ret=$?
+ if [ "$ret" -eq 5 ]
+ then
+ einfo " Waiting for other nodes to join the cluster ($CLVMD_NODES_TIMEOUT seconds)"
+ fi
+
+ clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
+ for vg in $clustervgs; do
+ ebegin " Activating Clustered VG: ${vg} "
+
+ wait=0
+ while [ -n "$($VGCHANGE -a y ${vg} 2>&1 |grep "clvmd not running")" ]; do
+ if [ $wait -lt $CLVMD_NODES_TIMEOUT ]; then
+ sleep 3
+ wait=$(($wait + 3))
+ else
+ eend 1
+ fi
+ done
+ eend 0
+ done
+}
+
+stop_volumes() {
+ # Deactivate only clustered volumes
+ clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
+ for vg in $clustervgs; do
+ ebegin " Shutting Down Clustered VG: ${vg} "
+ $VGCHANGE -anl ${vg} >/dev/null
+ eend $?
+ done
+}
+
+
+start() {
+ local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/{modules,devices})
+
+ if [ -z "${module}" ]; then
+ load_modules "dm-mod"
+ sleep 1s
+ fi
+
+ ebegin "Starting clvmd ($CLVMD_CLUSTER_TIMEOUT seconds)"
+
+ start-stop-daemon --start --quiet --exec ${CLVMD_BIN} -- -T ${CLVMD_CLUSTER_TIMEOUT}
+ eend $?
+
+ start_volumes
+}
+
+stop() {
+
+ # umount GFS filesystems
+ umount_gfs_filesystems
+
+ #stop_volumes
+
+ ebegin "Stopping clvmd"
+ #start-stop-daemon --stop -s TERM --quiet --exec ${CLVMD_BIN} --name clvmd
+ killall -TERM ${CLVMD_BIN} >/dev/null
+ eend $?
+
+ #local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/modules)
+
+ #if [[ "$?" -eq 0 && ! -z "${module}" ]]; then
+ # unload_modules "dm-mod"
+ #fi
+}
diff --git a/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3 b/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3
new file mode 100644
index 0000000..bc7a251
--- /dev/null
+++ b/sys-fs/lvm2/files/device-mapper.conf-1.02.22-r3
@@ -0,0 +1 @@
+RC_AFTER="lvm"
diff --git a/sys-fs/lvm2/files/device-mapper.rc-1.02.22-r3 b/sys-fs/lvm2/files/device-mapper.rc-1.02.22-r3
new file mode 100644
index 0000000..92f1de0
--- /dev/null
+++ b/sys-fs/lvm2/files/device-mapper.rc-1.02.22-r3
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/device-mapper.rc-1.02.22-r3,v 1.1 2009-11-17 21:23:15 randomdan 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/lvm2/files/device-mapper.rc-1.02.51-r2 b/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2
new file mode 100644
index 0000000..b76a929
--- /dev/null
+++ b/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2
@@ -0,0 +1,27 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/device-mapper.rc-1.02.51-r2,v 1.1 2009-11-17 21:23:15 randomdan 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
+
+ local f=/lib/rcscripts/addons/dm-start.sh
+ if [ -r "$f" ]; then
+ ( . "$f" )
+ fi
+}
+
diff --git a/sys-fs/lvm2/files/dm-start.sh b/sys-fs/lvm2/files/dm-start.sh
new file mode 100644
index 0000000..c4aece2
--- /dev/null
+++ b/sys-fs/lvm2/files/dm-start.sh
@@ -0,0 +1,86 @@
+# /lib/rcscripts/addons/dm-start.sh: Setup DM volumes at boot
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/dm-start.sh,v 1.1 2009-11-17 21:23:15 randomdan 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/lvm2/files/dmtab b/sys-fs/lvm2/files/dmtab
new file mode 100644
index 0000000..5fbbb38
--- /dev/null
+++ b/sys-fs/lvm2/files/dmtab
@@ -0,0 +1,12 @@
+#/etc/dmraid: config file for adding device-mapper volumes at boot
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/dmtab,v 1.1 2009-11-17 21:23:15 randomdan 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.
+
diff --git a/sys-fs/lvm2/files/lvm.conf-2.02.33.patch b/sys-fs/lvm2/files/lvm.conf-2.02.33.patch
new file mode 100644
index 0000000..dd80f8b
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.conf-2.02.33.patch
@@ -0,0 +1,89 @@
+diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.33.orig/doc/example.conf LVM2.2.02.33/doc/example.conf
+--- LVM2.2.02.33.orig/doc/example.conf 2008-01-09 07:32:19.000000000 -0800
++++ LVM2.2.02.33/doc/example.conf 2008-02-06 17:39:20.439958042 -0800
+@@ -49,7 +49,9 @@
+
+
+ # By default we accept every block device:
+- filter = [ "a/.*/" ]
++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
++ # noise when you probed while not available.
++ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "r|/dev/cdrom|" ]
+@@ -85,7 +87,7 @@
+ # If sysfs is mounted (2.6 kernels) restrict device scanning to
+ # the block devices it believes are valid.
+ # 1 enables; 0 disables.
+- sysfs_scan = 1
++ sysfs_scan = 1
+
+ # By default, LVM2 will ignore devices used as components of
+ # software RAID (md) devices by looking for md superblocks.
+@@ -218,12 +220,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 = 0
++ # Gentoo: the LVM tools are a seperate package.
++ fallback_to_lvm1 = 0
+
+ # 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 = "lvm1"
++ # Gentoo: default to LVM2 format
++ format = "lvm2"
+
+ # Location of proc filesystem
+ proc = "/proc"
+@@ -350,12 +354,12 @@
+
+ # 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
+ # when running pvcreate on new PVs which are to be added to large VGs.
+-
+- # pvmetadatacopies = 1
++ # Gentoo: enabled for data safety
++ pvmetadatacopies = 2
+
+ # Approximate default size of on-disk metadata areas in sectors.
+ # You should increase this if you have large volume groups or
+@@ -377,11 +381,11 @@
+ # the supplied toolset to make changes (e.g. vgcfgrestore).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+-#}
++}
+
+ # 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
+@@ -389,7 +393,7 @@
+ # reconfigures a mirror as necessary. If no mirror library is
+ # provided, mirrors are not monitored through dmeventd.
+
+- # mirror_library = "libdevmapper-event-lvm2mirror.so"
++ mirror_library = "libdevmapper-event-lvm2mirror.so"
+
+ # snapshot_library is the library used when monitoring a snapshot device.
+ #
+@@ -398,6 +402,6 @@
+ # snapshot exceedes 80%. The warning is repeated when 85%, 90% and
+ # 95% of the snapshot are filled.
+
+- # snapshot_library = "libdevmapper-event-lvm2snapshot.so"
+-#}
++ snapshot_library = "libdevmapper-event-lvm2snapshot.so"
++}
+
diff --git a/sys-fs/lvm2/files/lvm.conf-2.02.36.patch b/sys-fs/lvm2/files/lvm.conf-2.02.36.patch
new file mode 100644
index 0000000..98ac3c1
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.conf-2.02.36.patch
@@ -0,0 +1,89 @@
+diff -Nuar --exclude '*.orig' LVM2.2.02.36.orig/doc/example.conf LVM2.2.02.36/doc/example.conf
+--- LVM2.2.02.36.orig/doc/example.conf 2008-04-10 11:50:37.000000000 -0700
++++ LVM2.2.02.36/doc/example.conf 2008-04-29 23:45:08.165059223 -0700
+@@ -50,7 +50,9 @@
+
+
+ # By default we accept every block device:
+- filter = [ "a/.*/" ]
++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
++ # noise when you probed while not available.
++ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "r|/dev/cdrom|" ]
+@@ -86,7 +88,7 @@
+ # If sysfs is mounted (2.6 kernels) restrict device scanning to
+ # the block devices it believes are valid.
+ # 1 enables; 0 disables.
+- sysfs_scan = 1
++ sysfs_scan = 1
+
+ # By default, LVM2 will ignore devices used as components of
+ # software RAID (md) devices by looking for md superblocks.
+@@ -219,12 +221,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 = 0
++ # Gentoo: the LVM tools are a seperate package.
++ fallback_to_lvm1 = 0
+
+ # 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 = "lvm1"
++ # Gentoo: default to LVM2 format
++ format = "lvm2"
+
+ # Location of proc filesystem
+ proc = "/proc"
+@@ -351,12 +355,12 @@
+
+ # 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
+ # when running pvcreate on new PVs which are to be added to large VGs.
+-
+- # pvmetadatacopies = 1
++ # Gentoo: enabled for data safety
++ pvmetadatacopies = 2
+
+ # Approximate default size of on-disk metadata areas in sectors.
+ # You should increase this if you have large volume groups or
+@@ -378,11 +382,11 @@
+ # the supplied toolset to make changes (e.g. vgcfgrestore).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+-#}
++}
+
+ # 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
+@@ -390,7 +394,7 @@
+ # reconfigures a mirror as necessary. If no mirror library is
+ # provided, mirrors are not monitored through dmeventd.
+
+- # mirror_library = "libdevmapper-event-lvm2mirror.so"
++ mirror_library = "libdevmapper-event-lvm2mirror.so"
+
+ # snapshot_library is the library used when monitoring a snapshot device.
+ #
+@@ -399,6 +403,6 @@
+ # snapshot exceedes 80%. The warning is repeated when 85%, 90% and
+ # 95% of the snapshot are filled.
+
+- # snapshot_library = "libdevmapper-event-lvm2snapshot.so"
+-#}
++ snapshot_library = "libdevmapper-event-lvm2snapshot.so"
++}
+
diff --git a/sys-fs/lvm2/files/lvm.conf-2.02.45.patch b/sys-fs/lvm2/files/lvm.conf-2.02.45.patch
new file mode 100644
index 0000000..0bd98bc
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.conf-2.02.45.patch
@@ -0,0 +1,79 @@
+--- 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 @@
+
+
+ # By default we accept every block device:
+- filter = [ "a/.*/" ]
++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
++ # noise when you probed while not available.
++ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "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 = 0
++ # Gentoo: the LVM tools are a seperate package.
++ fallback_to_lvm1 = 0
+
+ # 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 = "lvm1"
++ # Gentoo: default to LVM2 format
++ format = "lvm2"
+
+ # Location of proc filesystem
+ proc = "/proc"
+@@ -364,12 +368,12 @@
+
+ # 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
+ # when running pvcreate on new PVs which are to be added to large VGs.
+-
+- # pvmetadatacopies = 1
++ # Gentoo: enabled for data safety
++ pvmetadatacopies = 2
+
+ # 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).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+-#}
++}
+
+ # 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.
+
+- # mirror_library = "libdevmapper-event-lvm2mirror.so"
++ mirror_library = "libdevmapper-event-lvm2mirror.so"
+
+ # snapshot_library is the library used when monitoring a snapshot device.
+ #
+@@ -412,6 +416,6 @@
+ # snapshot exceedes 80%. The warning is repeated when 85%, 90% and
+ # 95% of the snapshot are filled.
+
+- # snapshot_library = "libdevmapper-event-lvm2snapshot.so"
+-#}
++ snapshot_library = "libdevmapper-event-lvm2snapshot.so"
++}
+
diff --git a/sys-fs/lvm2/files/lvm.conf-2.02.51.patch b/sys-fs/lvm2/files/lvm.conf-2.02.51.patch
new file mode 100644
index 0000000..25e95ae
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.conf-2.02.51.patch
@@ -0,0 +1,79 @@
+--- 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 @@
+
+
+ # By default we accept every block device:
+- filter = [ "a/.*/" ]
++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
++ # noise when you probed while not available.
++ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "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 = 0
++ # Gentoo: the LVM tools are a seperate package.
++ fallback_to_lvm1 = 0
+
+ # 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 = "lvm1"
++ # Gentoo: default to LVM2 format
++ format = "lvm2"
+
+ # Location of proc filesystem
+ proc = "/proc"
+@@ -364,12 +368,12 @@
+
+ # 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
+ # when running pvcreate on new PVs which are to be added to large VGs.
+-
+- # pvmetadatacopies = 1
++ # Gentoo: enable for data safety, but PV resize is then disabled.
++ #pvmetadatacopies = 2
+
+ # 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).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+-#}
++}
+
+ # 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.
+
+- # mirror_library = "libdevmapper-event-lvm2mirror.so"
++ mirror_library = "libdevmapper-event-lvm2mirror.so"
+
+ # snapshot_library is the library used when monitoring a snapshot device.
+ #
+@@ -412,6 +416,6 @@
+ # snapshot exceedes 80%. The warning is repeated when 85%, 90% and
+ # 95% of the snapshot are filled.
+
+- # snapshot_library = "libdevmapper-event-lvm2snapshot.so"
+-#}
++ snapshot_library = "libdevmapper-event-lvm2snapshot.so"
++}
+
diff --git a/sys-fs/lvm2/files/lvm.confd-2.02.28-r2 b/sys-fs/lvm2/files/lvm.confd-2.02.28-r2
new file mode 100644
index 0000000..2fbd866
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.confd-2.02.28-r2
@@ -0,0 +1,5 @@
+# LVM should normally only be started after mdraid is available
+# this is because LVM physical volumes are very often MD devices.
+RC_AFTER="mdraid"
+
+# vim: ft=gentoo-conf-d
diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.28-r2 b/sys-fs/lvm2/files/lvm.rc-2.02.28-r2
new file mode 100644
index 0000000..8f4d727
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.rc-2.02.28-r2
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm.rc-2.02.28-r2,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+depend() {
+ if [ -f /etc/init.d/sysfs ]; then
+ # on baselayout-1 this causes
+ # dependency-cycles with checkroot (before *)
+ before checkfs fsck
+ after modules device-mapper
+ fi
+}
+
+start() {
+ if [ ! -f /etc/init.d/sysfs ]; 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 lvm
+}
+
+stop() {
+ stop_addon lvm
+}
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.51-r2 b/sys-fs/lvm2/files/lvm.rc-2.02.51-r2
new file mode 100644
index 0000000..ac0a697
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm.rc-2.02.51-r2
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm.rc-2.02.51-r2,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+depend() {
+ if [ -f /etc/init.d/sysfs ]; then
+ # on baselayout-1 this causes
+ # dependency-cycles with checkroot (before *)
+ before checkfs fsck
+ after modules device-mapper
+ fi
+}
+
+run_addon() {
+ local f=/lib/rcscripts/addons/$1.sh
+ if [ -r "$f" ]; then
+ ( . "$f" )
+ fi
+}
+
+start() {
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+
+ run_addon lvm-start
+}
+
+stop() {
+ run_addon lvm-stop
+}
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-2.02.45-device-mapper-export-format.patch b/sys-fs/lvm2/files/lvm2-2.02.45-device-mapper-export-format.patch
new file mode 100644
index 0000000..6f541d4
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.45-device-mapper-export-format.patch
@@ -0,0 +1,285 @@
+--- tools/dmsetup.c 2008-06-24 15:53:47.000000000 -0700
++++ tools/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, &params);
++ 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, &params);
++ 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
+--- libdm/libdevmapper.h 2008-06-24 15:53:48.000000000 -0700
++++ libdm/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
+--- libdm/libdm-report.c 2008-06-24 17:10:36.000000000 -0700
++++ libdm/libdm-report.c 2008-06-28 01:56:39.778466634 -0700
+@@ -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/lvm2/files/lvm2-2.02.45-dmeventd.patch b/sys-fs/lvm2/files/lvm2-2.02.45-dmeventd.patch
new file mode 100644
index 0000000..f8b5dad
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.45-dmeventd.patch
@@ -0,0 +1,11 @@
+--- daemons/dmeventd/Makefile.in 2009-03-22 04:01:26.754802410 -0400
++++ daemons/dmeventd/Makefile.in.new 2009-03-22 04:01:14.693689634 -0400
+@@ -42,7 +42,7 @@
+ LDFLAGS += -ldl -ldevmapper -lpthread
+ CLDFLAGS += -ldl -ldevmapper -lpthread
+
+-dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o
++dmeventd: $(LIB_SHARED) $(LIB_STATIC) $(VERSIONED_SHLIB) dmeventd.o
+ $(CC) -o $@ dmeventd.o $(CFLAGS) $(LDFLAGS) \
+ -L. -ldevmapper-event $(LIBS) -rdynamic
+
diff --git a/sys-fs/lvm2/files/lvm2-2.02.48-as-needed.patch b/sys-fs/lvm2/files/lvm2-2.02.48-as-needed.patch
new file mode 100644
index 0000000..2089beb
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.48-as-needed.patch
@@ -0,0 +1,188 @@
+Compile-fix with --as-needed.
+
+To ensure correct output when --as-needed are in the linker flags, the order of
+flags to the linker (directly or via the compiler) must explictly only include
+libraries and objects AFTER all compiler flags, linker flags and linker
+directory arguments.
+
+X-Gentoo-Bug: #217644
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+Signed-off-by: Christian Ruppert (idl0r) <idl0r@gentoo.org>
+
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/daemons/clogd/Makefile LVM2.2.02.48/daemons/clogd/Makefile
+--- LVM2.2.02.48.orig/daemons/clogd/Makefile 2009-01-08 09:12:33.000000000 -0800
++++ LVM2.2.02.48/daemons/clogd/Makefile 2009-07-05 14:33:03.799446085 -0700
+@@ -45,12 +45,12 @@ LDFLAGS += $(shell if [ -e /usr/lib64/op
+ else \
+ echo '-L/usr/lib/openais -L/usr/lib'; \
+ fi)
+-LDFLAGS += -lcpg -lSaCkpt -lext2fs
++LIBS += -lcpg -lSaCkpt -lext2fs
+
+ all: ${TARGET}
+
+ clogd: ${SOURCES}
+- ${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
++ ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $^
+
+ no_clogd_kernel_headers:
+ echo "Unable to find clogd kernel headers"
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/daemons/clvmd/Makefile.in LVM2.2.02.48/daemons/clvmd/Makefile.in
+--- LVM2.2.02.48.orig/daemons/clvmd/Makefile.in 2009-03-10 05:10:12.000000000 -0700
++++ LVM2.2.02.48/daemons/clvmd/Makefile.in 2009-07-05 14:41:22.633723993 -0700
+@@ -101,7 +101,7 @@ INSTALL_TARGETS = \
+ install_clvmd
+
+ clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a
+- $(CC) -o clvmd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \
++ $(CC) $(CFLAGS) $(LDFLAGS) -o clvmd $(OBJECTS) \
+ $(LVMLIBS) $(LMLIBS) $(LIBS)
+
+ .PHONY: install_clvmd
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/daemons/dmeventd/Makefile.in LVM2.2.02.48/daemons/dmeventd/Makefile.in
+--- LVM2.2.02.48.orig/daemons/dmeventd/Makefile.in 2009-07-05 14:32:41.000000000 -0700
++++ LVM2.2.02.48/daemons/dmeventd/Makefile.in 2009-07-05 14:40:43.094941107 -0700
+@@ -41,12 +41,12 @@ include $(top_srcdir)/make.tmpl
+ all: dmeventd
+ device-mapper: dmeventd $(LIB_STATIC)
+
+-LDFLAGS += -ldl -ldevmapper -lpthread
+-CLDFLAGS += -ldl -ldevmapper -lpthread
++LIBS += -ldl -ldevmapper -lpthread
+
+ 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
+
+ .PHONY: install_dynamic install_static install_include \
+ install_pkgconfig install_dmeventd
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/daemons/dmeventd/plugins/mirror/Makefile.in LVM2.2.02.48/daemons/dmeventd/plugins/mirror/Makefile.in
+--- LVM2.2.02.48.orig/daemons/dmeventd/plugins/mirror/Makefile.in 2009-05-11 03:28:46.000000000 -0700
++++ LVM2.2.02.48/daemons/dmeventd/plugins/mirror/Makefile.in 2009-07-05 14:33:03.801620744 -0700
+@@ -17,7 +17,8 @@ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+
+ INCLUDES += -I${top_srcdir}/tools
+-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
++CLDFLAGS += -L${top_srcdir}/tools
++LIBS += -ldevmapper -lpthread @LVM2CMD_LIB@
+
+ SOURCES = dmeventd_mirror.c
+
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/daemons/dmeventd/plugins/snapshot/Makefile.in LVM2.2.02.48/daemons/dmeventd/plugins/snapshot/Makefile.in
+--- LVM2.2.02.48.orig/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-05-11 03:28:46.000000000 -0700
++++ LVM2.2.02.48/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-07-05 14:33:03.801620744 -0700
+@@ -17,7 +17,8 @@ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+
+ INCLUDES += -I${top_srcdir}/tools
+-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
++CLDFLAGS += -L${top_srcdir}/tools
++LIBS += -lpthread -ldevmapper @LVM2CMD_LIB@
+
+ SOURCES = dmeventd_snapshot.c
+
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/lib/Makefile.in LVM2.2.02.48/lib/Makefile.in
+--- LVM2.2.02.48.orig/lib/Makefile.in 2009-07-17 11:16:40.572301218 +0200
++++ LVM2.2.02.48/lib/Makefile.in 2009-07-17 11:17:55.035551029 +0200
+@@ -137,7 +137,8 @@ ifeq ("@HAVE_LIBDL@", "yes")
+ endif
+
+ ifeq ("@DMEVENTD@", "yes")
+- CLDFLAGS += -ldevmapper-event
++ CLDFLAGS += -L../daemons/dmeventd
++ LIBS += -ldevmapper-event
+ endif
+
+ LIB_NAME = liblvm-internal
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/make.tmpl.in LVM2.2.02.48/make.tmpl.in
+--- LVM2.2.02.48.orig/make.tmpl.in 2009-05-11 03:28:45.000000000 -0700
++++ LVM2.2.02.48/make.tmpl.in 2009-07-05 14:33:03.801620744 -0700
+@@ -28,7 +28,7 @@ GENHTML = @GENHTML@
+ LN_S = @LN_S@
+ SED = @SED@
+
+-LIBS = @LIBS@
++LIBS += @LIBS@ $(LVMLIBS) $(LMLIBS)
+ DEFS += @DEFS@
+ CFLAGS += @CFLAGS@
+ CLDFLAGS += @CLDFLAGS@
+@@ -203,19 +203,19 @@ $(TARGETS): $(OBJECTS)
+ 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
+
+ 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
+
+ %.so: %.a
+ $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
+- $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \
+- @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@
++ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) -o $@ \
++ @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ $(LIBS)
+
+ $(LIB_STATIC): $(OBJECTS)
+ $(RM) $@
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/test/api/Makefile.in LVM2.2.02.48/test/api/Makefile.in
+--- LVM2.2.02.48.orig/test/api/Makefile.in 2009-05-22 07:45:00.000000000 -0700
++++ LVM2.2.02.48/test/api/Makefile.in 2009-07-05 14:39:19.353146953 -0700
+@@ -36,5 +36,5 @@ LDFLAGS = -L$(top_srcdir)/libdm -L$(top_
+ CLDFLAGS = -L$(top_srcdir)/libdm -L$(top_srcdir)/liblvm
+
+ test: $(OBJECTS) $(top_srcdir)/liblvm/liblvm2app.so $(top_srcdir)/libdm/libdevmapper.so
+- $(CC) -o test $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o test $(OBJECTS) $(LVMLIBS) $(LIBS)
+
+diff -Nuarp --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/tools/Makefile.in LVM2.2.02.48/tools/Makefile.in
+--- LVM2.2.02.48.orig/tools/Makefile.in 2009-07-17 11:16:40.579301663 +0200
++++ LVM2.2.02.48/tools/Makefile.in 2009-07-21 19:27:05.526972872 +0200
+@@ -106,24 +106,29 @@ include $(top_srcdir)/make.tmpl
+ device-mapper: $(TARGETS_DM)
+
+ 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)
+
+ 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)
+
+ all: device-mapper
+
+ 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
+
+ LIB_PTHREAD = @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) -rdynamic
++ $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacedir) \
++ -o $@ $(OBJECTS) lvm-static.o \
++ $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
+
+ liblvm2cmd.a: $(top_srcdir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
+ cat $(top_srcdir)/lib/liblvm-internal.a > $@ \ No newline at end of file
diff --git a/sys-fs/lvm2/files/lvm2-2.02.48-device-mapper-export-format.patch b/sys-fs/lvm2/files/lvm2-2.02.48-device-mapper-export-format.patch
new file mode 100644
index 0000000..6e73d41
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.48-device-mapper-export-format.patch
@@ -0,0 +1,306 @@
+Add support for exporting the device-mapper table to userspace.
+
+Original patch written by Matthias Schwarzott <zzam@gentoo.org>, in response 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 <robbat2@gentoo.org>
+
+diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/libdm/libdevmapper.h LVM2.2.02.48/libdm/libdevmapper.h
+--- LVM2.2.02.48.orig/libdm/libdevmapper.h 2009-06-17 13:55:24.000000000 -0700
++++ LVM2.2.02.48/libdm/libdevmapper.h 2009-07-05 14:16:14.331690820 -0700
+@@ -953,6 +953,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' LVM2.2.02.48.orig/libdm/libdm-report.c LVM2.2.02.48/libdm/libdm-report.c
+--- LVM2.2.02.48.orig/libdm/libdm-report.c 2009-02-09 01:45:49.000000000 -0800
++++ LVM2.2.02.48/libdm/libdm-report.c 2009-07-05 14:16:14.331690820 -0700
+@@ -891,6 +891,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))) {
+@@ -921,6 +923,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 -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.48.orig/tools/dmsetup.c LVM2.2.02.48/tools/dmsetup.c
+--- LVM2.2.02.48.orig/tools/dmsetup.c 2009-06-03 13:44:49.000000000 -0700
++++ LVM2.2.02.48/tools/dmsetup.c 2009-07-05 14:22:41.972149507 -0700
+@@ -107,6 +107,7 @@
+ enum {
+ READ_ONLY = 0,
+ COLS_ARG,
++ EXPORT_ARG,
+ EXEC_ARG,
+ FORCE_ARG,
+ GID_ARG,
+@@ -142,7 +143,8 @@
+ DR_INFO = 2,
+ DR_DEPS = 4,
+ DR_TREE = 8, /* Complete dependency tree required */
+- DR_NAME = 16
++ DR_NAME = 16,
++ DR_TABLE = 0x20, /* table is required, not just info */
+ } report_type_t;
+
+ static int _switches[NUM_SWITCHES];
+@@ -1217,8 +1219,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;
+@@ -1682,6 +1689,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,
+@@ -1793,6 +1810,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, &params);
++ 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, &params);
++ 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)
+@@ -2057,6 +2134,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 },
+ };
+
+@@ -2076,6 +2154,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.")
+@@ -2086,6 +2165,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.")
+@@ -2093,6 +2177,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.")
+
+ 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.")
+@@ -2109,14 +2194,16 @@
+ #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 const char *splitname_report_options = "vg_name,lv_name,lv_layer";
+
+ 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;
+@@ -2146,6 +2233,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];
+@@ -2197,6 +2293,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)))
+@@ -2276,7 +2375,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);
+@@ -2532,7 +2632,7 @@
+ show_all++;
+ if (c == 'd')
+ delete++;
+- if (c == 'e')
++ if (c == 'E')
+ encrypt_loop++;
+ if (c == 'f')
+ find++;
+@@ -2627,6 +2727,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},
+@@ -2709,12 +2810,16 @@
+
+ optarg = 0;
+ optind = OPTIND_INIT;
+- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:O:ru:U:v",
++ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefG:j:m:M:no:O:ru:U:v",
+ 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 --git a/sys-fs/lvm2/files/lvm2-2.02.48-fix-pkgconfig.patch b/sys-fs/lvm2/files/lvm2-2.02.48-fix-pkgconfig.patch
new file mode 100644
index 0000000..10d923b
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.48-fix-pkgconfig.patch
@@ -0,0 +1,45 @@
+libdevmapper.so doesn't link to SELinux libraries unless SELinux is enabled.
+Adding those libraries to Libs.private unconditionally is wrong.
+
+See bug 270350
+---
+--- LVM2.2.02.48/configure.in
++++ LVM2.2.02.48/configure.in
+@@ -558,18 +558,19 @@
+ if test x$HAVE_SEPOL = xyes; then
+ AC_DEFINE([HAVE_SEPOL], 1,
+ [Define to 1 if sepol_check_context is available.])
+- LIBS="-lsepol $LIBS"
++ SELINUX_LIBS="-lsepol $SELINUX_LIBS"
+ fi
+
+ AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no)
+
+ if test x$HAVE_SELINUX = xyes; then
+ AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
+- LIBS="-lselinux $LIBS"
++ SELINUX_LIBS="-lselinux $SELINUX_LIBS"
+ else
+ AC_MSG_WARN(Disabling selinux)
+ fi
+
++ LIBS="$SELINUX_LIBS $LIBS"
+ # With --enable-static_link and selinux enabled, linking
+ # fails on at least Debian unstable due to unsatisfied references
+ # to pthread_mutex_lock and _unlock. See if we need -lpthread.
+@@ -813,6 +814,7 @@
+ AC_SUBST(POOL)
+ AC_SUBST(QUORUM_CFLAGS)
+ AC_SUBST(QUORUM_LIBS)
++AC_SUBST(SELINUX_LIBS)
+ AC_SUBST(SNAPSHOTS)
+ AC_SUBST(STATICDIR)
+ AC_SUBST(STATIC_LINK)
+--- LVM2.2.02.48/libdm/libdevmapper.pc.in
++++ LVM2.2.02.48/libdm/libdevmapper.pc.in
+@@ -8,4 +8,4 @@
+ Version: @DM_LIB_PATCHLEVEL@
+ Cflags: -I${includedir}
+ Libs: -L${libdir} -ldevmapper
+-Libs.private: -lselinux -lsepol
++Libs.private: @SELINUX_LIBS@
diff --git a/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch b/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch
new file mode 100644
index 0000000..12fc065
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch
@@ -0,0 +1,386 @@
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/file_locking.c LVM2.2.02.49/lib/locking/file_locking.c
+--- LVM2.2.02.49.orig/lib/locking/file_locking.c 2008-11-12 01:30:52.000000000 -0800
++++ LVM2.2.02.49/lib/locking/file_locking.c 2009-07-23 17:39:10.021993262 -0700
+@@ -271,17 +271,22 @@ static int _file_lock_resource(struct cm
+ return 1;
+ }
+
+-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd)
++int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir)
+ {
+ locking->lock_resource = _file_lock_resource;
+ locking->reset_locking = _reset_file_locking;
+ locking->fin_locking = _fin_file_locking;
+ locking->flags = 0;
+
+- /* Get lockfile directory from config file */
+- strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir",
+- DEFAULT_LOCK_DIR),
+- sizeof(_lock_dir));
++ if(lock_dir) {
++ /* Get lockfile directory from commandline */
++ strncpy(_lock_dir, lock_dir, sizeof(_lock_dir));
++ } else {
++ /* Get lockfile directory from config file */
++ strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir",
++ DEFAULT_LOCK_DIR),
++ sizeof(_lock_dir));
++ }
+
+ if (!dm_create_dir(_lock_dir))
+ return 0;
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking.c LVM2.2.02.49/lib/locking/locking.c
+--- LVM2.2.02.49.orig/lib/locking/locking.c 2009-07-14 22:49:47.000000000 -0700
++++ LVM2.2.02.49/lib/locking/locking.c 2009-07-23 17:32:53.558509986 -0700
+@@ -213,7 +213,7 @@ static void _update_vg_lock_count(const
+ * Select a locking type
+ * type: locking type; if < 0, then read config tree value
+ */
+-int init_locking(int type, struct cmd_context *cmd)
++int init_locking(int type, struct cmd_context *cmd, const char *lock_dir)
+ {
+ if (type < 0)
+ type = find_config_tree_int(cmd, "global/locking_type", 1);
+@@ -228,7 +228,7 @@ int init_locking(int type, struct cmd_co
+
+ case 1:
+ log_very_verbose("File-based locking selected.");
+- if (!init_file_locking(&_locking, cmd))
++ if (!init_file_locking(&_locking, cmd, lock_dir))
+ break;
+ return 1;
+
+@@ -268,7 +268,7 @@ int init_locking(int type, struct cmd_co
+ log_warn("WARNING: Falling back to local file-based locking.");
+ log_warn("Volume Groups with the clustered attribute will "
+ "be inaccessible.");
+- if (init_file_locking(&_locking, cmd))
++ if (init_file_locking(&_locking, cmd, lock_dir))
+ return 1;
+ }
+
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking.h LVM2.2.02.49/lib/locking/locking.h
+--- LVM2.2.02.49.orig/lib/locking/locking.h 2009-06-12 01:30:19.000000000 -0700
++++ LVM2.2.02.49/lib/locking/locking.h 2009-07-23 17:31:49.638555398 -0700
+@@ -19,7 +19,7 @@
+ #include "uuid.h"
+ #include "config.h"
+
+-int init_locking(int type, struct cmd_context *cmd);
++int init_locking(int type, struct cmd_context *cmd, const char *lock_dir);
+ void fin_locking(void);
+ void reset_locking(void);
+ int vg_write_lock_held(void);
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking_types.h LVM2.2.02.49/lib/locking/locking_types.h
+--- LVM2.2.02.49.orig/lib/locking/locking_types.h 2009-07-14 22:57:11.000000000 -0700
++++ LVM2.2.02.49/lib/locking/locking_types.h 2009-07-23 17:37:58.598009804 -0700
+@@ -42,7 +42,7 @@ int init_no_locking(struct locking_type
+
+ int init_readonly_locking(struct locking_type *locking, struct cmd_context *cmd);
+
+-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd);
++int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir);
+
+ int init_external_locking(struct locking_type *locking, struct cmd_context *cmd);
+
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/liblvm/lvm_base.c LVM2.2.02.49/liblvm/lvm_base.c
+--- LVM2.2.02.49.orig/liblvm/lvm_base.c 2009-07-13 20:01:18.000000000 -0700
++++ LVM2.2.02.49/liblvm/lvm_base.c 2009-07-23 17:38:09.830509799 -0700
+@@ -39,7 +39,7 @@ lvm_t lvm_create(const char *system_dir)
+
+ /* FIXME: locking_type config option needed? */
+ /* initialize locking */
+- if (!init_locking(-1, cmd)) {
++ if (!init_locking(-1, cmd, NULL)) {
+ /* FIXME: use EAGAIN as error code here */
+ log_error("Locking initialisation failed.");
+ lvm_destroy((lvm_t) cmd);
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/args.h LVM2.2.02.49/tools/args.h
+--- LVM2.2.02.49.orig/tools/args.h 2009-06-04 05:01:16.000000000 -0700
++++ LVM2.2.02.49/tools/args.h 2009-07-23 17:30:36.680664586 -0700
+@@ -22,6 +22,7 @@ arg(version_ARG, '\0', "version", NULL,
+ arg(quiet_ARG, '\0', "quiet", NULL, 0)
+ arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
+ arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
++arg(lock_dir_ARG, '\0', "lock-dir", string_arg, 0)
+ arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
+ arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg, 0)
+ arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/commands.h LVM2.2.02.49/tools/commands.h
+--- LVM2.2.02.49.orig/tools/commands.h 2009-07-06 12:13:26.000000000 -0700
++++ LVM2.2.02.49/tools/commands.h 2009-07-23 17:30:36.680664586 -0700
+@@ -70,6 +70,7 @@ xx(lvchange,
+ "\t[-f|--force]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--ignoremonitoring]\n"
+ "\t[--monitor {y|n}]\n"
+ "\t[-M|--persistent y|n] [--major major] [--minor minor]\n"
+@@ -85,7 +86,7 @@ xx(lvchange,
+ "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
+
+ alloc_ARG, autobackup_ARG, available_ARG, contiguous_ARG, force_ARG,
+- ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
++ ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
+ monitor_ARG, partial_ARG, permission_ARG, persistent_ARG, readahead_ARG,
+ resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, yes_ARG)
+
+@@ -185,6 +186,7 @@ xx(lvdisplay,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[-m|--maps]\n"
+ "\t[--nosuffix]\n"
+ "\t[-P|--partial] " "\n"
+@@ -199,6 +201,7 @@ xx(lvdisplay,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+]Field[,Field]]\n"
+@@ -213,7 +216,7 @@ xx(lvdisplay,
+ "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
+
+ aligned_ARG, all_ARG, colon_ARG, columns_ARG, disk_ARG,
+- ignorelockingfailure_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG,
++ ignorelockingfailure_ARG, lock_dir_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG,
+ options_ARG, sort_ARG, partial_ARG, segments_ARG, separator_ARG,
+ unbuffered_ARG, units_ARG)
+
+@@ -373,6 +376,7 @@ xx(lvs,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+@@ -390,7 +394,7 @@ xx(lvs,
+ "\t[--version]" "\n"
+ "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
+
+- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG,
+ unbuffered_ARG, units_ARG, unquoted_ARG)
+@@ -404,11 +408,12 @@ xx(lvscan,
+ "\t[-d|--debug] " "\n"
+ "\t[-h|-?|--help] " "\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[-P|--partial] " "\n"
+ "\t[-v|--verbose] " "\n"
+ "\t[--version]\n",
+
+- all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, partial_ARG)
++ all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG)
+
+ xx(pvchange,
+ "Change attributes of physical volume(s)",
+@@ -510,6 +515,7 @@ xx(pvdisplay,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[-m|--maps]\n"
+ "\t[--nosuffix]\n"
+ "\t[-s|--short]\n"
+@@ -524,6 +530,7 @@ xx(pvdisplay,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+]Field[,Field]]\n"
+@@ -535,7 +542,7 @@ xx(pvdisplay,
+ "\t[--version]" "\n"
+ "\t[PhysicalVolumePath [PhysicalVolumePath...]]\n",
+
+- aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG,
++ aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, lock_dir_ARG,
+ maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, separator_ARG,
+ short_ARG, sort_ARG, unbuffered_ARG, units_ARG)
+
+@@ -585,6 +592,7 @@ xx(pvs,
+ "\t[-d|--debug]" "\n"
+ "\t[-h|-?|--help] " "\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+@@ -602,7 +610,7 @@ xx(pvs,
+ "\t[--version]\n"
+ "\t[PhysicalVolume [PhysicalVolume...]]\n",
+
+- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG,
+ unbuffered_ARG, units_ARG, unquoted_ARG)
+@@ -615,13 +623,14 @@ xx(pvscan,
+ "\t{-e|--exported | -n|--novolumegroup} " "\n"
+ "\t[-h|-?|--help]" "\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[-P|--partial] " "\n"
+ "\t[-s|--short] " "\n"
+ "\t[-u|--uuid] " "\n"
+ "\t[-v|--verbose] " "\n"
+ "\t[--version]\n",
+
+- exported_ARG, ignorelockingfailure_ARG, novolumegroup_ARG, partial_ARG,
++ exported_ARG, ignorelockingfailure_ARG, lock_dir_ARG, novolumegroup_ARG, partial_ARG,
+ short_ARG, uuid_ARG)
+
+ xx(segtypes,
+@@ -637,12 +646,13 @@ xx(vgcfgbackup,
+ "\t[-f|--file filename] " "\n"
+ "\t[-h|-?|--help] " "\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[-P|--partial] " "\n"
+ "\t[-v|--verbose]" "\n"
+ "\t[--version] " "\n"
+ "\t[VolumeGroupName...]\n",
+
+- file_ARG, ignorelockingfailure_ARG, partial_ARG)
++ file_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG)
+
+ xx(vgcfgrestore,
+ "Restore volume group configuration",
+@@ -671,6 +681,7 @@ xx(vgchange,
+ "\t[-d|--debug] " "\n"
+ "\t[-h|--help] " "\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--ignoremonitoring]\n"
+ "\t[--monitor {y|n}]\n"
+ "\t[--refresh]\n"
+@@ -689,7 +700,7 @@ xx(vgchange,
+ "\t[VolumeGroupName...]\n",
+
+ addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, available_ARG,
+- clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG,
++ clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG,
+ logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, partial_ARG,
+ physicalextentsize_ARG, refresh_ARG, resizeable_ARG, resizable_ARG,
+ test_ARG, uuid_ARG)
+@@ -752,6 +763,7 @@ xx(vgdisplay,
+ "\t[-d|--debug] " "\n"
+ "\t[-h|--help] " "\n"
+ "\t[--ignorelockingfailure]" "\n"
++ "\t[--lock-dir path]\n"
+ "\t[--nosuffix]\n"
+ "\t[-P|--partial] " "\n"
+ "\t[--units hsbkmgtHKMGT]\n"
+@@ -764,6 +776,7 @@ xx(vgdisplay,
+ "\t[-d|--debug] " "\n"
+ "\t[-h|--help] " "\n"
+ "\t[--ignorelockingfailure]" "\n"
++ "\t[--lock-dir path]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+]Field[,Field]]\n"
+@@ -777,7 +790,7 @@ xx(vgdisplay,
+ "\t[VolumeGroupName [VolumeGroupName...]]\n",
+
+ activevolumegroups_ARG, aligned_ARG, colon_ARG, columns_ARG, disk_ARG,
+- ignorelockingfailure_ARG, noheadings_ARG, nosuffix_ARG, options_ARG,
++ ignorelockingfailure_ARG, lock_dir_ARG, noheadings_ARG, nosuffix_ARG, options_ARG,
+ partial_ARG, short_ARG, separator_ARG, sort_ARG, unbuffered_ARG, units_ARG)
+
+ xx(vgexport,
+@@ -844,12 +857,13 @@ xx(vgmknodes,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--refresh]\n"
+ "\t[-v|--verbose]\n"
+ "\t[--version]" "\n"
+ "\t[VolumeGroupName...]\n",
+
+- ignorelockingfailure_ARG, refresh_ARG)
++ ignorelockingfailure_ARG, lock_dir_ARG, refresh_ARG)
+
+ xx(vgreduce,
+ "Remove physical volume(s) from a volume group",
+@@ -909,6 +923,7 @@ xx(vgs,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+@@ -925,7 +940,7 @@ xx(vgs,
+ "\t[--version]\n"
+ "\t[VolumeGroupName [VolumeGroupName...]]\n",
+
+- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ rows_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG,
+ unquoted_ARG)
+@@ -937,12 +952,13 @@ xx(vgscan,
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--ignorelockingfailure]\n"
++ "\t[--lock-dir path]\n"
+ "\t[--mknodes]\n"
+ "\t[-P|--partial] " "\n"
+ "\t[-v|--verbose]\n"
+ "\t[--version]" "\n",
+
+- ignorelockingfailure_ARG, mknodes_ARG, partial_ARG)
++ ignorelockingfailure_ARG, lock_dir_ARG, mknodes_ARG, partial_ARG)
+
+ xx(vgsplit,
+ "Move physical volumes into a new or existing volume group",
+diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/lvmcmdline.c LVM2.2.02.49/tools/lvmcmdline.c
+--- LVM2.2.02.49.orig/tools/lvmcmdline.c 2009-07-13 12:49:49.000000000 -0700
++++ LVM2.2.02.49/tools/lvmcmdline.c 2009-07-23 17:37:30.774058849 -0700
+@@ -964,6 +964,7 @@ int lvm_run_command(struct cmd_context *
+ {
+ int ret = 0;
+ int locking_type;
++ const char *lock_dir;
+
+ init_error_message_produced(0);
+
+@@ -1015,7 +1016,12 @@ int lvm_run_command(struct cmd_context *
+ else
+ locking_type = -1;
+
+- if (!init_locking(locking_type, cmd)) {
++ if(arg_count(cmd, lock_dir_ARG)) {
++ /* Get lockfile directory from commandline */
++ lock_dir = arg_str_value(cmd, lock_dir_ARG, "");
++ }
++
++ if (!init_locking(locking_type, cmd, lock_dir)) {
+ log_error("Locking type %d initialisation failed.",
+ locking_type);
+ ret = ECMD_FAILED;
+diff -Nuarp LVM2.2.02.49.orig/man/lvm.8.in LVM2.2.02.49/man/lvm.8.in
+--- LVM2.2.02.49.orig/man/lvm.8.in 2009-05-14 09:46:13.000000000 -0700
++++ LVM2.2.02.49/man/lvm.8.in 2009-07-24 15:48:14.768492371 -0700
+@@ -202,6 +202,11 @@ This lets you proceed with read-only met
+ One use for this is in a system init script if the lock directory
+ is mounted read-only when the script runs.
+ .TP
++\fB--lock-dir\fP
++This lets you override the directory used for lockfiles, as an alternative to
++entirely overriding locking failures. One use for this is in a system init script
++where parts of the system are still read-only.
++.TP
+ \fB--addtag tag\fP
+ Add the tag \fBtag\fP to a PV, VG or LV.
+ A tag is a word that can be used to group LVM2 objects of the same type
diff --git a/sys-fs/lvm2/files/lvm2-2.02.51-as-needed.patch b/sys-fs/lvm2/files/lvm2-2.02.51-as-needed.patch
new file mode 100644
index 0000000..371ef48
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.51-as-needed.patch
@@ -0,0 +1,191 @@
+Compile-fix with --as-needed.
+
+To ensure correct output when --as-needed are in the linker flags, the order of
+flags to the linker (directly or via the compiler) must explictly only include
+libraries and objects AFTER all compiler flags, linker flags and linker
+directory arguments.
+
+X-Gentoo-Bug: #217644
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+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.000000000 +0000
++++ LVM2.2.02.51/daemons/clogd/Makefile 2009-08-27 00:09:53.215521890 +0000
+@@ -45,12 +45,12 @@
+ else \
+ echo '-L/usr/lib/openais -L/usr/lib -L/lib'; \
+ fi)
+-LDFLAGS += -lcpg -lSaCkpt -lext2fs -ldevmapper
++LIBS += -lcpg -lSaCkpt -lext2fs -ldevmapper
+
+ all: ${TARGET}
+
+ clogd: ${SOURCES}
+- ${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
++ ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LIBS}
+
+ 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.000000000 +0000
++++ LVM2.2.02.51/daemons/clvmd/Makefile.in 2009-08-27 00:06:20.642231272 +0000
+@@ -101,7 +101,7 @@
+ install_clvmd
+
+ clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a
+- $(CC) -o clvmd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \
++ $(CC) $(CFLAGS) $(LDFLAGS) -o clvmd $(OBJECTS) \
+ $(LVMLIBS) $(LMLIBS) $(LIBS)
+
+ .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.805552570 +0000
++++ LVM2.2.02.51/daemons/dmeventd/Makefile.in 2009-08-27 00:06:20.642231272 +0000
+@@ -41,12 +41,12 @@
+ all: dmeventd
+ device-mapper: dmeventd $(LIB_STATIC)
+
+-LDFLAGS += -ldl -ldevmapper -lpthread
+-CLDFLAGS += -ldl -ldevmapper -lpthread
++LIBS += -ldl -ldevmapper -lpthread
+
+ 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
+
+ .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/plugins/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 00:06:20.642231272 +0000
+@@ -17,7 +17,8 @@
+ VPATH = @srcdir@
+
+ INCLUDES += -I${top_srcdir}/tools
+-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
++CLDFLAGS += -L${top_srcdir}/tools
++LIBS += -ldevmapper -lpthread @LVM2CMD_LIB@
+
+ SOURCES = dmeventd_mirror.c
+
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/dmeventd/plugins/snapshot/Makefile.in LVM2.2.02.51/daemons/dmeventd/plugins/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 = @srcdir@
+
+ INCLUDES += -I${top_srcdir}/tools
+-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
++CLDFLAGS += -L${top_srcdir}/tools
++LIBS += -lpthread -ldevmapper @LVM2CMD_LIB@
+
+ SOURCES = dmeventd_snapshot.c
+
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/lib/Makefile.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
+
+ ifeq ("@DMEVENTD@", "yes")
+- CLDFLAGS += -ldevmapper-event
++ CLDFLAGS += -L../daemons/dmeventd
++ LIBS += -ldevmapper-event
+ endif
+
+ LIB_NAME = liblvm-internal
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/make.tmpl.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 = @LN_S@
+ SED = @SED@
+
+-LIBS = @LIBS@
++LIBS += @LIBS@ $(LVMLIBS) $(LMLIBS)
+ DEFS += @DEFS@
+ CFLAGS += @CFLAGS@
+ CLDFLAGS += @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
+
+ 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
+
+ %.so: %.a
+ $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
+- $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \
+- @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@
++ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) -o $@ \
++ @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ $(LIBS)
+
+ $(LIB_STATIC): $(OBJECTS)
+ $(RM) $@
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/test/api/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 = $(test_OBJECTS) $(vgtest_OBJECTS)
+
+ test: $(test_OBJECTS) $(DEPLIBS)
+- $(CC) -o test $(test_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o test $(test_OBJECTS) $(LVMLIBS) $(LIBS)
+
+ vgtest: $(vgtest_OBJECTS) $(DEPLIBS)
+- $(CC) -o vgtest $(vgtest_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o vgtest $(vgtest_OBJECTS) $(LVMLIBS) $(LIBS)
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/tools/Makefile.in LVM2.2.02.51/tools/Makefile.in
+--- LVM2.2.02.51.orig/tools/Makefile.in 2009-05-21 11:11:29.000000000 +0000
++++ LVM2.2.02.51/tools/Makefile.in 2009-08-27 00:06:20.645583990 +0000
+@@ -106,24 +106,29 @@
+ device-mapper: $(TARGETS_DM)
+
+ 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)
+
+ 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)
+
+ all: device-mapper
+
+ 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
+
+ LIB_PTHREAD = @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) -rdynamic
++ $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacedir) \
++ -o $@ $(OBJECTS) lvm-static.o \
++ $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
+
+ liblvm2cmd.a: $(top_srcdir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
+ cat $(top_srcdir)/lib/liblvm-internal.a > $@
diff --git a/sys-fs/lvm2/files/lvm2-2.02.51-device-mapper-export-format.patch b/sys-fs/lvm2/files/lvm2-2.02.51-device-mapper-export-format.patch
new file mode 100644
index 0000000..661c490
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.51-device-mapper-export-format.patch
@@ -0,0 +1,308 @@
+Add support for exporting the device-mapper table to userspace.
+
+Original patch written by Matthias Schwarzott <zzam@gentoo.org>, in response 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 <robbat2@gentoo.org>
+Ported-from: lvm2-2.02.48-device-mapper-export-format.patch
+
+diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/libdm/libdevmapper.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
+
+ 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/libdm-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;
+
+ if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) {
+ if (!(field_id = strdup(rh->fields[field->props->field_num].id))) {
+@@ -921,6 +923,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 -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/tools/dmsetup.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 = 0,
+ COLS_ARG,
++ EXPORT_ARG,
+ EXEC_ARG,
+ FORCE_ARG,
+ GID_ARG,
+@@ -150,7 +151,8 @@
+ DR_INFO = 2,
+ DR_DEPS = 4,
+ DR_TREE = 8, /* Complete dependency tree required */
+- DR_NAME = 16
++ DR_NAME = 16,
++ DR_TABLE = 0x20, /* table is required, not just info */
+ } report_type_t;
+
+ static int _switches[NUM_SWITCHES];
+@@ -1383,8 +1385,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;
+@@ -1848,6 +1855,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,
+@@ -1959,6 +1976,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, &params);
++ 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, &params);
++ 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)
+@@ -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 },
+ };
+
+@@ -2242,6 +2320,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.")
+@@ -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", "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.")
+@@ -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_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.")
+
+ 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
+
+ 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 const char *splitname_report_options = "vg_name,lv_name,lv_layer";
+
+ 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;
+@@ -2312,6 +2399,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];
+@@ -2363,6 +2459,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)))
+@@ -2446,7 +2545,9 @@
+ " [-r|--readonly] [--noopencount] [--nolockfs]\n"
+ " [--noudevsync] [--readahead [+]<sectors>|auto|none]\n"
+ " [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n"
+- " [--nameprefixes] [--noheadings] [--separator <separator>]\n\n");
++ " [--nameprefixes] [--noheadings] [--separator <separator>]\n"
++ " [-e|--export]\n"
++ "\n");
+ for (i = 0; _commands[i].name; i++)
+ fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help);
+ fprintf(out, "\n<device> may be device name or -u <uuid> or "
+@@ -2701,7 +2802,7 @@
+ show_all++;
+ if (c == 'd')
+ delete++;
+- if (c == 'e')
++ if (c == 'E')
+ encrypt_loop++;
+ if (c == 'f')
+ find++;
+@@ -2796,6 +2897,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},
+@@ -2879,12 +2981,16 @@
+
+ optarg = 0;
+ optind = OPTIND_INIT;
+- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:O:ru:U:v",
++ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCefG:j:m:M:no:O:ru:U:v",
+ 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 --git a/sys-fs/lvm2/files/lvm2-2.02.51-dmeventd-logfunc-fixes.patch b/sys-fs/lvm2/files/lvm2-2.02.51-dmeventd-logfunc-fixes.patch
new file mode 100644
index 0000000..219fdf1
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.51-dmeventd-logfunc-fixes.patch
@@ -0,0 +1,33 @@
+diff -ur daemons/dmeventd/plugins/mirror/dmeventd_mirror.c daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+--- daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009-06-30 19:39:31.000000000 +0100
++++ daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009-11-17 21:01:01.932535235 +0000
+@@ -128,6 +128,7 @@
+
+ static void _temporary_log_fn(int level, const char *file __attribute((unused)),
+ int line __attribute((unused)),
++ int dm_err __attribute((unused)),
+ const char *format)
+ {
+ if (!strncmp(format, "WARNING: ", 9) && (level < 5))
+diff -ur daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
+--- daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c 2008-10-13 13:06:30.000000000 +0100
++++ daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c 2009-11-17 21:01:19.520632278 +0000
+@@ -57,6 +57,7 @@
+ static void _temporary_log_fn(int level,
+ const char *file __attribute((unused)),
+ int line __attribute((unused)),
++ int dm_err __attribute((unused)),
+ const char *format)
+ {
+ if (!strncmp(format, "WARNING: ", 9) && (level < 5))
+diff -ur tools/tools/lvm2cmd.h
+--- tools/lvm2cmd.h 2007-08-20 21:55:30.000000000 +0100
++++ tools/lvm2cmd.h 2009-11-17 20:59:29.840323142 +0000
+@@ -18,6 +18,7 @@
+
+ #ifndef _LVM_LOG_H
+ typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
++ int dmerr,
+ const char *message);
+ #endif
+
diff --git a/sys-fs/lvm2/files/lvm2-2.02.51-dmsetup-selinux-linking-fix.patch b/sys-fs/lvm2/files/lvm2-2.02.51-dmsetup-selinux-linking-fix.patch
new file mode 100644
index 0000000..5b8c0db
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.51-dmsetup-selinux-linking-fix.patch
@@ -0,0 +1,19 @@
+diff -Nuar LVM2.2.02.51.orig/tools/Makefile.in LVM2.2.02.51/tools/Makefile.in
+--- LVM2.2.02.51.orig/tools/Makefile.in 2009-11-09 21:31:21.785012413 +0000
++++ LVM2.2.02.51/tools/Makefile.in 2009-11-09 21:40:50.157475714 +0000
+@@ -109,13 +109,13 @@
+ $(CC) $(CFLAGS) $(LDFLAGS) \
+ -L$(top_srcdir)/libdm \
+ -o $@ dmsetup.o \
+- -ldevmapper $(LIB_PTHREAD)
++ -ldevmapper $(LIBS) $(LIB_PTHREAD)
+
+ dmsetup.static: dmsetup.o $(interfacedir)/libdevmapper.a
+ $(CC) $(CFLAGS) $(LDFLAGS) -static \
+ -L$(interfacedir) \
+ -o $@ dmsetup.o \
+- -ldevmapper $(LIB_PTHREAD)
++ -ldevmapper $(LIBS) $(LIB_PTHREAD)
+
+ all: device-mapper
+
diff --git a/sys-fs/lvm2/files/lvm2-2.02.51-fix-pvcreate.patch b/sys-fs/lvm2/files/lvm2-2.02.51-fix-pvcreate.patch
new file mode 100644
index 0000000..370ab6d
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.51-fix-pvcreate.patch
@@ -0,0 +1,98 @@
+Upstream patch:
+https://www.redhat.com/archives/lvm-devel/2009-August/msg00106.html
+
+# ===================================================================
+# RCS file: /cvs/lvm2/LVM2/WHATS_NEW,v
+# retrieving revision 1.1241
+# retrieving revision 1.1242
+# diff -u -r1.1241 -r1.1242
+# --- LVM2/WHATS_NEW 2009/08/13 17:16:38 1.1241
+# +++ LVM2/WHATS_NEW 2009/08/19 15:34:33 1.1242
+# @@ -1,5 +1,6 @@
+# Version 2.02.52 -
+# =================================
+# + Fix pvcreate on a partition (2.02.51).
+# Fix vgcfgrestore error paths when locking fails (2.02.49).
+# Added configure --enable-clogd to conditionally build the cluster log daemon.
+# Make lvchange --refresh only take a read lock on volume group.
+# ===================================================================
+# RCS file: /cvs/lvm2/LVM2/lib/device/dev-md.c,v
+# retrieving revision 1.18
+# retrieving revision 1.19
+diff -u -r1.18 -r1.19
+--- LVM2/lib/device/dev-md.c 2009/08/01 17:14:52 1.18
++++ LVM2/lib/device/dev-md.c 2009/08/19 15:34:43 1.19
+@@ -137,13 +137,15 @@
+ if (!sysfs_dir || !*sysfs_dir)
+ return ret;
+
+-check_md_major:
+- if (MAJOR(dev) != md_major()) {
+- if (get_primary_dev(sysfs_dir, blkdev, &dev))
+- goto check_md_major;
+- return ret;
++ if (MAJOR(dev) == blkext_major()) {
++ /* lookup parent MD device from blkext partition */
++ if (!get_primary_dev(sysfs_dir, blkdev, &dev))
++ return ret;
+ }
+
++ if (MAJOR(dev) != md_major())
++ return ret;
++
+ ret = dm_snprintf(path, size, "%s/dev/block/%d:%d/md/%s", sysfs_dir,
+ (int)MAJOR(dev), (int)MINOR(dev), attribute);
+ if (ret < 0) {
+===================================================================
+RCS file: /cvs/lvm2/LVM2/lib/filters/filter.c,v
+retrieving revision 1.48
+retrieving revision 1.49
+diff -u -r1.48 -r1.49
+--- LVM2/lib/filters/filter.c 2009/07/09 22:34:02 1.48
++++ LVM2/lib/filters/filter.c 2009/08/19 15:34:46 1.49
+@@ -38,6 +38,7 @@
+ } device_info_t;
+
+ static int _md_major = -1;
++static int _blkext_major = -1;
+ static int _device_mapper_major = -1;
+
+ int md_major(void)
+@@ -45,6 +46,11 @@
+ return _md_major;
+ }
+
++int blkext_major(void)
++{
++ return _blkext_major;
++}
++
+ /*
+ * Devices are only checked for partition tables if their minor number
+ * is a multiple of the number corresponding to their type below
+@@ -197,6 +203,10 @@
+ if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2)))
+ _md_major = line_maj;
+
++ /* Look for blkext device */
++ if (!strncmp("blkext", line + i, 6) && isspace(*(line + i + 6)))
++ _blkext_major = line_maj;
++
+ /* Look for device-mapper device */
+ /* FIXME Cope with multiple majors */
+ if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13)))
+===================================================================
+RCS file: /cvs/lvm2/LVM2/lib/filters/filter.h,v
+retrieving revision 1.15
+retrieving revision 1.16
+diff -u -r1.15 -r1.16
+--- LVM2/lib/filters/filter.h 2007/08/20 20:55:25 1.15
++++ LVM2/lib/filters/filter.h 2009/08/19 15:34:46 1.16
+@@ -36,6 +36,7 @@
+ void lvm_type_filter_destroy(struct dev_filter *f);
+
+ int md_major(void);
++int blkext_major(void);
+ int max_partitions(int major);
+
+ #endif
diff --git a/sys-fs/lvm2/files/lvm2-start.sh b/sys-fs/lvm2/files/lvm2-start.sh
new file mode 100755
index 0000000..7e75fbf
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-start.sh
@@ -0,0 +1,37 @@
+# /lib/rcscripts/addons/lvm-start.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-start.sh,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+dm_in_proc() {
+ local retval=0
+ for x in devices misc ; do
+ grep -qs 'device-mapper' /proc/${x}
+ retval=$((${retval} + $?))
+ done
+ return ${retval}
+}
+
+# LVM support for /usr, /home, /opt ....
+# This should be done *before* checking local
+# volumes, or they never get checked.
+
+# NOTE: Add needed modules for LVM or RAID, etc
+# to /etc/modules.autoload if needed
+if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then
+ if [ -e /proc/modules ] && ! dm_in_proc ; then
+ modprobe dm-mod 2>/dev/null
+ fi
+
+ if [ -d /proc/lvm ] || dm_in_proc ; then
+ ebegin "Setting up the Logical Volume Manager"
+ #still echo stderr for debugging
+ /sbin/vgscan --mknodes --ignorelockingfailure >/dev/null
+ if [ -x /sbin/vgchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ]
+ then
+ /sbin/vgchange --ignorelockingfailure -a y >/dev/null
+ fi
+ eend $? "Failed to setup the LVM"
+ fi
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.28-r2 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.28-r2
new file mode 100755
index 0000000..3b20d76
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.28-r2
@@ -0,0 +1,40 @@
+# /lib/rcscripts/addons/lvm-start.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-start.sh-2.02.28-r2,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+dm_in_proc() {
+ local retval=0
+ for x in devices misc ; do
+ grep -qs 'device-mapper' /proc/${x}
+ retval=$((${retval} + $?))
+ done
+ return ${retval}
+}
+
+# LVM support for /usr, /home, /opt ....
+# This should be done *before* checking local
+# volumes, or they never get checked.
+
+# NOTE: Add needed modules for LVM or RAID, etc
+# to /etc/modules.autoload if needed
+if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then
+ if [ -e /proc/modules ] && ! dm_in_proc ; then
+ modprobe dm-mod 2>/dev/null
+ fi
+
+ if [ -d /proc/lvm ] || dm_in_proc ; then
+ ebegin "Setting up the Logical Volume Manager"
+ #still echo stderr for debugging
+ # Extra PV find pass because some devices might not have been available until very recently
+ /sbin/pvscan >/dev/null
+ # Now make the nodes
+ /sbin/vgscan --mknodes --ignorelockingfailure >/dev/null
+ if [ -x /sbin/vgchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ]
+ then
+ /sbin/vgchange --ignorelockingfailure -a y >/dev/null
+ fi
+ eend $? "Failed to setup the LVM"
+ fi
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1
new file mode 100755
index 0000000..864f1c5
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1
@@ -0,0 +1,42 @@
+# /lib/rcscripts/addons/lvm-start.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+locking="--lock-dir /dev/.lvm/"
+
+dm_in_proc() {
+ local retval=0
+ for x in devices misc ; do
+ grep -qs 'device-mapper' /proc/${x}
+ retval=$((${retval} + $?))
+ done
+ return ${retval}
+}
+
+# LVM support for /usr, /home, /opt ....
+# This should be done *before* checking local
+# volumes, or they never get checked.
+
+# NOTE: Add needed modules for LVM or RAID, etc
+# to /etc/modules.autoload if needed
+if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then
+ if [ -e /proc/modules ] && ! dm_in_proc ; then
+ modprobe dm-mod 2>/dev/null
+ fi
+
+ if [ -d /proc/lvm ] || dm_in_proc ; then
+ ebegin "Setting up the Logical Volume Manager"
+ #still echo stderr for debugging
+ # Extra PV find pass because some devices might not have been available until very recently
+ /sbin/pvscan ${locking} >/dev/null
+ # Now make the nodes
+ /sbin/vgscan --mknodes ${locking} >/dev/null
+ if [ -x /sbin/vgchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ]
+ then
+ /sbin/vgchange ${locking} -a y >/dev/null
+ fi
+ eend $? "Failed to setup the LVM"
+ fi
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3
new file mode 100755
index 0000000..bc56930
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3
@@ -0,0 +1,42 @@
+# /lib/rcscripts/addons/lvm-start.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r3,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+config='global { locking_dir = "/dev/.lvm" }'
+
+dm_in_proc() {
+ local retval=0
+ for x in devices misc ; do
+ grep -qs 'device-mapper' /proc/${x}
+ retval=$((${retval} + $?))
+ done
+ return ${retval}
+}
+
+# LVM support for /usr, /home, /opt ....
+# This should be done *before* checking local
+# volumes, or they never get checked.
+
+# NOTE: Add needed modules for LVM or RAID, etc
+# to /etc/modules.autoload if needed
+if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then
+ if [ -e /proc/modules ] && ! dm_in_proc ; then
+ modprobe dm-mod 2>/dev/null
+ fi
+
+ if [ -d /proc/lvm ] || dm_in_proc ; then
+ ebegin "Setting up the Logical Volume Manager"
+ #still echo stderr for debugging
+ # Extra PV find pass because some devices might not have been available until very recently
+ /sbin/pvscan --config "${config}" >/dev/null
+ # Now make the nodes
+ /sbin/vgscan --mknodes --config "${config}" >/dev/null
+ if [ -x /sbin/vgchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ]
+ then
+ /sbin/vgchange --config "${config}" -a y >/dev/null
+ fi
+ eend $? "Failed to setup the LVM"
+ fi
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-stop.sh b/sys-fs/lvm2/files/lvm2-stop.sh
new file mode 100755
index 0000000..a63a297
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-stop.sh
@@ -0,0 +1,61 @@
+# /lib/rcscripts/addons/lvm-stop.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-stop.sh,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+# Stop LVM2
+if [ -x /sbin/vgchange ] && \
+ [ -x /sbin/lvdisplay ] && \
+ [ -x /sbin/vgdisplay ] && \
+ [ -x /sbin/lvchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ] && \
+ [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+then
+ einfo "Shutting down the Logical Volume Manager"
+ # If these commands fail it is not currently an issue
+ # as the system is going down anyway based on the current LVM
+ # functionality as described in this forum thread
+ #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
+
+ LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort`
+ VOLUME_GROUPS=`vgdisplay |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ lvchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ vgchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+
+ ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'`
+ MOUNTED_DEVICE=${x}
+ [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`"
+ [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`"
+ if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.28-r5 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.28-r5
new file mode 100755
index 0000000..4d2480e
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.28-r5
@@ -0,0 +1,65 @@
+# /lib/rcscripts/addons/lvm-stop.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-stop.sh-2.02.28-r5,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+# Stop LVM2
+if [ -x /sbin/vgchange ] && \
+ [ -x /sbin/lvdisplay ] && \
+ [ -x /sbin/vgdisplay ] && \
+ [ -x /sbin/lvchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ] && \
+ [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+then
+ einfo "Shutting down the Logical Volume Manager"
+ # If these commands fail it is not currently an issue
+ # as the system is going down anyway based on the current LVM
+ # functionality as described in this forum thread
+ #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
+
+ LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort`
+ VOLUME_GROUPS=`vgdisplay |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ lvchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ vgchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+ if type mountinfo >/dev/null 2>&1; then
+ ROOT_DEVICE=`mountinfo -t /`
+ else
+ ROOT_DEVICE=`mount|grep -v 'rootfs'|grep " / "|awk '{print $1}'`
+ fi
+
+ MOUNTED_DEVICE=${x}
+ [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`"
+ [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`"
+ if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.37 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.37
new file mode 100755
index 0000000..792336e
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.37
@@ -0,0 +1,65 @@
+# /lib/rcscripts/addons/lvm-stop.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-stop.sh-2.02.37,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+# Stop LVM2
+if [ -x /sbin/vgchange ] && \
+ [ -x /sbin/lvdisplay ] && \
+ [ -x /sbin/vgdisplay ] && \
+ [ -x /sbin/lvchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ] && \
+ [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+then
+ einfo "Shutting down the Logical Volume Manager"
+ # If these commands fail it is not currently an issue
+ # as the system is going down anyway based on the current LVM
+ # functionality as described in this forum thread
+ #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
+
+ LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort`
+ VOLUME_GROUPS=`vgdisplay |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ lvchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ vgchange -an --ignorelockingfailure -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+ if type mountinfo >/dev/null 2>&1; then
+ ROOT_DEVICE=`mountinfo -t /`
+ else
+ ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'`
+ fi
+
+ MOUNTED_DEVICE=${x}
+ [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`"
+ [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`"
+ if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1
new file mode 100755
index 0000000..edebe75
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1
@@ -0,0 +1,67 @@
+# /lib/rcscripts/addons/lvm-stop.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+locking="--lock-dir /dev/.lvm/"
+
+# Stop LVM2
+if [ -x /sbin/vgchange ] && \
+ [ -x /sbin/lvdisplay ] && \
+ [ -x /sbin/vgdisplay ] && \
+ [ -x /sbin/lvchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ] && \
+ [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+then
+ einfo "Shutting down the Logical Volume Manager"
+ # If these commands fail it is not currently an issue
+ # as the system is going down anyway based on the current LVM
+ # functionality as described in this forum thread
+ #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
+
+ LOGICAL_VOLUMES=`/sbin/lvdisplay ${locking} |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort`
+ VOLUME_GROUPS=`/sbin/vgdisplay ${locking} |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ /sbin/lvchange -an ${locking} -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`/sbin/vgdisplay ${locking} ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ /sbin/vgchange -an ${locking} -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+ if type mountinfo >/dev/null 2>&1; then
+ ROOT_DEVICE=`mountinfo -t /`
+ else
+ ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'`
+ fi
+
+ MOUNTED_DEVICE=${x}
+ [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`"
+ [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`"
+ if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3
new file mode 100755
index 0000000..8019003
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3
@@ -0,0 +1,67 @@
+# /lib/rcscripts/addons/lvm-stop.sh
+# $Header: /var/cvs/lportage/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r3,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+config='global { locking_dir = "/dev/.lvm" }'
+
+# Stop LVM2
+if [ -x /sbin/vgchange ] && \
+ [ -x /sbin/lvdisplay ] && \
+ [ -x /sbin/vgdisplay ] && \
+ [ -x /sbin/lvchange ] && \
+ [ -f /etc/lvmtab -o -d /etc/lvm ] && \
+ [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+then
+ einfo "Shutting down the Logical Volume Manager"
+ # If these commands fail it is not currently an issue
+ # as the system is going down anyway based on the current LVM
+ # functionality as described in this forum thread
+ #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html
+
+ LOGICAL_VOLUMES=`/sbin/lvdisplay --config "${config}" |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort`
+ VOLUME_GROUPS=`/sbin/vgdisplay --config "${config}" |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort`
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`/sbin/lvdisplay --config "${config}" ${x}|grep "# open"|awk '{print $3}'`
+ if [ "${LV_IS_ACTIVE}" = 0 ]
+ then
+ ebegin " Shutting Down logical volume: ${x} "
+ /sbin/lvchange -an --config "${config}" -P ${x} >/dev/null
+ eend $?
+ fi
+ done
+
+ for x in ${VOLUME_GROUPS}
+ do
+ VG_HAS_ACTIVE_LV=`/sbin/vgdisplay --config "${config}" ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'`
+ if [ "${VG_HAS_ACTIVE_LV}" = 0 ]
+ then
+ ebegin " Shutting Down volume group: ${x} "
+ /sbin/vgchange -an --config "${config}" -P ${x} >/dev/null
+ eend
+ fi
+ done
+
+ for x in ${LOGICAL_VOLUMES}
+ do
+ LV_IS_ACTIVE=`/sbin/lvdisplay --config "${config}" ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'`
+ if [ "${LV_IS_ACTIVE}" = 1 ]
+ then
+ if type mountinfo >/dev/null 2>&1; then
+ ROOT_DEVICE=`mountinfo -t /`
+ else
+ ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'`
+ fi
+
+ MOUNTED_DEVICE=${x}
+ [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`"
+ [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`"
+ if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ]
+ then
+ ewarn " Unable to shutdown: ${x} "
+ fi
+ fi
+ done
+ einfo "Finished Shutting down the Logical Volume Manager"
+fi
+
+# vim:ts=4
diff --git a/sys-fs/lvm2/lvm2-2.02.51-r3.ebuild b/sys-fs/lvm2/lvm2-2.02.51-r3.ebuild
new file mode 100644
index 0000000..7e9e5a2
--- /dev/null
+++ b/sys-fs/lvm2/lvm2-2.02.51-r3.ebuild
@@ -0,0 +1,223 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvs/lportage/sys-fs/lvm2/lvm2-2.02.51-r3.ebuild,v 1.1 2009-11-17 21:23:15 randomdan Exp $
+
+EAPI=2
+inherit eutils multilib toolchain-funcs autotools
+
+DESCRIPTION="User-land utilities for LVM2 (device-mapper) software."
+HOMEPAGE="http://sources.redhat.com/lvm2/"
+SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
+ ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="readline +static clvm cman +lvm1 selinux"
+
+DEPEND="!!sys-fs/device-mapper
+ clvm? ( =sys-cluster/dlm-2*
+ cman? ( =sys-cluster/cman-2* ) )"
+
+RDEPEND="${DEPEND}
+ !<sys-apps/openrc-0.4
+ !!sys-fs/lvm-user
+ !!sys-fs/clvm
+ >=sys-apps/util-linux-2.16"
+
+S="${WORKDIR}/${PN/lvm/LVM}.${PV}"
+
+pkg_setup() {
+ # 1. Genkernel no longer copies /sbin/lvm blindly.
+ # 2. There are no longer any linking deps in /usr.
+ if use static; then
+ elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
+ elog "their static versions. If you need the static binaries,"
+ elog "you must append .static the filename!"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.02.45-dmeventd.patch
+ epatch "${FILESDIR}"/lvm.conf-2.02.51.patch
+ epatch "${FILESDIR}"/${PN}-2.02.51-device-mapper-export-format.patch
+ epatch "${FILESDIR}"/${PN}-2.02.51-as-needed.patch
+ epatch "${FILESDIR}"/${PN}-2.02.48-fix-pkgconfig.patch
+ epatch "${FILESDIR}"/${PN}-2.02.51-fix-pvcreate.patch
+ epatch "${FILESDIR}"/${PN}-2.02.51-dmsetup-selinux-linking-fix.patch
+ epatch "${FILESDIR}"/${PN}-2.02.51-dmeventd-logfunc-fixes.patch
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+ local buildmode
+
+ myconf="${myconf} --enable-dmeventd"
+ myconf="${myconf} --enable-cmdlib"
+ myconf="${myconf} --enable-applib"
+ myconf="${myconf} --enable-fsadm"
+
+ # Most of this package does weird stuff.
+ # The build options are tristate, and --without is NOT supported
+ # options: 'none', 'internal', 'shared'
+ if use static ; then
+ einfo "Building static LVM, for usage inside genkernel"
+ buildmode="internal"
+ # This only causes the .static versions to become available
+ # For recent systems, there are no linkages against anything in /usr anyway.
+ # We explicitly provide the .static versions so that they can be included in
+ # initramfs environments.
+ myconf="${myconf} --enable-static_link"
+ else
+ ewarn "Building shared LVM, it will not work inside genkernel!"
+ buildmode="shared"
+ fi
+
+ # dmeventd requires mirrors to be internal, and snapshot available
+ # so we cannot disable them
+ myconf="${myconf} --with-mirrors=internal"
+ myconf="${myconf} --with-snapshots=internal"
+
+ if use lvm1 ; then
+ myconf="${myconf} --with-lvm1=${buildmode}"
+ else
+ myconf="${myconf} --with-lvm1=none"
+ fi
+
+ # disable O_DIRECT support on hppa, breaks pv detection (#99532)
+ use hppa && myconf="${myconf} --disable-o_direct"
+
+ if use clvm; then
+ myconf="${myconf} --with-cluster=${buildmode}"
+ # 4-state! Make sure we get it right, per bug 210879
+ # Valid options are: none, cman, gulm, all
+ #
+ # 2009/02:
+ # gulm is removed now, now dual-state:
+ # cman, none
+ # all still exists, but is not needed
+ #
+ # 2009/07:
+ # TODO: add corosync and re-enable ALL
+ local clvmd=""
+ use cman && clvmd="cman"
+ #clvmd="${clvmd/cmangulm/all}"
+ [ -z "${clvmd}" ] && clvmd="none"
+ myconf="${myconf} --with-clvmd=${clvmd}"
+ myconf="${myconf} --with-pool=${buildmode}"
+ else
+ myconf="${myconf} --with-clvmd=none --with-cluster=none"
+ fi
+
+ myconf="${myconf} --sbindir=/sbin --with-staticdir=/sbin"
+ econf $(use_enable readline) \
+ $(use_enable selinux) \
+ --enable-pkgconfig \
+ --libdir=/usr/$(get_libdir) \
+ ${myconf} \
+ CLDFLAGS="${LDFLAGS}" || die
+}
+
+src_compile() {
+ einfo "Doing symlinks"
+ pushd include
+ emake || die "Failed to prepare symlinks"
+ popd
+
+ einfo "Doing device-mapper"
+ pushd libdm
+ emake || die "failed to build libdm"
+ #emake ioctl/libdevmapper.a || die "failed to build libdm/ioctl/libdevmapper.a"
+ popd
+
+ einfo "Doing lib"
+ pushd lib
+ emake || die "failed to build lib"
+ popd
+
+ einfo "Doing main build"
+ emake || die "compile problem"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ dodir /$(get_libdir)
+ # Put these in root so we can reach before /usr is up
+ for i in \
+ libdevmapper-event{,-lvm2{mirror,snapshot}} \
+ libdevmapper \
+ liblvm2{format1,snapshot,cmd} \
+ ; do
+ b="${D}"/usr/$(get_libdir)/${i}
+ if [ -f "${b}".so ]; then
+ mv -f "${b}".so* "${D}"/$(get_libdir) || die
+ gen_usr_ldscript ${i}.so || die
+ fi
+ done
+
+ dodoc README VERSION WHATS_NEW doc/*.{conf,c,txt}
+ insinto /$(get_libdir)/rcscripts/addons
+ newins "${FILESDIR}"/lvm2-start.sh-2.02.49-r3 lvm-start.sh || die
+ newins "${FILESDIR}"/lvm2-stop.sh-2.02.49-r3 lvm-stop.sh || die
+ newinitd "${FILESDIR}"/lvm.rc-2.02.51-r2 lvm || die
+ newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die
+ if use clvm; then
+ newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd || die
+ newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd || die
+ fi
+
+ # move shared libs to /lib(64)
+ if use static; then
+ dolib.a libdm/ioctl/libdevmapper.a || die "dolib.a libdevmapper.a"
+ fi
+ #gen_usr_ldscript libdevmapper.so
+
+ insinto /etc
+ doins "${FILESDIR}"/dmtab
+ insinto /$(get_libdir)/rcscripts/addons
+ doins "${FILESDIR}"/dm-start.sh
+
+ # Device mapper stuff
+ newinitd "${FILESDIR}"/device-mapper.rc-1.02.51-r2 device-mapper || die
+ newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die
+
+ newinitd "${FILESDIR}"/1.02.22-dmeventd.initd dmeventd || die
+ if use static; then
+ dolib.a daemons/dmeventd/libdevmapper-event.a \
+ || die "dolib.a libdevmapper-event.a"
+ fi
+ #gen_usr_ldscript libdevmapper-event.so
+
+ insinto /etc/udev/rules.d/
+ newins "${FILESDIR}"/64-device-mapper.rules-1.02.49-r2 64-device-mapper.rules || die
+
+ # do not rely on /lib -> /libXX link
+ sed -e "s-/lib/rcscripts/-/$(get_libdir)/rcscripts/-" -i "${D}"/etc/init.d/*
+
+ elog "USE flag nocman is deprecated and replaced"
+ elog "with the cman USE flag."
+ elog ""
+ elog "USE flags clvm and cman are masked"
+ elog "by default and need to be unmasked to use them"
+ elog ""
+ elog "Rebuild your genkernel initramfs if you are using lvm"
+}
+
+pkg_postinst() {
+ elog "lvm 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 lvm boot"
+ elog "Do NOT add it if you are using baselayout-1 still."
+}
+
+src_test() {
+ einfo "Testcases disabled because of device-node mucking"
+ einfo "If you want them, compile the package and see ${S}/tests"
+}
diff --git a/sys-fs/lvm2/metadata.xml b/sys-fs/lvm2/metadata.xml
new file mode 100644
index 0000000..ce61d91
--- /dev/null
+++ b/sys-fs/lvm2/metadata.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>no-herd</herd>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ <name>Robin H. Johnson</name>
+ </maintainer>
+ <maintainer>
+ <email>cardoe@gentoo.org</email>
+ <name>Doug Goldstein</name>
+ </maintainer>
+ <maintainer>
+ <email>agk@redhat.com</email>
+ <name>Alasdair Kergon</name>
+ <description>Upstream Maintainer (please CC on bugs)</description>
+ </maintainer>
+ <use>
+ <flag name='clvm'>Allow users to build clustered lvm2</flag>
+ <flag name='cman'>Cman support for clustered lvm</flag>
+ <flag name='lvm1'>Allow users to build lvm2 with lvm1 support</flag>
+ <flag name='nolvmstatic'>Allow users to build lvm2 dynamically</flag>
+ </use>
+</pkgmetadata>