[DRBD-cvs] svn commit by lars - r2237 - trunk/tools - the outdater has no default resource. that was for deve

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Jun 20 09:25:44 CEST 2006


Author: lars
Date: 2006-06-20 09:25:44 +0200 (Tue, 20 Jun 2006)
New Revision: 2237

Modified:
   trunk/tools/drbd-peer-outdater.c
Log:
the outdater has no default resource. that was for development only...

Modified: trunk/tools/drbd-peer-outdater.c
===================================================================
--- trunk/tools/drbd-peer-outdater.c	2006-06-20 07:24:44 UTC (rev 2236)
+++ trunk/tools/drbd-peer-outdater.c	2006-06-20 07:25:44 UTC (rev 2237)
@@ -37,6 +37,7 @@
 #include <dopd.h>
 
 #define OPTARGS      "hVt:r:"
+#define DEFAULT_TIMEOUT 60 // timeout in seconds
 
 typedef struct dop_client_s
 {
@@ -133,8 +134,7 @@
 	int argerr = 0;
 	int flag;
 	char *drbd_resource = NULL;
-	char drbd_resource_default[] = "r0";
-	int timeout = 60; // timeout in seconds
+	int timeout = DEFAULT_TIMEOUT;
 
 	dop_client_t *new_client = NULL;
 	GCHSource *src = NULL;
@@ -165,9 +165,9 @@
 	crm_debug_3("Option processing complete");
 
 	/* the caller drbdadm sets DRBD_RESOURCE env variable, use it if
-	 * -r option was not specified, or use default value */
+	 * -r option was not specified */
 	if ((drbd_resource == NULL) && !(drbd_resource = getenv("DRBD_RESOURCE"))) {
-		drbd_resource = drbd_resource_default;
+		++argerr;
 	}
 
 	if (optind > argc) {
@@ -206,7 +206,7 @@
 	}
 
 	Gmain_timeout_add_full(G_PRIORITY_DEFAULT, new_client->timeout * 1000,
-	                       outdater_timeout_dispatch, (gpointer)new_client,
+			       outdater_timeout_dispatch, (gpointer)new_client,
 			       outdater_dispatch_destroy);
 
 	g_main_run(new_client->mainloop);
@@ -220,9 +220,14 @@
 	FILE* stream;
 
 	stream = exit_status ? stderr : stdout;
-	fprintf(stream, "usage: %s [-tr]\n", cmd);
-	fprintf(stream, "\t-t <int>\ttimeout in seconds\n");
-	fprintf(stream, "\t-r <string>\tdrbd resource, default is r0\n");
+	fprintf(stream, "usage: %s -r <string> [-t <int>]\n", cmd);
+	fprintf(stream, "\t-t <int>\ttimeout in seconds; default: %d\n",
+			DEFAULT_TIMEOUT);
+	fprintf(stream, "\t-r <string>\tdrbd resource\n\n"
+		"The drbd resource has to be specified,\n"
+		"either on the commandline using the -r option,\n"
+		"or unsing the $DRBD_RESOURCE environment variable,\n"
+		"which will be ignored, if the -r option is used.\n");
 	fflush(stream);
 
 	exit(exit_status);



More information about the drbd-cvs mailing list