Patchwork [1/3] export tdb_hash()

login
register
mail settings
Submitter Prerna Saxena
Date June 8, 2010, 7:01 a.m.
Message ID <20100608123138.353f46f3@zephyr>
Download mbox | patch
Permalink /patch/54938/
State New
Headers show

Comments

Prerna Saxena - June 8, 2010, 7:01 a.m.
This exports tdb_hash() for use by tracing framework.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
 qdict.c |    2 +-
 qdict.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
Luiz Capitulino - June 9, 2010, 8:35 p.m.
On Tue, 8 Jun 2010 12:31:38 +0530
Prerna Saxena <prerna@linux.vnet.ibm.com> wrote:

> This exports tdb_hash() for use by tracing framework.

 Suggest to rename it (eg. qemu_hash()) and move it to a better location, qdict
is not the best module to export such service.

> 
> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
> ---
>  qdict.c |    2 +-
>  qdict.h |    2 ++
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/qdict.c b/qdict.c
> index 175bc17..5261872 100644
> --- a/qdict.c
> +++ b/qdict.c
> @@ -56,7 +56,7 @@ QDict *qobject_to_qdict(const QObject *obj)
>   * tdb_hash(): based on the hash agorithm from gdbm, via tdb
>   * (from module-init-tools)
>   */
> -static unsigned int tdb_hash(const char *name)
> +unsigned int tdb_hash(const char *name)
>  {
>      unsigned value;	/* Used to compute the hash value.  */
>      unsigned   i;	/* Used to cycle through random values. */
> diff --git a/qdict.h b/qdict.h
> index 5e5902c..d221c18 100644
> --- a/qdict.h
> +++ b/qdict.h
> @@ -59,4 +59,6 @@ int64_t qdict_get_try_int(const QDict *qdict, const char *key,
>                            int64_t err_value);
>  const char *qdict_get_try_str(const QDict *qdict, const char *key);
>  
> +/* Export tdb_hash() for use by trace framework */
> +unsigned int tdb_hash(const char *name);
>  #endif /* QDICT_H */
Prerna Saxena - June 11, 2010, 10:32 a.m.
On 06/10/2010 02:05 AM, Luiz Capitulino wrote:
> On Tue, 8 Jun 2010 12:31:38 +0530
> Prerna Saxena<prerna@linux.vnet.ibm.com>  wrote:
>
>> This exports tdb_hash() for use by tracing framework.
>
>   Suggest to rename it (eg. qemu_hash()) and move it to a better location, qdict
> is not the best module to export such service.
>

Would 'qemu-common.h' be a good place to export it ? If not, any 
suggestions on where else I can export it ?
I havent renamed it in v2 of patches that I sent out. I'll send out a 
cumulative patch that renames and exports tdb_hash() from an appropriate 
location.

Regards,

Patch

diff --git a/qdict.c b/qdict.c
index 175bc17..5261872 100644
--- a/qdict.c
+++ b/qdict.c
@@ -56,7 +56,7 @@  QDict *qobject_to_qdict(const QObject *obj)
  * tdb_hash(): based on the hash agorithm from gdbm, via tdb
  * (from module-init-tools)
  */
-static unsigned int tdb_hash(const char *name)
+unsigned int tdb_hash(const char *name)
 {
     unsigned value;	/* Used to compute the hash value.  */
     unsigned   i;	/* Used to cycle through random values. */
diff --git a/qdict.h b/qdict.h
index 5e5902c..d221c18 100644
--- a/qdict.h
+++ b/qdict.h
@@ -59,4 +59,6 @@  int64_t qdict_get_try_int(const QDict *qdict, const char *key,
                           int64_t err_value);
 const char *qdict_get_try_str(const QDict *qdict, const char *key);
 
+/* Export tdb_hash() for use by trace framework */
+unsigned int tdb_hash(const char *name);
 #endif /* QDICT_H */