Skip to content

mkfs: Configuration file defined options

Dave Chinner linux-xfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 3 repliesIn review
  2. v15 patches 9 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5build: add support for libinih for mkfsconfigure.ac doc/INSTALL include/builddefs.in +1 more+29 -00 replies
2/5mkfs: add initial ini format config file parsing supportmkfs/Makefile mkfs/xfs_mkfs.c+119 -21 reply
3/5mkfs: constify various stringsinclude/linux.h mkfs/xfs_mkfs.c+15 -150 replies
4/5mkfs: hook up suboption parsing to ini filesmkfs/xfs_mkfs.c+79 -151 reply
5/5mkfs: document config files in mkfs.xfs(8)man/man8/mkfs.xfs.8+106 -71 reply

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchDarrick J. Wong
1/5R-b
2/5R-b
3/5R-b
4/5
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] mkfs: Configuration file defined options

Version 3:

- really do "-c file=xxx" > "-c options=xxx" everywhere
- update libinih parser error handling to be more robust
- ini_name -> ini_section and comment updates
- man page layout and grammar improvements
- Updated Darrick's old config file fstests to exercise the new code.

Version 2:

- "-c file=xxx" > "-c options=xxx"
- split out constification into new patch
- removed debug output
- fixed some comments
- added man page stuff

Hi Folks,

Because needing config files for mkfs came up yet again in discussion, here is a simple implementation of INI format config files. These config files behave identically to options specified on the command line - the do not change defaults, they do not override CLI options, they are not overridden by cli options.

Example:

$ echo -e "[metadata]\ncrc = 0" > foo
$ mkfs/mkfs.xfs -N -c options=foo -d file=1,size=100m blah
Parameters parsed from config file foo successfully
meta-data=blah                   isize=256    agcount=4, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0, rmapbt=0
         =                       reflink=0
data     =                       bsize=4096   blocks=25600, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$

And there's a V4 filesystem as specified by the option defined in the config file. If we do:

$ mkfs/mkfs.xfs -N -c options=foo -m crc=1 -d file=1,size=100m blah
-m crc option respecified
Usage: mkfs.xfs
.....
$

You can see it errors out because the CRC option was specified in both the config file and on the CLI.

There's lots of stuff we can do to make the conflict and respec error messages better, but that doesn't change the basic functionality of config file based mkfs options. To allow for future changes to the way we want to apply config files, I created a full option subtype for config files. That means we can add another option to say "apply config file as default values rather than as options" if we decide that is functionality that we want to support.

However, policy decisions like that are completely separate to the mechanism, so these patches don't try to address desires to ship "tuned" configs, system wide option files, shipping distro specific defaults in config files, etc. This is purely a mechanism to allow users to specify options via files instead of on the CLI. No more, no less.

Git branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/dgc/xfsprogs-dev.git mkfs-config-file

Cheers,

Dave.

Dave Chinner (5):
build: add support for libinih for mkfs
mkfs: add initial ini format config file parsing support
mkfs: constify various strings
mkfs: hook up suboption parsing to ini files
mkfs: document config files in mkfs.xfs(8)

 configure.ac         |   3 +
 doc/INSTALL          |   5 +
 include/builddefs.in |   1 +
 include/linux.h      |   2 +-
 m4/package_inih.m4   |  20 ++++
 man/man8/mkfs.xfs.8  | 113 +++++++++++++++++++--
 mkfs/Makefile        |   2 +-
 mkfs/xfs_mkfs.c      | 231 ++++++++++++++++++++++++++++++++++++++-----
 8 files changed, 343 insertions(+), 34 deletions(-)
 create mode 100644 m4/package_inih.m4
Signature · 1 line
2.28.0