Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/scsi/scsi_cd.c
Show All 12 Lines | |||||
#ifndef CD_DEFAULT_TIMEOUT | #ifndef CD_DEFAULT_TIMEOUT | ||||
#define CD_DEFAULT_TIMEOUT 30000 | #define CD_DEFAULT_TIMEOUT 30000 | ||||
#endif | #endif | ||||
static int cd_poll_period = CD_DEFAULT_POLL_PERIOD; | static int cd_poll_period = CD_DEFAULT_POLL_PERIOD; | ||||
static int cd_retry_count = CD_DEFAULT_RETRY; | static int cd_retry_count = CD_DEFAULT_RETRY; | ||||
static int cd_timeout = CD_DEFAULT_TIMEOUT; | static int cd_timeout = CD_DEFAULT_TIMEOUT; | ||||
static SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); | static SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, | ||||
"CAM CDROM driver"); | |||||
SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RWTUN, | ||||
&cd_poll_period, 0, "Media polling period in seconds"); | &cd_poll_period, 0, "Media polling period in seconds"); | ||||
SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RWTUN, | ||||
&cd_retry_count, 0, "Normal I/O retry count"); | &cd_retry_count, 0, "Normal I/O retry count"); | ||||
SYSCTL_INT(_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RWTUN, | SYSCTL_INT(_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RWTUN, | ||||
&cd_timeout, 0, "Timeout, in us, for read operations"); | &cd_timeout, 0, "Timeout, in us, for read operations"); | ||||
static MALLOC_DEFINE(M_SCSICD, "scsi_cd", "scsi_cd buffers"); | static MALLOC_DEFINE(M_SCSICD, "scsi_cd", "scsi_cd buffers"); | ||||
Show All 24 Lines | |||||
softc = (struct cd_softc *)periph->softc; | softc = (struct cd_softc *)periph->softc; | ||||
snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number); | snprintf(tmpstr, sizeof(tmpstr), "CAM CD unit %d", periph->unit_number); | ||||
snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); | snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number); | ||||
sysctl_ctx_init(&softc->sysctl_ctx); | sysctl_ctx_init(&softc->sysctl_ctx); | ||||
softc->flags |= CD_FLAG_SCTX_INIT; | softc->flags |= CD_FLAG_SCTX_INIT; | ||||
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, | softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx, | ||||
SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO, | SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO, | ||||
tmpstr2, CTLFLAG_RD, 0, tmpstr, "device_index"); | tmpstr2, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, tmpstr, | ||||
"device_index"); | |||||
if (softc->sysctl_tree == NULL) { | if (softc->sysctl_tree == NULL) { | ||||
printf("cdsysctlinit: unable to allocate sysctl tree\n"); | printf("cdsysctlinit: unable to allocate sysctl tree\n"); | ||||
cam_periph_release(periph); | cam_periph_release(periph); | ||||
return; | return; | ||||
} | } | ||||
/* | /* | ||||
* Now register the sysctl handler, so the user can the value on | * Now register the sysctl handler, so the user can the value on | ||||
* the fly. | * the fly. | ||||
*/ | */ | ||||
SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), | SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), | ||||
OID_AUTO, "minimum_cmd_size", CTLTYPE_INT | CTLFLAG_RW, | OID_AUTO, "minimum_cmd_size", | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&softc->minimum_command_size, 0, cdcmdsizesysctl, "I", | &softc->minimum_command_size, 0, cdcmdsizesysctl, "I", | ||||
"Minimum CDB size"); | "Minimum CDB size"); | ||||
cam_periph_release(periph); | cam_periph_release(periph); | ||||
} | } | ||||
/* | /* | ||||
* We have a handler function for this so we can check the values when the | * We have a handler function for this so we can check the values when the | ||||
Show All 12 Lines |