Skip to contentSkip to conversation

dmraid include/dmraid/lib_context.h lib/activa ...

PATCH [email protected] 1 participant 1 message Mar 18, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: dmraid
Changes by: [email protected] 2010-03-18 13:10:43

Modified files:
include/dmraid : lib_context.h
lib/activate : activate.c
lib/format/ataraid: isw.c jm.c
lib/register : dmreg.c
tools : commands.c

Log message:
Support --ignoremonitoring option to prohibit any dmeventd action, eg. allowing to disable monitoring in early boot with dynamic dmraid binary

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/include/dmraid/lib_context.h.diff?cvsroot=dm&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/activate/activate.c.diff?cvsroot=dm&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/isw.c.diff?cvsroot=dm&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/format/ataraid/jm.c.diff?cvsroot=dm&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/lib/register/dmreg.c.diff?cvsroot=dm&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/dmraid/tools/commands.c.diff?cvsroot=dm&r1=1.6&r2=1.7

include/dmraid/lib_context.h +7 -2
@@ -46,7 +46,8 @@
 	LC_CREATE,
 	LC_REBUILD_SET,
 	LC_REBUILD_DISK,
-	LC_HOT_SPARE_SET,	/* Add new options below this one ! */
+	LC_HOT_SPARE_SET,
+	LC_IGNOREMONITORING,	/* Add new options below this one ! */
 	LC_OPTIONS_SIZE,	/* Must be the last enumerator. */
 };
 
@@ -65,8 +66,9 @@
 #define	OPT_VERBOSE(lc)		(lc_opt(lc, LC_VERBOSE))
 #define	OPT_PARTCHAR(lc)	(lc_opt(lc, LC_PARTCHAR))
 #define	OPT_CREATE(lc)		(lc_opt(lc, LC_CREATE))
-#define OPT_HOT_SPARE_SET(lc)	(lc_opt(lc, LC_HOT_SPARE_SET))
 #define OPT_REBUILD_DISK(lc)	(lc_opt(lc, LC_REBUILD_DISK))
+#define OPT_HOT_SPARE_SET(lc)	(lc_opt(lc, LC_HOT_SPARE_SET))
+#define OPT_IGNOREMONITORING(lc) (lc_opt(lc, LC_IGNOREMONITORING))
 
 /* Return option value. */
 #define	OPT_STR(lc, o)		(lc->options[o].arg.str)
@@ -170,6 +172,9 @@
 
 #endif
 	RMPARTITIONS = 0x40000000,
+#ifndef DMRAID_MINI
+	IGNOREMONITORING = 0x80000000,
+#endif
 };
 
 /* Arguments allowed ? */
lib/activate/activate.c +30 -36

128 lines not on this page · raw message

lib/format/ataraid/isw.c +1 -1
@@ -193,7 +193,7 @@
 	n = snprintf(str, len, f->fmt, isw->family_num, f->what, num);
 
 	/* As '->volume' could contain anything, we sanitise the name. */
-	if (n > 0)
+	if (str && n > 0)
 		mk_alphanum(lc, str, n);
 
 	return n;
lib/format/ataraid/jm.c +1 -0
@@ -32,6 +32,7 @@
 
 	/* Sanitize name, make sure it's null terminated */
 	strncpy(buf, name, JM_NAME_LEN);
+	i = strlen(buf);
 	while (i && isspace(buf[i])) {
 		name[i]='\0';
 		buf[i]='\0';
lib/register/dmreg.c +1 -1
@@ -441,7 +441,7 @@
 
 	errors = _dm_raid_state(dev_name);
 	if (errors < 0)
-		return 1;
+		return 0;
 
 	if (errors) {
 		printf("ERROR: device \"%s\" \n"
tools/commands.c +23 -9
@@ -32,7 +32,7 @@
  */
 static char const *short_opts = "a:hipP:"
 #ifndef	DMRAID_MINI
-	"bc::dDEf:glxM:"
+	"bc::dDEf:gIlxM:"
 #ifdef	DMRAID_NATIVE_LOG
 	"n"
 #endif
@@ -74,6 +74,7 @@
 	{"create", required_argument, NULL, 'C'},
 	{"spare", optional_argument, NULL, 'S'},
 	{"rm_partitions", no_argument, NULL, 'Z'},
+	{"ignoremonitoring", no_argument, NULL, 'I'},
 	{NULL, no_argument, NULL, 0}
 };
 #endif /* #ifdef HAVE_GETOPTLONG */
@@ -229,8 +230,8 @@
 #ifdef	DMRAID_MINI
 	log_print(lc, "%s: Device-Mapper Software RAID tool "
 		  "[Early Boot Version]\n", c);
-	log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} [-i|--ignorelocking]\n"
-		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
+	log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} [-i|--ignorelocking]\n" 
+		  "\t[-f|--format fORMAT[,FORMAT...]]\n"
 		  "\t[-P|--partchar CHAR]\n"
 		  "\t[-p|--no_partitions]\n"
 		  "\t[-Z|--rm_partitions]\n"
@@ -244,6 +245,7 @@
 	log_print(lc,
 		  "%s\t{-a|--activate} {y|n|yes|no} *\n"
 		  "\t[-f|--format FORMAT[,FORMAT...]]\n"
+		  "\t[-I|--ignoremonitoring]\n"
 		  "\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n"
 		  "\t[--separator SEPARATOR]\n" "\t[-t|--test]\n"
 		  "\t[-Z|--rm_partitions] [RAID-set...]\n", c);
@@ -301,7 +303,7 @@
 	 ACTIVATE | DEACTIVATE | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS |
 	 SEPARATOR | RMPARTITIONS
 #ifndef DMRAID_MINI
-	 | DBG | TEST | VERBOSE
+	 | DBG | TEST | VERBOSE | IGNOREMONITORING
 #endif
 	 , ARGS,
 	 check_activate,
@@ -311,15 +313,15 @@
 	/* Format option. */
 	{'f',
 	 FORMAT,
-	 ACTIVATE | DEACTIVATE
+	 ACTIVATE | DEACTIVATE | IGNORELOCKING
 #ifndef DMRAID_MINI
 #  ifdef DMRAID_NATIVE_LOG
 	 | NATIVE_LOG
 #  endif
 	 | RAID_DEVICES | RAID_SETS,
 	 ACTIVE | INACTIVE | COLUMN | DBG | DUMP | DMERASE | GROUP | HELP |
-	 IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE |
-	 RMPARTITIONS
+	 NOPARTITIONS | SEPARATOR | TEST | VERBOSE | RMPARTITIONS |
+	 IGNOREMONITORING
 #else
 	 , UNDEF
 #endif
@@ -338,7 +340,7 @@
 	 ACTIVATE | DEACTIVATE,
 	 FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
 #ifndef DMRAID_MINI
-	 | DBG | TEST | VERBOSE
+	 | DBG | TEST | VERBOSE | IGNOREMONITORING
 #endif
 	 , ARGS,
 	 check_part_separator,
@@ -351,7 +353,7 @@
 	 ACTIVATE | DEACTIVATE,
 	 FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
 #ifndef DMRAID_MINI
-	 | DBG | TEST | VERBOSE
+	 | DBG | TEST | VERBOSE | IGNOREMONITORING
 #endif
 	 , ARGS,
 	 NULL,
@@ -608,6 +610,18 @@
 	 NULL,
 	 0,
 	 },
+#ifndef DMRAID_MINI
+	/* ignoremonitoring option. */
+	{'I',
+	 IGNOREMONITORING,
+	 ACTIVATE | DEACTIVATE,
+	 DBG | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | VERBOSE |
+	 SEPARATOR,
+	 ARGS,
+	 _lc_inc_opt,
+	 LC_IGNOREMONITORING,
+	 },
+#endif
 };
 
 /*