Odd Behavior in the enclosure module around the 2 fault bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. */
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? 

Thanks,
Ryan Attard


     --
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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux