All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Jan Tulak <jtulak@redhat.com>
Subject: [PATCH 19/22] mkfs: subopt flags should be saved as bool
Date: Wed, 15 Mar 2017 17:00:14 +0100	[thread overview]
Message-ID: <20170315160017.27805-20-jtulak@redhat.com> (raw)
In-Reply-To: <20170315160017.27805-1-jtulak@redhat.com>

Flag suboptions are not united in what data type they use internally.
Unify them as boolean.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
 mkfs/xfs_mkfs.c | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 767aeeea..914af9d3 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -664,10 +664,10 @@ struct opt_params {
 			},
 			{ .index = D_RTINHERIT,
 			  .conflicts = { {LAST_CONFLICT} },
-			  .minval.u = 1,
-			  .maxval.u = 1,
-			  .flagval.u = 1,
-			  .type = UINT,
+			  .minval.b = false,
+			  .maxval.b = true,
+			  .flagval.b = true,
+			  .type = BOOL,
 			},
 			{ .index = D_PROJINHERIT,
 			  .conflicts = { {LAST_CONFLICT} },
@@ -804,10 +804,10 @@ struct opt_params {
 					  .message = \
 		"Sparse inodes not supported without CRC support."},
 					 {LAST_CONFLICT} },
-			  .minval.i = 0,
-			  .maxval.i = 1,
-			  .flagval.i = 1,
-			  .type = INT,
+			  .minval.b = false,
+			  .maxval.b = true,
+			  .flagval.b = true,
+			  .type = BOOL,
 			},
 		},
 	},
@@ -936,10 +936,10 @@ struct opt_params {
 					  .subopt = L_INTERNAL,
 					 },
 					 {LAST_CONFLICT} },
-			  .minval.i = 0,
-			  .maxval.i = 1,
-			  .flagval.i = 1,
-			  .type = INT,
+			  .minval.b = false,
+			  .maxval.b = true,
+			  .flagval.b = true,
+			  .type = BOOL,
 			},
 			{ .index = L_NAME,
 			  .conflicts = { {.opt = OPT_L,
@@ -1069,10 +1069,10 @@ struct opt_params {
 			  .type = STRING,
 			},
 			{ .index = R_FILE,
-			  .minval.i = 0,
-			  .maxval.i = 1,
-			  .flagval.i = 1,
-			  .type = INT,
+			  .minval.b = false,
+			  .maxval.b = true,
+			  .flagval.b = true,
+			  .type = BOOL,
 			  .conflicts = { {LAST_CONFLICT} },
 			},
 			{ .index = R_NAME,
@@ -1089,10 +1089,10 @@ struct opt_params {
 			  .type = STRING,
 			},
 			{ .index = R_NOALIGN,
-			  .minval.i = 0,
-			  .maxval.i = 1,
-			  .flagval.i = 1,
-			  .type = INT,
+			  .minval.b = false,
+			  .maxval.b = true,
+			  .flagval.b = true,
+			  .type = BOOL,
 			  .conflicts = { {LAST_CONFLICT} },
 			},
 		},
@@ -2202,7 +2202,7 @@ main(
 	xfs_extlen_t		nbmblocks;
 	int			nlflag;
 	int			*nodsflag;
-	int			*norsflag;
+	bool			*norsflag;
 	xfs_alloc_rec_t		*nrec;
 	int			nsflag;
 	int			nvflag;
@@ -2265,7 +2265,7 @@ main(
 	dsu = &opts[OPT_D].subopt_params[D_SU].value.i;
 	dsw = &opts[OPT_D].subopt_params[D_SW].value.i;
 	nodsflag = &opts[OPT_D].subopt_params[D_NOALIGN].value.i;
-	norsflag = &opts[OPT_R].subopt_params[R_NOALIGN].value.i;
+	norsflag = &opts[OPT_R].subopt_params[R_NOALIGN].value.b;
 	logagno = &opts[OPT_L].subopt_params[L_AGNUM].value.u;
 	lsu = &opts[OPT_L].subopt_params[L_SU].value.i;
 	lsunit = &opts[OPT_L].subopt_params[L_SUNIT].value.i;
@@ -2400,7 +2400,7 @@ main(
 					if (c)
 						fsx.fsx_xflags |=
 							XFS_DIFLAG_RTINHERIT;
-					opts[OPT_D].subopt_params[D_RTINHERIT].value.u = c;
+					opts[OPT_D].subopt_params[D_RTINHERIT].value.b = c;
 					break;
 				case D_PROJINHERIT:
 					fsx.fsx_projid = getnum(value, &opts[OPT_D],
@@ -2736,15 +2736,15 @@ main(
 	opts[OPT_D].subopt_params[D_FILE].value.i  = xi.disfile;
 	opts[OPT_D].subopt_params[D_PROJINHERIT].value.u = fsx.fsx_projid;
 	opts[OPT_D].subopt_params[D_EXTSZINHERIT].value.u = fsx.fsx_extsize;
-	opts[OPT_L].subopt_params[L_FILE].value.i = xi.lisfile;
+	opts[OPT_L].subopt_params[L_FILE].value.b = xi.lisfile;
 	opts[OPT_L].subopt_params[L_VERSION].value.i = sb_feat.log_version;
 	opts[OPT_L].subopt_params[L_LAZYSBCNTR].value.b = sb_feat.lazy_sb_counters;
 	opts[OPT_I].subopt_params[I_ATTR].value.i = sb_feat.attr_version ;
 	opts[OPT_I].subopt_params[I_PROJID32BIT].value.b = !sb_feat.projid16bit ;
-	opts[OPT_I].subopt_params[I_SPINODES].value.i = sb_feat.spinodes ;
+	opts[OPT_I].subopt_params[I_SPINODES].value.b = sb_feat.spinodes ;
 	opts[OPT_M].subopt_params[M_FINOBT].value.i = sb_feat.finobt ;
 	opts[OPT_M].subopt_params[M_RMAPBT].value.b = sb_feat.rmapbt ;
-	opts[OPT_R].subopt_params[R_FILE].value.i = xi.risfile ;
+	opts[OPT_R].subopt_params[R_FILE].value.b = xi.risfile ;
 	opts[OPT_R].subopt_params[R_NAME].value.s = xi.rtname;
 	opts[OPT_R].subopt_params[R_DEV].value.s = xi.rtname;
 	opts[OPT_S].subopt_params[S_LOG].value.u = sectorsize;
-- 
2.11.0


  parent reply	other threads:[~2017-03-15 16:01 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 15:59 [PATCH 00/22] mkfs.xfs: Make stronger conflict checks Jan Tulak
2017-03-15 15:59 ` [PATCH 01/22] mkfs: remove intermediate getstr followed by getnum Jan Tulak
2017-03-16 22:59   ` Eric Sandeen
2017-04-05 13:00     ` Jan Tulak
2017-04-05 14:05       ` Eric Sandeen
2017-03-15 15:59 ` [PATCH 02/22] mkfs: merge tables for opts parsing into one table Jan Tulak
2017-03-15 15:59 ` [PATCH 03/22] mkfs: extend opt_params with a value field Jan Tulak
2017-03-15 15:59 ` [PATCH 04/22] mkfs: change conflicts array into a table capable of cross-option addressing Jan Tulak
2017-03-16 17:02   ` Eric Sandeen
2017-03-16 17:21     ` Jan Tulak
2017-03-16 17:41       ` Eric Sandeen
2017-03-16 17:47         ` Jan Tulak
2017-03-15 16:00 ` [PATCH 05/22] mkfs: add a check for conflicting values Jan Tulak
2017-03-25  0:36   ` Eric Sandeen
2017-03-29 14:58     ` Jan Tulak
2017-03-15 16:00 ` [PATCH 06/22] mkfs: add cross-section conflict checks Jan Tulak
2017-03-25  0:31   ` Eric Sandeen
2017-03-29 14:57     ` Jan Tulak
2017-03-15 16:00 ` [PATCH 07/22] mkfs: Move opts related #define to one place Jan Tulak
2017-03-16 23:25   ` Luis R. Rodriguez
2017-03-17 12:11     ` Jan Tulak
2017-03-15 16:00 ` [PATCH 08/22] mkfs: move conflicts into the table Jan Tulak
2017-03-16 18:04   ` Eric Sandeen
2017-03-16 18:39   ` Eric Sandeen
2017-03-16 18:45     ` Darrick J. Wong
2017-03-24 23:53   ` Eric Sandeen
2017-03-29 14:57     ` Jan Tulak
2017-03-15 16:00 ` [PATCH 09/22] mkfs: change conflict checks to utilize the new conflict structure Jan Tulak
2017-03-15 16:00 ` [PATCH 10/22] mkfs: change when to mark an option as seen Jan Tulak
2017-03-15 16:00 ` [PATCH 11/22] mkfs: add test_default_value into conflict struct Jan Tulak
2017-03-25  0:09   ` Eric Sandeen
2017-03-29 14:57     ` Jan Tulak
2017-03-29 16:33       ` Jan Tulak
2017-03-31  1:40         ` Luis R. Rodriguez
2017-03-31  7:35           ` Jan Tulak
2017-03-15 16:00 ` [PATCH 12/22] mkfs: expand conflicts declarations to named declaration Jan Tulak
2017-03-15 16:00 ` [PATCH 13/22] mkfs: remove zeroed items from conflicts declaration Jan Tulak
2017-03-15 16:00 ` [PATCH 14/22] mkfs: rename defaultval to flagval in opts Jan Tulak
2017-03-16 23:20   ` Luis R. Rodriguez
2017-03-17 12:06     ` Jan Tulak
2017-03-15 16:00 ` [PATCH 15/22] mkfs: replace SUBOPT_NEEDS_VAL for a flag Jan Tulak
2017-03-15 16:00 ` [PATCH 16/22] mkfs: Change all value fields in opt structures into unions Jan Tulak
2017-03-15 16:00 ` [PATCH 17/22] mkfs: use old variables as pointers to the new opts struct values Jan Tulak
2017-03-17  0:48   ` Eric Sandeen
2017-03-15 16:00 ` [PATCH 18/22] mkfs: prevent sector/blocksize to be specified as a number of blocks Jan Tulak
2017-03-15 16:00 ` Jan Tulak [this message]
2017-03-15 16:00 ` [PATCH 20/22] mkfs: move uuid empty string test to getstr() Jan Tulak
2017-03-15 16:00 ` [PATCH 21/22] mkfs: remove duplicit checks Jan Tulak
2017-03-15 16:00 ` [PATCH 22/22] mkfs: prevent multiple specifications of a single option Jan Tulak
2017-03-16 17:19 ` [PATCH 00/22] mkfs.xfs: Make stronger conflict checks Eric Sandeen
2017-03-16 17:23   ` Jan Tulak
2017-03-16 23:38 ` Luis R. Rodriguez
2017-03-16 23:47   ` Eric Sandeen
2017-03-17 12:57     ` Jan Tulak
2017-03-18  7:08       ` Dave Chinner
2017-03-17 12:20   ` Jan Tulak
  -- strict thread matches above, loose matches on Subject: below --
2016-12-07 13:27 [RFC PATCH " Jan Tulak
2016-12-07 13:27 ` [PATCH 19/22] mkfs: subopt flags should be saved as bool Jan Tulak
2017-01-16 14:16   ` Bill O'Donnell

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=20170315160017.27805-20-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=linux-xfs@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.