Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/ctl/ctl.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 400 Lines • ▼ Show 20 Lines | const static struct scsi_cddvd_capabilities_page cddvd_page_changeable = { | ||||
/*obsolete3*/0, | /*obsolete3*/0, | ||||
/*copy_management*/0, | /*copy_management*/0, | ||||
/*reserved2*/0, | /*reserved2*/0, | ||||
/*rotation_control*/0, | /*rotation_control*/0, | ||||
/*cur_write_speed*/0, | /*cur_write_speed*/0, | ||||
/*num_speed_descr*/0, | /*num_speed_descr*/0, | ||||
}; | }; | ||||
SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); | SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"CAM Target Layer"); | |||||
static int worker_threads = -1; | static int worker_threads = -1; | ||||
SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, | SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, | ||||
&worker_threads, 1, "Number of worker threads"); | &worker_threads, 1, "Number of worker threads"); | ||||
static int ctl_debug = CTL_DEBUG_NONE; | static int ctl_debug = CTL_DEBUG_NONE; | ||||
SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, | ||||
&ctl_debug, 0, "Enabled debug flags"); | &ctl_debug, 0, "Enabled debug flags"); | ||||
static int ctl_lun_map_size = 1024; | static int ctl_lun_map_size = 1024; | ||||
SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, | ||||
▲ Show 20 Lines • Show All 1,456 Lines • ▼ Show 20 Lines | if (error != 0) { | ||||
free(softc, M_DEVBUF); | free(softc, M_DEVBUF); | ||||
control_softc = NULL; | control_softc = NULL; | ||||
return (error); | return (error); | ||||
} | } | ||||
sysctl_ctx_init(&softc->sysctl_ctx); | sysctl_ctx_init(&softc->sysctl_ctx); | ||||
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, | softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx, | ||||
SYSCTL_STATIC_CHILDREN(_kern_cam), OID_AUTO, "ctl", | SYSCTL_STATIC_CHILDREN(_kern_cam), OID_AUTO, "ctl", | ||||
CTLFLAG_RD, 0, "CAM Target Layer"); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "CAM Target Layer"); | ||||
if (softc->sysctl_tree == NULL) { | if (softc->sysctl_tree == NULL) { | ||||
printf("%s: unable to allocate sysctl tree\n", __func__); | printf("%s: unable to allocate sysctl tree\n", __func__); | ||||
destroy_dev(softc->dev); | destroy_dev(softc->dev); | ||||
free(softc, M_DEVBUF); | free(softc, M_DEVBUF); | ||||
control_softc = NULL; | control_softc = NULL; | ||||
return (ENOMEM); | return (ENOMEM); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | ctl_init(void) | ||||
error = kproc_kthread_add(ctl_thresh_thread, softc, | error = kproc_kthread_add(ctl_thresh_thread, softc, | ||||
&softc->ctl_proc, &softc->thresh_thread, 0, 0, "ctl", "thresh"); | &softc->ctl_proc, &softc->thresh_thread, 0, 0, "ctl", "thresh"); | ||||
if (error != 0) { | if (error != 0) { | ||||
printf("error creating CTL threshold thread!\n"); | printf("error creating CTL threshold thread!\n"); | ||||
return (error); | return (error); | ||||
} | } | ||||
SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), | SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), | ||||
OID_AUTO, "ha_role", CTLTYPE_INT | CTLFLAG_RWTUN, | OID_AUTO, "ha_role", | ||||
CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NEEDGIANT, | |||||
softc, 0, ctl_ha_role_sysctl, "I", "HA role for this head"); | softc, 0, ctl_ha_role_sysctl, "I", "HA role for this head"); | ||||
if (softc->is_single == 0) { | if (softc->is_single == 0) { | ||||
if (ctl_frontend_register(&ha_frontend) != 0) | if (ctl_frontend_register(&ha_frontend) != 0) | ||||
softc->is_single = 1; | softc->is_single = 1; | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 11,601 Lines • Show Last 20 Lines |