[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH v1 02/25] hw/xen: Add basic XenStore tree walk and write/read/directory support
On 02/03/2023 15:34, David Woodhouse wrote: From: David Woodhouse <dwmw@xxxxxxxxxxxx> This is a fairly simple implementation of a copy-on-write tree. The node walk function starts off at the root, with 'inplace == true'. If it ever encounters a node with a refcount greater than one (including the root node), then that node is shared with other trees, and cannot be modified in place, so the inplace flag is cleared and we copy on write from there on down. Xenstore write has 'mkdir -p' semantics and will create the intermediate nodes if they don't already exist, so in that case we flip the inplace flag back to true as as populated the newly-created nodes. Something has gone wrong with the comment there... 'as we populate' perhaps? We put a copy of the absolute path into the buffer in the struct walk_op, with *two* NUL terminators at the end. As xs_node_walk() goes down the tree, it replaces the next '/' separator with a NUL so that it can use the 'child name' in place. The next recursion down then puts the '/' back and repeats the exercise for the next path element... if it doesn't hit that *second* NUL termination which indicates the true end of the path. Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx> --- hw/i386/kvm/xenstore_impl.c | 527 +++++++++++++++++++++++++++++++++++- tests/unit/meson.build | 1 + tests/unit/test-xs-node.c | 197 ++++++++++++++ 3 files changed, 718 insertions(+), 7 deletions(-) create mode 100644 tests/unit/test-xs-node.c With the comment fixed... Reviewed-by: Paul Durrant <paul@xxxxxxx>
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |