On Wed, 2015-09-30 at 15:17 +0000, Ryan Attard wrote: > My coworkers and I were setting some enclosure states on our storage > devices, and then reading the states back using sysfs, and came across > the 'fault' field being set to 2. When we investigated into the ses.c > file, we found this wonderful comment: > > /* For device slot and array device slot elements, byte 3 bit 6 > * is "fault sensed" while byte 3 bit 5 is "fault reqstd". As this > * code stands these bits are shifted 4 positions right so in > * sysfs they will appear as bits 2 and 1 respectively. Strange. */ This comment is thanks to Doug Gilbert: commit 2a350cab9daf9a46322d83b091bb05cf54ccf6ab Author: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> Date: Thu Jun 9 00:27:07 2011 -0400 [SCSI] ses: requesting a fault indication > static void ses_get_fault(struct enclosure_device *edev, > struct enclosure_component *ecomp) > { > unsigned char *desc; > > > desc = ses_get_page2_descriptor(edev, ecomp); > if (desc) > ecomp->fault = (desc[3] & 0x60) >> 4; > } > > I was hoping there might be an explanation (purely for curiosity's > sake) why it was not shifted 5 positions? Or why it wasn't exported as > 2 fields in sysfs, each representing 1 bit in the SES page? If I remember correctly, the desire was to keep the nybble values. Because it's not an on off field, it didn't seem to matter much whether the fields were 0 2 4 6 or 0 1 2 3 James -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html