[prev in list] [next in list] [prev in thread] [next in thread] 

List:       drbd-cvs
Subject:    [DRBD-cvs] svn commit by phil - r2252 - in trunk: drbd drbd/linux
From:       drbd-cvs () linbit ! com
Date:       2006-06-30 11:18:29
Message-ID: 20060630111829.54D192D99ECC () mail ! linbit ! com
[Download RAW message or body]

* Fixed att
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: phil
Date: 2006-06-30 13:18:26 +0200 (Fri, 30 Jun 2006)
New Revision: 2252

Modified:
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_sizeof_sanity_check.c
   trunk/drbd/linux/drbd.h
   trunk/testing/ioctl_structs_sizes.c
   trunk/user/drbdadm_parser.c
Log:
* Fixed the IOCTLs for 64bit and for 32bit.
* Fixed attaching to backing devices.
* Forwardported the compile time IOCTL sanity checks from drbd-0.7
* Improved the error reporting of drbdadm regarding errors in 
  the configuration file.


Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/drbd_actlog.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -346,6 +346,7 @@
  * record.
  */
 STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,
+			   struct drbd_backing_dev *bdev,
 			   struct al_transaction* b,
 			   int index)
 {
@@ -353,9 +354,9 @@
 	int rv,i;
 	u32 xor_sum=0;
 
-	sector = mdev->bc->md.md_offset + mdev->bc->md.al_offset + index;
+	sector = bdev->md.md_offset + bdev->md.al_offset + index;
 
-	if(!drbd_md_sync_page_io(mdev,mdev->bc,sector,READ)) {
+	if(!drbd_md_sync_page_io(mdev,bdev,sector,READ)) {
 		drbd_chk_io_error(mdev, 1);
 		drbd_io_error(mdev);
 		return -1;
@@ -376,7 +377,7 @@
  * representation. Returns 1 on success, returns 0 when 
  * reading the log failed due to IO errors.
  */
-int drbd_al_read_log(struct Drbd_Conf *mdev)
+int drbd_al_read_log(struct Drbd_Conf *mdev,struct drbd_backing_dev *bdev)
 {
 	struct al_transaction* buffer;
 	int from=-1,to=-1,i,cnr, overflow=0,rv;
@@ -395,7 +396,7 @@
 
 	// Find the valid transaction in the log
 	for(i=0;i<=mx;i++) {
-		rv = drbd_al_read_tr(mdev,buffer,i);
+		rv = drbd_al_read_tr(mdev,bdev,buffer,i);
 		if(rv == 0) continue;
 		if(rv == -1) {
 			up(&mdev->md_io_mutex);
@@ -434,7 +435,7 @@
 		unsigned int extent_nr;
 		unsigned int trn;
 
-		rv = drbd_al_read_tr(mdev,buffer,i);
+		rv = drbd_al_read_tr(mdev,bdev,buffer,i);
 		ERR_IF(rv == 0) goto cancel;
 		if(rv == -1) {
 			up(&mdev->md_io_mutex);

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/drbd_fs.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -463,7 +463,7 @@
 		goto release_bdev3_fail_ioctl;
 	}
 
-	if(!drbd_al_read_log(mdev)) {
+	if(!drbd_al_read_log(mdev,nbc)) {
 		retcode = MDIOError;
 		goto release_bdev3_fail_ioctl;		
 	}

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/drbd_int.h	2006-06-30 11:18:26 UTC (rev 2252)
@@ -1153,7 +1153,7 @@
 extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
 extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
 extern void drbd_rs_cancel_all(drbd_dev* mdev);
-extern int drbd_al_read_log(struct Drbd_Conf *mdev);
+extern int drbd_al_read_log(struct Drbd_Conf *mdev,struct drbd_backing_dev *);
 extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const \
char* file, const unsigned int line);  #define drbd_set_in_sync(mdev,sector,size) \
 	__drbd_set_in_sync(mdev,sector,size, __FILE__, __LINE__ )

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/drbd_main.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -2380,7 +2380,6 @@
 	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
 }
 
-int sizeof_drbd_structs_sanity_check(void);
 int __init drbd_init(void)
 {
 	int i,err;
@@ -2427,9 +2426,6 @@
 		       ": never change the size or layout of the HandShake packet.\n");
 		return -EINVAL;
 	}
-	if (sizeof_drbd_structs_sanity_check()) {
-		return -EINVAL;
-	}
 
 	if (1 > minor_count||minor_count > 255) {
 		printk(KERN_ERR DEVICE_NAME

Modified: trunk/drbd/drbd_sizeof_sanity_check.c
===================================================================
--- trunk/drbd/drbd_sizeof_sanity_check.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/drbd_sizeof_sanity_check.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -1,25 +1,19 @@
 #include <linux/drbd.h>
 #include <linux/kernel.h>
 
+#define COMPILETIME_ASSERT(x) \
+	switch(0) { case 0:; case (x):; }
 #define SZO(type,size) \
-	s = sizeof(type); \
-	if (s != size) { \
-		printk("<3>sizeof(" #type "): %d != %d\n", s, size); \
-		err = -1; \
-	}
+void __assert_sizeof_ ##type ## _eq_ ##size(void) { COMPILETIME_ASSERT(sizeof(struct \
type) == (size)); } \ +void __assert_sizeof_ ##type ## _modulo_8_eq_0(void) { \
COMPILETIME_ASSERT(sizeof(struct type) % 8 == 0); }  
-int sizeof_drbd_structs_sanity_check(void)
-{
-	int err = 0, s = 0;
-	SZO(struct disk_config,		 32)
-	SZO(struct net_config,		448)
-	SZO(struct syncer_config,	 24)
-	SZO(struct ioctl_disk_config,	 40)
-	SZO(struct ioctl_net_config,	456)
-	SZO(struct ioctl_syncer_config,	 32)
-	SZO(struct ioctl_wait,		 16)
-	SZO(struct ioctl_get_config,	580)
-	SZO(struct ioctl_get_uuids,      48)
-	if (err) printk("<3>ioctls won't work, aborting\n");
-	return err;
-}
+SZO(disk_config,	 32)
+SZO(net_config,		456)
+SZO(syncer_config,	 24)
+SZO(ioctl_disk_config,	 40)
+SZO(ioctl_net_config,	464)
+SZO(ioctl_syncer_config, 32)
+SZO(ioctl_wait,		 16)
+SZO(ioctl_get_config,	584)
+SZO(ioctl_get_uuids,     48)
+

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/drbd/linux/drbd.h	2006-06-30 11:18:26 UTC (rev 2252)
@@ -123,6 +123,7 @@
 	   int      want_lose;
 	IN enum disconnect_handler on_disconnect;
 	IN enum after_sb_handler after_sb_0p, after_sb_1p, after_sb_2p;
+	const int _pad;  
 };
 
 struct syncer_config {
@@ -299,7 +300,6 @@
 	OUT int               meta_device_minor;
 	OUT int               meta_index;
 	OUT drbd_state_t      state;
-	int                   _pad;
 };
 
 enum MetaDataFlags {

Modified: trunk/testing/ioctl_structs_sizes.c
===================================================================
--- trunk/testing/ioctl_structs_sizes.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/testing/ioctl_structs_sizes.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -5,7 +5,7 @@
 ({ int _i = sizeof(x); printf("sizeof(" #x ") = %d\n", _i); \
  if( _i % 8 ) printf(" WARN sizeof(" #x ") %% 8 != 0\n"); _i; })
 
-#define DRBD_08_SUM 1176
+#define DRBD_08_SUM 1696
 
 int main()
 {
@@ -19,6 +19,7 @@
 	sum += SZO(struct ioctl_syncer_config);
 	sum += SZO(struct ioctl_wait);
 	sum += SZO(struct ioctl_get_config);
+	sum += SZO(struct ioctl_get_uuids);
 
 	printf("sum = %d  DRBD_08_SUM = %d\n",sum,DRBD_08_SUM);
 

Modified: trunk/user/drbdadm_parser.c
===================================================================
--- trunk/user/drbdadm_parser.c	2006-06-29 14:38:47 UTC (rev 2251)
+++ trunk/user/drbdadm_parser.c	2006-06-30 11:18:26 UTC (rev 2252)
@@ -200,34 +200,36 @@
 ///////////////////////////
 
 
-#define EXP(TOKEN1)					\
-({ 							\
-	int token; 					\
-	token = yylex(); 				\
-	if(token != TOKEN1)				\
-		pe_expected_got( #TOKEN1, token ); 	\
-	token;						\
-})
-
-#define EXP2(TOKEN1,TOKEN2)					\
+#define EXP(TOKEN1)						\
 ({ 								\
 	int token; 						\
 	token = yylex(); 					\
-	if(token != TOKEN1 && token != TOKEN2) 			\
-		pe_expected_got( #TOKEN1 "|" # TOKEN2, token );	\
+	if(token != TOKEN1)					\
+		pe_expected_got( #TOKEN1, token, yylval.txt); 	\
 	token;							\
 })
 
-static void pe_expected(const char *exp)
+#define EXP2(TOKEN1,TOKEN2)						\
+({ 									\
+	int token; 							\
+	token = yylex(); 						\
+	if(token != TOKEN1 && token != TOKEN2) 				\
+		pe_expected_got( #TOKEN1 "|" # TOKEN2, token, yylval.txt ); \
+	token;								\
+})
+
+static void pe_expected(const char *exp, char* got_txt)
 {
-	fprintf(stderr,"Parse error '%s' expected, at line %d\n",exp,line);
+	fprintf(stderr,"Parse error '%s' expected,\n"
+		"but got '%s' at line %d\n",exp,got_txt,line);
 	exit(10);
 }
 
-static void pe_expected_got(const char *exp, int got)
+static void pe_expected_got(const char *exp, int got, char* got_txt)
 {
-	fprintf(stderr,"Parse error '%s' expected but got %d, at line %d\n",
-		exp,got,line);
+	fprintf(stderr,"Parse error '%s' expected,\n"
+		"but got '%s' (TK %d) at line %d\n",
+		exp,got_txt,got,line);
 	exit(10);
 }
 
@@ -253,14 +255,14 @@
 			case TK_YES: global_options.usage_count=UC_YES; break; 
 			case TK_NO:  global_options.usage_count=UC_NO;  break; 
 			case TK_ASK: global_options.usage_count=UC_ASK; break; 
-			default:     pe_expected("yes | no | ask");
+			default:     pe_expected("yes | no | ask",yylval.txt);
 			}
 			break;
 		case '}':
 			return;
 		default:
 			pe_expected("dialog-refresh | minor-count | "
-				    "disable-ip-verification");
+				    "disable-ip-verification",yylval.txt);
 		}
 		EXP(';');
 	}
@@ -289,7 +291,7 @@
 		} else if ( token == '}' ) {
 			return options;
 		} else {
-			pe_expected("An option keyword");
+			pe_expected("an option keyword",yylval.txt);
 		}
 		switch(yylex()) {
 		case TK__IS_DEFAULT:
@@ -299,7 +301,7 @@
 		case ';':
 			break;
 		default:
-			pe_expected("_is_default | ;");
+			pe_expected("_is_default | ;",yylval.txt);
 		}
 	}
 }
@@ -327,7 +329,7 @@
 			case ';':
 				break;
 			default:
-				pe_expected("_major | ;");
+				pe_expected("_major | ;",yylval.txt);
 			}
 			break;
 		case TK_DEVICE:
@@ -365,7 +367,7 @@
 				case ';':
 					break;
 				default:
-					pe_expected("_major | ;");
+					pe_expected("_major | ;",yylval.txt);
 				}
 			} else {
 				EXP(';');
@@ -383,7 +385,7 @@
 			goto break_loop;
 		default:
 			pe_expected("disk | device | address | meta-disk "
-				    "| flex-meta-disk");
+				    "| flex-meta-disk",yylval.txt);
 		}
 	}
  break_loop:
@@ -487,7 +489,7 @@
 			return res;
 		default:
 			pe_expected_got("protocol | on | disk | net | syncer |"
-					" startup | handler",token);
+					" startup | handler",token,yylval.txt);
 		}
 	}
 }
@@ -527,7 +529,8 @@
 		case TK_SKIP: parse_skip(); break;
 		case 0: return;
 		default:
-			pe_expected("global | common | resource | skip");
+			pe_expected("global | common | resource | skip",
+				    yylval.txt);
 		}
 	}
 }

_______________________________________________
drbd-cvs mailing list
drbd-cvs@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/drbd-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic