diff mbox series

[v3,15/25] tools/xenstore: make data parameter of db_write() const

Message ID 20230724110247.10520-16-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series tools/xenstore: drop TDB | expand

Commit Message

Jürgen Groß July 24, 2023, 11:02 a.m. UTC
db_write() doesn't change the data written to the data base, so the
data parameter can be const.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V3:
- new patch
---
 tools/xenstore/xenstored_core.c | 4 ++--
 tools/xenstore/xenstored_core.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index a08962c3ea..9f88914149 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -611,11 +611,11 @@  static unsigned int get_acc_domid(struct connection *conn, const char *name,
 	return (!conn || name[0] == '/' || name[0] == '@') ? domid : conn->id;
 }
 
-int db_write(struct connection *conn, const char *db_name, void *data,
+int db_write(struct connection *conn, const char *db_name, const void *data,
 	     size_t size, struct node_account_data *acc,
 	     enum write_node_mode mode, bool no_quota_check)
 {
-	struct xs_tdb_record_hdr *hdr = data;
+	const struct xs_tdb_record_hdr *hdr = data;
 	struct node_account_data old_acc = {};
 	unsigned int old_domid, new_domid;
 	size_t name_len = strlen(db_name);
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index e1aeb4aecd..1aa3cc0936 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -363,7 +363,7 @@  int remember_string(struct hashtable *hash, const char *str);
 
 /* Data base access functions. */
 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,
+int db_write(struct connection *conn, const char *db_name, const void *data,
 	     size_t size, struct node_account_data *acc,
 	     enum write_node_mode mode, bool no_quota_check);
 void db_delete(struct connection *conn, const char *name,