1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Support passthru ioctl commands from 32bit binaries.

This commit is contained in:
Paul Saab 2005-05-18 05:31:34 +00:00
parent 39be1552ee
commit 7caeec6a13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146337
2 changed files with 30 additions and 1 deletions

View File

@ -4055,6 +4055,11 @@ static int
ciss_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *p)
{
struct ciss_softc *sc;
IOCTL_Command_struct *ioc = (IOCTL_Command_struct *)addr;
#ifdef __amd64__
IOCTL_Command_struct32 *ioc32 = (IOCTL_Command_struct32 *)addr;
IOCTL_Command_struct ioc_swab;
#endif
int error;
debug_called(1);
@ -4146,8 +4151,19 @@ ciss_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t
*/
break;
#ifdef __amd64__
case CCISS_PASSTHRU32:
ioc_swab.LUN_info = ioc32->LUN_info;
ioc_swab.Request = ioc32->Request;
ioc_swab.error_info = ioc32->error_info;
ioc_swab.buf_size = ioc32->buf_size;
ioc_swab.buf = (u_int8_t *)(uintptr_t)ioc32->buf;
ioc = &ioc_swab;
/* FALLTHROUGH */
#endif
case CCISS_PASSTHRU:
error = ciss_user_command(sc, (IOCTL_Command_struct *)addr);
error = ciss_user_command(sc, ioc);
break;
default:

View File

@ -184,6 +184,16 @@ typedef struct {
u_int8_t *buf; /* 4 */
} __packed IOCTL_Command_struct;
#ifdef __amd64__
typedef struct {
LUNAddr_struct LUN_info; /* 8 */
RequestBlock_struct Request; /* 20 */
ErrorInfo_struct error_info; /* 48 */
u_int16_t buf_size; /* 2 */
u_int32_t buf; /* 4 */
} __packed IOCTL_Command_struct32;
#endif
/*
* Note that we'd normally pass the struct in directly, but
* this code is trying to be compatible with other drivers.
@ -199,5 +209,8 @@ typedef struct {
#define CCISS_GETDRIVERVER _IOR ('C', 208, DriverVer_type)
#define CCISS_REVALIDVOLS _IO ('C', 209)
#define CCISS_PASSTHRU _IOWR ('C', 210, IOCTL_Command_struct)
#ifdef __amd64
#define CCISS_PASSTHRU32 _IOWR ('C', 210, IOCTL_Command_struct32)
#endif
#pragma pack()