amdgpu/util_hash: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>main
parent
bf4826430a
commit
5f0f6387a6
|
@ -214,8 +214,8 @@ static struct util_node **util_hash_find_node(struct util_hash *hash, unsigned a
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash_iter util_hash_insert(struct util_hash *hash,
|
drm_private struct util_hash_iter
|
||||||
unsigned key, void *data)
|
util_hash_insert(struct util_hash *hash, unsigned key, void *data)
|
||||||
{
|
{
|
||||||
util_data_might_grow(hash->data.d);
|
util_data_might_grow(hash->data.d);
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ struct util_hash_iter util_hash_insert(struct util_hash *hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash * util_hash_create(void)
|
drm_private struct util_hash *util_hash_create(void)
|
||||||
{
|
{
|
||||||
struct util_hash *hash = malloc(sizeof(struct util_hash));
|
struct util_hash *hash = malloc(sizeof(struct util_hash));
|
||||||
if (!hash)
|
if (!hash)
|
||||||
|
@ -257,7 +257,7 @@ struct util_hash * util_hash_create(void)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_hash_delete(struct util_hash *hash)
|
drm_private void util_hash_delete(struct util_hash *hash)
|
||||||
{
|
{
|
||||||
struct util_node *e_for_x = (struct util_node *)(hash->data.d);
|
struct util_node *e_for_x = (struct util_node *)(hash->data.d);
|
||||||
struct util_node **bucket = (struct util_node **)(hash->data.d->buckets);
|
struct util_node **bucket = (struct util_node **)(hash->data.d->buckets);
|
||||||
|
@ -275,22 +275,22 @@ void util_hash_delete(struct util_hash *hash)
|
||||||
free(hash);
|
free(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash_iter util_hash_find(struct util_hash *hash,
|
drm_private struct util_hash_iter
|
||||||
unsigned key)
|
util_hash_find(struct util_hash *hash, unsigned key)
|
||||||
{
|
{
|
||||||
struct util_node **nextNode = util_hash_find_node(hash, key);
|
struct util_node **nextNode = util_hash_find_node(hash, key);
|
||||||
struct util_hash_iter iter = {hash, *nextNode};
|
struct util_hash_iter iter = {hash, *nextNode};
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned util_hash_iter_key(struct util_hash_iter iter)
|
drm_private unsigned util_hash_iter_key(struct util_hash_iter iter)
|
||||||
{
|
{
|
||||||
if (!iter.node || iter.hash->data.e == iter.node)
|
if (!iter.node || iter.hash->data.e == iter.node)
|
||||||
return 0;
|
return 0;
|
||||||
return iter.node->key;
|
return iter.node->key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * util_hash_iter_data(struct util_hash_iter iter)
|
drm_private void *util_hash_iter_data(struct util_hash_iter iter)
|
||||||
{
|
{
|
||||||
if (!iter.node || iter.hash->data.e == iter.node)
|
if (!iter.node || iter.hash->data.e == iter.node)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -327,21 +327,21 @@ static struct util_node *util_hash_data_next(struct util_node *node)
|
||||||
return a.e;
|
return a.e;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash_iter util_hash_iter_next(struct util_hash_iter iter)
|
drm_private struct util_hash_iter
|
||||||
|
util_hash_iter_next(struct util_hash_iter iter)
|
||||||
{
|
{
|
||||||
struct util_hash_iter next = {iter.hash, util_hash_data_next(iter.node)};
|
struct util_hash_iter next = {iter.hash, util_hash_data_next(iter.node)};
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
int util_hash_iter_is_null(struct util_hash_iter iter)
|
drm_private int util_hash_iter_is_null(struct util_hash_iter iter)
|
||||||
{
|
{
|
||||||
if (!iter.node || iter.node == iter.hash->data.e)
|
if (!iter.node || iter.node == iter.hash->data.e)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * util_hash_take(struct util_hash *hash,
|
drm_private void *util_hash_take(struct util_hash *hash, unsigned akey)
|
||||||
unsigned akey)
|
|
||||||
{
|
{
|
||||||
struct util_node **node = util_hash_find_node(hash, akey);
|
struct util_node **node = util_hash_find_node(hash, akey);
|
||||||
if (*node != hash->data.e) {
|
if (*node != hash->data.e) {
|
||||||
|
@ -356,13 +356,14 @@ void * util_hash_take(struct util_hash *hash,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash_iter util_hash_first_node(struct util_hash *hash)
|
drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash)
|
||||||
{
|
{
|
||||||
struct util_hash_iter iter = {hash, util_data_first_node(hash->data.d)};
|
struct util_hash_iter iter = {hash, util_data_first_node(hash->data.d)};
|
||||||
return iter;
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct util_hash_iter util_hash_erase(struct util_hash *hash, struct util_hash_iter iter)
|
drm_private struct util_hash_iter
|
||||||
|
util_hash_erase(struct util_hash *hash, struct util_hash_iter iter)
|
||||||
{
|
{
|
||||||
struct util_hash_iter ret = iter;
|
struct util_hash_iter ret = iter;
|
||||||
struct util_node *node = iter.node;
|
struct util_node *node = iter.node;
|
||||||
|
|
|
@ -44,8 +44,14 @@
|
||||||
#ifndef UTIL_HASH_H
|
#ifndef UTIL_HASH_H
|
||||||
#define UTIL_HASH_H
|
#define UTIL_HASH_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "libdrm_macros.h"
|
||||||
|
|
||||||
struct util_hash;
|
struct util_hash;
|
||||||
struct util_node;
|
struct util_node;
|
||||||
|
|
||||||
|
@ -55,8 +61,8 @@ struct util_hash_iter {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct util_hash *util_hash_create(void);
|
drm_private struct util_hash *util_hash_create(void);
|
||||||
void util_hash_delete(struct util_hash *hash);
|
drm_private void util_hash_delete(struct util_hash *hash);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,8 +71,8 @@ void util_hash_delete(struct util_hash *hash);
|
||||||
* in the collision list.
|
* in the collision list.
|
||||||
* Function returns iterator pointing to the inserted item in the hash.
|
* Function returns iterator pointing to the inserted item in the hash.
|
||||||
*/
|
*/
|
||||||
struct util_hash_iter util_hash_insert(struct util_hash *hash, unsigned key,
|
drm_private struct util_hash_iter
|
||||||
void *data);
|
util_hash_insert(struct util_hash *hash, unsigned key, void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the item pointed to by the current iterator from the hash.
|
* Removes the item pointed to by the current iterator from the hash.
|
||||||
|
@ -75,25 +81,27 @@ struct util_hash_iter util_hash_insert(struct util_hash *hash, unsigned key,
|
||||||
* Function returns iterator pointing to the item after the removed one in
|
* Function returns iterator pointing to the item after the removed one in
|
||||||
* the hash.
|
* the hash.
|
||||||
*/
|
*/
|
||||||
struct util_hash_iter util_hash_erase(struct util_hash *hash,
|
drm_private struct util_hash_iter
|
||||||
struct util_hash_iter iter);
|
util_hash_erase(struct util_hash *hash, struct util_hash_iter iter);
|
||||||
|
|
||||||
void *util_hash_take(struct util_hash *hash, unsigned key);
|
drm_private void *util_hash_take(struct util_hash *hash, unsigned key);
|
||||||
|
|
||||||
|
|
||||||
struct util_hash_iter util_hash_first_node(struct util_hash *hash);
|
drm_private struct util_hash_iter util_hash_first_node(struct util_hash *hash);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an iterator pointing to the first entry in the collision list.
|
* Return an iterator pointing to the first entry in the collision list.
|
||||||
*/
|
*/
|
||||||
struct util_hash_iter util_hash_find(struct util_hash *hash, unsigned key);
|
drm_private struct util_hash_iter
|
||||||
|
util_hash_find(struct util_hash *hash, unsigned key);
|
||||||
|
|
||||||
|
|
||||||
int util_hash_iter_is_null(struct util_hash_iter iter);
|
drm_private int util_hash_iter_is_null(struct util_hash_iter iter);
|
||||||
unsigned util_hash_iter_key(struct util_hash_iter iter);
|
drm_private unsigned util_hash_iter_key(struct util_hash_iter iter);
|
||||||
void *util_hash_iter_data(struct util_hash_iter iter);
|
drm_private void *util_hash_iter_data(struct util_hash_iter iter);
|
||||||
|
|
||||||
|
|
||||||
struct util_hash_iter util_hash_iter_next(struct util_hash_iter iter);
|
drm_private struct util_hash_iter
|
||||||
|
util_hash_iter_next(struct util_hash_iter iter);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue