[DRBD-cvs] r1615 - in branches/drbd-0.7: drbd/linux testing

svn at svn.drbd.org svn at svn.drbd.org
Thu Oct 28 21:37:02 CEST 2004


Author: phil
Date: 2004-10-28 21:36:59 +0200 (Thu, 28 Oct 2004)
New Revision: 1615

Modified:
   branches/drbd-0.7/drbd/linux/drbd.h
   branches/drbd-0.7/testing/ioctl_structs_sizes.c
Log:
Make it work again in an 32-bit userland / 64-bit kernel environment.


Modified: branches/drbd-0.7/drbd/linux/drbd.h
===================================================================
--- branches/drbd-0.7/drbd/linux/drbd.h	2004-10-27 14:08:45 UTC (rev 1614)
+++ branches/drbd-0.7/drbd/linux/drbd.h	2004-10-28 19:36:59 UTC (rev 1615)
@@ -45,8 +45,12 @@
 #define INOUT
 #endif
 
-/* Never forget to place bigger members before the smaller, to
-   avoid unaligned placement of members on 64 bit architectures. */
+/* 
+   - Never forget to place bigger members before the smaller ones, 
+     to avoid unaligned placement of members on 64 bit architectures. 
+   - Never forget to add explicit _pad members to make sizeof(struct)
+     divisible by 8.
+*/
 
 #define MAX_SOCK_ADDR	128	/* 108 for Unix domain -
 				   16 for IP, 16 for IPX,
@@ -92,6 +96,7 @@
 	IN int      sndbuf_size;  /* socket send buffer size */
 	IN unsigned int ko_count;
 	IN enum disconnect_handler on_disconnect;
+	const int   _pad;
 };
 
 struct syncer_config {
@@ -100,6 +105,7 @@
 	int      skip;
 	int      group;
 	int      al_extents;
+	const int _pad;
 };
 
 /* KEEP the order, do not delete or insert!
@@ -127,22 +133,26 @@
 struct ioctl_disk_config {
 	struct disk_config    config;
 	OUT enum ret_codes    ret_code;
+	const int             _pad;
 };
 
 struct ioctl_net_config {
 	struct net_config     config;
 	OUT enum ret_codes    ret_code;
+	const int             _pad;
 };
 
 struct ioctl_syncer_config {
 	struct syncer_config  config;
 	OUT enum ret_codes    ret_code;
+	const int             _pad;
 };
 
 struct ioctl_wait {
 	IN int wfc_timeout;
 	IN int degr_wfc_timeout;
 	OUT int ret_code;
+	int      _pad;
 };
 
 #define DRBD_PROT_A   1
@@ -206,6 +216,7 @@
 	OUT Drbd_CState       cstate;
 	OUT Drbd_State        state;
 	OUT Drbd_State        peer_state;
+	int                   _pad;
 };
 
 #define DRBD_MAGIC 0x83740267

Modified: branches/drbd-0.7/testing/ioctl_structs_sizes.c
===================================================================
--- branches/drbd-0.7/testing/ioctl_structs_sizes.c	2004-10-27 14:08:45 UTC (rev 1614)
+++ branches/drbd-0.7/testing/ioctl_structs_sizes.c	2004-10-28 19:36:59 UTC (rev 1615)
@@ -2,11 +2,11 @@
 #include <linux/drbd.h>
 
 #define SZO(x) \
-({ int _i = sizeof(x); printf("sizeof(" #x ") = %d\n", _i); _i; })
+({ int _i = sizeof(x); printf("sizeof(" #x ") = %d\n", _i); \
+ if( _i % 8 ) printf(" WARN sizeof(" #x ") %% 8 != 0\n"); _i; })
 
+#define DRBD_07_SUM 1184
 
-#define DRBD_07_SUM 1140
-
 int main()
 {
 	int sum=0;



More information about the drbd-cvs mailing list