#define ARGUSED(x) ((void)(x))
-const char *os_XXXX_c_cvsid="$Id: os_linux.cpp 2915 2009-09-18 21:17:37Z chrfranke $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.cpp 2951 2009-10-08 23:43:46Z samm2 $" \
ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_LINUX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
/* for passing global control variables */
char line[128];
int mjr, n1;
FILE *fp;
+ int report = con->reportscsiioctl;
if (!linux_smart_device::open())
return false;
else if (ioctl(get_fd(), SCSI_IOCTL_GET_BUS_NUMBER, &m_hba) != 0) {
int err = errno;
linux_smart_device::close();
- return set_err(err, "can't get hba");
+ return set_err(err, "can't get bus number");
}
/* Perform mknod of device ioctl node */
n1=0;
if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR, makedev(mjr, 0));
- printf("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
+ if(report > 0)
+ printf("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
if (n1 >= 0 || errno == EEXIST)
break;
}
else if (sscanf(line, "%d megadev%n", &mjr, &n1) == 1 && n1 == 11) {
n1=mknod("/dev/megadev0", S_IFCHR, makedev(mjr, 0));
- printf("Creating /dev/megadev0 = %d\n", n1 >= 0 ? 0 : errno);
+ if(report > 0)
+ printf("Creating /dev/megadev0 = %d\n", n1 >= 0 ? 0 : errno);
if (n1 >= 0 || errno == EEXIST)
break;
}
if (iop->cmnd[0] == 0x00)
return true;
if (iop->cmnd[0] == 0x85 && iop->cmnd[1] == 0x06) {
- pout("Rejecting SMART/ATA command to controller\n");
+ if(report > 0)
+ pout("Rejecting SMART/ATA command to controller\n");
+ // Emulate SMART STATUS CHECK drive reply
+ // smartctl fail to work without this
+ if(iop->cmnd[2]==0x2c) {
+ iop->resp_sense_len=22;
+ iop->sensep[0]=0x72; // response code
+ iop->sensep[7]=0x0e; // no idea what it is, copied from sat device answer
+ iop->sensep[8]=0x09; //
+ iop->sensep[17]=0x4f; // lm
+ iop->sensep[19]=0xc2; // lh
+ }
return true;
}
"you may need to replace %s with /dev/twaN or /dev/tweN", get_dev_name());
return this;
}
-
+ // DELL?
+ if (!memcmp(req_buff + 8, "DELL PERC", 12) || !memcmp(req_buff + 8, "MegaRAID", 8)) {
+ close();
+ set_err(EINVAL, "DELL or MegaRaid controller, please try adding '-d megaraid,N'");
+ return this;
+ }
+
// Marvell ?
if (len >= 42 && !memcmp(req_buff + 36, "MVSATA", 6)) {
//pout("Device %s: using '-d marvell' for ATA disk with Marvell driver\n", get_dev_name());