All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: Jan Tulak <jtulak@redhat.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	Dmitri Pal <dpal@redhat.com>
Subject: Re: [PATCH] mkfs: rename defaultval to flagval in opts
Date: Tue, 29 Aug 2017 08:36:53 +1000	[thread overview]
Message-ID: <20170828223653.GA10621@dastard> (raw)
In-Reply-To: <20170825003918.GX27873@wotan.suse.de>

On Fri, Aug 25, 2017 at 02:39:18AM +0200, Luis R. Rodriguez wrote:
> On Fri, Aug 25, 2017 at 09:58:43AM +1000, Dave Chinner wrote:
> > A clean design isolates the different functionality into
> > self-contained modules and connects them with simple, easy to
> > understand structures and minimal APIs.
> > 
> > The default behaviours we can modify are a much smaller subset of
> > options than the CLI can modify. Hence if we define a structure that
> > contains all the default options we can set, we also define the
> > required config file contents.
> 
> I see, so the configuration file purpose is to be able to override
> the smaller set of defaults, not supplement the CLI with all the
> bells and whistles the CLI allows. I'll yield to you for this, it
> sounds reasonable to me, however I suppose I should point out that
> at least ext[2-4] do allow for CLI options, so its not clear to me
> what that should implicate about mke2fs.conf.

I don't really care what mke2fs does with it's config file - it's
got different constraints and behaviours, and likely different ways
of setting defaults. If they have to set them via using CLI options
in the confg file, then that's what they thought best.

I'm working on the model that if something can have a sane default
defined, then it should be a known key/value pair in the config
file which has a matching entry in the struct mkfs_default_params
that is then used in the appropriate place in the code to apply that
default. Using CLI option syntax for this just makes the config file
format more complex and parsing it harder for no good reason.

> > IOWs, we have 4 clear modules and a set of data that is needed
> > as inputs into each module:
> > 
> > Module				Connecting structure
> > Setting defaults
> > 				struct mkfs_default_params
> > CLI parsing
> > 				struct cli_params
> > Validation + calculation
> > 				struct mkfs_params
> > On disk formatting
> > 
> > Note that there's nothing here that dictates how each module is
> > implemented - all I've done is define modules and the data that
> > needs to flow between the modules. I've simply applied a basic
> > software engineering technique (SADT - structured analysis and
> > design technique) and made a ruidmentary data flow diagram in my
> > head to get to this.
> 
> Thanks, this helps. FWIW the way I split things out was
> 
> CLI  ------------
>                   \
>                    ---> params
>                  /
> config file ---
> 
> It would seem from what you are saying
> 
> 
> CLI  ------------
>                   \
>                    ---> struct mkfs_default_params
>                  /
> config file ---
> 
> Is that right?

No. It's:

Build defaults --\
		  ---> mkfs_default_params -> CLI -> mkfs_params
config file -----/


Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2017-08-28 22:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 10:39 [PATCH] mkfs: rename defaultval to flagval in opts Jan Tulak
2017-08-19  1:03 ` Dave Chinner
2017-08-19  6:40   ` Jan Tulak
2017-08-19 16:26     ` Darrick J. Wong
2017-08-20  1:56     ` Dave Chinner
2017-08-21  7:27       ` Jan Tulak
2017-08-24 19:15       ` Luis R. Rodriguez
2017-08-24 23:58         ` Dave Chinner
2017-08-25  0:39           ` Luis R. Rodriguez
2017-08-28 22:36             ` Dave Chinner [this message]
2017-08-29 17:38               ` Luis R. Rodriguez

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=20170828223653.GA10621@dastard \
    --to=david@fromorbit.com \
    --cc=dpal@redhat.com \
    --cc=jtulak@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mcgrof@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.