diff mbox series

libselinux: rename hashtab functions

Message ID 20240826041044.1753994-1-tweek@google.com (mailing list archive)
State Accepted
Commit b41174207ce5
Delegated to: Petr Lautrbach
Headers show
Series libselinux: rename hashtab functions | expand

Commit Message

Thiébaud Weksteen Aug. 26, 2024, 4:10 a.m. UTC
In commit d95bc8b75539 ("libselinux: migrating hashtab from
policycoreutils") and commit 4a420508a98c ("libselinux: adapting hashtab
to libselinux"), the hashtab implementation was copied to libselinux.
Since the same functions exist in libsepol (e.g., hashtab_create,
hashtab_destroy, etc), a compilation error is raised when both libraries
are included statically.

Prefix the libselinux internal implementation with "selinux_".

Signed-off-by: Thiébaud Weksteen <tweek@google.com>
---
 libselinux/src/hashtab.c    | 16 ++++++++--------
 libselinux/src/hashtab.h    | 16 ++++++++--------
 libselinux/src/label_file.c | 10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)

Comments

James Carter Aug. 30, 2024, 3:12 p.m. UTC | #1
On Mon, Aug 26, 2024 at 12:11 AM Thiébaud Weksteen <tweek@google.com> wrote:
>
> In commit d95bc8b75539 ("libselinux: migrating hashtab from
> policycoreutils") and commit 4a420508a98c ("libselinux: adapting hashtab
> to libselinux"), the hashtab implementation was copied to libselinux.
> Since the same functions exist in libsepol (e.g., hashtab_create,
> hashtab_destroy, etc), a compilation error is raised when both libraries
> are included statically.
>
> Prefix the libselinux internal implementation with "selinux_".
>
> Signed-off-by: Thiébaud Weksteen <tweek@google.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libselinux/src/hashtab.c    | 16 ++++++++--------
>  libselinux/src/hashtab.h    | 16 ++++++++--------
>  libselinux/src/label_file.c | 10 +++++-----
>  3 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/libselinux/src/hashtab.c b/libselinux/src/hashtab.c
> index 7452613b..0c6641ed 100644
> --- a/libselinux/src/hashtab.c
> +++ b/libselinux/src/hashtab.c
> @@ -11,7 +11,7 @@
>  #include <string.h>
>  #include "hashtab.h"
>
> -hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> +hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
>                                                      const_hashtab_key_t key),
>                          int (*keycmp) (hashtab_t h,
>                                         const_hashtab_key_t key1,
> @@ -42,7 +42,7 @@ hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
>         return p;
>  }
>
> -int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
> +int selinux_hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
>  {
>         unsigned int hvalue;
>         hashtab_ptr_t prev, cur, newnode;
> @@ -79,7 +79,7 @@ int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
>         return HASHTAB_SUCCESS;
>  }
>
> -int hashtab_remove(hashtab_t h, hashtab_key_t key,
> +int selinux_hashtab_remove(hashtab_t h, hashtab_key_t key,
>                    void (*destroy) (hashtab_key_t k,
>                                     hashtab_datum_t d, void *args), void *args)
>  {
> @@ -112,7 +112,7 @@ int hashtab_remove(hashtab_t h, hashtab_key_t key,
>         return HASHTAB_SUCCESS;
>  }
>
> -hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
> +hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t key)
>  {
>
>         unsigned int hvalue;
> @@ -132,7 +132,7 @@ hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
>         return cur->datum;
>  }
>
> -void hashtab_destroy(hashtab_t h)
> +void selinux_hashtab_destroy(hashtab_t h)
>  {
>         unsigned int i;
>         hashtab_ptr_t cur, temp;
> @@ -156,7 +156,7 @@ void hashtab_destroy(hashtab_t h)
>         free(h);
>  }
>
> -void hashtab_destroy_key(hashtab_t h,
> +void selinux_hashtab_destroy_key(hashtab_t h,
>                 int (*destroy_key) (hashtab_key_t k))
>  {
>         unsigned int i;
> @@ -182,7 +182,7 @@ void hashtab_destroy_key(hashtab_t h,
>         free(h);
>  }
>
> -int hashtab_map(hashtab_t h,
> +int selinux_hashtab_map(hashtab_t h,
>                 int (*apply) (hashtab_key_t k,
>                               hashtab_datum_t d, void *args), void *args)
>  {
> @@ -205,7 +205,7 @@ int hashtab_map(hashtab_t h,
>         return HASHTAB_SUCCESS;
>  }
>
> -void hashtab_hash_eval(hashtab_t h, char *tag)
> +void selinux_hashtab_hash_eval(hashtab_t h, char *tag)
>  {
>         unsigned int i;
>         int chain_len, slots_used, max_chain_len;
> diff --git a/libselinux/src/hashtab.h b/libselinux/src/hashtab.h
> index f10fc0af..6fbf5fb4 100644
> --- a/libselinux/src/hashtab.h
> +++ b/libselinux/src/hashtab.h
> @@ -52,7 +52,7 @@ typedef hashtab_val_t *hashtab_t;
>     Returns NULL if insufficient space is available or
>     the new hash table otherwise.
>   */
> -extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> +extern hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
>                                                             const_hashtab_key_t
>                                                             key),
>                                 int (*keycmp) (hashtab_t h,
> @@ -66,7 +66,7 @@ extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
>     HASHTAB_PRESENT  if there is already an entry with the same key or
>     HASHTAB_SUCCESS otherwise.
>   */
> -extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
> +extern int selinux_hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
>
>  /*
>     Removes the entry with the specified key from the hash table.
> @@ -76,7 +76,7 @@ extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
>     Returns HASHTAB_MISSING if no entry has the specified key or
>     HASHTAB_SUCCESS otherwise.
>   */
> -extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
> +extern int selinux_hashtab_remove(hashtab_t h, hashtab_key_t k,
>                           void (*destroy) (hashtab_key_t k,
>                                            hashtab_datum_t d,
>                                            void *args), void *args);
> @@ -87,13 +87,13 @@ extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
>     Returns NULL if no entry has the specified key or
>     the datum of the entry otherwise.
>   */
> -extern hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t k);
> +extern hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t k);
>
>  /*
>     Destroys the specified hash table.
>   */
> -extern void hashtab_destroy(hashtab_t h);
> -extern void hashtab_destroy_key(hashtab_t h,
> +extern void selinux_hashtab_destroy(hashtab_t h);
> +extern void selinux_hashtab_destroy_key(hashtab_t h,
>                         int (*destroy_key) (hashtab_key_t k));
>
>  /*
> @@ -107,11 +107,11 @@ extern void hashtab_destroy_key(hashtab_t h,
>     iterating through the hash table and will propagate the error
>     return to its caller.
>   */
> -extern int hashtab_map(hashtab_t h,
> +extern int selinux_hashtab_map(hashtab_t h,
>                        int (*apply) (hashtab_key_t k,
>                                      hashtab_datum_t d,
>                                      void *args), void *args);
>
> -extern void hashtab_hash_eval(hashtab_t h, char *tag);
> +extern void selinux_hashtab_hash_eval(hashtab_t h, char *tag);
>
>  #endif
> diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> index 59c9f2ef..2fad0c93 100644
> --- a/libselinux/src/label_file.c
> +++ b/libselinux/src/label_file.c
> @@ -111,7 +111,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
>         struct chkdups_key *new = NULL;
>         unsigned int hashtab_len = (data->nspec / SHRINK_MULTIS) ? data->nspec / SHRINK_MULTIS : 1;
>
> -       hashtab_t hash_table = hashtab_create(symhash, symcmp, hashtab_len);
> +       hashtab_t hash_table = selinux_hashtab_create(symhash, symcmp, hashtab_len);
>         if (!hash_table) {
>                 rc = -1;
>                 COMPAT_LOG(SELINUX_ERROR, "%s: hashtab create failed.\n", path);
> @@ -121,18 +121,18 @@ static int nodups_specs(struct saved_data *data, const char *path)
>                 new = (struct chkdups_key *)malloc(sizeof(struct chkdups_key));
>                 if (!new) {
>                         rc = -1;
> -                       hashtab_destroy_key(hash_table, destroy_chkdups_key);
> +                       selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
>                         COMPAT_LOG(SELINUX_ERROR, "%s: hashtab key create failed.\n", path);
>                         return rc;
>                 }
>                 new->regex = spec_arr[ii].regex_str;
>                 new->mode = spec_arr[ii].mode;
> -               ret = hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
> +               ret = selinux_hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
>                 if (ret == HASHTAB_SUCCESS)
>                         continue;
>                 if (ret == HASHTAB_PRESENT) {
>                         curr_spec =
> -                               (struct spec *)hashtab_search(hash_table, (hashtab_key_t)new);
> +                               (struct spec *)selinux_hashtab_search(hash_table, (hashtab_key_t)new);
>                         rc = -1;
>                         errno = EINVAL;
>                         free(new);
> @@ -161,7 +161,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
>                 }
>         }
>
> -       hashtab_destroy_key(hash_table, destroy_chkdups_key);
> +       selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
>
>         return rc;
>  }
> --
> 2.46.0.295.g3b9ea8a38a-goog
>
James Carter Sept. 5, 2024, 7:04 p.m. UTC | #2
On Fri, Aug 30, 2024 at 11:12 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Aug 26, 2024 at 12:11 AM Thiébaud Weksteen <tweek@google.com> wrote:
> >
> > In commit d95bc8b75539 ("libselinux: migrating hashtab from
> > policycoreutils") and commit 4a420508a98c ("libselinux: adapting hashtab
> > to libselinux"), the hashtab implementation was copied to libselinux.
> > Since the same functions exist in libsepol (e.g., hashtab_create,
> > hashtab_destroy, etc), a compilation error is raised when both libraries
> > are included statically.
> >
> > Prefix the libselinux internal implementation with "selinux_".
> >
> > Signed-off-by: Thiébaud Weksteen <tweek@google.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Jim

> > ---
> >  libselinux/src/hashtab.c    | 16 ++++++++--------
> >  libselinux/src/hashtab.h    | 16 ++++++++--------
> >  libselinux/src/label_file.c | 10 +++++-----
> >  3 files changed, 21 insertions(+), 21 deletions(-)
> >
> > diff --git a/libselinux/src/hashtab.c b/libselinux/src/hashtab.c
> > index 7452613b..0c6641ed 100644
> > --- a/libselinux/src/hashtab.c
> > +++ b/libselinux/src/hashtab.c
> > @@ -11,7 +11,7 @@
> >  #include <string.h>
> >  #include "hashtab.h"
> >
> > -hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> > +hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> >                                                      const_hashtab_key_t key),
> >                          int (*keycmp) (hashtab_t h,
> >                                         const_hashtab_key_t key1,
> > @@ -42,7 +42,7 @@ hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> >         return p;
> >  }
> >
> > -int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
> > +int selinux_hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
> >  {
> >         unsigned int hvalue;
> >         hashtab_ptr_t prev, cur, newnode;
> > @@ -79,7 +79,7 @@ int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
> >         return HASHTAB_SUCCESS;
> >  }
> >
> > -int hashtab_remove(hashtab_t h, hashtab_key_t key,
> > +int selinux_hashtab_remove(hashtab_t h, hashtab_key_t key,
> >                    void (*destroy) (hashtab_key_t k,
> >                                     hashtab_datum_t d, void *args), void *args)
> >  {
> > @@ -112,7 +112,7 @@ int hashtab_remove(hashtab_t h, hashtab_key_t key,
> >         return HASHTAB_SUCCESS;
> >  }
> >
> > -hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
> > +hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t key)
> >  {
> >
> >         unsigned int hvalue;
> > @@ -132,7 +132,7 @@ hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
> >         return cur->datum;
> >  }
> >
> > -void hashtab_destroy(hashtab_t h)
> > +void selinux_hashtab_destroy(hashtab_t h)
> >  {
> >         unsigned int i;
> >         hashtab_ptr_t cur, temp;
> > @@ -156,7 +156,7 @@ void hashtab_destroy(hashtab_t h)
> >         free(h);
> >  }
> >
> > -void hashtab_destroy_key(hashtab_t h,
> > +void selinux_hashtab_destroy_key(hashtab_t h,
> >                 int (*destroy_key) (hashtab_key_t k))
> >  {
> >         unsigned int i;
> > @@ -182,7 +182,7 @@ void hashtab_destroy_key(hashtab_t h,
> >         free(h);
> >  }
> >
> > -int hashtab_map(hashtab_t h,
> > +int selinux_hashtab_map(hashtab_t h,
> >                 int (*apply) (hashtab_key_t k,
> >                               hashtab_datum_t d, void *args), void *args)
> >  {
> > @@ -205,7 +205,7 @@ int hashtab_map(hashtab_t h,
> >         return HASHTAB_SUCCESS;
> >  }
> >
> > -void hashtab_hash_eval(hashtab_t h, char *tag)
> > +void selinux_hashtab_hash_eval(hashtab_t h, char *tag)
> >  {
> >         unsigned int i;
> >         int chain_len, slots_used, max_chain_len;
> > diff --git a/libselinux/src/hashtab.h b/libselinux/src/hashtab.h
> > index f10fc0af..6fbf5fb4 100644
> > --- a/libselinux/src/hashtab.h
> > +++ b/libselinux/src/hashtab.h
> > @@ -52,7 +52,7 @@ typedef hashtab_val_t *hashtab_t;
> >     Returns NULL if insufficient space is available or
> >     the new hash table otherwise.
> >   */
> > -extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> > +extern hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> >                                                             const_hashtab_key_t
> >                                                             key),
> >                                 int (*keycmp) (hashtab_t h,
> > @@ -66,7 +66,7 @@ extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
> >     HASHTAB_PRESENT  if there is already an entry with the same key or
> >     HASHTAB_SUCCESS otherwise.
> >   */
> > -extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
> > +extern int selinux_hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
> >
> >  /*
> >     Removes the entry with the specified key from the hash table.
> > @@ -76,7 +76,7 @@ extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
> >     Returns HASHTAB_MISSING if no entry has the specified key or
> >     HASHTAB_SUCCESS otherwise.
> >   */
> > -extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
> > +extern int selinux_hashtab_remove(hashtab_t h, hashtab_key_t k,
> >                           void (*destroy) (hashtab_key_t k,
> >                                            hashtab_datum_t d,
> >                                            void *args), void *args);
> > @@ -87,13 +87,13 @@ extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
> >     Returns NULL if no entry has the specified key or
> >     the datum of the entry otherwise.
> >   */
> > -extern hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t k);
> > +extern hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t k);
> >
> >  /*
> >     Destroys the specified hash table.
> >   */
> > -extern void hashtab_destroy(hashtab_t h);
> > -extern void hashtab_destroy_key(hashtab_t h,
> > +extern void selinux_hashtab_destroy(hashtab_t h);
> > +extern void selinux_hashtab_destroy_key(hashtab_t h,
> >                         int (*destroy_key) (hashtab_key_t k));
> >
> >  /*
> > @@ -107,11 +107,11 @@ extern void hashtab_destroy_key(hashtab_t h,
> >     iterating through the hash table and will propagate the error
> >     return to its caller.
> >   */
> > -extern int hashtab_map(hashtab_t h,
> > +extern int selinux_hashtab_map(hashtab_t h,
> >                        int (*apply) (hashtab_key_t k,
> >                                      hashtab_datum_t d,
> >                                      void *args), void *args);
> >
> > -extern void hashtab_hash_eval(hashtab_t h, char *tag);
> > +extern void selinux_hashtab_hash_eval(hashtab_t h, char *tag);
> >
> >  #endif
> > diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> > index 59c9f2ef..2fad0c93 100644
> > --- a/libselinux/src/label_file.c
> > +++ b/libselinux/src/label_file.c
> > @@ -111,7 +111,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
> >         struct chkdups_key *new = NULL;
> >         unsigned int hashtab_len = (data->nspec / SHRINK_MULTIS) ? data->nspec / SHRINK_MULTIS : 1;
> >
> > -       hashtab_t hash_table = hashtab_create(symhash, symcmp, hashtab_len);
> > +       hashtab_t hash_table = selinux_hashtab_create(symhash, symcmp, hashtab_len);
> >         if (!hash_table) {
> >                 rc = -1;
> >                 COMPAT_LOG(SELINUX_ERROR, "%s: hashtab create failed.\n", path);
> > @@ -121,18 +121,18 @@ static int nodups_specs(struct saved_data *data, const char *path)
> >                 new = (struct chkdups_key *)malloc(sizeof(struct chkdups_key));
> >                 if (!new) {
> >                         rc = -1;
> > -                       hashtab_destroy_key(hash_table, destroy_chkdups_key);
> > +                       selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
> >                         COMPAT_LOG(SELINUX_ERROR, "%s: hashtab key create failed.\n", path);
> >                         return rc;
> >                 }
> >                 new->regex = spec_arr[ii].regex_str;
> >                 new->mode = spec_arr[ii].mode;
> > -               ret = hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
> > +               ret = selinux_hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
> >                 if (ret == HASHTAB_SUCCESS)
> >                         continue;
> >                 if (ret == HASHTAB_PRESENT) {
> >                         curr_spec =
> > -                               (struct spec *)hashtab_search(hash_table, (hashtab_key_t)new);
> > +                               (struct spec *)selinux_hashtab_search(hash_table, (hashtab_key_t)new);
> >                         rc = -1;
> >                         errno = EINVAL;
> >                         free(new);
> > @@ -161,7 +161,7 @@ static int nodups_specs(struct saved_data *data, const char *path)
> >                 }
> >         }
> >
> > -       hashtab_destroy_key(hash_table, destroy_chkdups_key);
> > +       selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
> >
> >         return rc;
> >  }
> > --
> > 2.46.0.295.g3b9ea8a38a-goog
> >
diff mbox series

Patch

diff --git a/libselinux/src/hashtab.c b/libselinux/src/hashtab.c
index 7452613b..0c6641ed 100644
--- a/libselinux/src/hashtab.c
+++ b/libselinux/src/hashtab.c
@@ -11,7 +11,7 @@ 
 #include <string.h>
 #include "hashtab.h"
 
-hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
+hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
 						     const_hashtab_key_t key),
 			 int (*keycmp) (hashtab_t h,
 					const_hashtab_key_t key1,
@@ -42,7 +42,7 @@  hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
 	return p;
 }
 
-int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
+int selinux_hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
 {
 	unsigned int hvalue;
 	hashtab_ptr_t prev, cur, newnode;
@@ -79,7 +79,7 @@  int hashtab_insert(hashtab_t h, hashtab_key_t key, hashtab_datum_t datum)
 	return HASHTAB_SUCCESS;
 }
 
-int hashtab_remove(hashtab_t h, hashtab_key_t key,
+int selinux_hashtab_remove(hashtab_t h, hashtab_key_t key,
 		   void (*destroy) (hashtab_key_t k,
 				    hashtab_datum_t d, void *args), void *args)
 {
@@ -112,7 +112,7 @@  int hashtab_remove(hashtab_t h, hashtab_key_t key,
 	return HASHTAB_SUCCESS;
 }
 
-hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
+hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t key)
 {
 
 	unsigned int hvalue;
@@ -132,7 +132,7 @@  hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t key)
 	return cur->datum;
 }
 
-void hashtab_destroy(hashtab_t h)
+void selinux_hashtab_destroy(hashtab_t h)
 {
 	unsigned int i;
 	hashtab_ptr_t cur, temp;
@@ -156,7 +156,7 @@  void hashtab_destroy(hashtab_t h)
 	free(h);
 }
 
-void hashtab_destroy_key(hashtab_t h,
+void selinux_hashtab_destroy_key(hashtab_t h,
 		int (*destroy_key) (hashtab_key_t k))
 {
 	unsigned int i;
@@ -182,7 +182,7 @@  void hashtab_destroy_key(hashtab_t h,
 	free(h);
 }
 
-int hashtab_map(hashtab_t h,
+int selinux_hashtab_map(hashtab_t h,
 		int (*apply) (hashtab_key_t k,
 			      hashtab_datum_t d, void *args), void *args)
 {
@@ -205,7 +205,7 @@  int hashtab_map(hashtab_t h,
 	return HASHTAB_SUCCESS;
 }
 
-void hashtab_hash_eval(hashtab_t h, char *tag)
+void selinux_hashtab_hash_eval(hashtab_t h, char *tag)
 {
 	unsigned int i;
 	int chain_len, slots_used, max_chain_len;
diff --git a/libselinux/src/hashtab.h b/libselinux/src/hashtab.h
index f10fc0af..6fbf5fb4 100644
--- a/libselinux/src/hashtab.h
+++ b/libselinux/src/hashtab.h
@@ -52,7 +52,7 @@  typedef hashtab_val_t *hashtab_t;
    Returns NULL if insufficient space is available or
    the new hash table otherwise.
  */
-extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
+extern hashtab_t selinux_hashtab_create(unsigned int (*hash_value) (hashtab_t h,
 							    const_hashtab_key_t
 							    key),
 				int (*keycmp) (hashtab_t h,
@@ -66,7 +66,7 @@  extern hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
    HASHTAB_PRESENT  if there is already an entry with the same key or
    HASHTAB_SUCCESS otherwise.
  */
-extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
+extern int selinux_hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
 
 /*
    Removes the entry with the specified key from the hash table.
@@ -76,7 +76,7 @@  extern int hashtab_insert(hashtab_t h, hashtab_key_t k, hashtab_datum_t d);
    Returns HASHTAB_MISSING if no entry has the specified key or
    HASHTAB_SUCCESS otherwise.
  */
-extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
+extern int selinux_hashtab_remove(hashtab_t h, hashtab_key_t k,
 			  void (*destroy) (hashtab_key_t k,
 					   hashtab_datum_t d,
 					   void *args), void *args);
@@ -87,13 +87,13 @@  extern int hashtab_remove(hashtab_t h, hashtab_key_t k,
    Returns NULL if no entry has the specified key or
    the datum of the entry otherwise.
  */
-extern hashtab_datum_t hashtab_search(hashtab_t h, const_hashtab_key_t k);
+extern hashtab_datum_t selinux_hashtab_search(hashtab_t h, const_hashtab_key_t k);
 
 /*
    Destroys the specified hash table.
  */
-extern void hashtab_destroy(hashtab_t h);
-extern void hashtab_destroy_key(hashtab_t h,
+extern void selinux_hashtab_destroy(hashtab_t h);
+extern void selinux_hashtab_destroy_key(hashtab_t h,
 			int (*destroy_key) (hashtab_key_t k));
 
 /*
@@ -107,11 +107,11 @@  extern void hashtab_destroy_key(hashtab_t h,
    iterating through the hash table and will propagate the error
    return to its caller.
  */
-extern int hashtab_map(hashtab_t h,
+extern int selinux_hashtab_map(hashtab_t h,
 		       int (*apply) (hashtab_key_t k,
 				     hashtab_datum_t d,
 				     void *args), void *args);
 
-extern void hashtab_hash_eval(hashtab_t h, char *tag);
+extern void selinux_hashtab_hash_eval(hashtab_t h, char *tag);
 
 #endif
diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
index 59c9f2ef..2fad0c93 100644
--- a/libselinux/src/label_file.c
+++ b/libselinux/src/label_file.c
@@ -111,7 +111,7 @@  static int nodups_specs(struct saved_data *data, const char *path)
 	struct chkdups_key *new = NULL;
 	unsigned int hashtab_len = (data->nspec / SHRINK_MULTIS) ? data->nspec / SHRINK_MULTIS : 1;
 
-	hashtab_t hash_table = hashtab_create(symhash, symcmp, hashtab_len);
+	hashtab_t hash_table = selinux_hashtab_create(symhash, symcmp, hashtab_len);
 	if (!hash_table) {
 		rc = -1;
 		COMPAT_LOG(SELINUX_ERROR, "%s: hashtab create failed.\n", path);
@@ -121,18 +121,18 @@  static int nodups_specs(struct saved_data *data, const char *path)
 		new = (struct chkdups_key *)malloc(sizeof(struct chkdups_key));
 		if (!new) {
 			rc = -1;
-			hashtab_destroy_key(hash_table, destroy_chkdups_key);
+			selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
 			COMPAT_LOG(SELINUX_ERROR, "%s: hashtab key create failed.\n", path);
 			return rc;
 		}
 		new->regex = spec_arr[ii].regex_str;
 		new->mode = spec_arr[ii].mode;
-		ret = hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
+		ret = selinux_hashtab_insert(hash_table, (hashtab_key_t)new, &spec_arr[ii]);
 		if (ret == HASHTAB_SUCCESS)
 			continue;
 		if (ret == HASHTAB_PRESENT) {
 			curr_spec =
-				(struct spec *)hashtab_search(hash_table, (hashtab_key_t)new);
+				(struct spec *)selinux_hashtab_search(hash_table, (hashtab_key_t)new);
 			rc = -1;
 			errno = EINVAL;
 			free(new);
@@ -161,7 +161,7 @@  static int nodups_specs(struct saved_data *data, const char *path)
 		}
 	}
 
-	hashtab_destroy_key(hash_table, destroy_chkdups_key);
+	selinux_hashtab_destroy_key(hash_table, destroy_chkdups_key);
 
 	return rc;
 }