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

Re: [PATCH 07/20] tools/xenstore: enhance hashtable implementation



Hi Juergen,

On 01/11/2022 15:28, Juergen Gross wrote:
Today it is possible to set a flag when calling hashtable_destroy() in
order to specify whether the data associated with the hashtable entries
should be freed or not. The keys of the entries will always be freed.

Change that by replacing the flag of hashtable_destroy() by two flags
for create_hashtable() which will specify whether the data and/or the
key of each entry should be freed or not.

This will enable users to have the key e.g. as part of the data.

Add a new function hashtable_iterate() to call a user specified
function for each entry in the hashtable.

Add new primes to the primetable in order to support smaller sizes of
the hashtable. The primes are selected according to:

https://planetmath.org/goodhashtableprimes

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
  tools/xenstore/hashtable.c      | 66 +++++++++++++++++++++++----------
  tools/xenstore/hashtable.h      | 35 +++++++++++++++--
  tools/xenstore/xenstored_core.c |  7 ++--
  3 files changed, 82 insertions(+), 26 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 6ac336eff1..7a1548c490 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -16,6 +16,7 @@ struct entry
struct hashtable {
      unsigned int tablelength;
+    unsigned int flags;
      struct entry **table;
      unsigned int entrycount;
      unsigned int loadlimit;
@@ -25,12 +26,11 @@ struct hashtable {
  };
/*
-Credit for primes table: Aaron Krowne
- http://br.endernet.org/~akrowne/
- http://planetmath.org/encyclopedia/GoodHashTablePrimes.html
-*/
+ * Credit for primes table: Aaron Krowne
+ * https://planetmath.org/goodhashtableprimes
+ */

You don't seem to explain in the commit message why the URLs have been modified. Other than that:

Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

Cheers,

--
Julien Grall



 


Rackspace

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