[DRBD-user] sparc64 - patch.

Lars Ellenberg Lars.Ellenberg at linbit.com
Sun Jan 18 01:41:32 CET 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2004-01-16 13:13:24 +0100
\ Ing. Milan Pikula:
> Hello all,
> 
> yesterday a customer requested me to install drbd on a sparc64. As it turned 
> out, I had to add a code, which is required for ioctl()s on sparc64 
> architecture. Besides of this slight change, the drbd seems to be working 
> there.

yes, Philipp made sure from the very begining that all structs
involved are "clean" wrt. 64bit and endianness.

> As I didn't find a direct e-mail address to the authors on the project web 
oh? we should have a look then...

> page, I post the necessary patch here.

> Please note that:
> 1) the changes cannot be easily made in a module (kernel change needed)

nope. already done, unfortunately not in the 0.6 branch, but for 0.7 it is in.
and there have been patches on this list since 0.6.6 to do this.

I attach a patch for current 0.6.10 and later cvs.
I think this could easily go into 0.6.11 (when that is released ... )

so 2) is not necessary.

> 2) you will also need to copy the header files drbd.h and drbd_config.h to the 
> kernel include directory before compilation
> 3) a similiar change will be needed for other 64-bit architectures.

right, but see the #if ...

> Please CC: me when replying, I am not member of the list.
> 
> Regards,
> 	Milan Pikula

please, maybe you can verify and ackknowledge that this patch does work.
last time I tested, it did, but ... no sparc64 around anylonger...

thanks.

	Lars Ellenberg
-------------- next part --------------
diff -u -p -r1.89 drbd_main.c
--- drbd_main.c	6 Jan 2004 10:06:25 -0000	1.89
+++ drbd_main.c	18 Jan 2004 00:38:32 -0000
@@ -57,6 +57,16 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+
+#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
+extern int register_ioctl32_conversion(unsigned int cmd,
+				       int (*handler)(unsigned int,
+						      unsigned int,
+						      unsigned long,
+						      struct file *));
+extern int unregister_ioctl32_conversion(unsigned int cmd);
+#endif
+
 #define __KERNEL_SYSCALLS__
 #include <linux/unistd.h>
 
@@ -1184,6 +1194,23 @@ int __init drbd_init(void)
 	blksize_size[MAJOR_NR] = drbd_blocksizes;
 	blk_size[MAJOR_NR] = drbd_sizes;	/* Size in Kb */
 
+#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
+	lock_kernel();
+	register_ioctl32_conversion(DRBD_IOCTL_DO_SYNC_ALL,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_GET_CONFIG,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_GET_VERSION,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_SECONDARY_REM,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_SET_DISK_CONFIG,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_SET_NET_CONFIG,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_SET_STATE,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_SET_SYNC_CONFIG,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_BOTH,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_NET,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_WAIT_CONNECT,NULL);
+	register_ioctl32_conversion(DRBD_IOCTL_WAIT_SYNC,NULL);
+	unlock_kernel();
+#endif
+
 	return 0;
 }
 
@@ -1252,6 +1279,22 @@ void cleanup_module(void)
 	kfree(drbd_blocksizes);
 	kfree(drbd_sizes);
 	kfree(drbd_conf);
+#if defined(CONFIG_PPC64) || defined(CONFIG_SPARC64) || defined(CONFIG_X86_64)
+	lock_kernel();
+	unregister_ioctl32_conversion(DRBD_IOCTL_DO_SYNC_ALL);
+	unregister_ioctl32_conversion(DRBD_IOCTL_GET_CONFIG);
+	unregister_ioctl32_conversion(DRBD_IOCTL_GET_VERSION);
+	unregister_ioctl32_conversion(DRBD_IOCTL_SECONDARY_REM);
+	unregister_ioctl32_conversion(DRBD_IOCTL_SET_DISK_CONFIG);
+	unregister_ioctl32_conversion(DRBD_IOCTL_SET_NET_CONFIG);
+	unregister_ioctl32_conversion(DRBD_IOCTL_SET_STATE);
+	unregister_ioctl32_conversion(DRBD_IOCTL_SET_SYNC_CONFIG);
+	unregister_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_BOTH);
+	unregister_ioctl32_conversion(DRBD_IOCTL_UNCONFIG_NET);
+	unregister_ioctl32_conversion(DRBD_IOCTL_WAIT_CONNECT);
+	unregister_ioctl32_conversion(DRBD_IOCTL_WAIT_SYNC);
+	unlock_kernel();
+#endif
 }
 
 


More information about the drbd-user mailing list