tools/xenstore: let db_delete() return void

db_delete() only ever is returning 0. Switch it to return void and
remove all the error handling dealing wit a non-zero return value.

Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
Juergen Gross authored and Julien Grall committed 2023-08-18 13:44:48 +01:00
1 parent 6bc3a1cbdc
commit f39c39ba25
3 files changed
+11 -18

No files matched your search

+4 -7
View File
@@ -677,8 +677,8 @@ int db_write(struct connection *conn, const char *db_name, void *data,
return 0;
}
int db_delete(struct connection *conn, const char *name,
struct node_account_data *acc)
void db_delete(struct connection *conn, const char *name,
struct node_account_data *acc)
{
struct node_account_data tmp_acc;
unsigned int domid;
@@ -698,8 +698,6 @@ int db_delete(struct connection *conn, const char *name,
domain_memory_add_nochk(conn, domid,
-acc->memory - strlen(name));
}
return 0;
}
/*
@@ -1670,9 +1668,8 @@ static int delnode_sub(const void *ctx, struct connection *conn,
if (domain_nbentry_dec(conn, get_node_owner(node)))
return WALK_TREE_ERROR_STOP;
/* In case of error stop the walk. */
if (!ret && db_delete(conn, db_name, &node->acc))
return WALK_TREE_ERROR_STOP;
if (!ret)
db_delete(conn, db_name, &node->acc);
/*
* Fire the watches now, when we can still see the node permissions.
+2 -2
View File
@@ -366,8 +366,8 @@ struct xs_tdb_record_hdr *db_fetch(const char *db_name, size_t *size);
int db_write(struct connection *conn, const char *db_name, void *data,
size_t size, struct node_account_data *acc,
enum write_node_mode mode, bool no_quota_check);
int db_delete(struct connection *conn, const char *name,
struct node_account_data *acc);
void db_delete(struct connection *conn, const char *name,
struct node_account_data *acc);
void conn_free_buffered_data(struct connection *conn);
+5 -9
View File
@@ -377,10 +377,8 @@ static int finalize_transaction(struct connection *conn,
/* Entries for unmodified nodes can be removed early. */
if (!i->modified) {
if (i->ta_node) {
if (db_delete(conn, i->trans_name, NULL))
return EIO;
}
if (i->ta_node)
db_delete(conn, i->trans_name, NULL);
list_del(&i->list);
talloc_free(i);
}
@@ -397,8 +395,7 @@ static int finalize_transaction(struct connection *conn,
? NODE_CREATE : NODE_MODIFY;
*is_corrupt |= db_write(conn, i->node, hdr,
size, NULL, mode, true);
if (db_delete(conn, i->trans_name, NULL))
*is_corrupt = true;
db_delete(conn, i->trans_name, NULL);
} else {
*is_corrupt = true;
}
@@ -408,9 +405,8 @@ static int finalize_transaction(struct connection *conn,
* in this transaction will have no generation
* information stored.
*/
*is_corrupt |= (i->generation == NO_GENERATION)
? false
: db_delete(conn, i->node, NULL);
if (i->generation != NO_GENERATION)
db_delete(conn, i->node, NULL);
}
if (i->fire_watch)
fire_watches(conn, trans, i->node, NULL, i->watch_exact,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.