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

svn at svn.drbd.org svn at svn.drbd.org
Wed Oct 20 12:38:31 CEST 2004


Author: phil
Date: 2004-10-20 12:38:29 +0200 (Wed, 20 Oct 2004)
New Revision: 1605

Added:
   branches/drbd-0.7/testing/ioctl_structs_sizes.c
Modified:
   branches/drbd-0.7/drbd/linux/drbd.h
   branches/drbd-0.7/testing/Makefile
Log:
This fix makes it work on machines with 64bit kernel space and
32bit user space. Still need to decide if I should increase the
API version number...



Modified: branches/drbd-0.7/drbd/linux/drbd.h
===================================================================
--- branches/drbd-0.7/drbd/linux/drbd.h	2004-10-19 20:26:01 UTC (rev 1604)
+++ branches/drbd-0.7/drbd/linux/drbd.h	2004-10-20 10:38:29 UTC (rev 1605)
@@ -62,7 +62,7 @@
 };
 
 
-struct disk_config {
+struct __attribute__((packed)) disk_config {
 	IN int      lower_device;
 	IN __u64    disk_size;
 	IN enum io_error_handler on_io_error;
@@ -76,7 +76,7 @@
 	FreezeIO
 };
 
-struct net_config {
+struct __attribute__((packed)) net_config {
 	IN char     my_addr[MAX_SOCK_ADDR];
 	IN int      my_addr_len;
 	IN char     other_addr[MAX_SOCK_ADDR];
@@ -92,7 +92,7 @@
 	IN enum disconnect_handler on_disconnect;
 };
 
-struct syncer_config {
+struct __attribute__((packed)) syncer_config {
 	int      rate; /* KB/sec */
 	int      use_csums;   /* use checksum based syncing*/
 	int      skip;
@@ -122,22 +122,22 @@
 	LDDeviceTooLarge,
 };
 
-struct ioctl_disk_config {
+struct __attribute__((packed)) ioctl_disk_config {
 	struct disk_config    config;
 	OUT enum ret_codes    ret_code;
 };
 
-struct ioctl_net_config {
+struct __attribute__((packed)) ioctl_net_config {
 	struct net_config     config;
 	OUT enum ret_codes    ret_code;
 };
 
-struct ioctl_syncer_config {
+struct __attribute__((packed)) ioctl_syncer_config {
 	struct syncer_config  config;
 	OUT enum ret_codes    ret_code;
 };
 
-struct ioctl_wait {
+struct __attribute__((packed)) ioctl_wait {
 	IN int wfc_timeout;
 	IN int degr_wfc_timeout;
 	OUT int ret_code;
@@ -189,7 +189,7 @@
 # define BDEVNAME_SIZE 32
 #endif
 
-struct ioctl_get_config {
+struct __attribute__((packed)) ioctl_get_config {
 	struct net_config     nconf;
 	struct syncer_config  sconf;
 	OUT int               lower_device_major;

Modified: branches/drbd-0.7/testing/Makefile
===================================================================
--- branches/drbd-0.7/testing/Makefile	2004-10-19 20:26:01 UTC (rev 1604)
+++ branches/drbd-0.7/testing/Makefile	2004-10-20 10:38:29 UTC (rev 1605)
@@ -1,5 +1,5 @@
-PROGRAMS=show_size  access_and_verify
-CFLAGS=-Wall
+PROGRAMS=show_size  access_and_verify ioctl_structs_sizes
+CFLAGS=-Wall -I../drbd
 
 all: $(PROGRAMS)
 

Added: branches/drbd-0.7/testing/ioctl_structs_sizes.c
===================================================================
--- branches/drbd-0.7/testing/ioctl_structs_sizes.c	2004-10-19 20:26:01 UTC (rev 1604)
+++ branches/drbd-0.7/testing/ioctl_structs_sizes.c	2004-10-20 10:38:29 UTC (rev 1605)
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <linux/drbd.h>
+
+#define SZO(x)  (int) sizeof(x);\
+({ printf("sizeof(" #x ") = %d\n", (int)sizeof(x)); })
+                
+
+#define DRBD_07_SUM 1140
+
+int main()
+{
+	int sum=0;
+
+	sum += SZO(struct disk_config);
+	sum += SZO(struct net_config);
+	sum += SZO(struct syncer_config);
+	sum += SZO(struct ioctl_disk_config);
+	sum += SZO(struct ioctl_net_config);
+	sum += SZO(struct ioctl_syncer_config);
+	sum += SZO(struct ioctl_wait);
+	sum += SZO(struct ioctl_get_config);
+
+	printf("sum = %d  DRBD_07_SUM = %d\n",sum,DRBD_07_SUM);
+
+	printf(sum == DRBD_07_SUM ? "OKAY\n" : "FAILED\n" );
+
+	return 0;
+}



More information about the drbd-cvs mailing list