Author: mav
Date: Thu Oct  6 03:20:47 2016
New Revision: 306750
URL: https://svnweb.freebsd.org/changeset/base/306750

Log:
  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.

Modified:
  stable/10/sys/cam/cam_compat.c
  stable/10/sys/cam/cam_compat.h

Modified: stable/10/sys/cam/cam_compat.c
==============================================================================
--- stable/10/sys/cam/cam_compat.c      Thu Oct  6 03:14:08 2016        
(r306749)
+++ stable/10/sys/cam/cam_compat.c      Thu Oct  6 03:20:47 2016        
(r306750)
@@ -63,28 +63,28 @@ cam_compat_ioctl(struct cdev *dev, u_lon
        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;

Modified: stable/10/sys/cam/cam_compat.h
==============================================================================
--- stable/10/sys/cam/cam_compat.h      Thu Oct  6 03:14:08 2016        
(r306749)
+++ stable/10/sys/cam/cam_compat.h      Thu Oct  6 03:20:47 2016        
(r306750)
@@ -43,8 +43,8 @@ int cam_compat_ioctl(struct cdev *dev, u
 #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)
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to