Skip to content

RFC mkfs: sanitise input parameters

Dave Chinner linux-xfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest15 patches 26 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15xfsprogs: use common code for multi-disk detectioninclude/Makefile include/xfs_mkfs.h mkfs/Makefile +3 more+171 -1292 replies
2/15mkfs: sanitise ftype parameter values.mkfs/xfs_mkfs.c+4 -11 reply
3/15mkfs: Sanitise the superblock feature macrosinclude/xfs_mkfs.h mkfs/xfs_mkfs.c+146 -1062 replies
4/15mkfs: validate all input valuesinclude/xfs_mkfs.h man/man8/mkfs.xfs.8 mkfs/proto.c +1 more+153 -1315 replies
5/15mkfs: factor boolean option parsingmkfs/xfs_mkfs.c+42 -592 replies
6/15mkfs: validate logarithmic parameters sanelymkfs/xfs_mkfs.c+51 -283 replies
7/15mkfs: structify input parameter passingmkfs/xfs_mkfs.c+392 -2102 replies
8/15mkfs: getbool is redundantmkfs/xfs_mkfs.c+106 -411 reply
9/15mkfs: use getnum_checked for all ranged parametersinclude/xfs_mkfs.h mkfs/xfs_mkfs.c+81 -761 reply
10/15mkfs: add respecification detection to generic parsingmkfs/xfs_mkfs.c+17 -471 reply
11/15mkfs: table based parsing for converted parametersmkfs/xfs_mkfs.c+68 -1031 reply
12/15mkfs: merge getnuminclude/xfs_mkfs.h mkfs/proto.c mkfs/xfs_mkfs.c+113 -1132 replies
13/15mkfs: encode conflicts into parsing tablemkfs/xfs_mkfs.c+123 -1231 reply
14/15mkfs: add string options to generic parsingmkfs/xfs_mkfs.c+71 -580 replies
15/15mkfs: don't treat files as though they are block deviceslibxfs/linux.c mkfs/xfs_mkfs.c+126 -522 replies

Reviews trailers per patch

10 of 15 patches have a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/15
2/15R-b
3/15R-b
4/15
5/15R-b
6/15R-b
7/15R-b
8/15R-b
9/15R-b
10/15R-b
11/15R-b
12/15
13/15R-b
14/15
15/15

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

Read the v1 thread

Cover letter [RFC, PATCH 00/15] mkfs: sanitise input parameters

Hi folks,

This is still a work in progress, but is compelte enough to get feedback on the general structure. The problem being solved here is that mkfs does a terrible job of input validation from the command line, has huge amounts of repeated code in the sub options processing loops and has many, many unnecessary variable for tracking simply things like whether a parameter was specified.

This patchset introduces a parameter table structure that is used to define the parameters and their constraints. Things like minimum and maximum valid values, default values, conflicting options, etc are all contained within the table, so all the "policy" is found in a single place.

This greatly reduces the complexity of the option parsing loop. It doesn't remove all the complexity (yet) because many of the options have special cases or more complex conflicts than I've yet added support for. The idea is, however, that all of the sub-option parameter setup will eventually end up being implemented as a generic loop as the parameter structure will hold all the information about in the input parameters.

To get there, the parameter table still needs more work - it needs to hold the value/string for the parameter, and we need to reference those in the code.

The flow on effect of this is that we can remove the many, many individual variables and start passing the option structures to functions rather than avoiding using functions because passing so many variables is messy and nasty. IOWs, it lays the groundwork for factoring xfs_mkfs.c into something more than a bunch of spagetti...

Anyway, have a look and see what you think about progress so far.

FWIW, the first patch is following up on the multi-disk discussion Christoph and I had, and the last patch in the series covers all the issues that arose with "-d file" and treating files like block devices....

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs