From: Matthew Hall <mhall@mhcomputing.net>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] hash: move rte_hash structure to C file and make it internal
Date: Thu, 9 Jul 2015 13:42:17 -0700 [thread overview]
Message-ID: <20150709204217.GA11561@mhcomputing.net> (raw)
In-Reply-To: <20150709081222.GB8408@bricha3-MOBL3>
On Thu, Jul 09, 2015 at 09:12:23AM +0100, Bruce Richardson wrote:
> Thanks for the feedback Matthew. Can you suggest a function prototype for such
> a walk operation that would make it useful for you. While we can keep the
> hash structure public, I'd prefer if we could avoid it, as it makes making changes
> hard due to ABI issues.
>
> /Bruce
Hi Bruce,
I understand about the ABI issues. Hence my suggestion of an iterator if the
structs are opaque. The names could be something like these:
rte_hash_iterate(_safe)
rte_hash_foreach(_safe)
If required due to the implementation, the safe version would be similar to
what's seen in BSD queue.h, where you can do a slower iteration that allows
removing a current entry without corrupting the table or iterator.
Then the function would look something like this:
rte_hash_iterate(rte_hash_t* h, rte_hash_callback_t callback, void* data)
rte_hash_iterate(rte_hash_t* h, rte_hash_callback_t callback, void* data)
rte_hash_iterate(rte_hash_t* h, rte_hash_callback_t callback, void* data)
rte_hash_callback_t would be a typedef of a function pointer for a callback
function, something like this on the function depending how it works inside
the hash:
int application_hash_callback(void* key, void* value, void* data)
int application_hash_callback(void* key, rte_hash_entry_t* entry, void* data)
int application_hash_callback(void* key, void* key, void* value, void* data)
The data pointer will contain the same pointer passed to the iterator. If the
iteration function returns non-zero, iteration could be discontinued, as the
client code found what it wanted already.
Threading synchronization responsibility will fall on the client as before.
The iterator should say if it's thread-safe for read-only, read-write, or
unsafe for anything, etc.
Matthew.
next prev parent reply other threads:[~2015-07-09 20:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 11:27 [PATCH] Make rte_hash struct internal - Cuckoo hash part 1 Pablo de Lara
2015-07-08 11:27 ` [PATCH] hash: move rte_hash structure to C file and make it internal Pablo de Lara
2015-07-08 13:21 ` Bruce Richardson
2015-07-08 16:57 ` Matthew Hall
2015-07-09 8:12 ` Bruce Richardson
2015-07-09 20:42 ` Matthew Hall [this message]
2015-07-10 10:27 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150709204217.GA11561@mhcomputing.net \
--to=mhall@mhcomputing.net \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.