linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 8/13] Config before command line.
@ 2007-07-24 11:05 Girish Shilamkar
  2007-07-24 14:41 ` Theodore Tso
  0 siblings, 1 reply; 2+ messages in thread
From: Girish Shilamkar @ 2007-07-24 11:05 UTC (permalink / raw)
  To: Ext4 Mailing List; +Cc: Andreas Dilger, Theodore Tso

The patch changes the order that the config file and command line are parsed so
that command line has precedence.  It also adds a check to make sure only one -E
option is passed on the command line as -E option parsing is not cumulative.

Signed-off-by: Jim Garlick  <garlick@llnl.gov>

Index: e2fsprogs-1.40.1/e2fsck/unix.c
===================================================================
--- e2fsprogs-1.40.1.orig/e2fsck/unix.c
+++ e2fsprogs-1.40.1/e2fsck/unix.c
@@ -583,7 +583,6 @@ static errcode_t PRS(int argc, char *arg
 #ifdef HAVE_SIGNAL_H
 	struct sigaction	sa;
 #endif
-	char		*extended_opts = 0;
 	char		*cp;
 
 	retval = e2fsck_allocate_context(&ctx);
@@ -610,6 +609,12 @@ static errcode_t PRS(int argc, char *arg
 		ctx->program_name = *argv;
 	else
 		ctx->program_name = "e2fsck";
+
+	if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
+		config_fn[0] = cp;
+	profile_set_syntax_err_cb(syntax_err_report);
+	profile_init(config_fn, &ctx->profile);
+
 	while ((c = getopt (argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDk")) != EOF)
 		switch (c) {
 		case 'C':
@@ -633,7 +638,7 @@ static errcode_t PRS(int argc, char *arg
 			ctx->options |= E2F_OPT_COMPRESS_DIRS;
 			break;
 		case 'E':
-			extended_opts = optarg;
+			parse_extended_opts(ctx, optarg);
 			break;
 		case 'p':
 		case 'a':
@@ -753,13 +758,6 @@ static errcode_t PRS(int argc, char *arg
 			argv[optind]);
 		fatal_error(ctx, 0);
 	}
-	if (extended_opts)
-		parse_extended_opts(ctx, extended_opts);
-
-	if ((cp = getenv("E2FSCK_CONFIG")) != NULL)
-		config_fn[0] = cp;
-	profile_set_syntax_err_cb(syntax_err_report);
-	profile_init(config_fn, &ctx->profile);
 
 	if (flush) {
 		fd = open(ctx->filesystem_name, O_RDONLY, 0);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch 8/13] Config before command line.
  2007-07-24 11:05 [Patch 8/13] Config before command line Girish Shilamkar
@ 2007-07-24 14:41 ` Theodore Tso
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2007-07-24 14:41 UTC (permalink / raw)
  To: Girish Shilamkar; +Cc: Ext4 Mailing List, Andreas Dilger

On Tue, Jul 24, 2007 at 04:35:02PM +0530, Girish Shilamkar wrote:
> The patch changes the order that the config file and command line are parsed so
> that command line has precedence.  

#1)  Could you please wrap your patch headers at about coulmn 72 or so,
please?  Thanks!!

#2) Changing when the config file is parsed doesn't change whether the
command line or the config file has precendence.  Parsing the config
file merely sets up an in-memory parse tree so that C code can query
the contents of the config file, e.g.:

	profile_get_boolean(ctx->profile, "options",
			    "defer_check_on_battery", 0, 1, 
			    &defer_check_on_battery);

Simply moving the profile_init() makes no difference.  Also, none of
the parameters in /etc/e2fsck.conf overlap with what you can specify
on the command-line, so I'm not even sure what the original author
(Jim Garlick) was even trying to get at.

> It also adds a check to make sure only one -E
> option is passed on the command line as -E option parsing is not cumulative.

Yep, this is reasonable.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-24 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 11:05 [Patch 8/13] Config before command line Girish Shilamkar
2007-07-24 14:41 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).