
On Mon, Jun 11, 2018 at 04:21:47PM +0200, Pavel Hrdina wrote:
D-Bus object path element can contain only [a-zA-Z0-9_] characters so we need to encode existing unique IDs. In case of UUID it's simple, we just change '-' into '_' but in case of storage volumes we need to use 'key' which is arbitrary string.
This helpers encode the string using this algorithm:
[a-zA-Z0-9] > [a-zA-Z0-9] anything else > _XX where XX is hex representation
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- .gitignore | 4 ++- src/util.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++ src/util.h | 6 +++++ tests/Makefile.am | 20 +++++++++++++++ tests/test_util.c | 47 ++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 tests/test_util.c
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>