[DRBD-cvs] user by phil; Added the "dialog-refresh" config option...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Thu, 8 Jul 2004 11:53:48 +0200 (CEST)


DRBD CVS committal

Author  : phil
Project : drbd
Module  : user

Dir     : drbd/user


Modified Files:
      Tag: rel-0_7-branch
	drbdadm.h drbdadm_main.c drbdadm_parser.y drbdadm_scanner.fl 


Log Message:
Added the "dialog-refresh" config option. This allows the init-dialog
to be friendly to logging serial console terminal servers...

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm.h,v
retrieving revision 1.1.2.23
retrieving revision 1.1.2.24
diff -u -3 -r1.1.2.23 -r1.1.2.24
--- drbdadm.h	5 Jul 2004 12:24:30 -0000	1.1.2.23
+++ drbdadm.h	8 Jul 2004 09:53:43 -0000	1.1.2.24
@@ -25,6 +25,7 @@
 {
   int disable_io_hints;
   int minor_count;
+  int dialog_refresh;
 };
 
 struct d_host_info
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm_main.c,v
retrieving revision 1.1.2.58
retrieving revision 1.1.2.59
diff -u -3 -r1.1.2.58 -r1.1.2.59
--- drbdadm_main.c	6 Jul 2004 09:39:11 -0000	1.1.2.58
+++ drbdadm_main.c	8 Jul 2004 09:53:43 -0000	1.1.2.59
@@ -91,7 +91,7 @@
 struct utsname nodeinfo;
 int line=1;
 int fline, c_resource_start;
-struct d_globals global_options = { 0, 0 };
+struct d_globals global_options = { 0, 0, 1 };
 char *config_file = NULL;
 struct d_resource* config = NULL;
 int nr_resources;
@@ -187,6 +187,8 @@
 	printI("disable-io-hints;\n");
       if (global_options.minor_count)
 	printI("minor-count %i;\n", global_options.minor_count);
+      if (global_options.dialog_refresh != 1)
+	printI("dialog-refresh %i;\n", global_options.dialog_refresh);
       --indent; printI("}\n\n");
     }
 }
@@ -636,6 +638,7 @@
   pid_t* pids;
   struct d_option* opt;
   int argc,sec,i=0;
+  int wtime;
 
   struct sigaction so;
   struct sigaction sa;
@@ -660,6 +663,9 @@
     pids[i++]=m_system(SF_MaySleep|SF_ReturnPid, argv);
   }
 
+  wtime = global_options.dialog_refresh ? 
+    global_options.dialog_refresh : -1;
+
   sec = 0;
   while(sec < 3) {
     if(!childs_running(pids,WNOHANG)) return 0;
@@ -683,7 +689,7 @@
     do {
       printf("\e[s\e[31G[%4d]:\e[u",sec); // Redraw sec, preserve cursor pos.
       fflush(stdout);
-      if(gets_timeout(answer,40,1000)) {
+      if(gets_timeout(answer,40,wtime*1000)) {
 	if(!strcmp(answer,"yes\n")) {
 	  kill_childs(pids);
 	  childs_running(pids,0);
@@ -691,7 +697,7 @@
 	  printf(" To abort waiting enter 'yes' [%4d]:",sec);
 	}
       }
-      sec++;
+      sec += wtime;
     } while(childs_running(pids,WNOHANG));
     printf("\n");
   }
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm_parser.y,v
retrieving revision 1.1.2.23
retrieving revision 1.1.2.24
diff -u -3 -r1.1.2.23 -r1.1.2.24
--- drbdadm_parser.y	9 Jun 2004 20:06:36 -0000	1.1.2.23
+++ drbdadm_parser.y	8 Jul 2004 09:53:43 -0000	1.1.2.24
@@ -125,7 +125,7 @@
 %token <txt> TK_MAX_EPOCH_SIZE TK_SNDBUF_SIZE
 %token <txt> TK_SKIP_SYNC TK_USE_CSUMS TK_RATE TK_SYNC_GROUP TK_AL_EXTENTS
 %token <txt> TK_WFC_TIMEOUT TK_DEGR_WFC_TIMEOUT
-%token <txt> TK_KO_COUNT TK_ON_DISCONNECT
+%token <txt> TK_KO_COUNT TK_ON_DISCONNECT TK_DIALOG_REFRESH
 
 %type <txt> hostname resource_name
 %type <d_option> disk_stmts disk_stmt
@@ -150,6 +150,8 @@
 			{ global_options.disable_io_hints=1;   }
 		| TK_MINOR_COUNT TK_INTEGER
 			{ global_options.minor_count=atoi($2); }
+		| TK_DIALOG_REFRESH TK_INTEGER   
+                        { global_options.dialog_refresh=atoi($2); }
 		;
 
 resources:	  /* empty */	     { $$ = 0; }
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/user/Attic/drbdadm_scanner.fl,v
retrieving revision 1.1.2.24
retrieving revision 1.1.2.25
diff -u -3 -r1.1.2.24 -r1.1.2.25
--- drbdadm_scanner.fl	1 Jul 2004 07:48:47 -0000	1.1.2.24
+++ drbdadm_scanner.fl	8 Jul 2004 09:53:43 -0000	1.1.2.25
@@ -191,7 +191,8 @@
 <GLOBAL>{
   minor[-_]count	do_assign(NUM); return TK_MINOR_COUNT;
   disable[-_]io[-_]hints yy_push_state(SEMICOLON); return TK_DISABLE_IO_HINTS;
-  {NDELIM}		expect_error("'minor-count|disable-io-hints'");
+  dialog-refresh        do_assign(NUM); CP; return TK_DIALOG_REFRESH;
+  {NDELIM}		expect_error("'minor-count|disable-io-hints|dialog-refresh'");
 }
 
 <RESOURCE>{