diff options
author | mav <mav@FreeBSD.org> | 2016-10-06 03:20:47 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2016-10-06 03:20:47 +0000 |
commit | ad44cbcf96571d28c76d58c4beff77c8f2af28cb (patch) | |
tree | 1f995d369ab7077218b5c3ab7fddf14da93fdc37 | |
parent | e42abb674dc8f5e50b1950d9cb9d98073d604706 (diff) | |
download | FreeBSD-src-ad44cbcf96571d28c76d58c4beff77c8f2af28cb.zip FreeBSD-src-ad44cbcf96571d28c76d58c4beff77c8f2af28cb.tar.gz |
Fix ABI compat shims for FreeBSD 9.0-9.1 binaries (CAM_VERSION 0x16).
This is a direct commit to stable/10, inspired by some commits to later
branches.
-rw-r--r-- | sys/cam/cam_compat.c | 26 | ||||
-rw-r--r-- | sys/cam/cam_compat.h | 8 |
2 files changed, 17 insertions, 17 deletions
diff --git a/sys/cam/cam_compat.c b/sys/cam/cam_compat.c index f291479..68193fc 100644 --- a/sys/cam/cam_compat.c +++ b/sys/cam/cam_compat.c @@ -63,28 +63,28 @@ cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, switch (cmd) { case CAMIOCOMMAND_0x16: { - union ccb *ccb; + struct ccb_hdr_0x17 *hdr17; - ccb = (union ccb *)addr; - if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS_0x16) { - ccb->ccb_h.flags &= ~CAM_SG_LIST_PHYS_0x16; - ccb->ccb_h.flags |= CAM_DATA_SG_PADDR; + hdr17 = (struct ccb_hdr_0x17 *)addr; + if (hdr17->flags & CAM_SG_LIST_PHYS_0x16) { + hdr17->flags &= ~CAM_SG_LIST_PHYS_0x16; + hdr17->flags |= CAM_DATA_SG_PADDR; } - if (ccb->ccb_h.flags & CAM_DATA_PHYS_0x16) { - ccb->ccb_h.flags &= ~CAM_DATA_PHYS_0x16; - ccb->ccb_h.flags |= CAM_DATA_PADDR; + if (hdr17->flags & CAM_DATA_PHYS_0x16) { + hdr17->flags &= ~CAM_DATA_PHYS_0x16; + hdr17->flags |= CAM_DATA_PADDR; } - if (ccb->ccb_h.flags & CAM_SCATTER_VALID_0x16) { - ccb->ccb_h.flags &= CAM_SCATTER_VALID_0x16; - ccb->ccb_h.flags |= CAM_DATA_SG; + if (hdr17->flags & CAM_SCATTER_VALID_0x16) { + hdr17->flags &= CAM_SCATTER_VALID_0x16; + hdr17->flags |= CAM_DATA_SG; } cmd = CAMIOCOMMAND; - error = (cbfnp)(dev, cmd, addr, flag, td); + error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); break; } case CAMGETPASSTHRU_0x16: cmd = CAMGETPASSTHRU; - error = (cbfnp)(dev, cmd, addr, flag, td); + error = cam_compat_handle_0x17(dev, cmd, addr, flag, td, cbfnp); break; case CAMIOCOMMAND_0x17: cmd = CAMIOCOMMAND; diff --git a/sys/cam/cam_compat.h b/sys/cam/cam_compat.h index d5bde1a..ffcf99f 100644 --- a/sys/cam/cam_compat.h +++ b/sys/cam/cam_compat.h @@ -43,8 +43,8 @@ int cam_compat_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, #define CAM_VERSION_0x16 0x16 /* The size of the union ccb didn't change when going to 0x17 */ -#define CAMIOCOMMAND_0x16 _IOWR(CAM_VERSION_0x16, 2, union ccb) -#define CAMGETPASSTHRU_0x16 _IOWR(CAM_VERSION_0x16, 3, union ccb) +#define CAMIOCOMMAND_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 2, CAM_0X17_LEN) +#define CAMGETPASSTHRU_0x16 _IOC(IOC_INOUT, CAM_VERSION_0x16, 3, CAM_0X17_LEN) #define CAM_SCATTER_VALID_0x16 0x00000010 #define CAM_SG_LIST_PHYS_0x16 0x00040000 @@ -110,8 +110,8 @@ struct ccb_pathinq_0x17 { u_int16_t hba_subdevice; /* HBA subdevice ID */ }; -#define CAM_0X17_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr) + sizeof(struct ccb_hdr_0x17)) -#define CAM_0X17_DATA_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr_0x17)) +#define CAM_0X17_DATA_LEN (sizeof(union ccb) - sizeof(struct ccb_hdr)) +#define CAM_0X17_LEN (sizeof(struct ccb_hdr_0x17) + CAM_0X17_DATA_LEN) #define CAMIOCOMMAND_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 2, CAM_0X17_LEN) #define CAMGETPASSTHRU_0x17 _IOC(IOC_INOUT, CAM_VERSION_0x17, 3, CAM_0X17_LEN) |