Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ctl/ctl_frontend_ioctl.c
Show First 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | cfi_ioctl_port_create(struct ctl_req *req) | ||||
port->virtual_port = vp; | port->virtual_port = vp; | ||||
port->targ_port = -1; | port->targ_port = -1; | ||||
retval = ctl_port_register(port); | retval = ctl_port_register(port); | ||||
if (retval != 0) { | if (retval != 0) { | ||||
req->status = CTL_LUN_ERROR; | req->status = CTL_LUN_ERROR; | ||||
snprintf(req->error_str, sizeof(req->error_str), | snprintf(req->error_str, sizeof(req->error_str), | ||||
"ctl_port_register() failed with error %d", retval); | "ctl_port_register() failed with error %d", retval); | ||||
free(port, M_CTL); | free(cfi, M_CTL); | ||||
return; | return; | ||||
} | } | ||||
req->result_nvl = nvlist_create(0); | req->result_nvl = nvlist_create(0); | ||||
nvlist_add_number(req->result_nvl, "port_id", port->targ_port); | nvlist_add_number(req->result_nvl, "port_id", port->targ_port); | ||||
ctl_port_online(port); | ctl_port_online(port); | ||||
make_dev_args_init(&args); | make_dev_args_init(&args); | ||||
args.mda_devsw = &cfi_cdevsw; | args.mda_devsw = &cfi_cdevsw; | ||||
args.mda_uid = UID_ROOT; | args.mda_uid = UID_ROOT; | ||||
args.mda_gid = GID_OPERATOR; | args.mda_gid = GID_OPERATOR; | ||||
args.mda_mode = 0600; | args.mda_mode = 0600; | ||||
args.mda_si_drv1 = NULL; | args.mda_si_drv1 = NULL; | ||||
args.mda_si_drv2 = cfi; | args.mda_si_drv2 = cfi; | ||||
retval = make_dev_s(&args, &cfi->dev, "cam/ctl%d.%d", pp, vp); | retval = make_dev_s(&args, &cfi->dev, "cam/ctl%d.%d", pp, vp); | ||||
if (retval != 0) { | if (retval != 0) { | ||||
req->status = CTL_LUN_ERROR; | req->status = CTL_LUN_ERROR; | ||||
snprintf(req->error_str, sizeof(req->error_str), | snprintf(req->error_str, sizeof(req->error_str), | ||||
"make_dev_s() failed with error %d", retval); | "make_dev_s() failed with error %d", retval); | ||||
free(port, M_CTL); | free(cfi, M_CTL); | ||||
return; | return; | ||||
} | } | ||||
req->status = CTL_LUN_OK; | req->status = CTL_LUN_OK; | ||||
TAILQ_INSERT_TAIL(&isoftc->ports, cfi, link); | TAILQ_INSERT_TAIL(&isoftc->ports, cfi, link); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines |