diff mbox series

[ndctl,6/7] ndctl, util: use 'unsigned long long' type in OPT_U64 define

Message ID 4653004cf532c2e14f79a45bddf0ebaac09ef4e6.1641233076.git.alison.schofield@intel.com (mailing list archive)
State Superseded
Headers show
Series Add partitioning support for CXL memdevs | expand

Commit Message

Alison Schofield Jan. 3, 2022, 8:16 p.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

The OPT_U64 define failed in check_vtype() with unknown 'u64' type.
Replace with 'unsigned long long' to make the OPT_U64 define usable.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 util/parse-options.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ira Weiny Jan. 6, 2022, 8:54 p.m. UTC | #1
On Mon, Jan 03, 2022 at 12:16:17PM -0800, Schofield, Alison wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> The OPT_U64 define failed in check_vtype() with unknown 'u64' type.
> Replace with 'unsigned long long' to make the OPT_U64 define usable.

I feel like this should be the first patch in the series.

> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
>  util/parse-options.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/parse-options.h b/util/parse-options.h
> index 9318fe7..91b7932 100644
> --- a/util/parse-options.h
> +++ b/util/parse-options.h
> @@ -124,7 +124,7 @@ struct option {
>  #define OPT_INTEGER(s, l, v, h)     { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
>  #define OPT_UINTEGER(s, l, v, h)    { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
>  #define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
> -#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
> +#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long long *), .help = (h) }

Why can't this be uint64_t?

Ira

>  #define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
>  #define OPT_FILENAME(s, l, v, a, h) { .type = OPTION_FILENAME, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
>  #define OPT_DATE(s, l, v, h) \
> -- 
> 2.31.1
>
Alison Schofield Jan. 7, 2022, 8:59 p.m. UTC | #2
On Thu, Jan 06, 2022 at 12:54:54PM -0800, Ira Weiny wrote:
> On Mon, Jan 03, 2022 at 12:16:17PM -0800, Schofield, Alison wrote:
> > From: Alison Schofield <alison.schofield@intel.com>
> > 
> > The OPT_U64 define failed in check_vtype() with unknown 'u64' type.
> > Replace with 'unsigned long long' to make the OPT_U64 define usable.
> 
> I feel like this should be the first patch in the series.

I felt like it was a fixup, that should go right before I use it.

Now that the -size parameter is getting changed to a string,
(next patch feedback), this isn't needed.

I'll drop this patch from the set and save it for trivial cleanup
day.

more below...
> 
> > 
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> > ---
> >  util/parse-options.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/util/parse-options.h b/util/parse-options.h
> > index 9318fe7..91b7932 100644
> > --- a/util/parse-options.h
> > +++ b/util/parse-options.h
> > @@ -124,7 +124,7 @@ struct option {
> >  #define OPT_INTEGER(s, l, v, h)     { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
> >  #define OPT_UINTEGER(s, l, v, h)    { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
> >  #define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
> > -#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
> > +#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long long *), .help = (h) }
> 
> Why can't this be uint64_t?

I don't know. ULL worked so I didn't look further.
Is uint64_t more suitable?

> 
> Ira
> 
> >  #define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
> >  #define OPT_FILENAME(s, l, v, a, h) { .type = OPTION_FILENAME, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
> >  #define OPT_DATE(s, l, v, h) \
> > -- 
> > 2.31.1
> >
diff mbox series

Patch

diff --git a/util/parse-options.h b/util/parse-options.h
index 9318fe7..91b7932 100644
--- a/util/parse-options.h
+++ b/util/parse-options.h
@@ -124,7 +124,7 @@  struct option {
 #define OPT_INTEGER(s, l, v, h)     { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
 #define OPT_UINTEGER(s, l, v, h)    { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
 #define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
-#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
+#define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned long long *), .help = (h) }
 #define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
 #define OPT_FILENAME(s, l, v, a, h) { .type = OPTION_FILENAME, .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
 #define OPT_DATE(s, l, v, h) \