[DRBD-cvs] svn commit by lars - r2000 - branches/drbd-0.7/drbd -
upgrade to the "new" compatibility ioctl mechanism in 2
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Mon Nov 14 17:03:01 CET 2005
Author: lars
Date: 2005-11-14 17:03:00 +0100 (Mon, 14 Nov 2005)
New Revision: 2000
Modified:
branches/drbd-0.7/drbd/drbd_fs.c
branches/drbd-0.7/drbd/drbd_int.h
branches/drbd-0.7/drbd/drbd_main.c
Log:
upgrade to the "new" compatibility ioctl mechanism in 2.6.14,
while still retaining compatibility with even 2.4 series kernels.
still untested beyond "does compile"...
Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c 2005-11-03 13:02:33 UTC (rev 1999)
+++ branches/drbd-0.7/drbd/drbd_fs.c 2005-11-14 16:03:00 UTC (rev 2000)
@@ -1021,6 +1021,17 @@
return 0;
}
+#ifdef CONFIG_COMPAT
+long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
+{
+ int ret;
+ lock_kernel();
+ ret = drbd_ioctl(f->f_dentry->d_inode, f, cmd, arg);
+ unlock_kernel();
+ return ret;
+}
+#endif
+
int drbd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
@@ -1404,4 +1415,3 @@
out_unlocked:
return err;
}
-
Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h 2005-11-03 13:02:33 UTC (rev 1999)
+++ branches/drbd-0.7/drbd/drbd_int.h 2005-11-14 16:03:00 UTC (rev 2000)
@@ -25,7 +25,6 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/version.h>
@@ -1047,6 +1046,7 @@
extern int drbd_set_state(drbd_dev *mdev,Drbd_State newstate);
extern int drbd_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
+extern long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
// drbd_worker.c
extern int drbd_worker(struct Drbd_thread *thi);
@@ -1103,19 +1103,6 @@
* event macros
*************************/
-// we use these within spin_lock_irq() ...
-#ifndef wq_write_lock
-#if USE_RW_WAIT_QUEUE_SPINLOCK
-# define wq_write_lock write_lock
-# define wq_write_unlock write_unlock
-# define wq_write_unlock_irq write_unlock_irq
-#else
-# define wq_write_lock spin_lock
-# define wq_write_unlock spin_unlock
-# define wq_write_unlock_irq spin_unlock_irq
-#endif
-#endif
-
// sched.h does not have it with timeout, so here goes:
#ifndef wait_event_interruptible_timeout
Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c 2005-11-03 13:02:33 UTC (rev 1999)
+++ branches/drbd-0.7/drbd/drbd_main.c 2005-11-14 16:03:00 UTC (rev 2000)
@@ -76,7 +76,15 @@
# endif
#else
# ifdef CONFIG_COMPAT
-# include <linux/ioctl32.h>
+# if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+ /* FIXME on which thing could we test instead of the KERNEL_VERSION
+ * again? register_ioctl32_conversion was deprecated in 2.610, got
+ * "officially" deprecated somewhen in 2.6.12, and removed in 2.6.14.
+ * so lets assume all vendor kernels did the transition. */
+# define HAVE_COMPAT_IOCTL_MEMBER
+# else
+# include <linux/ioctl32.h>
+# endif
# endif
#endif
@@ -163,7 +171,10 @@
#endif
.open = drbd_open,
.release = drbd_close,
- .ioctl = drbd_ioctl
+ .ioctl = drbd_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = drbd_compat_ioctl,
+#endif
};
#define ARRY_SIZE(A) (sizeof(A)/sizeof(A[0]))
@@ -1644,6 +1655,7 @@
drbd_destroy_mempools();
}
+#ifndef HAVE_COMPAT_IOCTL_MEMBER
#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
lock_kernel();
unregister_ioctl32_conversion(DRBD_IOCTL_GET_VERSION);
@@ -1661,6 +1673,7 @@
unregister_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_DISK);
unlock_kernel();
#endif
+#endif
NOT_IN_26(
blksize_size[MAJOR_NR] = NULL;
@@ -1879,6 +1892,7 @@
NOT_IN_26(blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR),drbd_make_request_24);)
+#ifndef HAVE_COMPAT_IOCTL_MEMBER
#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
// tell the kernel that we think our ioctls are 64bit clean
lock_kernel();
@@ -1897,6 +1911,7 @@
register_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_DISK,NULL);
unlock_kernel();
#endif
+#endif
printk(KERN_INFO DEVICE_NAME ": initialised. "
"Version: " REL_VERSION " (api:%d/proto:%d)\n",
More information about the drbd-cvs
mailing list