Page MenuHomeFreeBSD

D35312.id106347.diff
No OneTemporary

D35312.id106347.diff

Index: sys/cam/cam_compat.c
===================================================================
--- sys/cam/cam_compat.c
+++ sys/cam/cam_compat.c
@@ -54,6 +54,12 @@
#include "opt_cam.h"
+/*
+ * Note: struct cdev *dev parameter here is simply passed through. For cdioctl
+ * we need to pass down a struct periph * which has been cast to a cdev and that
+ * is cast back again in cdioctl_dev().
+ */
+
static int cam_compat_handle_0x17(struct cdev *dev, u_long cmd, caddr_t addr,
int flag, struct thread *td, d_ioctl_t *cbfnp);
static int cam_compat_handle_0x18(struct cdev *dev, u_long cmd, caddr_t addr,
Index: sys/cam/scsi/scsi_cd.c
===================================================================
--- sys/cam/scsi/scsi_cd.c
+++ sys/cam/scsi/scsi_cd.c
@@ -76,6 +76,7 @@
#include <cam/cam_xpt_periph.h>
#include <cam/cam_queue.h>
#include <cam/cam_sim.h>
+#include <cam/cam_compat.h>
#include <cam/scsi/scsi_message.h>
#include <cam/scsi/scsi_da.h>
@@ -1752,6 +1753,20 @@
}
}
+static int
+cdioctl_dev(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
+{
+ struct cam_periph *periph;
+
+ /*
+ * For compat, we need to cast struct periph * into struct cdev *dev and
+ * then back again.
+ */
+ periph = (struct cam_periph *)(void *)dev;
+ cam_periph_assert(periph, MA_OWNED);
+ return (cam_periph_ioctl(periph, cmd, addr, cderror));
+}
+
static int
cdioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
{
@@ -2608,6 +2623,15 @@
default:
cam_periph_lock(periph);
error = cam_periph_ioctl(periph, cmd, addr, cderror);
+ if (error == ENOTTY) {
+ /*
+ * We assume that the compat layer doesn't care about
+ * the dev parameter. It just passes it through, so
+ * cheat a little.
+ */
+ error = cam_compat_ioctl((struct cdev *)(void *)periph,
+ cmd, addr, flag, td, cdioctl_dev);
+ }
cam_periph_unlock(periph);
break;
}

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 21, 12:27 AM (4 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31874492
Default Alt Text
D35312.id106347.diff (1 KB)

Event Timeline