Date: Sun, 27 May 2007 17:31:13 GMT From: Matt Jacob <mjacob@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 120460 for review Message-ID: <200705271731.l4RHVDhh033045@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120460 Change 120460 by mjacob@mjexp on 2007/05/27 17:31:10 Add an ioctl entry point in prepartion for lsiutil support. Affected files ... .. //depot/projects/mjexp/sys/dev/mpt/mpt.c#9 edit .. //depot/projects/mjexp/sys/dev/mpt/mpt_ioctl.h#1 add Differences ... ==== //depot/projects/mjexp/sys/dev/mpt/mpt.c#9 (text+ko) ==== @@ -108,10 +108,41 @@ #include <dev/mpt/mpilib/mpi_targ.h> #include <sys/sysctl.h> +#include <sys/conf.h> +#include <sys/ioccom.h> #define MPT_MAX_TRYS 3 #define MPT_MAX_WAIT 300000 +static d_ioctl_t mptioctl; +#if __FreeBSD_version < 500000 +#define MPT_CDEV_MAJOR 249 +static struct cdevsw mpt_cdevsw = { + /* open */ nullopen, + /* close */ nullclose, + /* read */ noread, + /* write */ nowrite, + /* ioctl */ mptioctl, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "mpt", + /* maj */ MPT_CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ D_TAPE, +}; +#else +static struct cdevsw mpt_cdevsw = { + .d_version = D_VERSION, +#if __FreeBSD_version < 700037 + .d_flags = D_NEEDGIANT, +#endif + .d_ioctl = mptioctl, + .d_name = "mpt", +}; +#endif + static int maxwait_ack = 0; static int maxwait_int = 0; static int maxwait_state = 0; @@ -2099,6 +2130,7 @@ mpt_config_reply_handler; mpt_reply_handlers[MPT_CBI(MPT_REPLY_HANDLER_HANDSHAKE)] = mpt_handshake_reply_handler; + (void) make_dev(&mpt_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600, "mptctl"); return (0); } @@ -2140,7 +2172,6 @@ MPT_LOCK(mpt); error = mpt_configure_ioc(mpt, 0, 0); MPT_UNLOCK(mpt); - return (error); } @@ -2624,6 +2655,40 @@ } /* + * IOCTL support + */ + +#if __FreeBSD_version < 500000 +#define _DEV dev_t +#define _IOP struct proc +#else +#define _IOP struct thread +#define _DEV struct cdev * +#endif + +static int +mptioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) +{ + struct mpt_softc *mpt; + int retval = ENOTTY; + + TAILQ_FOREACH(mpt, &mpt_tailq, links) { + if (minor(dev) == device_get_unit(mpt->dev)) { + break; + } + } + if (mpt == NULL) { + return (ENXIO); + } + + switch (c) { + default: + break; + } + return (retval); +} + +/* * Endian Conversion Functions- only used on Big Endian machines */ #if _BYTE_ORDER == _BIG_ENDIAN
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705271731.l4RHVDhh033045>