static void vmci_remove_device(struct pci_dev* pdev);
static int vmci_open(struct inode *inode, struct file *file);
static int vmci_close(struct inode *inode, struct file *file);
-static int vmci_ioctl(struct inode *inode, struct file *file,
+static int vmci_ioctl(struct inode *dummy, struct file *file,
unsigned int cmd, unsigned long arg);
+#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+static long vmci_unlocked_ioctl(struct file *file,
+ unsigned int cmd, unsigned long arg);
+#endif
static unsigned int vmci_poll(struct file *file, poll_table *wait);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
static compat_irqreturn_t vmci_interrupt(int irq, void *dev_id,
.owner = THIS_MODULE,
.open = vmci_open,
.release = vmci_close,
+#ifdef HAVE_UNLOCKED_IOCTL
+ .unlocked_ioctl = vmci_unlocked_ioctl,
+#else
.ioctl = vmci_ioctl,
+#endif
+#ifdef HAVE_COMPAT_IOCTL
+ .compat_ioctl = vmci_unlocked_ioctl,
+#endif
.poll = vmci_poll,
};
*/
static int
-vmci_ioctl(struct inode *inode, // IN
+vmci_ioctl(struct inode *dummy, // IN: NULL or inode; do not use
struct file *file, // IN
unsigned int cmd, // IN
unsigned long arg) // IN
return -ENOTTY;
#else
int retval;
- VMCIGuestDeviceHandle *devHndl =
- (VMCIGuestDeviceHandle *) file->private_data;
+ VMCIGuestDeviceHandle *devHndl = file->private_data;
if (devHndl == NULL) {
return -EINVAL;
}
+ /*
+ * When adding new ioctls make sure that their data structures are same
+ * for i386 and x86_64 architectures, as this handler is used for both ia32
+ * and x86_64 ioctls.
+ */
switch (cmd) {
case IOCTL_VMCI_CREATE_PROCESS: {
if (devHndl->objType != VMCIOBJ_NOT_SET) {
case IOCTL_VMCI_DATAGRAM_SEND: {
VMCIDatagramSendRecvInfo sendInfo;
- VMCIDatagram *dg = NULL;
+ VMCIDatagram *dg;
if (devHndl->objType != VMCIOBJ_DATAGRAM_PROCESS) {
printk("VMCI: Ioctl %d only valid for process datagram handle.\n",
}
+#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * vmci_unlocked_ioctl --
+ *
+ * IOCTL interface to device.
+ *
+ * Results:
+ * Negative error code, or per-ioctl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static long
+vmci_unlocked_ioctl(struct file *filp, // IN:
+ u_int iocmd, // IN:
+ unsigned long ioarg) // IN:
+{
+ long err;
+
+ lock_kernel();
+ err = vmci_ioctl(NULL, filp, iocmd, ioarg);
+ unlock_kernel();
+
+ return err;
+}
+#endif
+
+
/*
*-----------------------------------------------------------------------------
*