forked from Minki/linux
perf config: Introduce perf_config_u8()
Introduce perf_config_u8() utility function to convert char * input into u8 destination. We will utilize it in followup patch. Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Changbin Du <changbin.du@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Song Liu <songliubraving@fb.com> Cc: Taeung Song <treeze.taeung@gmail.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Yisheng Xie <xieyisheng1@huawei.com> Link: http://lore.kernel.org/lkml/20200213064306.160480-5-ravi.bangoria@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
46ccb44269
commit
7b43b69704
@ -374,6 +374,18 @@ int perf_config_int(int *dest, const char *name, const char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int perf_config_u8(u8 *dest, const char *name, const char *value)
|
||||
{
|
||||
long ret = 0;
|
||||
|
||||
if (!perf_parse_long(value, &ret)) {
|
||||
bad_config(name);
|
||||
return -1;
|
||||
}
|
||||
*dest = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int perf_config_bool_or_int(const char *name, const char *value, int *is_bool)
|
||||
{
|
||||
int ret;
|
||||
|
@ -29,6 +29,7 @@ typedef int (*config_fn_t)(const char *, const char *, void *);
|
||||
int perf_default_config(const char *, const char *, void *);
|
||||
int perf_config(config_fn_t fn, void *);
|
||||
int perf_config_int(int *dest, const char *, const char *);
|
||||
int perf_config_u8(u8 *dest, const char *name, const char *value);
|
||||
int perf_config_u64(u64 *dest, const char *, const char *);
|
||||
int perf_config_bool(const char *, const char *);
|
||||
int config_error_nonbool(const char *);
|
||||
|
Loading…
Reference in New Issue
Block a user