[Dmraid-debian-commits] [SCM] Maintenance of the dmraid package branch, master, updated. debian/1.0.0.rc15-6-3-g9cf5ed5
Giuseppe Iuculano
giuseppe at iuculano.it
Sun Apr 19 17:47:02 UTC 2009
The following commit has been merged in the master branch:
commit 9cf5ed5439aa38c610695b3f92e3f5746cb45622
Author: Giuseppe Iuculano <giuseppe at iuculano.it>
Date: Sun Apr 19 19:45:07 2009 +0200
debian/patches/14_isw-serial-fix.patch: Use Hans de Goede patch.
diff --git a/debian/patches/14_isw-serial-fix.patch b/debian/patches/14_isw-serial-fix.patch
index aea5482..eaae976 100644
--- a/debian/patches/14_isw-serial-fix.patch
+++ b/debian/patches/14_isw-serial-fix.patch
@@ -1,26 +1,91 @@
-Author: Sam Bingner <sam at bingner.com>
+Author: Hans de Goede <hdegoede at redhat.com>
Description: Change the serial number scan to only look at the LAST 16 bytes rather than the first
(LP: #267953)
+ https://bugzilla.redhat.com/show_bug.cgi?id=490121
--- a/1.0.0.rc15/lib/format/ataraid/isw.c
+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -84,12 +84,19 @@ is_raid10(struct isw_dev *dev)
+@@ -81,15 +81,43 @@ is_raid10(struct isw_dev *dev)
+ }
+
+ /* Find a disk table slot by serial number. */
++static const char *dev_info_serial_to_isw(const char *di_serial)
++{
++ static char isw_serial[1024];
++
++ int i, isw_serial_len = 0;
++
++ for (i = 0; di_serial[i] && isw_serial_len < 1023; i++) {
++ if (((unsigned char)di_serial[i]) > 0x20) {
++ /* ':' is reserved for use in placeholder serial
++ * numbers for missing disks */
++ if (di_serial[i] == ':')
++ isw_serial[isw_serial_len] = ';';
++ else
++ isw_serial[isw_serial_len] = di_serial[i];
++ isw_serial_len++;
++ }
++ }
++ isw_serial[isw_serial_len] = 0;
++
++ if (isw_serial_len > MAX_RAID_SERIAL_LEN)
++ memmove(isw_serial,
++ isw_serial + (isw_serial_len - MAX_RAID_SERIAL_LEN),
++ MAX_RAID_SERIAL_LEN);
++
++ return isw_serial;
++}
++
static struct isw_disk *
_get_disk(struct isw *isw, struct dev_info *di)
{
-+ int off;
-+
if (di->serial) {
int i = isw->num_disks;
struct isw_disk *disk = isw->disk;
++ const char *isw_serial = dev_info_serial_to_isw(di->serial);
-+ if(strlen(di->serial) > MAX_RAID_SERIAL_LEN)
-+ off=strlen(di->serial) - MAX_RAID_SERIAL_LEN;
-+ else
-+ off=0;
-+
while (i--) {
- if (!strncmp(di->serial, (const char *) disk[i].serial,
-+ if (!strncmp(di->serial+off, (const char *) disk[i].serial,
++ if (!strncmp(isw_serial, (const char *) disk[i].serial,
MAX_RAID_SERIAL_LEN))
return disk + i;
}
+@@ -866,7 +894,8 @@ rd_by_serial(struct raid_set *rs, const
+
+ list_for_each_entry(rd, &rs->devs, devs) {
+ if (rd->di &&
+- !strncmp(rd->di->serial, serial, MAX_RAID_SERIAL_LEN))
++ !strncmp(dev_info_serial_to_isw(rd->di->serial), serial,
++ MAX_RAID_SERIAL_LEN))
+ return rd;
+ }
+
+@@ -1297,7 +1326,8 @@ isw_config_disks(struct lib_context *lc,
+ struct raid_dev *rd;
+
+ list_for_each_entry(rd, &rs->devs, devs) {
+- strncpy((char *) disk[i].serial, rd->di->serial,
++ strncpy((char *) disk[i].serial,
++ dev_info_serial_to_isw(rd->di->serial),
+ MAX_RAID_SERIAL_LEN);
+ disk[i].totalBlocks = rd->di->sectors;
+
+@@ -2420,7 +2450,8 @@ update_metadata(struct lib_context *lc,
+ while (i--) {
+ /* Check if the disk is listed. */
+ list_for_each_entry(di, LC_DI(lc), list) {
+- if (!strncmp(di->serial, (const char *) disk[i].serial,
++ if (!strncmp(dev_info_serial_to_isw(di->serial),
++ (const char *) disk[i].serial,
+ MAX_RAID_SERIAL_LEN))
+ goto goon;
+ }
+@@ -2516,7 +2547,8 @@ update_metadata(struct lib_context *lc,
+ new_disk->status = CONFIG_ON_DISK |
+ DISK_SMART_EVENT_SUPPORTED |
+ CLAIMED_DISK | DETECTED_DISK | USABLE_DISK | CONFIGURED_DISK;
+- strncpy((char *) new_disk->serial, di->serial, MAX_RAID_SERIAL_LEN);
++ strncpy((char *) new_disk->serial, dev_info_serial_to_isw(di->serial),
++ MAX_RAID_SERIAL_LEN);
+
+ /* build new isw_disk array */
+ for (i = 0; i < isw->num_disks; i++) {
diff --git a/debian/patches/16_fix_isw_sectors_calculation.patch b/debian/patches/16_fix_isw_sectors_calculation.patch
index 485dddf..ff96880 100644
--- a/debian/patches/16_fix_isw_sectors_calculation.patch
+++ b/debian/patches/16_fix_isw_sectors_calculation.patch
@@ -1,7 +1,7 @@
Fix for #524637. Do not subtract RAID_DS_JOURNAL
--- a/1.0.0.rc15/lib/format/ataraid/isw.c
+++ b/1.0.0.rc15/lib/format/ataraid/isw.c
-@@ -674,7 +674,9 @@ _create_rd(struct lib_context *lc,
+@@ -695,7 +695,9 @@ _create_rd(struct lib_context *lc,
r->di = rd->di;
r->fmt = rd->fmt;
r->offset = dev->vol.map.pba_of_lba0;
--
Maintenance of the dmraid package
More information about the Dmraid-debian-commits
mailing list