diff --git a/packaging/debian/megactl/changelog b/packaging/debian/megactl/changelog index 8f66414..ee6a5a0 100644 --- a/packaging/debian/megactl/changelog +++ b/packaging/debian/megactl/changelog @@ -1,3 +1,10 @@ +megactl (0.4.1+svn20090725.r6-2) unstable; urgency=medium + + * Integrate patch by Pat Suwalski to handle devices + without enclosure. + + -- Adam Cécile (Le_Vert) Sat, 14 Dec 2013 14:36:22 +0100 + megactl (0.4.1+svn20090725.r6-1) unstable; urgency=low * New upstream release (based on sv trunk snapshot): diff --git a/packaging/debian/megactl/patches/002-No_enclosure_support.dpatch b/packaging/debian/megactl/patches/002-No_enclosure_support.dpatch new file mode 100755 index 0000000..630d912 --- /dev/null +++ b/packaging/debian/megactl/patches/002-No_enclosure_support.dpatch @@ -0,0 +1,75 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 002-No_enclosure_support by Pat Suwalski +## +## DP: The root of the problem is that a lot of the logic behind building +## DP: the enclosure map and printing the disk list compares directly the +## DP: adapter channel list with the physical disk enclosure number, like so: +## DP: +## DP: if (device->device[k].enclosure == a->channel[j]) +## DP: +## DP: The problem is that one is a uint16_t and the other is a uint8_t. +## DP: When an enclosure is not present, the value comes back as all-ones. +## DP: So, the code was trying in numerous places to compare 0xffff with +## DP: 0xff. Adjusting the struct so both members are uint16_t fixes this. +## DP: +## DP: The patch also changes the output when no enclosure is present to +## DP: put an asterisk as the enclosure ID in the output. +## DP: The output on the same machine now looks like this: +## DP: +## DP: a0 PERC 5/i Integrated encl:1 ldrv:2 batt:good +## DP: a0d0 19GiB RAID 5 1x4 DEGRADED +## DP: a0d1 5567GiB RAID 5 1x4 DEGRADED +## DP: a0e*s0 1863GiB a0d0+ online errs: media:0 other:28 +## DP: a0e*s1 1863GiB a0d0+ rebuild errs: media:0 other:26 +## DP: a0e*s2 1863GiB a0d0+ online errs: media:0 other:28 +## DP: a0e*s3 1863GiB a0d0+ online errs: media:0 other:28 + +@DPATCH@ +Index: adapter.c +=================================================================== +--- a/src/adapter.c (revision 6) ++++ b/src/adapter.c (working copy) +@@ -192,7 +192,10 @@ + d->channel = info->enclosure; + d->id = info->slot; + +- snprintf (d->name, sizeof (d->name), "%se%us%u", a->name, d->channel, d->id); ++ if (d->channel == DISK_NOENC) ++ snprintf (d->name, sizeof (d->name), "%se*s%u", a->name, d->id); ++ else ++ snprintf (d->name, sizeof (d->name), "%se%us%u", a->name, d->channel, d->id); + + d->inquiry = info->inquiry.inq; + strncpy (d->vendor, d->inquiry.vendor_info, sizeof (d->vendor) - 1); +@@ -691,6 +694,7 @@ + for (j = 0; j < a->num_channels; ++j) + if (device->device[k].enclosure == a->channel[j]) + break; ++ + if (j < a->num_channels) + continue; + +Index: mega.h +=================================================================== +--- a/src/mega.h (revision 6) ++++ b/src/mega.h (working copy) +@@ -114,7 +114,10 @@ + #define SCSI_SELFTEST_FOREGROUND_SHORT 0x05 + #define SCSI_SELFTEST_FOREGROUND_LONG 0x06 + ++/* Drives without enclosure report this as the enclosure ID */ ++#define DISK_NOENC 0xffff + ++ + /* megaraid2 header file gets this wrong. */ + typedef struct { + uint8_t max_commands; +@@ -545,7 +548,7 @@ + uint16_t dram_size; /* size of DRAM in MB */ + uint16_t rebuild_rate; /* rebuild rate as percentage */ + uint16_t num_channels; /* number of channels or enclosures */ +- uint8_t *channel; /* channel/enclosure map */ ++ uint16_t *channel; /* channel/enclosure map */ + uint16_t num_physicals; + struct physical_drive_info *physical; + struct physical_drive_info **physical_list; /* ordered list of physical devices */ diff --git a/packaging/debian/megactl/patches/00list b/packaging/debian/megactl/patches/00list index 3028007..4a994f2 100644 --- a/packaging/debian/megactl/patches/00list +++ b/packaging/debian/megactl/patches/00list @@ -1,2 +1,3 @@ 000-No_absolute_pathes_in_examples.dpatch 001-Drop_obsolete_asm_user.h.dpatch +002-No_enclosure_support.dpatch