MFC r288211: Remove some control_softc references.

This commit is contained in:
mav 2015-10-05 10:58:41 +00:00
parent 44b21c856f
commit 7f0834440e
6 changed files with 25 additions and 52 deletions

View File

@ -626,7 +626,7 @@ alloc:
void void
ctl_isc_announce_port(struct ctl_port *port) ctl_isc_announce_port(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
union ctl_ha_msg *msg; union ctl_ha_msg *msg;
int i; int i;
@ -687,7 +687,7 @@ ctl_isc_announce_port(struct ctl_port *port)
void void
ctl_isc_announce_iid(struct ctl_port *port, int iid) ctl_isc_announce_iid(struct ctl_port *port, int iid)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
union ctl_ha_msg *msg; union ctl_ha_msg *msg;
int i, l; int i, l;
@ -1128,12 +1128,11 @@ ctl_isc_mode_sync(struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
static void static void
ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param) ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_event event, int param)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
union ctl_io *io; union ctl_io *io;
struct ctl_prio *presio; struct ctl_prio *presio;
ctl_ha_status isc_status; ctl_ha_status isc_status;
softc = control_softc;
CTL_DEBUG_PRINT(("CTL: Isc Msg event %d\n", event)); CTL_DEBUG_PRINT(("CTL: Isc Msg event %d\n", event));
if (event == CTL_HA_EVT_MSG_RECV) { if (event == CTL_HA_EVT_MSG_RECV) {
union ctl_ha_msg *msg, msgbuf; union ctl_ha_msg *msg, msgbuf;
@ -1584,13 +1583,11 @@ ctl_init(void)
int i, error, retval; int i, error, retval;
retval = 0; retval = 0;
control_softc = malloc(sizeof(*control_softc), M_DEVBUF, softc = control_softc = malloc(sizeof(*control_softc), M_DEVBUF,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
softc = control_softc;
softc->dev = make_dev(&ctl_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, softc->dev = make_dev(&ctl_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600,
"cam/ctl"); "cam/ctl");
softc->dev->si_drv1 = softc; softc->dev->si_drv1 = softc;
sysctl_ctx_init(&softc->sysctl_ctx); sysctl_ctx_init(&softc->sysctl_ctx);
@ -1722,11 +1719,9 @@ ctl_init(void)
void void
ctl_shutdown(void) ctl_shutdown(void)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
struct ctl_lun *lun, *next_lun; struct ctl_lun *lun, *next_lun;
softc = (struct ctl_softc *)control_softc;
if (softc->is_single == 0) { if (softc->is_single == 0) {
ctl_ha_msg_shutdown(softc); ctl_ha_msg_shutdown(softc);
if (ctl_ha_msg_deregister(CTL_HA_CHAN_CTL) if (ctl_ha_msg_deregister(CTL_HA_CHAN_CTL)
@ -1803,7 +1798,7 @@ ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td)
int int
ctl_remove_initiator(struct ctl_port *port, int iid) ctl_remove_initiator(struct ctl_port *port, int iid)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
mtx_assert(&softc->ctl_lock, MA_NOTOWNED); mtx_assert(&softc->ctl_lock, MA_NOTOWNED);
@ -1829,7 +1824,7 @@ ctl_remove_initiator(struct ctl_port *port, int iid)
int int
ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name) ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
time_t best_time; time_t best_time;
int i, best; int i, best;
@ -2004,15 +1999,13 @@ ctl_create_iid(struct ctl_port *port, int iid, uint8_t *buf)
static int static int
ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
union ctl_ha_msg msg_info; union ctl_ha_msg msg_info;
struct ctl_lun *lun; struct ctl_lun *lun;
const struct ctl_cmd_entry *entry; const struct ctl_cmd_entry *entry;
int retval = 0; int retval = 0;
uint32_t targ_lun; uint32_t targ_lun;
softc = control_softc;
targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
if ((targ_lun < CTL_MAX_LUNS) && if ((targ_lun < CTL_MAX_LUNS) &&
@ -2379,12 +2372,10 @@ static int
ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
struct thread *td) struct thread *td)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = dev->si_drv1;
struct ctl_lun *lun; struct ctl_lun *lun;
int retval; int retval;
softc = control_softc;
retval = 0; retval = 0;
switch (cmd) { switch (cmd) {
@ -3483,7 +3474,7 @@ ctl_get_initindex(struct ctl_nexus *nexus)
int int
ctl_lun_map_init(struct ctl_port *port) ctl_lun_map_init(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
struct ctl_lun *lun; struct ctl_lun *lun;
uint32_t i; uint32_t i;
@ -3507,7 +3498,7 @@ ctl_lun_map_init(struct ctl_port *port)
int int
ctl_lun_map_deinit(struct ctl_port *port) ctl_lun_map_deinit(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
struct ctl_lun *lun; struct ctl_lun *lun;
if (port->lun_map == NULL) if (port->lun_map == NULL)
@ -4674,14 +4665,11 @@ ctl_free_lun(struct ctl_lun *lun)
static void static void
ctl_create_lun(struct ctl_be_lun *be_lun) ctl_create_lun(struct ctl_be_lun *be_lun)
{ {
struct ctl_softc *softc;
softc = control_softc;
/* /*
* ctl_alloc_lun() should handle all potential failure cases. * ctl_alloc_lun() should handle all potential failure cases.
*/ */
ctl_alloc_lun(softc, NULL, be_lun); ctl_alloc_lun(control_softc, NULL, be_lun);
} }
int int
@ -8726,12 +8714,11 @@ done:
static void static void
ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg) ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
{ {
struct ctl_softc *softc = control_softc;
struct ctl_lun *lun; struct ctl_lun *lun;
struct ctl_softc *softc;
int i; int i;
uint32_t residx, targ_lun; uint32_t residx, targ_lun;
softc = control_softc;
targ_lun = msg->hdr.nexus.targ_mapped_lun; targ_lun = msg->hdr.nexus.targ_mapped_lun;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
if ((targ_lun >= CTL_MAX_LUNS) || if ((targ_lun >= CTL_MAX_LUNS) ||
@ -9259,7 +9246,7 @@ ctl_verify(struct ctl_scsiio *ctsio)
int int
ctl_report_luns(struct ctl_scsiio *ctsio) ctl_report_luns(struct ctl_scsiio *ctsio)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc;
struct scsi_report_luns *cdb; struct scsi_report_luns *cdb;
struct scsi_report_luns_data *lun_data; struct scsi_report_luns_data *lun_data;
struct ctl_lun *lun, *request_lun; struct ctl_lun *lun, *request_lun;
@ -9272,6 +9259,7 @@ ctl_report_luns(struct ctl_scsiio *ctsio)
retval = CTL_RETVAL_COMPLETE; retval = CTL_RETVAL_COMPLETE;
cdb = (struct scsi_report_luns *)ctsio->cdb; cdb = (struct scsi_report_luns *)ctsio->cdb;
port = ctl_io_port(&ctsio->io_hdr); port = ctl_io_port(&ctsio->io_hdr);
softc = port->ctl_softc;
CTL_DEBUG_PRINT(("ctl_report_luns\n")); CTL_DEBUG_PRINT(("ctl_report_luns\n"));
@ -10348,15 +10336,13 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio)
{ {
struct scsi_inquiry_data *inq_ptr; struct scsi_inquiry_data *inq_ptr;
struct scsi_inquiry *cdb; struct scsi_inquiry *cdb;
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
struct ctl_port *port; struct ctl_port *port;
struct ctl_lun *lun; struct ctl_lun *lun;
char *val; char *val;
uint32_t alloc_len, data_len; uint32_t alloc_len, data_len;
ctl_port_type port_type; ctl_port_type port_type;
softc = control_softc;
/* /*
* Figure out whether we're talking to a Fibre Channel port or not. * Figure out whether we're talking to a Fibre Channel port or not.
* We treat the ioctl front end, and any SCSI adapters, as packetized * We treat the ioctl front end, and any SCSI adapters, as packetized
@ -12190,11 +12176,9 @@ ctl_handle_isc(union ctl_io *io)
{ {
int free_io; int free_io;
struct ctl_lun *lun; struct ctl_lun *lun;
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
uint32_t targ_lun; uint32_t targ_lun;
softc = control_softc;
targ_lun = io->io_hdr.nexus.targ_mapped_lun; targ_lun = io->io_hdr.nexus.targ_mapped_lun;
lun = softc->ctl_luns[targ_lun]; lun = softc->ctl_luns[targ_lun];
@ -12863,13 +12847,11 @@ static int
ctl_datamove_remote_sgl_setup(union ctl_io *io) ctl_datamove_remote_sgl_setup(union ctl_io *io)
{ {
struct ctl_sg_entry *local_sglist; struct ctl_sg_entry *local_sglist;
struct ctl_softc *softc;
uint32_t len_to_go; uint32_t len_to_go;
int retval; int retval;
int i; int i;
retval = 0; retval = 0;
softc = control_softc;
local_sglist = io->io_hdr.local_sglist; local_sglist = io->io_hdr.local_sglist;
len_to_go = io->scsiio.kern_data_len; len_to_go = io->scsiio.kern_data_len;

View File

@ -65,11 +65,9 @@ extern struct ctl_softc *control_softc;
int int
ctl_backend_register(struct ctl_backend_driver *be) ctl_backend_register(struct ctl_backend_driver *be)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
struct ctl_backend_driver *be_tmp; struct ctl_backend_driver *be_tmp;
softc = control_softc;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
/* /*
* Sanity check, make sure this isn't a duplicate registration. * Sanity check, make sure this isn't a duplicate registration.
@ -120,9 +118,7 @@ ctl_backend_register(struct ctl_backend_driver *be)
int int
ctl_backend_deregister(struct ctl_backend_driver *be) ctl_backend_deregister(struct ctl_backend_driver *be)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
softc = control_softc;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
@ -153,20 +149,16 @@ ctl_backend_deregister(struct ctl_backend_driver *be)
struct ctl_backend_driver * struct ctl_backend_driver *
ctl_backend_find(char *backend_name) ctl_backend_find(char *backend_name)
{ {
struct ctl_softc *softc; struct ctl_softc *softc = control_softc;
struct ctl_backend_driver *be_tmp; struct ctl_backend_driver *be_tmp;
softc = control_softc;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
STAILQ_FOREACH(be_tmp, &softc->be_list, links) { STAILQ_FOREACH(be_tmp, &softc->be_list, links) {
if (strcmp(be_tmp->name, backend_name) == 0) { if (strcmp(be_tmp->name, backend_name) == 0) {
mtx_unlock(&softc->ctl_lock); mtx_unlock(&softc->ctl_lock);
return (be_tmp); return (be_tmp);
} }
} }
mtx_unlock(&softc->ctl_lock); mtx_unlock(&softc->ctl_lock);
return (NULL); return (NULL);

View File

@ -148,6 +148,7 @@ ctl_port_register(struct ctl_port *port)
retval = 0; retval = 0;
KASSERT(softc != NULL, ("CTL is not initialized")); KASSERT(softc != NULL, ("CTL is not initialized"));
port->ctl_softc = softc;
mtx_lock(&softc->ctl_lock); mtx_lock(&softc->ctl_lock);
if (port->targ_port >= 0) if (port->targ_port >= 0)
@ -218,7 +219,7 @@ error:
int int
ctl_port_deregister(struct ctl_port *port) ctl_port_deregister(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
struct ctl_io_pool *pool; struct ctl_io_pool *pool;
int retval, i; int retval, i;
@ -309,7 +310,7 @@ ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn,
void void
ctl_port_online(struct ctl_port *port) ctl_port_online(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
struct ctl_lun *lun; struct ctl_lun *lun;
uint32_t l; uint32_t l;
@ -344,7 +345,7 @@ ctl_port_online(struct ctl_port *port)
void void
ctl_port_offline(struct ctl_port *port) ctl_port_offline(struct ctl_port *port)
{ {
struct ctl_softc *softc = control_softc; struct ctl_softc *softc = port->ctl_softc;
struct ctl_lun *lun; struct ctl_lun *lun;
uint32_t l; uint32_t l;

View File

@ -211,6 +211,7 @@ struct ctl_wwpn_iid {
* shouldn't touch this field. * shouldn't touch this field.
*/ */
struct ctl_port { struct ctl_port {
struct ctl_softc *ctl_softc;
struct ctl_frontend *frontend; struct ctl_frontend *frontend;
ctl_port_type port_type; /* passed to CTL */ ctl_port_type port_type; /* passed to CTL */
int num_requested_ctl_io; /* passed to CTL */ int num_requested_ctl_io; /* passed to CTL */

View File

@ -171,7 +171,6 @@ static void cfiscsi_target_release(struct cfiscsi_target *ct);
static void cfiscsi_session_delete(struct cfiscsi_session *cs); static void cfiscsi_session_delete(struct cfiscsi_session *cs);
static struct cfiscsi_softc cfiscsi_softc; static struct cfiscsi_softc cfiscsi_softc;
extern struct ctl_softc *control_softc;
static struct ctl_frontend cfiscsi_frontend = static struct ctl_frontend cfiscsi_frontend =
{ {

View File

@ -160,8 +160,6 @@ struct ha_softc {
TAILQ_HEAD(, ctl_ha_dt_req) ha_dts; TAILQ_HEAD(, ctl_ha_dt_req) ha_dts;
} ha_softc; } ha_softc;
extern struct ctl_softc *control_softc;
static void static void
ctl_ha_conn_wake(struct ha_softc *softc) ctl_ha_conn_wake(struct ha_softc *softc)
{ {