summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2013-06-17 08:57:09 +0000
committerscottl <scottl@FreeBSD.org>2013-06-17 08:57:09 +0000
commit95ba85598a3f78e22697c60c43da43d596b594e9 (patch)
tree1b9b385be156f2bc84548258f02f142b5c7a3768 /sys/cam/cam_xpt.c
parent77beb08b596b19afe6e24d161bea012782144956 (diff)
downloadFreeBSD-src-95ba85598a3f78e22697c60c43da43d596b594e9.zip
FreeBSD-src-95ba85598a3f78e22697c60c43da43d596b594e9.tar.gz
Add infrastructure for doing compatibility shims, as has been sorely
needed for the last 10 years. Far too much of the internal API is exposed, and every small adjustment causes applications to stop working. To kick this off, bump the API version to 0x17 as should have been done with r246713, but add shims to compensate. Thanks to the shims, there should be no visible change in application behavior. I have plans to do a significant overhaul of the API to harnen it for the future, but until then, I welcome others to add shims for older versions of the API. Obtained from: Netflix
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index a4c83b1..3511265 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <cam/cam_xpt_periph.h>
#include <cam/cam_xpt_internal.h>
#include <cam/cam_debug.h>
+#include <cam/cam_compat.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
@@ -180,6 +181,7 @@ PERIPHDRIVER_DECLARE(xpt, xpt_driver);
static d_open_t xptopen;
static d_close_t xptclose;
static d_ioctl_t xptioctl;
+static d_ioctl_t xptdoioctl;
static struct cdevsw xpt_cdevsw = {
.d_version = D_VERSION,
@@ -395,6 +397,19 @@ xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td
{
int error;
+ if ((error = xptdoioctl(dev, cmd, addr, flag, td)) == ENOTTY) {
+ error = cam_compat_ioctl(dev, &cmd, &addr, &flag, td);
+ if (error == EAGAIN)
+ return (xptdoioctl(dev, cmd, addr, flag, td));
+ }
+ return (error);
+}
+
+static int
+xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
+{
+ int error;
+
error = 0;
switch(cmd) {
OpenPOWER on IntegriCloud