/* find iscsi session */
transportdev = parent;
- while (1) {
+ for (;;) {
transportdev = udev_device_get_parent(transportdev);
if (transportdev == NULL)
return NULL;
if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0)
break;
}
- if (transportdev == NULL)
- return NULL;
/* find iscsi session device */
sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev));
}
return SG_ERR_CAT_SENSE;
}
- if (!host_status) {
+ if (host_status) {
if ((host_status == DID_NO_CONNECT) ||
(host_status == DID_BUS_BUSY) ||
(host_status == DID_TIME_OUT))
return SG_ERR_CAT_TIMEOUT;
}
- if (!driver_status) {
+ if (driver_status) {
if (driver_status == DRIVER_TIMEOUT)
return SG_ERR_CAT_TIMEOUT;
}
{ INQUIRY_CMD, evpd, page, 0, buflen, 0 };
unsigned char sense[SENSE_BUFF_LEN];
void *io_buf;
- int retval;
+ struct sg_io_v4 io_v4;
+ struct sg_io_hdr io_hdr;
int retry = 3; /* rather random */
+ int retval;
if (buflen > SCSI_INQ_BUFF_LEN) {
info(udev, "buflen %d too long\n", buflen);
dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page);
if (dev_scsi->use_sg == 4) {
- struct sg_io_v4 io_v4;
-
memset(&io_v4, 0, sizeof(struct sg_io_v4));
io_v4.guard = 'Q';
io_v4.protocol = BSG_PROTOCOL_SCSI;
io_v4.din_xferp = (uintptr_t)buf;
io_buf = (void *)&io_v4;
} else {
- struct sg_io_hdr io_hdr;
-
memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof(inq_cmd);