config: add write support to atomic-sections

System Internals / NetworkManager - Thomas Haller [redhat.com] - 2 July 2015 09:01 UTC

We already support setting configuration values, either: (1) set any internal section, i.e. groups starting with [.intern*]. Those values don't ever interfere with that the user can configure. (2) set individual properties that overwrite user configuration. When doing that, we record the value from user configuration and on load, we reject our internal overwrite if the user configuration changed in the meantime. This is done by storing the values with ".set." and ".was." prefixes.

Now add support for "atomic sections". In this case, certain groups can be marked as "atomic". When writing to such sections, we overwrite the entire user-provided setting. We also record the values from user configuration, and reject our internal value if we notice modifications. This basically extends (2) from individual properties to the entire section.

40c57fa config: add write support to atomic-sections
src/main.c | 2 +-
src/nm-config-data.c | 57 ++++++++++-
src/nm-config-data.h | 1 +
src/nm-config.c | 209 +++++++++++++++++++++++++++++++++++++---
src/nm-config.h | 6 +-
src/tests/config/test-config.c | 2 +-
6 files changed, 253 insertions(+), 24 deletions(-)

Upstream: cgit.freedesktop.org


  • Share