diff mbox

[01/12] mkfs: Save raw user input field to the opts struct

Message ID 20170423185503.31415-2-jtulak@redhat.com (mailing list archive)
State Superseded
Headers show

Commit Message

Jan Tulak April 23, 2017, 6:54 p.m. UTC
Save exactly what the user gave us for every option.  This way, we will
never lose the information if we need it to print back an issue.

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

Comments

Eric Sandeen April 25, 2017, 5:38 p.m. UTC | #1
On 4/23/17 1:54 PM, Jan Tulak wrote:
> Save exactly what the user gave us for every option.  This way, we will
> never lose the information if we need it to print back an issue.
> 
> Signed-off-by: Jan Tulak <jtulak@redhat.com>

Hm but no users yet?  I suppose that's ok.  Just adding the infrastructure
here.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  mkfs/xfs_mkfs.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 83a04fc..84674d5 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -119,6 +119,10 @@ uint64_t		sectorsize;
>   *     A special SUBOPT_NEEDS_VAL can be used to require a user-given
>   *     value in any case.
>   *
> + *   raw_input INTERNAL
> + *     Filled raw string from the user, so we never lose that information e.g.
> + *     to print it back in case of an issue.
> + *
>   * !!! NOTE ==================================================================
>   *
>   * If you are adding a new option, or changing an existing one,
> @@ -141,6 +145,7 @@ struct opt_params {
>  		uint64_t	minval;
>  		uint64_t	maxval;
>  		uint64_t	defaultval;
> +		const char	*raw_input;
>  	}		subopt_params[MAX_SUBOPTS];
>  };
>  
> @@ -748,6 +753,18 @@ struct opt_params mopts = {
>   */
>  #define WHACK_SIZE (128 * 1024)
>  
> +static inline void
> +set_conf_raw(struct opt_params *opt, int subopt, const char *value)
> +{
> +	opt->subopt_params[subopt].raw_input = value;
> +}
> +
> +static inline const char *
> +get_conf_raw(const struct opt_params *opt, int subopt)
> +{
> +	return opt->subopt_params[subopt].raw_input;
> +}
> +
>  /*
>   * Convert lsu to lsunit for 512 bytes blocks and check validity of the values.
>   */
> 
--
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 83a04fc..84674d5 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -119,6 +119,10 @@  uint64_t		sectorsize;
  *     A special SUBOPT_NEEDS_VAL can be used to require a user-given
  *     value in any case.
  *
+ *   raw_input INTERNAL
+ *     Filled raw string from the user, so we never lose that information e.g.
+ *     to print it back in case of an issue.
+ *
  * !!! NOTE ==================================================================
  *
  * If you are adding a new option, or changing an existing one,
@@ -141,6 +145,7 @@  struct opt_params {
 		uint64_t	minval;
 		uint64_t	maxval;
 		uint64_t	defaultval;
+		const char	*raw_input;
 	}		subopt_params[MAX_SUBOPTS];
 };
 
@@ -748,6 +753,18 @@  struct opt_params mopts = {
  */
 #define WHACK_SIZE (128 * 1024)
 
+static inline void
+set_conf_raw(struct opt_params *opt, int subopt, const char *value)
+{
+	opt->subopt_params[subopt].raw_input = value;
+}
+
+static inline const char *
+get_conf_raw(const struct opt_params *opt, int subopt)
+{
+	return opt->subopt_params[subopt].raw_input;
+}
+
 /*
  * Convert lsu to lsunit for 512 bytes blocks and check validity of the values.
  */