Skip to contentSkip to conversation

libselinux: rename hashtab functions

PATCH In review Thiébaud Weksteen 2 participants 3 messages Aug 26, 2024 – Sep 5, 2024 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: rename hashtab functions

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_".

---
 libselinux/src/hashtab.c    | 16 ++++++++--------
 libselinux/src/hashtab.h    | 16 ++++++++--------
 libselinux/src/label_file.c | 10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)
libselinux/src/hashtab.c +8 -8
index 7452613b..0c6641ed 100644
@@ -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;
libselinux/src/hashtab.h +8 -8
index f10fc0af..6fbf5fb4 100644
@@ -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
libselinux/src/label_file.c +5 -5
index 59c9f2ef..2fad0c93 100644
@@ -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;
 }
Signature · 1 line
2.46.0.295.g3b9ea8a38a-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Thiébaud Weksteen

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_".

Quoted 191 lines
---
 libselinux/src/hashtab.c    | 16 ++++++++--------
 libselinux/src/hashtab.h    | 16 ++++++++--------
 libselinux/src/label_file.c | 10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)
libselinux/src/hashtab.c +8 -8
index 7452613b..0c6641ed 100644
@@ -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;
libselinux/src/hashtab.h +8 -8
index f10fc0af..6fbf5fb4 100644
@@ -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
libselinux/src/label_file.c +5 -6
index 59c9f2ef..2fad0c93 100644
@@ -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

#2 lore raw
Quoted 10 lines · James Carter
Quoted 8 lines · Thiébaud Weksteen

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.

Quoted 6 lines
Quoted 3 lines

Prefix the libselinux internal implementation with "selinux_".

Merged.
Jim

Quoted 191 lines
Quoted 191 lines
---
 libselinux/src/hashtab.c    | 16 ++++++++--------
 libselinux/src/hashtab.h    | 16 ++++++++--------
 libselinux/src/label_file.c | 10 +++++-----
 3 files changed, 21 insertions(+), 21 deletions(-)
libselinux/src/hashtab.c +8 -8
index 7452613b..0c6641ed 100644
@@ -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;
libselinux/src/hashtab.h +8 -8
index f10fc0af..6fbf5fb4 100644
@@ -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
libselinux/src/label_file.c +5 -6
index 59c9f2ef..2fad0c93 100644
@@ -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