diff mbox

[3/3] mkfs: do not allow both "dev" and "name" subopts for log or realtime

Message ID 6ea46cfb-357b-17c4-fc5f-65598431526f@sandeen.net (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Dec. 24, 2017, 7:12 p.m. UTC
Today we can specify i.e. both logdev= and name= ;
it works, with last-parsed-wins behavior:

mkfs.xfs -f -l logdev=/dev/sda1,name=/dev/sda2 /dev/sda3

Make these conflict to resolve ambiguity; do the same for
the realtime subvol.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Jan. 2, 2018, 5:44 p.m. UTC | #1
On Sun, Dec 24, 2017 at 11:12:13AM -0800, Eric Sandeen wrote:
> Today we can specify i.e. both logdev= and name= ;
> it works, with last-parsed-wins behavior:
> 
> mkfs.xfs -f -l logdev=/dev/sda1,name=/dev/sda2 /dev/sda3
> 
> Make these conflict to resolve ambiguity; do the same for
> the realtime subvol.
> 
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 035af03..5ae67d5 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -507,6 +507,7 @@ struct opt_params lopts = {
>  		},
>  		{ .index = L_DEV,
>  		  .conflicts = { { &lopts, L_AGNUM },
> +				 { &lopts, L_NAME },
>  				 { &lopts, L_INTERNAL },
>  				 { &lopts, LAST_CONFLICT } },
>  		  .defaultval = SUBOPT_NEEDS_VAL,
> @@ -529,6 +530,7 @@ struct opt_params lopts = {
>  		},
>  		{ .index = L_NAME,
>  		  .conflicts = { { &lopts, L_AGNUM },
> +				 { &lopts, L_DEV },
>  				 { &lopts, L_INTERNAL },
>  				 { &lopts, LAST_CONFLICT } },
>  		  .defaultval = SUBOPT_NEEDS_VAL,
> @@ -599,7 +601,8 @@ struct opt_params ropts = {
>  		  .defaultval = SUBOPT_NEEDS_VAL,
>  		},
>  		{ .index = R_DEV,
> -		  .conflicts = { { &ropts, LAST_CONFLICT } },
> +		  .conflicts = { { &ropts, R_NAME },
> +			         { &ropts, LAST_CONFLICT } },
>  		  .defaultval = SUBOPT_NEEDS_VAL,
>  		},
>  		{ .index = R_FILE,
> @@ -609,7 +612,8 @@ struct opt_params ropts = {
>  		  .conflicts = { { &ropts, LAST_CONFLICT } },
>  		},
>  		{ .index = R_NAME,
> -		  .conflicts = { { &ropts, LAST_CONFLICT } },
> +		  .conflicts = { { &ropts, R_DEV },
> +			         { &ropts, LAST_CONFLICT } },
>  		  .defaultval = SUBOPT_NEEDS_VAL,
>  		},
>  		{ .index = R_NOALIGN,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 035af03..5ae67d5 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -507,6 +507,7 @@  struct opt_params lopts = {
 		},
 		{ .index = L_DEV,
 		  .conflicts = { { &lopts, L_AGNUM },
+				 { &lopts, L_NAME },
 				 { &lopts, L_INTERNAL },
 				 { &lopts, LAST_CONFLICT } },
 		  .defaultval = SUBOPT_NEEDS_VAL,
@@ -529,6 +530,7 @@  struct opt_params lopts = {
 		},
 		{ .index = L_NAME,
 		  .conflicts = { { &lopts, L_AGNUM },
+				 { &lopts, L_DEV },
 				 { &lopts, L_INTERNAL },
 				 { &lopts, LAST_CONFLICT } },
 		  .defaultval = SUBOPT_NEEDS_VAL,
@@ -599,7 +601,8 @@  struct opt_params ropts = {
 		  .defaultval = SUBOPT_NEEDS_VAL,
 		},
 		{ .index = R_DEV,
-		  .conflicts = { { &ropts, LAST_CONFLICT } },
+		  .conflicts = { { &ropts, R_NAME },
+			         { &ropts, LAST_CONFLICT } },
 		  .defaultval = SUBOPT_NEEDS_VAL,
 		},
 		{ .index = R_FILE,
@@ -609,7 +612,8 @@  struct opt_params ropts = {
 		  .conflicts = { { &ropts, LAST_CONFLICT } },
 		},
 		{ .index = R_NAME,
-		  .conflicts = { { &ropts, LAST_CONFLICT } },
+		  .conflicts = { { &ropts, R_DEV },
+			         { &ropts, LAST_CONFLICT } },
 		  .defaultval = SUBOPT_NEEDS_VAL,
 		},
 		{ .index = R_NOALIGN,