]> xenbits.xensource.com Git - unikraft/unikraft.git/commit
lib/uklibparam: Rewrite of parser
authorSimon Kuenzer <simon@unikraft.io>
Thu, 23 Feb 2023 23:42:29 +0000 (00:42 +0100)
committerUnikraft <monkey@unikraft.io>
Sun, 7 May 2023 16:44:41 +0000 (16:44 +0000)
commit1cc3a2f6e33d1dbb390d24e79f73b86b34597b23
tree8cd55a76925ea3cf6cd5e409f37b70174d819bdc
parent243f0c45ca8060a230e0bde34783b75c0fefb47a
lib/uklibparam: Rewrite of parser

This commit introduces a rewrite of `lib/uklibparam`. The rewrite ensures
that it is errno-free, malloc-free, and TLS-free. This makes it ideal for
processing library parameters early during boot. It includes an own and
modified version of `strtoull` function that is used for parsing integer
values from the command line.
Additionally, the parser can handle arrays more intuitively (and for any
data type of the elements) while fully utilizing pre-processed argument
vectors. It relies on the fact that whitespacing and quoting is already
handled (e.g., by `lib/ukargparse`). There are new types that are more
inline with the ones defined by ukstore.

This rewrite introduces the ability to provide a parameter description
with updated parameter registration macros:
  UK_LIBPARAM_PARAM(variable, type, description)
  UK_LIBPARAM_PARAM_ARR(variable, type, count, description)
The description is printed on the help output.

The previous interfaces are kept for backwards compatibility. However,
it is planned to remove them as soon as the code base is completely
adopted.

Checkpatch-Ignore: SPACING
Checkpatch-Ignore: OPEN_BRACE
Checkpatch-Ignore: MACRO_WITH_FLOW_CONTROL
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #868
lib/ukboot/boot.c
lib/uklibparam/Makefile.rules
lib/uklibparam/Makefile.uk
lib/uklibparam/exportsyms.uk
lib/uklibparam/include/uk/libparam.h
lib/uklibparam/libparam.lds.S
lib/uklibparam/param.c [deleted file]
lib/uklibparam/parser.c [new file with mode: 0644]