From: Ted Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@whamcloud.com>
Cc: linux-ext4@vger.kernel.org, Jim Garlick <garlick@llnl.gov>
Subject: Re: [PATCH 1/2] misc: Allow "-E" and "-O" options multiple times
Date: Sun, 10 Jul 2011 16:46:33 -0400 [thread overview]
Message-ID: <20110710204633.GB5615@thunk.org> (raw)
In-Reply-To: <1310172544-18650-1-git-send-email-adilger@whamcloud.com>
On Fri, Jul 08, 2011 at 06:49:03PM -0600, Andreas Dilger wrote:
> Allow "-E" and "-O" options to be specified multiple times on the
> command-line for mke2fs, tune2fs, and e2fsck, and parse them after
> the config file options to more closely match user expectations.
Well, we're doing that already for mke2fs. As far as e2fsck is
concerned....
> @@ -883,14 +888,15 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
> 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 (extended_opts)
> + parse_extended_opts(ctx, extended_opts);
> +
> if (flush) {
> fd = open(ctx->filesystem_name, O_RDONLY, 0);
> if (fd < 0) {
Merely moving parse_extended_opts to after profile_init() doesn't
actually do anything. All profile_init() does is to parse the
configuration file and load it into memory in a format where it can be
quickly and easily fetched via profile_get_{bool,string,int}().
If you want the command line options to override what is specified in
the config file, you have one of two options:
1) Call profile_get_{bool,string,int}() and stash the result in a
variable, and then call parse_extended_opts(), and have that function
modify the configuration variable.
2) Have parse_extended_opts() modify a configuration variable, and
then if the configuration variable is set, then at the place in the
code where profile_get_{bool,string,int}() is called, don't call the
profile_get_* function.
In general, #1, is the better choice, but moving parse_extended_opts()
above is pointless.
- Ted
next prev parent reply other threads:[~2011-07-10 20:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-09 0:49 [PATCH 1/2] misc: Allow "-E" and "-O" options multiple times Andreas Dilger
2011-07-09 0:49 ` [PATCH 2/2] e2fsck: allow shared blocks to be handled safely Andreas Dilger
2011-07-10 20:46 ` Ted Ts'o [this message]
2011-07-10 20:59 ` [PATCH 1/2] misc: Allow "-E" and "-O" options multiple times Ted Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110710204633.GB5615@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@whamcloud.com \
--cc=garlick@llnl.gov \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.