On 17.07.23 23:40, Julien Grall wrote:
Hi Juergen,On 10/07/2023 07:59, Juergen Gross wrote:Instead of using TDB_REPLACE for either creating or modifying a TDB entry, use either TDB_INSERT or TDB_MODIFY when calling tdb_store(). At higher function levels use the abstract flag values NODE_CREATEWere you meant to replace 'flag' with 'mode'?
Of course.
[...]diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.cindex 334f1609f1..0655073de7 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -290,7 +290,8 @@ int access_node(struct connection *conn, struct node *node, i->check_gen = true; if (node->generation != NO_GENERATION) { set_tdb_key(i->trans_name, &local_key); - ret = write_node_raw(conn, &local_key, node, true); + ret = write_node_raw(conn, &local_key, node, + NODE_CREATE, true); if (ret) goto err; i->ta_node = true; @@ -363,6 +364,7 @@ static int finalize_transaction(struct connection *conn, TDB_DATA key, ta_key, data; struct xs_tdb_record_hdr *hdr; uint64_t gen; + int flag;I think this should be 'enum write_node_mode mode'. Also, can't the variable be defined a bit below in the if ( ... )?
Yes to both. Juergen
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature