static int clariion_activate(struct scsi_device *sdev) { struct clariion_dh_data *csdev = get_clariion_data(sdev); int result; result = clariion_send_inquiry(sdev, csdev); if (result != SCSI_DH_OK) goto done; if (csdev->lun_state == CLARIION_LUN_OWNED) goto done; result = send_trespass_cmd(sdev, csdev); if (result != SCSI_DH_OK) goto done; sdev_printk(KERN_INFO, sdev,"%s: %s trespass command sent\n", CLARIION_NAME, csdev->flags&CLARIION_SHORT_TRESPASS?"short":"long" ); /* Update status */ result = clariion_send_inquiry(sdev, csdev); if (result != SCSI_DH_OK) goto done; done: sdev_printk(KERN_INFO, sdev, "%s: at SP %c Port %d (%s, default SP %c)\n", CLARIION_NAME, csdev->current_sp + 'A', csdev->port, lun_state[csdev->lun_state], csdev->default_sp + 'A'); return result; }
/* * params - parameters in the following format * "no_of_params\0param1\0param2\0param3\0...\0" * for example, string for 2 parameters with value 10 and 21 * is specified as "2\010\021\0". */ static int clariion_set_params(struct scsi_device *sdev, const char *params) { struct clariion_dh_data *csdev = sdev->handler_data; unsigned int hr = 0, st = 0, argc; const char *p = params; int result = SCSI_DH_OK; if ((sscanf(params, "%u", &argc) != 1) || (argc != 2)) return -EINVAL; while (*p++) ; if ((sscanf(p, "%u", &st) != 1) || (st > 1)) return -EINVAL; while (*p++) ; if ((sscanf(p, "%u", &hr) != 1) || (hr > 1)) return -EINVAL; if (st) csdev->flags |= CLARIION_SHORT_TRESPASS; else csdev->flags &= ~CLARIION_SHORT_TRESPASS; if (hr) csdev->flags |= CLARIION_HONOR_RESERVATIONS; else csdev->flags &= ~CLARIION_HONOR_RESERVATIONS; /* * If this path is owned, we have to send a trespass command * with the new parameters. If not, simply return. Next trespass * command would use the parameters. */ if (csdev->lun_state != CLARIION_LUN_OWNED) goto done; csdev->lun_state = CLARIION_LUN_UNINITIALIZED; result = send_trespass_cmd(sdev, csdev); if (result != SCSI_DH_OK) goto done; /* Update status */ result = clariion_send_inquiry(sdev, csdev); done: return result; }
static int clariion_activate(struct scsi_device *sdev, activate_complete fn, void *data) { struct clariion_dh_data *csdev = get_clariion_data(sdev); int result; result = clariion_send_inquiry(sdev, csdev); if (result != SCSI_DH_OK) goto done; if (csdev->lun_state == CLARIION_LUN_OWNED) goto done; result = send_trespass_cmd(sdev, csdev); if (result != SCSI_DH_OK) goto done; // sdev_printk(KERN_INFO, sdev,"%s: %s trespass command sent\n", // CLARIION_NAME, ; /* Update status */ result = clariion_send_inquiry(sdev, csdev); if (result != SCSI_DH_OK) goto done; done: // sdev_printk(KERN_INFO, sdev, // "%s: at SP %c Port %d (%s, default SP %c)\n", // CLARIION_NAME, csdev->current_sp + 'A', // csdev->port, lun_state[csdev->lun_state], ; if (fn) fn(data, result); return 0; }