Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
xen.10697
xs-09-add_change_node-params.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xs-09-add_change_node-params.patch of Package xen.10697
commit 2a29eec174227123b3b814da39cf6c333323667a Author: Juergen Gross <jgross@suse.com> Date: Mon Dec 5 08:48:42 2016 +0100 xenstore: modify add_change_node() parameter types In order to prepare adding a generation count to each node modify add_change_node() to take the connection pointer and a node pointer instead of the transaction pointer and node name as parameters. This requires moving the call of add_change_node() from do_rm() to delete_node_single(). While at it correct the comment for the prototype: there is no longjmp() involved. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com> Index: xen-4.4.4-testing/tools/xenstore/xenstored_core.c =================================================================== --- xen-4.4.4-testing.orig/tools/xenstore/xenstored_core.c +++ xen-4.4.4-testing/tools/xenstore/xenstored_core.c @@ -817,7 +817,8 @@ static void do_read(struct connection *c send_reply(conn, XS_READ, node->data, node->datalen); } -static void delete_node_single(struct connection *conn, struct node *node) +static void delete_node_single(struct connection *conn, struct node *node, + bool changed) { TDB_DATA key; @@ -829,6 +830,9 @@ static void delete_node_single(struct co return; } + if (changed) + add_change_node(conn, node, true); + domain_entry_dec(conn, node); } @@ -979,7 +983,7 @@ static void do_write(struct connection * } } - add_change_node(conn->transaction, name, false); + add_change_node(conn, node, false); wrl_apply_debit_direct(conn); fire_watches(conn, in, name, false); send_ack(conn, XS_WRITE); @@ -1011,21 +1015,22 @@ static void do_mkdir(struct connection * send_error(conn, errno); return; } - add_change_node(conn->transaction, name, false); + add_change_node(conn, node, false); wrl_apply_debit_direct(conn); fire_watches(conn, in, name, false); } send_ack(conn, XS_MKDIR); } -static void delete_node(struct connection *conn, struct node *node) +static void delete_node(struct connection *conn, struct node *node, + bool changed) { unsigned int i; /* Delete self, then delete children. If we crash, then the worst that can happen is the children will continue to take up space, but will otherwise be unreachable. */ - delete_node_single(conn, node); + delete_node_single(conn, node, changed); /* Delete children, too. */ for (i = 0; i < node->childlen; i += strlen(node->children+i) + 1) { @@ -1035,7 +1040,7 @@ static void delete_node(struct connectio talloc_asprintf(node, "%s/%s", node->name, node->children + i)); if (child) { - delete_node(conn, child); + delete_node(conn, child, false); } else { trace("delete_node: No child '%s/%s' found!\n", @@ -1094,7 +1099,7 @@ static int _rm(struct connection *conn, return 0; } - delete_node(conn, node); + delete_node(conn, node, true); return 1; } @@ -1138,7 +1143,6 @@ static void do_rm(struct connection *con } if (_rm(conn, node, name)) { - add_change_node(conn->transaction, name, true); wrl_apply_debit_direct(conn); fire_watches(conn, in, name, true); send_ack(conn, XS_RM); @@ -1215,7 +1219,7 @@ static void do_set_perms(struct connecti return; } - add_change_node(conn->transaction, name, false); + add_change_node(conn, node, false); wrl_apply_debit_direct(conn); fire_watches(conn, in, name, false); send_ack(conn, XS_SET_PERMS); Index: xen-4.4.4-testing/tools/xenstore/xenstored_transaction.c =================================================================== --- xen-4.4.4-testing.orig/tools/xenstore/xenstored_transaction.c +++ xen-4.4.4-testing/tools/xenstore/xenstored_transaction.c @@ -93,18 +93,21 @@ TDB_CONTEXT *tdb_transaction_context(str /* Callers get a change node (which can fail) and only commit after they've * finished. This way they don't have to unwind eg. a write. */ -void add_change_node(struct transaction *trans, const char *node, bool recurse) +void add_change_node(struct connection *conn, struct node *node, bool recurse) { struct changed_node *i; + struct transaction *trans; - if (!trans) { + if (!conn || !conn->transaction) { /* They're changing the global database. */ generation++; return; } + trans = conn->transaction; + list_for_each_entry(i, &trans->changes, list) { - if (streq(i->node, node)) { + if (streq(i->node, node->name)) { if (recurse) i->recurse = recurse; return; @@ -112,7 +115,7 @@ void add_change_node(struct transaction } i = talloc(trans, struct changed_node); - i->node = talloc_strdup(i, node); + i->node = talloc_strdup(i, node->name); i->recurse = recurse; list_add_tail(&i->list, &trans->changes); } Index: xen-4.4.4-testing/tools/xenstore/xenstored_transaction.h =================================================================== --- xen-4.4.4-testing.orig/tools/xenstore/xenstored_transaction.h +++ xen-4.4.4-testing/tools/xenstore/xenstored_transaction.h @@ -31,8 +31,8 @@ struct transaction *transaction_lookup(s void transaction_entry_inc(struct transaction *trans, unsigned int domid); void transaction_entry_dec(struct transaction *trans, unsigned int domid); -/* This node was changed: can fail and longjmp. */ -void add_change_node(struct transaction *trans, const char *node, +/* This node was changed. */ +void add_change_node(struct connection *conn, struct node *node, bool recurse); /* Return tdb context to use for this connection. */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor