- Just use cam_calc_geometry(9) on newer version of FreeBSD rather than

duplicating it.
- In hptmv(4) and hptrr(4) use __FBSDID and DEVMETHOD_END.
This commit is contained in:
Marius Strobl 2011-11-23 21:43:51 +00:00
parent 604f5f1f77
commit f3b080e6ab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=227912
4 changed files with 34 additions and 14 deletions

View File

@ -2714,16 +2714,20 @@ static void arcmsr_action(struct cam_sim * psim, union ccb * pccb)
xpt_done(pccb);
break;
}
case XPT_CALC_GEOMETRY: {
struct ccb_calc_geometry *ccg;
u_int32_t size_mb;
u_int32_t secs_per_cylinder;
case XPT_CALC_GEOMETRY:
if(pccb->ccb_h.target_id == 16) {
pccb->ccb_h.status |= CAM_FUNC_NOTAVAIL;
xpt_done(pccb);
break;
}
#if __FreeBSD_version >= 500000
cam_calc_geometry(&pccb->ccg, 1);
#else
{
struct ccb_calc_geometry *ccg;
u_int32_t size_mb;
u_int32_t secs_per_cylinder;
ccg= &pccb->ccg;
if (ccg->block_size == 0) {
pccb->ccb_h.status = CAM_REQ_INVALID;
@ -2746,9 +2750,10 @@ static void arcmsr_action(struct cam_sim * psim, union ccb * pccb)
secs_per_cylinder=ccg->heads * ccg->secs_per_track;
ccg->cylinders=ccg->volume_size / secs_per_cylinder;
pccb->ccb_h.status |= CAM_REQ_CMP;
}
#endif
xpt_done(pccb);
break;
}
default:
pccb->ccb_h.status |= CAM_REQ_INVALID;
xpt_done(pccb);

View File

@ -1813,11 +1813,15 @@ static void hptiop_action(struct cam_sim *sim, union ccb *ccb)
break;
case XPT_CALC_GEOMETRY:
#if __FreeBSD_version >= 500000
cam_calc_geometry(&ccb->ccg, 1);
#else
ccb->ccg.heads = 255;
ccb->ccg.secs_per_track = 63;
ccb->ccg.cylinders = ccb->ccg.volume_size /
(ccb->ccg.heads * ccb->ccg.secs_per_track);
ccb->ccb_h.status = CAM_REQ_CMP;
#endif
break;
case XPT_PATH_INQ:

View File

@ -22,9 +22,10 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
@ -94,7 +95,7 @@ static device_method_t driver_methods[] = {
DEVMETHOD(device_detach, hpt_detach),
DEVMETHOD(device_shutdown, hpt_shutdown),
{ 0, 0 }
DEVMETHOD_END
};
static driver_t hpt_pci_driver = {
@ -2371,7 +2372,10 @@ hpt_action(struct cam_sim *sim, union ccb *ccb)
break;
case XPT_CALC_GEOMETRY:
{
#if __FreeBSD_version >= 500000
cam_calc_geometry(&ccb->ccg, 1);
#else
{
struct ccb_calc_geometry *ccg;
u_int32_t size_mb;
u_int32_t secs_per_cylinder;
@ -2389,9 +2393,10 @@ hpt_action(struct cam_sim *sim, union ccb *ccb)
secs_per_cylinder = ccg->heads * ccg->secs_per_track;
ccg->cylinders = ccg->volume_size / secs_per_cylinder;
ccb->ccb_h.status = CAM_REQ_CMP;
}
#endif
xpt_done(ccb);
break;
}
case XPT_PATH_INQ: /* Path routing inquiry */
{

View File

@ -22,9 +22,11 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <dev/hptrr/hptrr_config.h>
/* $Id: osm_bsd.c,v 1.27 2007/11/22 07:35:49 gmm Exp $
*
@ -795,10 +797,14 @@ static void hpt_action(struct cam_sim *sim, union ccb *ccb)
break;
case XPT_CALC_GEOMETRY:
#if __FreeBSD_version >= 500000
cam_calc_geometry(&ccb->ccg, 1);
#else
ccb->ccg.heads = 255;
ccb->ccg.secs_per_track = 63;
ccb->ccg.cylinders = ccb->ccg.volume_size / (ccb->ccg.heads * ccb->ccg.secs_per_track);
ccb->ccb_h.status = CAM_REQ_CMP;
#endif
break;
case XPT_PATH_INQ:
@ -1250,7 +1256,7 @@ static device_method_t driver_methods[] = {
DEVMETHOD(device_attach, hpt_attach),
DEVMETHOD(device_detach, hpt_detach),
DEVMETHOD(device_shutdown, hpt_shutdown),
{ 0, 0 }
DEVMETHOD_END
};
static driver_t hpt_pci_driver = {