xenstore_write(unsigned int tx_id, const char *path) "tx %u path %s"
xenstore_mkdir(unsigned int tx_id, const char *path) "tx %u path %s"
xenstore_directory(unsigned int tx_id, const char *path) "tx %u path %s"
-xenstore_transaction_start(unsigned int tx_id, unsigned int new_tx) "tx %u new_tx %u"
+xenstore_transaction_start(unsigned int new_tx) "new_tx %u"
xenstore_transaction_end(unsigned int tx_id, bool commit) "tx %u commit %d"
xenstore_rm(unsigned int tx_id, const char *path) "tx %u path %s"
xenstore_get_perms(unsigned int tx_id, const char *path) "tx %u path %s"
{
struct xsd_sockmsg *rsp = (struct xsd_sockmsg *)s->rsp_data;
char *rsp_data = (char *)&rsp[1];
- unsigned int new_tx = 0;
int err;
if (len != 1 || req_data[0] != '\0') {
rsp->tx_id = tx_id;
rsp->len = 0;
- err = xs_impl_transaction_start(s->impl, xen_domid, tx_id, &new_tx);
- trace_xenstore_transaction_start(tx_id, new_tx);
+ err = xs_impl_transaction_start(s->impl, xen_domid, &tx_id);
if (err) {
xs_error(s, req_id, tx_id, err);
return;
}
+ trace_xenstore_transaction_start(tx_id);
+
rsp->len = snprintf(rsp_data, XENSTORE_PAYLOAD_MAX, "%u", tx_id);
assert(rsp->len < XENSTORE_PAYLOAD_MAX);
rsp->len++;
static xs_transaction_t xs_be_transaction_start(struct qemu_xs_handle *h)
{
unsigned int new_tx = XBT_NULL;
- int err = xs_impl_transaction_start(h->impl, DOMID_QEMU, XBT_NULL, &new_tx);
+ int err = xs_impl_transaction_start(h->impl, DOMID_QEMU, &new_tx);
if (err) {
errno = err;
return XBT_NULL;
}
int xs_impl_transaction_start(XenstoreImplState *s, unsigned int dom_id,
- unsigned int tx_id, unsigned int *new_tx)
+ unsigned int *tx_id)
{
- XsTransaction *tx = g_new0(XsTransaction, 1);
+ XsTransaction *tx;
+
+ if (*tx_id != XBT_NULL)
+ return EINVAL;
+
+ tx = g_new0(XsTransaction, 1);
tx->tx_id = ++s->last_tx;
tx->base_tx = s->root_tx;
tx->dom_id = dom_id;
g_hash_table_insert(s->transactions, GINT_TO_POINTER(tx->tx_id), tx);
- *new_tx = tx->tx_id;
+ *tx_id = tx->tx_id;
return 0;
}
int xs_impl_directory(XenstoreImplState *s, unsigned int dom_id,
unsigned int tx_id, const char *path, GList **items);
int xs_impl_transaction_start(XenstoreImplState *s, unsigned int dom_id,
- unsigned int tx_id, unsigned int *new_tx);
+ unsigned int *tx_id);
int xs_impl_transaction_end(XenstoreImplState *s, unsigned int dom_id,
unsigned int tx_id, bool commit);
int xs_impl_rm(XenstoreImplState *s, unsigned int dom_id, unsigned int tx_id,
XenstoreImplState *s = xs_impl_create();
GString *watches = g_string_new(NULL);
GByteArray *data = g_byte_array_new();
- unsigned int tx_id;
+ unsigned int tx_id = XBT_NULL;
int err;
g_assert(s);
g_string_truncate(watches, 0);
/* Create a transaction */
- err = xs_impl_transaction_start(s, DOMID_GUEST, XBT_NULL, &tx_id);
+ err = xs_impl_transaction_start(s, DOMID_GUEST, &tx_id);
g_assert(!err);
if (fail) {
XenstoreImplState *s = xs_impl_create();
GString *watches = g_string_new(NULL);
GByteArray *data = g_byte_array_new();
- unsigned int tx_id;
+ unsigned int tx_id = XBT_NULL;
int err;
g_assert(s);
g_string_truncate(watches, 0);
/* Create a transaction */
- err = xs_impl_transaction_start(s, DOMID_GUEST, XBT_NULL, &tx_id);
+ err = xs_impl_transaction_start(s, DOMID_GUEST, &tx_id);
g_assert(!err);
/* Delete the tree in the transaction */
XenstoreImplState *s = xs_impl_create();
GString *watches = g_string_new(NULL);
GByteArray *data = g_byte_array_new();
- unsigned int tx_id;
+ unsigned int tx_id = XBT_NULL;
int err;
g_assert(s);
g_assert(!err);
/* Create a transaction */
- err = xs_impl_transaction_start(s, DOMID_GUEST, XBT_NULL, &tx_id);
+ err = xs_impl_transaction_start(s, DOMID_GUEST, &tx_id);
g_assert(!err);
/* Delete the tree in the transaction */