FreeBSD/sys/dev/mrsas/mrsas.c
/**
 * mrsas_get_softc_instance:    Find softc instance based on cmd type
 *
 * This function will return softc instance based on cmd type.
 * In some case, application fire ioctl on required management instance and
 * do not provide host_no. Use cdev->si_drv1 to get softc instance for those
 * case, else get the softc instance from host_no provided by application in
 * user data.
 */
Find softc instance based on cmd type
This function will return softc instance based on cmd type.
In some case, application fire ioctl on required management instance and
do not provide host_no. Use cdev->si_drv1 to get softc instance for those
case, else get the softc instance from host_no provided by application in
user data.
Find softc instance based on cmd type This function will return softc instance based on cmd type . In some case application fire ioctl on required management instance and do not provide host_no . Use cdev - > si_drv1 to get softc instance for those case else get the softc instance from host_no provided by application in user data .
static struct mrsas_softc *
mrsas_get_softc_instance(struct cdev *dev, u_long cmd, caddr_t arg)
{
	struct mrsas_softc *sc = NULL;
	struct mrsas_iocpacket *user_ioc = (struct mrsas_iocpacket *)arg;
	if (cmd == MRSAS_IOC_GET_PCI_INFO) {
		sc = dev->si_drv1;
	} else {
		sc = mrsas_mgmt_info.sc_ptr[user_ioc->host_no];
		if (sc == NULL)
			printf("There is no Controller number %d\n",
			    user_ioc->host_no);
		else if (user_ioc->host_no >= mrsas_mgmt_info.max_index)
			mrsas_dprint(sc, MRSAS_FAULT,
			    "Invalid Controller number %d\n", user_ioc->host_no);
	}
	return sc;
}
static struct mrsas_softc * mrsas_get_softc_instance ( struct cdev * dev , u_long cmd , caddr_t arg ) { struct mrsas_softc * sc = NULL ; struct mrsas_iocpacket * user_ioc = ( struct mrsas_iocpacket * ) arg ; if ( cmd == MRSAS_IOC_GET_PCI_INFO ) { sc = dev -> si_drv1 ; } else { sc = mrsas_mgmt_info . sc_ptr [ user_ioc -> host_no ] ; if ( sc == NULL ) printf ( " \n " , user_ioc -> host_no ) ; else if ( user_ioc -> host_no >= mrsas_mgmt_info . max_index ) mrsas_dprint ( sc , MRSAS_FAULT , " \n " , user_ioc -> host_no ) ; } return sc ; }
mrsas_get_softc_instance:    Find softc instance based on cmd type
 This function will return softc instance based on cmd type.
mrsas_get_softc_instance : Find softc instance based on cmd type This function will return softc instance based on cmd type .
/*
		 * get the Host number & the softc from data sent by the
		 * Application
		 */