1 /* 2 Transaction code for Xen Store Daemon. 3 Copyright (C) 2005 Rusty Russell IBM Corporation 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; If not, see <http://www.gnu.org/licenses/>. 17 */ 18 #ifndef _XENSTORED_TRANSACTION_H 19 #define _XENSTORED_TRANSACTION_H 20 #include "xenstored_core.h" 21 22 enum node_access_type { 23 NODE_ACCESS_READ, 24 NODE_ACCESS_WRITE, 25 NODE_ACCESS_DELETE 26 }; 27 28 struct transaction; 29 30 extern uint64_t generation; 31 32 int do_transaction_start(struct connection *conn, struct buffered_data *node); 33 int do_transaction_end(struct connection *conn, struct buffered_data *in); 34 35 struct transaction *transaction_lookup(struct connection *conn, uint32_t id); 36 37 /* inc/dec entry number local to trans while changing a node */ 38 void transaction_entry_inc(struct transaction *trans, unsigned int domid); 39 void transaction_entry_dec(struct transaction *trans, unsigned int domid); 40 41 /* This node was accessed. */ 42 int access_node(struct connection *conn, struct node *node, 43 enum node_access_type type, TDB_DATA *key); 44 45 /* Prepend the transaction to name if appropriate. */ 46 int transaction_prepend(struct connection *conn, const char *name, 47 TDB_DATA *key); 48 49 void conn_delete_all_transactions(struct connection *conn); 50 int check_transactions(struct hashtable *hash); 51 52 #endif /* _XENSTORED_TRANSACTION_H */ 53