[LTP] [PATCH v4 1/3] Add tst_kconfig_get() helper function

Cyril Hrubis chrubis@suse.cz
Thu Nov 19 13:10:32 CET 2020


Hi!
> +/**
> + * Checks kernel config for a single configuration option and returns its
> + * state if found. The possible return values are the same as for
> + * tst_kconfig_var.choice, with the same meaning. See tst_kconfig_read()
> + * description for details.
> + *
> + * @param confname The configuration option name to search for.
> + */
> +char tst_kconfig_get(const char *confname);

I do not like this interface at all since the whole kernel config is
parsed every time this function is called and I bet that people would
call it five times in a test setup() soon enough.

I guess that if you want easier interface than the tst_kconfig_read() it
should be implemented as:

* A function loads config given an array of variable names to store.
  Either it should return a handle or store the pointer to newly
  allocated data to a global variable.

* A set of functions that return variable value given variable name

* A function that frees the memory once we are done

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list