[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/11] tools/xenstore: add wrapper for tdb_fetch()



On 20.06.23 15:03, Julien Grall wrote:
Hi Juergen,

One more remark as I was reviewing patch #10.

On 30/05/2023 10:13, Juergen Gross wrote:
Add a wrapper function for tdb_fetch taking the name of the node in
the data base as a parameter. Let it return a data pointer and the
length of the data via a length pointer provided as additional
parameter.

This enables to make set_tdb_key() static again.

This is in preparation to replace TDB with a more simple data storage.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
  tools/xenstore/xenstored_core.c        | 55 ++++++++++++++++----------
  tools/xenstore/xenstored_core.h        |  3 +-
  tools/xenstore/xenstored_transaction.c | 34 ++++++++--------
  3 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 522b2bbf5f..12c584f09b 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -85,7 +85,7 @@ bool keep_orphans = false;
  static int reopen_log_pipe[2];
  static int reopen_log_pipe0_pollfd_idx = -1;
  char *tracefile = NULL;
-TDB_CONTEXT *tdb_ctx = NULL;
+static TDB_CONTEXT *tdb_ctx = NULL;
  unsigned int trace_flags = TRACE_OBJ | TRACE_IO;
  static const char *sockmsg_string(enum xsd_sockmsg_type type);
@@ -556,7 +556,7 @@ static void initialize_fds(int *p_sock_pollfd_idx, int *ptimeout)
      }
  }
-void set_tdb_key(const char *name, TDB_DATA *key)
+static void set_tdb_key(const char *name, TDB_DATA *key)
  {
      /*
       * Dropping const is fine here, as the key will never be modified
@@ -566,25 +566,39 @@ void set_tdb_key(const char *name, TDB_DATA *key)
      key->dsize = strlen(name);
  }
+void *db_fetch(const char *db_name, size_t *size)

Should not this return xs_tdb_record_hdr?

Indeed.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.