Skip to content

bootconfig: Add value override operator

Masami Hiramatsu linux-doc lkml 1 version In review

Get series with b4
b4 am 159482882056.126704.15508672095852220119.stgit@devnote2

Versions newest first

  1. v1 Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/bootconfig: Add override operator supportlib/bootconfig.c+23 -100 replies
2/3tools/bootconfig: Add testcases for value override operatortools/bootconfig/samples/bad-override.bconf tools/bootconfig/samples/bad-override2.bconf tools/bootconfig/samples/good-override.bconf +1 more+25 -00 replies
3/3Documentation: bootconfig: Add bootconfig override operatorDocumentation/admin-guide/bootconfig.rst+11 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] bootconfig: Add value override operator

Hi,

Here is a seires of value-override operator support for bootconfig.

Currently, the bootconfig syntax supports normal assignment operator ("=") and value append operator ("+="), but there is no way to override (or update) existing value.

This patch adds the value override operator (":=") to update the existing value with another value. For example,

key.word = value1
key.word := value2, value3

In this case, the 2nd "key.word" config overwrites the 1st one. Thus this is equal to;

key.word = value2, value3

Note that it is still not allowed to override a subkey with a value, and a value with a subkey. This means the following case is not allowed.

key.word = value1
key := value2 # Error!

With this change, if the bootloader wants to change some value in the default bootconfig, it doesn't need to parse the existing bootconfig, but it can just append the new configs at the tail of the bootconfig and update the footer (size, checksum and magic word).

Thank you,

---

Masami Hiramatsu (3):
lib/bootconfig: Add override operator support tools/bootconfig: Add testcases for value override operator
Documentation: bootconfig: Add bootconfig override operator

 Documentation/admin-guide/bootconfig.rst     |   11 +++++++++
 lib/bootconfig.c                             |   33 ++++++++++++++++++--------
 tools/bootconfig/samples/bad-override.bconf  |    3 ++
 tools/bootconfig/samples/bad-override2.bconf |    3 ++
 tools/bootconfig/samples/good-override.bconf |    6 +++++
 tools/bootconfig/test-bootconfig.sh          |   13 ++++++++++
 6 files changed, 59 insertions(+), 10 deletions(-)
 create mode 100644 tools/bootconfig/samples/bad-override.bconf
 create mode 100644 tools/bootconfig/samples/bad-override2.bconf
 create mode 100644 tools/bootconfig/samples/good-override.bconf

--
Masami Hiramatsu (Linaro) <[email protected]>