Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_tpc.c
Show All 35 Lines | |||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/condvar.h> | #include <sys/condvar.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/nv.h> | |||||
#include <sys/dnv.h> | |||||
#include <machine/atomic.h> | #include <machine/atomic.h> | ||||
#include <cam/cam.h> | #include <cam/cam.h> | ||||
#include <cam/scsi/scsi_all.h> | #include <cam/scsi/scsi_all.h> | ||||
#include <cam/scsi/scsi_da.h> | #include <cam/scsi/scsi_da.h> | ||||
#include <cam/ctl/ctl_io.h> | #include <cam/ctl/ctl_io.h> | ||||
#include <cam/ctl/ctl.h> | #include <cam/ctl/ctl.h> | ||||
#include <cam/ctl/ctl_frontend.h> | #include <cam/ctl/ctl_frontend.h> | ||||
▲ Show 20 Lines • Show All 1,611 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct ctl_lun *lun = CTL_LUN(ctsio); | struct ctl_lun *lun = CTL_LUN(ctsio); | ||||
struct scsi_extended_copy *cdb; | struct scsi_extended_copy *cdb; | ||||
struct scsi_extended_copy_lid1_data *data; | struct scsi_extended_copy_lid1_data *data; | ||||
struct scsi_ec_cscd *cscd; | struct scsi_ec_cscd *cscd; | ||||
struct scsi_ec_segment *seg; | struct scsi_ec_segment *seg; | ||||
struct tpc_list *list, *tlist; | struct tpc_list *list, *tlist; | ||||
uint8_t *ptr; | uint8_t *ptr; | ||||
char *value; | const char *value; | ||||
int len, off, lencscd, lenseg, leninl, nseg; | int len, off, lencscd, lenseg, leninl, nseg; | ||||
CTL_DEBUG_PRINT(("ctl_extended_copy_lid1\n")); | CTL_DEBUG_PRINT(("ctl_extended_copy_lid1\n")); | ||||
cdb = (struct scsi_extended_copy *)ctsio->cdb; | cdb = (struct scsi_extended_copy *)ctsio->cdb; | ||||
len = scsi_4btoul(cdb->length); | len = scsi_4btoul(cdb->length); | ||||
if (len == 0) { | if (len == 0) { | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (lencscd + lenseg > TPC_MAX_LIST || | ||||
len < sizeof(struct scsi_extended_copy_lid1_data) + | len < sizeof(struct scsi_extended_copy_lid1_data) + | ||||
lencscd + lenseg + leninl) { | lencscd + lenseg + leninl) { | ||||
ctl_set_param_len_error(ctsio); | ctl_set_param_len_error(ctsio); | ||||
goto done; | goto done; | ||||
} | } | ||||
list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); | list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); | ||||
list->service_action = cdb->service_action; | list->service_action = cdb->service_action; | ||||
value = ctl_get_opt(&lun->be_lun->options, "insecure_tpc"); | value = dnvlist_get_string(lun->be_lun->options, "insecure_tpc", NULL); | ||||
if (value != NULL && strcmp(value, "on") == 0) | if (value != NULL && strcmp(value, "on") == 0) | ||||
list->init_port = -1; | list->init_port = -1; | ||||
else | else | ||||
list->init_port = ctsio->io_hdr.nexus.targ_port; | list->init_port = ctsio->io_hdr.nexus.targ_port; | ||||
list->init_idx = ctl_get_initindex(&ctsio->io_hdr.nexus); | list->init_idx = ctl_get_initindex(&ctsio->io_hdr.nexus); | ||||
list->list_id = data->list_identifier; | list->list_id = data->list_identifier; | ||||
list->flags = data->flags; | list->flags = data->flags; | ||||
list->params = ctsio->kern_data_ptr; | list->params = ctsio->kern_data_ptr; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct ctl_lun *lun = CTL_LUN(ctsio); | struct ctl_lun *lun = CTL_LUN(ctsio); | ||||
struct scsi_extended_copy *cdb; | struct scsi_extended_copy *cdb; | ||||
struct scsi_extended_copy_lid4_data *data; | struct scsi_extended_copy_lid4_data *data; | ||||
struct scsi_ec_cscd *cscd; | struct scsi_ec_cscd *cscd; | ||||
struct scsi_ec_segment *seg; | struct scsi_ec_segment *seg; | ||||
struct tpc_list *list, *tlist; | struct tpc_list *list, *tlist; | ||||
uint8_t *ptr; | uint8_t *ptr; | ||||
char *value; | const char *value; | ||||
int len, off, lencscd, lenseg, leninl, nseg; | int len, off, lencscd, lenseg, leninl, nseg; | ||||
CTL_DEBUG_PRINT(("ctl_extended_copy_lid4\n")); | CTL_DEBUG_PRINT(("ctl_extended_copy_lid4\n")); | ||||
cdb = (struct scsi_extended_copy *)ctsio->cdb; | cdb = (struct scsi_extended_copy *)ctsio->cdb; | ||||
len = scsi_4btoul(cdb->length); | len = scsi_4btoul(cdb->length); | ||||
if (len == 0) { | if (len == 0) { | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (lencscd + lenseg > TPC_MAX_LIST || | ||||
len < sizeof(struct scsi_extended_copy_lid1_data) + | len < sizeof(struct scsi_extended_copy_lid1_data) + | ||||
lencscd + lenseg + leninl) { | lencscd + lenseg + leninl) { | ||||
ctl_set_param_len_error(ctsio); | ctl_set_param_len_error(ctsio); | ||||
goto done; | goto done; | ||||
} | } | ||||
list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); | list = malloc(sizeof(struct tpc_list), M_CTL, M_WAITOK | M_ZERO); | ||||
list->service_action = cdb->service_action; | list->service_action = cdb->service_action; | ||||
value = ctl_get_opt(&lun->be_lun->options, "insecure_tpc"); | value = dnvlist_get_string(lun->be_lun->options, "insecure_tpc", NULL); | ||||
if (value != NULL && strcmp(value, "on") == 0) | if (value != NULL && strcmp(value, "on") == 0) | ||||
list->init_port = -1; | list->init_port = -1; | ||||
else | else | ||||
list->init_port = ctsio->io_hdr.nexus.targ_port; | list->init_port = ctsio->io_hdr.nexus.targ_port; | ||||
list->init_idx = ctl_get_initindex(&ctsio->io_hdr.nexus); | list->init_idx = ctl_get_initindex(&ctsio->io_hdr.nexus); | ||||
list->list_id = scsi_4btoul(data->list_identifier); | list->list_id = scsi_4btoul(data->list_identifier); | ||||
list->flags = data->flags; | list->flags = data->flags; | ||||
list->params = ctsio->kern_data_ptr; | list->params = ctsio->kern_data_ptr; | ||||
▲ Show 20 Lines • Show All 577 Lines • Show Last 20 Lines |