aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2019-05-02 15:31:54 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-05-27 18:23:11 +0000
commit1606a2ff8ec904210b91ddbd61243617f0847e4f (patch)
tree3ea688fc9a56685e3a4f93fd880eb6f2891e2ce6
parent69ea419e813a91d238f2379f54a6a008fb85c1b6 (diff)
downloadaports-1606a2ff8ec904210b91ddbd61243617f0847e4f.tar.gz
aports-1606a2ff8ec904210b91ddbd61243617f0847e4f.tar.bz2
aports-1606a2ff8ec904210b91ddbd61243617f0847e4f.tar.xz
main/dmraid: new aport
-rw-r--r--main/dmraid/001-do_not_use_p_for_partition.patch13
-rw-r--r--main/dmraid/002-support_virtio_devices.patch13
-rw-r--r--main/dmraid/003-isw-probe-hpa.patch144
-rw-r--r--main/dmraid/004-activate_multiple_raid_sets.patch12
-rw-r--r--main/dmraid/005-fix_isw_sectors_calculation.patch14
-rw-r--r--main/dmraid/006-musl-libc.patch20
-rw-r--r--main/dmraid/007-fix-loff_t-musl.patch14
-rw-r--r--main/dmraid/APKBUILD56
8 files changed, 286 insertions, 0 deletions
diff --git a/main/dmraid/001-do_not_use_p_for_partition.patch b/main/dmraid/001-do_not_use_p_for_partition.patch
new file mode 100644
index 0000000000..faa0b5b73e
--- /dev/null
+++ b/main/dmraid/001-do_not_use_p_for_partition.patch
@@ -0,0 +1,13 @@
+Author: Giuseppe Iuculano <giuseppe@iuculano.it>
+Description: Removed "p" from device name. A proper upgrade script is needed before using it.
+--- dmraid/lib/format/partition/dos.c
++++ dmraid/lib/format/partition/dos.c
+@@ -31,7 +31,7 @@ _name(struct lib_context *lc, struct rai
+ {
+ const char *base = get_basename(lc, rd->di->path);
+
+- return type ? snprintf(str, len, "%s%s%u", base, OPT_STR_PARTCHAR(lc),
++ return type ? snprintf(str, len, "%s%u", base,
+ partition) : snprintf(str, len, "%s", base);
+ }
+
diff --git a/main/dmraid/002-support_virtio_devices.patch b/main/dmraid/002-support_virtio_devices.patch
new file mode 100644
index 0000000000..17c31c1bba
--- /dev/null
+++ b/main/dmraid/002-support_virtio_devices.patch
@@ -0,0 +1,13 @@
+Author: Luke Yelavich <themuso@ubuntu.com>
+Description: Support for checking virtio devices for dmraid metadata.
+--- dmraid/lib/device/scan.c
++++ dmraid/lib/device/scan.c
+@@ -174,7 +174,7 @@ interested(struct lib_context *lc, char
+ * Whole IDE and SCSI disks only.
+ */
+ return (!isdigit(name[strlen(name) - 1]) &&
+- (*(name + 1) == 'd' && (*name == 'h' || *name == 's')))
++ (*(name + 1) == 'd' && (*name == 'h' || *name == 's' || *name == 'v')))
+ #ifdef DMRAID_TEST
+ /*
+ * Include dm devices for testing.
diff --git a/main/dmraid/003-isw-probe-hpa.patch b/main/dmraid/003-isw-probe-hpa.patch
new file mode 100644
index 0000000000..93756a9255
--- /dev/null
+++ b/main/dmraid/003-isw-probe-hpa.patch
@@ -0,0 +1,144 @@
+Probe isw disks with [some] HPA awareness, thanks to Robert Collins <robert@ubuntu.com>. (LP: #372170)
+--- dmraid/lib/format/ataraid/isw.c
++++ dmraid/lib/format/ataraid/isw.c
+@@ -353,6 +353,7 @@ raiddev(struct isw *isw, unsigned i)
+ enum convert { FULL, FIRST, LAST };
+ #if BYTE_ORDER == LITTLE_ENDIAN
+ # define to_cpu(x, y)
++# define CVT16(x)
+ #else
+ /*
+ * We can differ from the read_raid_dev template here,
+@@ -547,15 +548,16 @@ disk_ok(struct lib_context *lc, struct d
+ }
+
+ static void *
+-isw_read_metadata(struct lib_context *lc, struct dev_info *di,
+- size_t * sz, uint64_t * offset, union read_info *info)
++isw_try_sboffset(struct lib_context *lc, struct dev_info *di,
++ size_t * sz, uint64_t * offset, union read_info *info,
++ uint64_t const isw_sboffset)
+ {
+ size_t size = ISW_DISK_BLOCK_SIZE;
+- uint64_t isw_sboffset = ISW_CONFIGOFFSET(di);
+ struct isw *isw;
++ uint64_t temp_isw_sboffset = isw_sboffset;
+
+ if (!(isw = alloc_private_and_read(lc, handler, size,
+- di->path, isw_sboffset)))
++ di->path, temp_isw_sboffset)))
+ goto out;
+
+ /*
+@@ -565,9 +567,15 @@ isw_read_metadata(struct lib_context *lc
+ to_cpu(isw, FIRST);
+
+ /* Check Signature and read optional extended metadata. */
+- if (!is_isw(lc, di, isw) ||
+- !isw_read_extended(lc, di, &isw, &isw_sboffset, &size))
++ if (!is_isw(lc, di, isw)) {
++ log_dbg(lc, "not isw at %ld", isw_sboffset);
+ goto bad;
++ }
++ if (!isw_read_extended(lc, di, &isw, &temp_isw_sboffset, &size)) {
++ log_err(lc, "isw metadata, but extended read failed at %ld",
++ isw_sboffset);
++ goto bad;
++ }
+
+ /*
+ * Now that we made sure, that we've got all the
+@@ -578,6 +586,8 @@ isw_read_metadata(struct lib_context *lc
+ if (disk_ok(lc, di, isw)) {
+ *sz = size;
+ *offset = info->u64 = isw_sboffset;
++ log_dbg(lc, "isw metadata found at %ld from probe at %ld\n",
++ *offset, isw_sboffset);
+ goto out;
+ }
+
+@@ -589,6 +599,54 @@ out:
+ return (void *) isw;
+ }
+
++/* HPA on a disk shifts everything down. This is a 'works-enough' approach to
++ * handling that. There is a better long term approach requiring kernel
++ * patches - see the lkml patches for alt_size.
++ */
++static void *
++isw_try_hpa(struct lib_context *lc, struct dev_info *di,
++ size_t * sz, uint64_t * offset, union read_info *info)
++{
++ struct isw10 *isw10;
++ void *result = NULL;
++ uint64_t actual_offset;
++ if (!(isw10 = alloc_private_and_read(lc, handler, ISW_DISK_BLOCK_SIZE,
++ di->path, ISW_10_CONFIGOFFSET(di))))
++ goto out;
++ if (strncmp((const char *)isw10->sig, ISW10_SIGNATURE, ISW10_SIGNATURE_SIZE))
++ goto out_free;
++ log_dbg(lc, "Found isw 10 gafr signature.");
++ CVT16(isw10->offset);
++ actual_offset = isw10->offset + 2;
++ log_dbg(lc, "isw 10 sector offset calculated at %hd.", actual_offset);
++ if (actual_offset > di->sectors)
++ goto out_free;
++ result = isw_try_sboffset(lc, di, sz, offset, info,
++ ISW_SECTOR_TO_OFFSET(di->sectors - actual_offset));
++ out_free:
++ dbg_free(isw10);
++ out:
++ return result;
++}
++
++
++static void *
++isw_read_metadata(struct lib_context *lc, struct dev_info *di,
++ size_t * sz, uint64_t * offset, union read_info *info)
++{
++ void *result;
++ if ((result = isw_try_sboffset(
++ lc, di, sz, offset, info, ISW_CONFIGOFFSET(di))))
++ return result;
++ if ((result = isw_try_hpa(lc, di, sz, offset, info)))
++ return result;
++ log_dbg(lc, "isw trying hard coded -2115 offset.");
++ if ((result = isw_try_sboffset(
++ lc, di, sz, offset, info, (di->sectors - 2115)*512)))
++ return result;
++ return NULL;
++}
++
+ static int setup_rd(struct lib_context *lc, struct raid_dev *rd,
+ struct dev_info *di, void *meta, union read_info *info);
+ static struct raid_dev *
+--- dmraid/lib/format/ataraid/isw.h
++++ dmraid/lib/format/ataraid/isw.h
+@@ -36,8 +36,11 @@
+
+ /* Intel metadata offset in bytes */
+ #define ISW_CONFIGSECTOR(di) ((di)->sectors - 2)
+-#define ISW_CONFIGOFFSET(di) (ISW_CONFIGSECTOR(di) << 9)
++#define ISW_SECTOR_TO_OFFSET(sector) ((sector) << 9)
++#define ISW_CONFIGOFFSET(di) (ISW_SECTOR_TO_OFFSET(ISW_CONFIGSECTOR(di)))
+ #define ISW_DATAOFFSET 0 /* Data offset in sectors */
++#define ISW_10_CONFIGSECTOR(di) ((di)->sectors - 1)
++#define ISW_10_CONFIGOFFSET(di) (ISW_SECTOR_TO_OFFSET(ISW_10_CONFIGSECTOR(di)))
+
+ #define MPB_SIGNATURE "Intel Raid ISM Cfg Sig. "
+ #define MPB_SIGNATURE_SIZE (sizeof(MPB_SIGNATURE) - 1)
+@@ -222,6 +225,14 @@ struct isw {
+ // here comes isw_dev[num_raid_devs]
+ } __attribute__ ((packed));
+
++#define ISW10_SIGNATURE "$GAFR\x10"
++#define ISW10_SIGNATURE_SIZE (sizeof(ISW10_SIGNATURE) - 1)
++struct isw10 {
++ int8_t sig[ISW10_SIGNATURE_SIZE];
++ uint32_t offset; /* offset to real data, in sectors back */
++} __attribute__ ((packed));
++
++
+ #endif
+
+ int register_isw(struct lib_context *lc);
diff --git a/main/dmraid/004-activate_multiple_raid_sets.patch b/main/dmraid/004-activate_multiple_raid_sets.patch
new file mode 100644
index 0000000000..4dd64ab23b
--- /dev/null
+++ b/main/dmraid/004-activate_multiple_raid_sets.patch
@@ -0,0 +1,12 @@
+Continue onto all raid sets instead of returning after processing the first. (LP: #401713)
+--- dmraid/lib/metadata/metadata.c
++++ dmraid/lib/metadata/metadata.c
+@@ -839,7 +839,7 @@ _discover_partitions(struct lib_context
+ */
+ if (T_GROUP(rs)) {
+ _discover_partitions(lc, &rs->sets);
+- return;
++ continue;
+ }
+
+ /*
diff --git a/main/dmraid/005-fix_isw_sectors_calculation.patch b/main/dmraid/005-fix_isw_sectors_calculation.patch
new file mode 100644
index 0000000000..9887a35093
--- /dev/null
+++ b/main/dmraid/005-fix_isw_sectors_calculation.patch
@@ -0,0 +1,14 @@
+Fix isw raid0 incorrect sectors calculation, thanks to Valentin Pavlyuchenko
+--- dmraid/lib/format/ataraid/isw.c
++++ dmraid/lib/format/ataraid/isw.c
+@@ -776,7 +776,9 @@ _create_rd(struct lib_context *lc,
+ r->di = rd->di;
+ r->fmt = rd->fmt;
+ r->offset = dev->vol.map[0].pba_of_lba0;
+- if ((r->sectors = dev->vol.map[0].blocks_per_member - RAID_DS_JOURNAL))
++ //fix bugs on ICH10R
++ //if ((r->sectors = dev->vol.map[0].blocks_per_member - RAID_DS_JOURNAL))
++ if ((r->sectors = dev->vol.map[0].blocks_per_member))
+ goto out;
+
+ log_zero_sectors(lc, rd->di->path, handler);
diff --git a/main/dmraid/006-musl-libc.patch b/main/dmraid/006-musl-libc.patch
new file mode 100644
index 0000000000..bf88d5777a
--- /dev/null
+++ b/main/dmraid/006-musl-libc.patch
@@ -0,0 +1,20 @@
+---dmraid/include/dmraid/misc.h.orig
++++ dmraid/include/dmraid/misc.h
+@@ -10,6 +10,7 @@
+
+ #ifndef _MISC_H_
+ #define _MISC_H_
++#include <fcntl.h>
+
+ #define DM_ASSERT(__cond) do { if (!(__cond)) { printf("ASSERT file:%s line:%d fuction:%s cond: %s\n", __FILE__, __LINE__, __FUNCTION__, #__cond); } } while(0);
+
+--- dmraid/lib/device/scan.c.orig
++++ dmraid/lib/device/scan.c
+@@ -10,6 +10,7 @@
+ # include <dirent.h>
+ # include <paths.h>
+ #else
++# include <paths.h>
+ # include <dirent.h>
+ # include <mntent.h>
+ #endif
diff --git a/main/dmraid/007-fix-loff_t-musl.patch b/main/dmraid/007-fix-loff_t-musl.patch
new file mode 100644
index 0000000000..0cd84879b9
--- /dev/null
+++ b/main/dmraid/007-fix-loff_t-musl.patch
@@ -0,0 +1,14 @@
+Source: maxice8
+Upstream: no, it seems to be inactive.
+Reason: fixes usage of dmraid.h under musl libc.
+
+--- dmraid/include/dmraid/misc.h
++++ dmraid/include/dmraid/misc.h
+@@ -10,6 +10,7 @@
+
+ #ifndef _MISC_H_
+ #define _MISC_H_
++#define _GNU_SOURCE
+ #include <fcntl.h>
+
+ #define DM_ASSERT(__cond) do { if (!(__cond)) { printf("ASSERT file:%s line:%d fuction:%s cond: %s\n", __FILE__, __LINE__, __FUNCTION__, #__cond); } } while(0);
diff --git a/main/dmraid/APKBUILD b/main/dmraid/APKBUILD
new file mode 100644
index 0000000000..4246f632ea
--- /dev/null
+++ b/main/dmraid/APKBUILD
@@ -0,0 +1,56 @@
+# Contributor: Rasmus Thomsen <oss@cogitri.dev>
+# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
+pkgname=dmraid
+pkgver=1.0.0_rc16
+_distver=3
+pkgrel=0
+pkgdesc="Device mapper RAID interface"
+url="http://people.redhat.com/~heinzm/sw/dmraid/"
+arch="all"
+license="GPL-2.0-only LGPL-2.1-only"
+makedepends="lvm2-dev"
+options="!check" # No tests to run
+subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
+source="http://people.redhat.com/~heinzm/sw/dmraid/src/dmraid-${pkgver/_/.}-${_distver}.tar.bz2
+ 001-do_not_use_p_for_partition.patch
+ 002-support_virtio_devices.patch
+ 003-isw-probe-hpa.patch
+ 004-activate_multiple_raid_sets.patch
+ 005-fix_isw_sectors_calculation.patch
+ 006-musl-libc.patch
+ 007-fix-loff_t-musl.patch"
+builddir="$srcdir/dmraid/${pkgver/_/.}-${_distver}/dmraid"
+
+prepare() {
+ default_prepare
+ update_config_sub
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --enable-led \
+ --enable-intel_led \
+ --enable-shared_lib
+ # parallel compilation fails due to faulty job ordering. Tries to link with
+ # its shared libs before it's even compiled
+ make -j1
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="7c45e5117adc52fc2094b1b2bad4f4c518a46317a2196611966d72085ba3587c4ac8d1080f9d934888c01788f2b2d3d621c6f0d3e2a023c0fb1f9f3fa7fc127e dmraid-1.0.0.rc16-3.tar.bz2
+df1e285f404da61f9d15c9be3fae905599fb5d03203d3cd0551421b89913361d36524f9d2ee899eac9088c35daad9e8d6280a621c6a5832eec1a9be21bd05b12 001-do_not_use_p_for_partition.patch
+1486aa76066e959d800506030f37392560e4953eb23fbcb65899ce76ef8e646639d5bd7abed8d9328e9a7f8dcc005fac4312528a8afcc806d228828a5d9b3fb9 002-support_virtio_devices.patch
+b679ef5ff2671a8c8aa1a12feb54cfdfa6a40cbb0aef23e49b1ea5a8f97563061f9b207eeaf06da9fbb33837d9d04a4972869adc87eb89eb459aeb1c1e7bc5ee 003-isw-probe-hpa.patch
+ce120d7313f7f1b563e95fd9b81e4eb5353edf416a521d2955b0bd7a0c08ec4c0a5da4402aa1690f65d2b4464d1f5fc534ec7819b07ee8791046b25f0209a21b 004-activate_multiple_raid_sets.patch
+702cb4cf0edf79dbde9185cada12462681b52bffd5f8c4eab1b594ef754c964fb6c7f711ce77e4074167d920755fe0466d284f94fb272d60ea2314f2a45ef366 005-fix_isw_sectors_calculation.patch
+1335297528df24faa292e4d80a57e23e3f910b669a92370e57a97bd4df443092323a91489c2cc1f17e3b280a3a7f0386bb7fed3a157cdab7ab55686e9d5e1ae4 006-musl-libc.patch
+3fe66677b7bb3a314cabcab32d35192ddd5ec70e50398a37916197eb2818debf919fe48337fe9befb3a7d7ab727cbeed976413db89585f66fed7375cf9b36ac8 007-fix-loff_t-musl.patch"